aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 2bd12afb9297..adcc045952c2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1496,14 +1496,15 @@ static int put_master_ifindex(struct sk_buff *skb, struct net_device *dev)
1496 return ret; 1496 return ret;
1497} 1497}
1498 1498
1499static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev) 1499static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev,
1500 bool force)
1500{ 1501{
1501 int ifindex = dev_get_iflink(dev); 1502 int ifindex = dev_get_iflink(dev);
1502 1503
1503 if (dev->ifindex == ifindex) 1504 if (force || dev->ifindex != ifindex)
1504 return 0; 1505 return nla_put_u32(skb, IFLA_LINK, ifindex);
1505 1506
1506 return nla_put_u32(skb, IFLA_LINK, ifindex); 1507 return 0;
1507} 1508}
1508 1509
1509static noinline_for_stack int nla_put_ifalias(struct sk_buff *skb, 1510static noinline_for_stack int nla_put_ifalias(struct sk_buff *skb,
@@ -1520,6 +1521,8 @@ static int rtnl_fill_link_netnsid(struct sk_buff *skb,
1520 const struct net_device *dev, 1521 const struct net_device *dev,
1521 struct net *src_net) 1522 struct net *src_net)
1522{ 1523{
1524 bool put_iflink = false;
1525
1523 if (dev->rtnl_link_ops && dev->rtnl_link_ops->get_link_net) { 1526 if (dev->rtnl_link_ops && dev->rtnl_link_ops->get_link_net) {
1524 struct net *link_net = dev->rtnl_link_ops->get_link_net(dev); 1527 struct net *link_net = dev->rtnl_link_ops->get_link_net(dev);
1525 1528
@@ -1528,10 +1531,12 @@ static int rtnl_fill_link_netnsid(struct sk_buff *skb,
1528 1531
1529 if (nla_put_s32(skb, IFLA_LINK_NETNSID, id)) 1532 if (nla_put_s32(skb, IFLA_LINK_NETNSID, id))
1530 return -EMSGSIZE; 1533 return -EMSGSIZE;
1534
1535 put_iflink = true;
1531 } 1536 }
1532 } 1537 }
1533 1538
1534 return 0; 1539 return nla_put_iflink(skb, dev, put_iflink);
1535} 1540}
1536 1541
1537static int rtnl_fill_link_af(struct sk_buff *skb, 1542static int rtnl_fill_link_af(struct sk_buff *skb,
@@ -1617,7 +1622,6 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
1617#ifdef CONFIG_RPS 1622#ifdef CONFIG_RPS
1618 nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || 1623 nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) ||
1619#endif 1624#endif
1620 nla_put_iflink(skb, dev) ||
1621 put_master_ifindex(skb, dev) || 1625 put_master_ifindex(skb, dev) ||
1622 nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) || 1626 nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||
1623 (dev->qdisc && 1627 (dev->qdisc &&