Subject: Re: [FIX][PATCH] ipv6 addrconf.c REMOVED #if patch

From: Oliver Hartkopp <[email-masked]>
Date: Thu, 17 May 2007 23:10:16 +0200

YOSHIFUJI Hideaki / 吉藤英明 wrote:
> Please remove #if, or please provide for other
> dependencies as well (e.g., CONFIG_IPV6_TUNNEL etc.)
>
> Otherwise, I would agree.
>
>   
Yep - you were right. It looks better like this as ARPHRD_SIT is defined 
in if_arp.h in any CONFIG_* case ...

Best regards & tnx,
Oliver

--- linux-2.6.21/net/ipv6/addrconf.c.orig    2007-05-18 
00:54:54.000000000 +0200
+++ linux-2.6.21/net/ipv6/addrconf.c    2007-05-18 00:57:11.000000000 +0200
@@ -2076,15 +2076,6 @@ static void addrconf_dev_config(struct n
 
     ASSERT_RTNL();
 
-    if ((dev->type != ARPHRD_ETHER) &&
-        (dev->type != ARPHRD_FDDI) &&
-        (dev->type != ARPHRD_IEEE802_TR) &&
-        (dev->type != ARPHRD_ARCNET) &&
-        (dev->type != ARPHRD_INFINIBAND)) {
-        /* Alas, we support only Ethernet autoconfiguration. */
-        return;
-    }
-
     idev = addrconf_add_dev(dev);
     if (idev == NULL)
         return;
@@ -2172,13 +2163,33 @@ static void addrconf_ip6_tnl_config(stru
     ip6_tnl_add_linklocal(idev);
 }
 
+static int ipv6_hwtype(struct net_device *dev)
+{
+    if ((dev->type == ARPHRD_ETHER) ||
+        (dev->type == ARPHRD_LOOPBACK) ||
+        (dev->type == ARPHRD_SIT) ||
+        (dev->type == ARPHRD_TUNNEL6) ||
+        (dev->type == ARPHRD_FDDI) ||
+        (dev->type == ARPHRD_IEEE802_TR) ||
+        (dev->type == ARPHRD_ARCNET) ||
+        (dev->type == ARPHRD_INFINIBAND))
+        return 1;
+
+    return 0;
+}
+
 static int addrconf_notify(struct notifier_block *this, unsigned long 
event,
                void * data)
 {
     struct net_device *dev = (struct net_device *) data;
-    struct inet6_dev *idev = __in6_dev_get(dev);
+    struct inet6_dev *idev;
     int run_pending = 0;
 
+    if (!ipv6_hwtype(dev))
+        return NOTIFY_OK;
+
+    idev = __in6_dev_get(dev);
+
     switch(event) {
     case NETDEV_REGISTER:
         if (!idev) {