]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
net: Support specifying the network namespace upon device creation.
authorwolf <wolf@030b6a49-0b11-0410-94ab-b0dab22257f2>
Sat, 21 Nov 2009 20:28:17 +0000 (20:28 +0000)
committerwolf <wolf@030b6a49-0b11-0410-94ab-b0dab22257f2>
Sat, 21 Nov 2009 20:28:17 +0000 (20:28 +0000)
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.

From net-next-2.6 commit 81adee47dfb608df3ad0b91d230fb3cef75f0060
adapted for SVN trunk.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1085 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/drivers/net/can/dev.c

index b8edeaa3f75ada3efb69393a46f3f2c509c03723..ac81d20b846182be71485d0daa80b11c847b97c3 100644 (file)
@@ -770,8 +770,13 @@ nla_put_failure:
        return -EMSGSIZE;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
 static int can_newlink(struct net_device *dev,
                       struct nlattr *tb[], struct nlattr *data[])
+#else
+static int can_newlink(struct net *src_net, struct net_device *dev,
+                      struct nlattr *tb[], struct nlattr *data[])
+#endif
 {
        return -EOPNOTSUPP;
 }