diff options
author | Eric W. Biederman <ebiederm@aristanetworks.com> | 2009-11-08 03:53:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-08 03:53:51 -0500 |
commit | 81adee47dfb608df3ad0b91d230fb3cef75f0060 (patch) | |
tree | e9d7a41872f84c1395e21915e5f92c05ab872e69 /include/net/rtnetlink.h | |
parent | f7a3a1d8affe563846fc17f0e7c0cc1500190c57 (diff) |
net: Support specifying the network namespace upon device creation.
There is no good reason to not support userspace specifying the
network namespace during device creation, and it makes it easier
to create a network device and pass it to a child network namespace
with a well known name.
We have to be careful to ensure that the target network namespace
for the new device exists through the life of the call. To keep
that logic clear I have factored out the network namespace grabbing
logic into rtnl_link_get_net.
In addtion we need to continue to pass the source network namespace
to the rtnl_link_ops.newlink method so that we can find the base
device source network namespace.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Diffstat (limited to 'include/net/rtnetlink.h')
-rw-r--r-- | include/net/rtnetlink.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index cd5af1f508f2..48d3efcb0880 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h | |||
@@ -55,7 +55,8 @@ struct rtnl_link_ops { | |||
55 | int (*validate)(struct nlattr *tb[], | 55 | int (*validate)(struct nlattr *tb[], |
56 | struct nlattr *data[]); | 56 | struct nlattr *data[]); |
57 | 57 | ||
58 | int (*newlink)(struct net_device *dev, | 58 | int (*newlink)(struct net *src_net, |
59 | struct net_device *dev, | ||
59 | struct nlattr *tb[], | 60 | struct nlattr *tb[], |
60 | struct nlattr *data[]); | 61 | struct nlattr *data[]); |
61 | int (*changelink)(struct net_device *dev, | 62 | int (*changelink)(struct net_device *dev, |
@@ -83,8 +84,9 @@ extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops); | |||
83 | extern int rtnl_link_register(struct rtnl_link_ops *ops); | 84 | extern int rtnl_link_register(struct rtnl_link_ops *ops); |
84 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); | 85 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); |
85 | 86 | ||
86 | extern struct net_device *rtnl_create_link(struct net *net, char *ifname, | 87 | extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); |
87 | const struct rtnl_link_ops *ops, struct nlattr *tb[]); | 88 | extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net, |
89 | char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]); | ||
88 | extern const struct nla_policy ifla_policy[IFLA_MAX+1]; | 90 | extern const struct nla_policy ifla_policy[IFLA_MAX+1]; |
89 | 91 | ||
90 | #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) | 92 | #define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) |