diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2015-01-27 05:13:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-29 17:23:25 -0500 |
commit | 7b4ce694b2030e7bb41f938cba6a0be4947a5aa5 (patch) | |
tree | ae7eee9848ab34d3e9dc7a2db1ede28a4d2a7775 /net/core | |
parent | 86b3bfe914f41c2d47d5882d06e1261cc58fb5e9 (diff) |
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 <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/rtnetlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 07447d1665e6..fedd7ab4085a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2148,7 +2148,7 @@ replay: | |||
2148 | dev->ifindex = ifm->ifi_index; | 2148 | dev->ifindex = ifm->ifi_index; |
2149 | 2149 | ||
2150 | if (ops->newlink) { | 2150 | if (ops->newlink) { |
2151 | err = ops->newlink(net, dev, tb, data); | 2151 | err = ops->newlink(link_net ? : net, dev, tb, data); |
2152 | /* Drivers should call free_netdev() in ->destructor | 2152 | /* Drivers should call free_netdev() in ->destructor |
2153 | * and unregister it on failure after registration | 2153 | * and unregister it on failure after registration |
2154 | * so that device could be finally freed in rtnl_unlock. | 2154 | * so that device could be finally freed in rtnl_unlock. |