netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org, Urs Thuermann <urs@isnogud.escape.de>
Subject: ipv6 addrconf hardware type restrictions
Date: Thu, 26 Apr 2007 21:24:17 +0200	[thread overview]
Message-ID: <4630FC61.1080706@hartkopp.net> (raw)

Hello,

since the invocation of ipv6_add_dev() at NETDEV_REGISTER time in 
addrconf_notify() i get an 'add_dev failed' when registering a netdevice 
with a MTU of 16.

As the code doesn't check for ipv6 capable hardware types it simply runs 
into an error for some non-ipv6 capable networking hw ...

This patch below may just be a hint - maybe you find any 'nicer' 
implementation for this.

Best regards,
Oliver

Signed-Off-By: Oliver Hartkopp <socketcan@hartkopp.net>

--- addrconf.c-orig    2007-04-26 20:40:38.000000000 +0200
+++ addrconf.c    2007-04-26 20:54:58.000000000 +0200
@@ -2076,15 +2076,6 @@
 
     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,6 +2163,21 @@
     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)
 {
@@ -2179,6 +2185,9 @@
     struct inet6_dev *idev = __in6_dev_get(dev);
     int run_pending = 0;
 
+    if (!ipv6_hwtype(dev))
+        return NOTIFY_OK;
+
     switch(event) {
     case NETDEV_REGISTER:
         if (!idev) {



                 reply	other threads:[~2007-04-26 19:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4630FC61.1080706@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=netdev@vger.kernel.org \
    --cc=urs@isnogud.escape.de \
    --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).