Skip to content

Commit 7b4ce69

Browse files
NicolasDichteldavem330
authored andcommitted
rtnetlink: pass link_net to the newlink handler
When IFLA_LINK_NETNSID is used, the netdevice should be built in this link netns and moved at the end to another netns (pointed by the socket netns or IFLA_NET_NS_[PID|FD]). Existing user of the newlink handler will use the netns argument (src_net) to find a link netdevice or to check some other information into the link netns. For example, to find a netdevice, two information are required: an ifindex (usually from IFLA_LINK) and a netns (this link netns). Note: when using IFLA_LINK_NETNSID and IFLA_NET_NS_[PID|FD], a user may create a netdevice that stands in netnsX and with its link part in netnsY, by sending a rtnl message from netnsZ. Signed-off-by: Nicolas Dichtel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 86b3bfe commit 7b4ce69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/rtnetlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
21482148
dev->ifindex = ifm->ifi_index;
21492149

21502150
if (ops->newlink) {
2151-
err = ops->newlink(net, dev, tb, data);
2151+
err = ops->newlink(link_net ? : net, dev, tb, data);
21522152
/* Drivers should call free_netdev() in ->destructor
21532153
* and unregister it on failure after registration
21542154
* so that device could be finally freed in rtnl_unlock.

0 commit comments

Comments
 (0)