From: Andreas Henriksson <andreas@fatal.se>
To: Patrick McHardy <kaber@trash.net>
Cc: maximilian attems <max@stro.at>,
shemminger@linux-foundation.org, netdev@vger.kernel.org
Subject: Re: iproute2: git pull request from debian repo.
Date: Tue, 23 Oct 2007 16:18:38 +0200 [thread overview]
Message-ID: <20071023141838.GA25201@scream.fatal.se> (raw)
In-Reply-To: <471B90E5.1040108@trash.net>
On Sun, Oct 21, 2007 at 07:48:21PM +0200, Patrick McHardy wrote:
> Andreas Henriksson wrote:
> >- for (;;) {
> >+ while (round < MAX_ROUNDS) {
> > if (rtnl_wilddump_request(&rth, filter.family,
> > RTM_GETADDR) < 0) {
> > perror("Cannot send dump request");
> > exit(1);
> >@@ -694,6 +696,8 @@ int ipaddr_list_or_flush(int argc, char **argv, int
> >flush)
> > fflush(stdout);
> > }
> > }
> >+ fprintf(stderr, "*** Flush remains incomplete after %d
> >rounds. ***\n", MAX_ROUNDS); fflush(stderr);
>
>
> Again, please make this optional. People might want to make
> sure the cache is flushed even if it takes a bit longer.
And here's the alternativ with configurable max rounds (0=infinite)...
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index ff9e318..e4ba340 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -67,6 +67,7 @@ static void usage(void)
fprintf(stderr, " ip addr del IFADDR dev STRING\n");
fprintf(stderr, " ip addr {show|flush} [ dev STRING ] [ scope SCOPE-ID ]\n");
fprintf(stderr, " [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ]\n");
+ fprintf(stderr, " [ maxrounds N ]\n");
fprintf(stderr, "IFADDR := PREFIX | ADDR peer PREFIX\n");
fprintf(stderr, " [ broadcast ADDR ] [ anycast ADDR ]\n");
fprintf(stderr, " [ label STRING ] [ scope SCOPE-ID ]\n");
@@ -566,6 +567,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
struct nlmsg_list *l, *n;
char *filter_dev = NULL;
int no_link = 0;
+ int maxrounds = MAX_ROUNDS;
ipaddr_reset_filter(oneline);
filter.showqueue = 1;
@@ -630,6 +632,9 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
} else if (strcmp(*argv, "label") == 0) {
NEXT_ARG();
filter.label = *argv;
+ } else if (strcmp(*argv, "maxrounds") == 0) {
+ NEXT_ARG();
+ maxrounds = atoi(*argv);
} else {
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
@@ -669,7 +674,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
filter.flushp = 0;
filter.flushe = sizeof(flushb);
- while (round < MAX_ROUNDS) {
+ while ((maxrounds == 0) || (round < maxrounds)) {
if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
perror("Cannot send dump request");
exit(1);
@@ -696,7 +701,10 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
fflush(stdout);
}
}
- fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", MAX_ROUNDS); fflush(stderr);
+ fprintf(stderr,
+ "*** Flush remains incomplete after %d rounds. ***\n",
+ maxrounds);
+ fflush(stderr);
return 1;
}
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index db684f5..5a9ce40 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -53,6 +53,7 @@ static void usage(void)
" [ nud { permanent | noarp | stale | reachable } ]\n"
" | proxy ADDR } [ dev DEV ]\n");
fprintf(stderr, " ip neigh {show|flush} [ to PREFIX ] [ dev DEV ] [ nud STATE ]\n");
+ fprintf(stderr, " [ maxrounds N ]\n");
exit(-1);
}
@@ -321,6 +322,7 @@ int do_show_or_flush(int argc, char **argv, int flush)
{
char *filter_dev = NULL;
int state_given = 0;
+ int maxrounds = MAX_ROUNDS;
ipneigh_reset_filter();
@@ -361,6 +363,9 @@ int do_show_or_flush(int argc, char **argv, int flush)
if (state == 0)
state = 0x100;
filter.state |= state;
+ } else if (strcmp(*argv, "maxrounds") == 0) {
+ NEXT_ARG();
+ maxrounds = atoi(*argv);
} else {
if (strcmp(*argv, "to") == 0) {
NEXT_ARG();
@@ -392,7 +397,7 @@ int do_show_or_flush(int argc, char **argv, int flush)
filter.flushe = sizeof(flushb);
filter.state &= ~NUD_FAILED;
- while (round < MAX_ROUNDS) {
+ while ((maxrounds == 0) || (round < maxrounds)) {
if (rtnl_wilddump_request(&rth, filter.family, RTM_GETNEIGH) < 0) {
perror("Cannot send dump request");
exit(1);
@@ -418,8 +423,10 @@ int do_show_or_flush(int argc, char **argv, int flush)
fflush(stdout);
}
}
- printf("*** Flush not complete bailing out after %d rounds\n",
- MAX_ROUNDS);
+ fprintf(stderr,
+ "*** Flush remains incomplete after %d rounds. ***\n",
+ maxrounds);
+ fflush(stderr);
return 1;
}
--
Regards,
Andreas Henriksson
next prev parent reply other threads:[~2007-10-23 14:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-19 12:27 iproute2: git pull request from debian repo Andreas Henriksson
2007-10-19 13:06 ` maximilian attems
2007-10-19 14:48 ` Andreas Henriksson
2007-10-21 17:48 ` Patrick McHardy
2007-10-23 13:56 ` Andreas Henriksson
2007-10-23 14:18 ` Andreas Henriksson [this message]
2007-10-23 14:38 ` Patrick McHardy
2007-10-23 15:01 ` Andreas Henriksson
2007-10-23 15:08 ` Patrick McHardy
2007-10-23 15:27 ` Andreas Henriksson
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=20071023141838.GA25201@scream.fatal.se \
--to=andreas@fatal.se \
--cc=kaber@trash.net \
--cc=max@stro.at \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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.