summaryrefslogtreecommitdiffstats
path: root/ip/ip.c
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2010-12-01 11:13:51 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-12-01 11:13:51 -0800
commit64c7956061500611061910067d76512afcd2ddb4 (patch)
treedd2e69e791d03f9207ef03b07269971c9f86a697 /ip/ip.c
parent3f0a7b4c4f0a6c5462ad55b7fa4445c2d485f435 (diff)
Allow 'ip addr flush' to loop more than 10 times
The default remains at 10 for backwards compatibility. For instance: # ip addr flush dev eth2 *** Flush remains incomplete after 10 rounds. *** # ip -l 20 addr flush dev eth2 *** Flush remains incomplete after 20 rounds. *** # ip -loops 0 addr flush dev eth2 # This is useful for getting rid of large numbers of IP addresses in scripts. Signed-off-by: Ben Greear <greearb@candelatech.com>
Diffstat (limited to 'ip/ip.c')
-rw-r--r--ip/ip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ip/ip.c b/ip/ip.c
index 9f295334..b127d570 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -32,6 +32,8 @@ int timestamp = 0;
char * _SL_ = NULL;
char *batch_file = NULL;
int force = 0;
+int max_flush_loops = 10;
+
struct rtnl_handle rth = { .fd = -1 };
static void usage(void) __attribute__((noreturn));
@@ -45,6 +47,7 @@ static void usage(void)
" tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm }\n"
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
" -f[amily] { inet | inet6 | ipx | dnet | link } |\n"
+" -l[oops] { maximum-addr-flush-attempts } |\n"
" -o[neline] | -t[imestamp] | -b[atch] [filename] |\n"
" -rc[vbuf] [size]}\n");
exit(-1);
@@ -157,7 +160,13 @@ int main(int argc, char **argv)
break;
if (opt[1] == '-')
opt++;
- if (matches(opt, "-family") == 0) {
+ if (matches(opt, "-loops") == 0) {
+ argc--;
+ argv++;
+ if (argc <= 1)
+ usage();
+ max_flush_loops = atoi(argv[1]);
+ } else if (matches(opt, "-family") == 0) {
argc--;
argv++;
if (argc <= 1)