rtnl: add link netns id to interface messages
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Thu, 15 Jan 2015 14:11:16 +0000 (15:11 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Jan 2015 19:21:26 +0000 (14:21 -0500)
This patch adds a new attribute (IFLA_LINK_NETNSID) which contains the 'link'
netns id when this netns is different from the netns where the interface
stands (for example for x-net interfaces like ip tunnels).
With this attribute, it's possible to interpret correctly all advertised
information (like IFLA_LINK, etc.).

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/rtnetlink.h
include/uapi/linux/if_link.h
net/core/rtnetlink.c

index e21b9f9..6c6d539 100644 (file)
@@ -46,6 +46,7 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
  *                         to create when creating a new device.
  *     @get_num_rx_queues: Function to determine number of receive queues
  *                         to create when creating a new device.
+ *     @get_link_net: Function to get the i/o netns of the device
  */
 struct rtnl_link_ops {
        struct list_head        list;
@@ -93,6 +94,7 @@ struct rtnl_link_ops {
        int                     (*fill_slave_info)(struct sk_buff *skb,
                                                   const struct net_device *dev,
                                                   const struct net_device *slave_dev);
+       struct net              *(*get_link_net)(const struct net_device *dev);
 };
 
 int __rtnl_link_register(struct rtnl_link_ops *ops);
index 2a8380e..0deee3e 100644 (file)
@@ -146,6 +146,7 @@ enum {
        IFLA_PHYS_PORT_ID,
        IFLA_CARRIER_CHANGES,
        IFLA_PHYS_SWITCH_ID,
+       IFLA_LINK_NETNSID,
        __IFLA_MAX
 };
 
Simple merge