rtnetlink.c (802d00bd774b77fe132e9e83462b96fb9919411c) rtnetlink.c (5891cd5ec46c2c2eb6427cb54d214b149635dd0e)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Routing netlink socket interface: protocol independent part.
8 *

--- 1685 unchanged lines hidden (view full) ---

1694 struct net_device *dev, struct net *src_net,
1695 int type, u32 pid, u32 seq, u32 change,
1696 unsigned int flags, u32 ext_filter_mask,
1697 u32 event, int *new_nsid, int new_ifindex,
1698 int tgt_netnsid, gfp_t gfp)
1699{
1700 struct ifinfomsg *ifm;
1701 struct nlmsghdr *nlh;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Routing netlink socket interface: protocol independent part.
8 *

--- 1685 unchanged lines hidden (view full) ---

1694 struct net_device *dev, struct net *src_net,
1695 int type, u32 pid, u32 seq, u32 change,
1696 unsigned int flags, u32 ext_filter_mask,
1697 u32 event, int *new_nsid, int new_ifindex,
1698 int tgt_netnsid, gfp_t gfp)
1699{
1700 struct ifinfomsg *ifm;
1701 struct nlmsghdr *nlh;
1702 struct Qdisc *qdisc;
1702
1703 ASSERT_RTNL();
1704 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
1705 if (nlh == NULL)
1706 return -EMSGSIZE;
1707
1708 ifm = nlmsg_data(nlh);
1709 ifm->ifi_family = AF_UNSPEC;
1710 ifm->__ifi_pad = 0;
1711 ifm->ifi_type = dev->type;
1712 ifm->ifi_index = dev->ifindex;
1713 ifm->ifi_flags = dev_get_flags(dev);
1714 ifm->ifi_change = change;
1715
1716 if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid))
1717 goto nla_put_failure;
1718
1703
1704 ASSERT_RTNL();
1705 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
1706 if (nlh == NULL)
1707 return -EMSGSIZE;
1708
1709 ifm = nlmsg_data(nlh);
1710 ifm->ifi_family = AF_UNSPEC;
1711 ifm->__ifi_pad = 0;
1712 ifm->ifi_type = dev->type;
1713 ifm->ifi_index = dev->ifindex;
1714 ifm->ifi_flags = dev_get_flags(dev);
1715 ifm->ifi_change = change;
1716
1717 if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid))
1718 goto nla_put_failure;
1719
1720 qdisc = rtnl_dereference(dev->qdisc);
1719 if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||
1720 nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) ||
1721 nla_put_u8(skb, IFLA_OPERSTATE,
1722 netif_running(dev) ? dev->operstate : IF_OPER_DOWN) ||
1723 nla_put_u8(skb, IFLA_LINKMODE, dev->link_mode) ||
1724 nla_put_u32(skb, IFLA_MTU, dev->mtu) ||
1725 nla_put_u32(skb, IFLA_MIN_MTU, dev->min_mtu) ||
1726 nla_put_u32(skb, IFLA_MAX_MTU, dev->max_mtu) ||
1727 nla_put_u32(skb, IFLA_GROUP, dev->group) ||
1728 nla_put_u32(skb, IFLA_PROMISCUITY, dev->promiscuity) ||
1729 nla_put_u32(skb, IFLA_NUM_TX_QUEUES, dev->num_tx_queues) ||
1730 nla_put_u32(skb, IFLA_GSO_MAX_SEGS, dev->gso_max_segs) ||
1731 nla_put_u32(skb, IFLA_GSO_MAX_SIZE, dev->gso_max_size) ||
1732 nla_put_u32(skb, IFLA_GRO_MAX_SIZE, dev->gro_max_size) ||
1733#ifdef CONFIG_RPS
1734 nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) ||
1735#endif
1736 put_master_ifindex(skb, dev) ||
1737 nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||
1721 if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||
1722 nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) ||
1723 nla_put_u8(skb, IFLA_OPERSTATE,
1724 netif_running(dev) ? dev->operstate : IF_OPER_DOWN) ||
1725 nla_put_u8(skb, IFLA_LINKMODE, dev->link_mode) ||
1726 nla_put_u32(skb, IFLA_MTU, dev->mtu) ||
1727 nla_put_u32(skb, IFLA_MIN_MTU, dev->min_mtu) ||
1728 nla_put_u32(skb, IFLA_MAX_MTU, dev->max_mtu) ||
1729 nla_put_u32(skb, IFLA_GROUP, dev->group) ||
1730 nla_put_u32(skb, IFLA_PROMISCUITY, dev->promiscuity) ||
1731 nla_put_u32(skb, IFLA_NUM_TX_QUEUES, dev->num_tx_queues) ||
1732 nla_put_u32(skb, IFLA_GSO_MAX_SEGS, dev->gso_max_segs) ||
1733 nla_put_u32(skb, IFLA_GSO_MAX_SIZE, dev->gso_max_size) ||
1734 nla_put_u32(skb, IFLA_GRO_MAX_SIZE, dev->gro_max_size) ||
1735#ifdef CONFIG_RPS
1736 nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) ||
1737#endif
1738 put_master_ifindex(skb, dev) ||
1739 nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||
1738 (dev->qdisc &&
1739 nla_put_string(skb, IFLA_QDISC, dev->qdisc->ops->id)) ||
1740 (qdisc &&
1741 nla_put_string(skb, IFLA_QDISC, qdisc->ops->id)) ||
1740 nla_put_ifalias(skb, dev) ||
1741 nla_put_u32(skb, IFLA_CARRIER_CHANGES,
1742 atomic_read(&dev->carrier_up_count) +
1743 atomic_read(&dev->carrier_down_count)) ||
1744 nla_put_u32(skb, IFLA_CARRIER_UP_COUNT,
1745 atomic_read(&dev->carrier_up_count)) ||
1746 nla_put_u32(skb, IFLA_CARRIER_DOWN_COUNT,
1747 atomic_read(&dev->carrier_down_count)))

--- 3971 unchanged lines hidden ---
1742 nla_put_ifalias(skb, dev) ||
1743 nla_put_u32(skb, IFLA_CARRIER_CHANGES,
1744 atomic_read(&dev->carrier_up_count) +
1745 atomic_read(&dev->carrier_down_count)) ||
1746 nla_put_u32(skb, IFLA_CARRIER_UP_COUNT,
1747 atomic_read(&dev->carrier_up_count)) ||
1748 nla_put_u32(skb, IFLA_CARRIER_DOWN_COUNT,
1749 atomic_read(&dev->carrier_down_count)))

--- 3971 unchanged lines hidden ---