All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Clouter <alex@digriz.org.uk>
To: netdev@vger.kernel.org
Subject: Re: [iproute2] iproute2:  Allow 'ip addr flush' to loop more than 10 times.
Date: Tue, 29 Jun 2010 09:03:49 +0100	[thread overview]
Message-ID: <50mof7-b9p.ln1@chipmunk.wormnet.eu> (raw)
In-Reply-To: 1277790959-28075-1-git-send-email-greearb@candelatech.com

greearb@gmail.com wrote:
> 
> 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.
> 
Maybe I am missing a trick, but what is wrong with putting this trivial 
logic into the script:

ip addr show ${DEV} | awk '/inet6? / { print $2 }' | xargs -I{} ip addr del '{}' dev ${DEV}

You can probably speed things up with '-P' too, '-P 2' gives me a huge 
huge speed up for the work I do with 'ip route'.

If you still have addresses on your interface after the above command, 
your looping approach probably would have failed also.

Why the need to cram more functionality and options into iproute when 
it is something that can be pushed into the wrapper script? 

Cheers

-- 
Alexander Clouter
.sigmonster says: Lend money to a bad debtor and he will hate you.


  parent reply	other threads:[~2010-06-29  8:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29  5:55 [iproute2] iproute2: Allow 'ip addr flush' to loop more than 10 times greearb
2010-06-29  6:12 ` David Miller
2010-06-29  6:27   ` Ben Greear
2010-06-29  6:36     ` David Miller
2010-06-29  9:58       ` Andreas Henriksson
2010-06-29 14:59         ` Ben Greear
2010-06-29 15:10       ` Ben Greear
2010-06-29 17:02         ` David Miller
2010-06-29  8:03 ` Alexander Clouter [this message]
2010-06-29 15:04   ` Ben Greear
2010-06-29 15:48     ` Alexander Clouter
2010-06-29 16:30       ` Ben Greear
2010-08-04 21:00 ` Stephen Hemminger
2010-08-04 21:13   ` Ben Greear

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=50mof7-b9p.ln1@chipmunk.wormnet.eu \
    --to=alex@digriz.org.uk \
    --cc=netdev@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.