All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylvain Rochet <gradator@gradator.net>
To: linux-kernel@vger.kernel.org
Subject: PROBLEM: 2.4.37.9 destroying an Ethernet interface with permanent NUD leaves the kernels with undestroyable interfaces when ATM is compiled in
Date: Wed, 7 Apr 2010 22:23:39 +0200	[thread overview]
Message-ID: <20100407202339.GB4830@gradator.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1633 bytes --]

Hi,

When ATM and Ethernet are compiled in, ATM and Ethernet create their 
NEIGH/ARP tables, they are both assigned to family AF_INET.


int neigh_add(....) {

 ...
        for (tbl=neigh_tables; tbl; tbl = tbl->next) {
                if (tbl->family != ndm->ndm_family)
                        continue;
  ...
}


As ATM table is created before Ethernet(main?) table, 
net/core/neighbour.c::neigh_add() function add all permanent IP ARP 
Ethernet NUD to the IP ATM table, which is wrong.

Therefore, when net/core/neighbour.c::neigh_ifdown() is called ARP 
entries are not cleared, leaving dev->refcnt to a value that will never 
be able to reach 0 anymore.

So, when net/core/dev.c::unregister_netdevice() is called it stalls 
without being able to destroy the interface leaving the system with no 
network tools working anymore.


This is really easy to reproduce:

openvpn --mktun --dev tap10
ip addr add 10.20.30.20/24 dev tap10
ip link set up dev tap10
ip neighbour add 10.20.30.40 lladdr 01:02:03:04:05:06 nud permanent dev tap10
ip link set down dev tap10
openvpn --rmtun --dev tap10

and then kernel log starts being filled by:

unregister_netdevice: waiting for tap10 to become free. Usage count = 2
unregister_netdevice: waiting for tap10 to become free. Usage count = 2
unregister_netdevice: waiting for tap10 to become free. Usage count = 2
unregister_netdevice: waiting for tap10 to become free. Usage count = 2


I changed the family of the ATM table to AF_ATMPVC, of course it fixes 
the issue but I guess this is the wrong way to fix that.


Best regard,
Sylvain

[-- Attachment #1.2: wrongfamily-atm-2.5.36.6.patch --]
[-- Type: text/x-diff, Size: 695 bytes --]

diff -Nru linux-2.4.36.6.a/net/atm/clip.c linux-2.4.36.6.b/net/atm/clip.c
--- linux-2.4.36.6.a/net/atm/clip.c	2008-06-06 18:25:34.000000000 +0200
+++ linux-2.4.36.6.b/net/atm/clip.c	2010-04-07 21:33:38.000000000 +0200
@@ -277,7 +277,7 @@
 
 
 static struct neigh_ops clip_neigh_ops = {
-	family:			AF_INET,
+	family:			AF_ATMPVC,
 	destructor:		clip_neigh_destroy,
 	solicit:		clip_neigh_solicit,
 	error_report:		clip_neigh_error,
@@ -316,7 +316,7 @@
 
 static struct neigh_table clip_tbl = {
 	NULL,			/* next */
-	AF_INET,		/* family */
+	AF_ATMPVC,		/* family */
 	sizeof(struct neighbour)+sizeof(struct atmarp_entry), /* entry_size */
 	4,			/* key_len */
 	clip_hash,

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2010-04-07 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 20:23 Sylvain Rochet [this message]
2010-04-08 13:47 ` PROBLEM: 2.4.37.9 destroying an Ethernet interface with permanent NUD leaves the kernels with undestroyable interfaces when ATM is compiled in Sylvain Rochet
2010-04-20  5:11   ` Willy Tarreau
2010-04-21 14:07     ` Sylvain Rochet

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=20100407202339.GB4830@gradator.net \
    --to=gradator@gradator.net \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.