Comment 17 for bug 16137

Revision history for this message
In , Herbert Straub (herbert) wrote : iproute: "ip -4 neigh flush dev eth0" hangs up

I had the same situation with Ubuntu Hoary (iproute_20041019). I think
this is the same version as in Debian and also the 2.6.10 kernel.
Yesterday i inform Stehpen Hemminger at osdl.org about this problem and
he answer:

Thanks, this usually shows up when someone tries to run flush
as non-root. Some vendors added a check for getuid() != 0, but that
fails in secure environments with capabilities and no root user.

I'll probably just change it to try 10 times and give up.

I isolate his changes and create this patch

--- ip/ipneigh.c.ORIG 2005-08-17 22:11:06.000000000 +0200
+++ ip/ipneigh.c 2005-08-17 22:13:02.000000000 +0200
@@ -31,6 +31,7 @@
 #include "ip_common.h"

 #define NUD_VALID
(NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
+#define MAX_ROUNDS 10

 static struct
 {
@@ -411,7 +412,7 @@
         filter.rth = &rth;
         filter.state &= ~NUD_FAILED;

- for (;;) {
+ while (round < MAX_ROUNDS) {
             if (rtnl_wilddump_request(&rth, filter.family,
RTM_GETNEIGH) < 0) {
                 perror("Cannot send dump request");
                 exit(1);
@@ -437,6 +438,9 @@
                 fflush(stdout);
             }
         }
+ printf("*** Flush not complete bailing out after %d rounds\n",
+ MAX_ROUNDS);
+ return 1;
     }

     if (rtnl_wilddump_request(&rth, filter.family, RTM_GETNEIGH) < 0) {

The modified iproute package for Ubuntu Hoary (and i think you can easy
rebuild it for Debian) are available under:
http://apt-get.linuxhacker.at/ubuntu/dists/hoary/main/pool/

More details in the Ubuntu Bug #9106
(https://bugzilla.ubuntu.com/show_bug.cgi?id=9106)

Best regards
Herbert Straub