netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: davem@davemloft.net, yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org
Subject: Resend: [FIX][PATCH] ipv6 addrconf.c : wrong handling of non-ipv6 hardware since 2.6.21
Date: Thu, 17 May 2007 19:09:06 +0200	[thread overview]
Message-ID: <464C8C32.3050301@hartkopp.net> (raw)
In-Reply-To: <464C886F.50703@hartkopp.net>

Sorry. I had a problem with my mailer that disrupted the patch ...

--------------------------

Hello Hideaki, hello David,

since 2.6.21 the new case NETDEV_REGISTER has been added to the big 
'switch' in addrconf_notify().

But within this "case NETDEV_REGISTER"-code no check about valid ipv6 
networking hardware is done, as it is done in NETDEV_UP, NETDEV_CHANGE 
and others.

Please apply the following patch to handle only valid ipv6 networking 
hardware inside the addrconf-notifier. This omits the invocation of 
ipv6_add_dev(dev) for non ipv6 capable hardware (e.g. with MTUs < 
IPV6_MIN_MTU) which leads to an ugly "IPv6: add_dev failed for %s\n" 
kernel warning.

The patch applies since 2.6.21 and also to the latest 2.6.22-rc1-git5 
(with an offset of 78 lines).

Best regards,
Oliver

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---
--- linux-2.6.21/net/ipv6/addrconf.c.orig    2007-05-16 
01:43:30.000000000 +0200
+++ linux-2.6.21/net/ipv6/addrconf.c    2007-05-16 02:01:18.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,35 @@ 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) ||
+#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
+        (dev->type == ARPHRD_SIT) ||
+#endif
+        (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) {



  reply	other threads:[~2007-05-17 17:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 16:53 [FIX][PATCH] ipv6 addrconf.c : wrong handling of non-ipv6 hardware since 2.6.21 Oliver Hartkopp
2007-05-17 17:09 ` Oliver Hartkopp [this message]
2007-05-17 17:49 ` YOSHIFUJI Hideaki / 吉藤英明
2007-05-17 20:41   ` Oliver Hartkopp
2007-05-17 21:10   ` [FIX][PATCH] ipv6 addrconf.c REMOVED #if patch Oliver Hartkopp
2007-05-21 18:20     ` Urs Thuermann
2007-05-23 21:35       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=464C8C32.3050301@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).