]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
Updated check for correct net device namespaces introduced in Kernel 2.6.26
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Fri, 2 May 2008 12:04:42 +0000 (12:04 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Fri, 2 May 2008 12:04:42 +0000 (12:04 +0000)
by YOSHIFUJI Hideaki:

[NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS.

Introduce per-net_device inlines: dev_net(), dev_net_set().
Without CONFIG_NET_NS, no namespace other than &init_net exists.
Let's explicitly define them to help compiler optimizations.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c346dca10840a874240c78efe3f39acf4312a1f2

git-svn-id: svn://svn.berlios.de//socketcan/trunk@719 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/net/can/af_can.c
kernel/2.6/net/can/bcm.c
kernel/2.6/net/can/raw.c

index fc621a8c969aca1cb6e8ac0e71e3ebaf5725a125..ca371ae2498f43265eef01bc79ec5a0602358c8a 100644 (file)
@@ -675,7 +675,9 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
        struct dev_rcv_lists *d;
        int matches;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+       if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) {
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
        if (dev->type != ARPHRD_CAN || dev->nd_net != &init_net) {
 #else
        if (dev->type != ARPHRD_CAN) {
@@ -796,7 +798,10 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
        struct net_device *dev = (struct net_device *)data;
        struct dev_rcv_lists *d;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+       if (dev_net(dev) != &init_net)
+               return NOTIFY_DONE;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
        if (dev->nd_net != &init_net)
                return NOTIFY_DONE;
 #endif
index 1c21984ea5e9eb251daa77729982bd99a1cf12b9..783acd3468ec3bd70b9a012b6dd66db562468aad 100644 (file)
@@ -1563,7 +1563,10 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
        struct bcm_op *op;
        int notify_enodev = 0;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+       if (dev_net(dev) != &init_net)
+               return NOTIFY_DONE;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
        if (dev->nd_net != &init_net)
                return NOTIFY_DONE;
 #endif
index 68af1c33a927963405843b9fc05f7c909af34839..a5e9ee03033376e12f1ab27469a6541e28a58768 100644 (file)
@@ -231,7 +231,10 @@ static int raw_notifier(struct notifier_block *nb,
        struct sock *sk = ro->sk;
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+       if (dev_net(dev) != &init_net)
+               return NOTIFY_DONE;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
        if (dev->nd_net != &init_net)
                return NOTIFY_DONE;
 #endif