lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <38hpf7-map.ln1@chipmunk.wormnet.eu>
Date:	Tue, 29 Jun 2010 16:48:51 +0100
From:	Alexander Clouter <alex@...riz.org.uk>
To:	netdev@...r.kernel.org
Subject: Re: [iproute2] iproute2:  Allow 'ip addr flush' to loop more than 10 times.

Ben Greear <greearb@...delatech.com> wrote:
>
>>> 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}
> 
> This isn't going to be fast if you have thousands of addresses.
>
Obviously not like-for-like but:
----
maru:/home/alex# cat /proc/cpuinfo
Processor       : Feroceon 88FR131 rev 1 (v5l)
BogoMIPS        : 1192.75
Features        : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant     : 0x2
CPU part        : 0x131
CPU revision    : 1

Hardware        : Marvell SheevaPlug Reference Board
Revision        : 0000
Serial          : 0000000000000000

maru:/home/alex# ip route show realm filthpit | wc
   8464   76176  533812

maru:/home/alex# time ip route list realm filthpit | xargs -I{} sh -c 'ip route del {}'

real    1m7.590s
user    0m0.650s
sys     0m3.010s
----

>> 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'.
> 
> Where are you using the -P at?  It's not a supported option of 'ip'
> as far as I can tell.
>
xargs, it works well on SMP systems, on my SheevaPlug you do not get 
much gain.
 
>> Why the need to cram more functionality and options into iproute when
>> it is something that can be pushed into the wrapper script?
> 
> Speed and ease of use.
> 
Annoying 'ip addr show dev dummy0' craps out after 54 assignments in 
it's output (bug?), however ifconfig works so:
----
truffle:/home/ac56# cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 4
model name      : Intel(R) Xeon(TM) CPU 2.80GHz
stepping        : 3
cpu MHz         : 2793.177
cache size      : 2048 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc pebs bts pni monitor ds_cpl cid cx16 xtpr
bogomips        : 5591.21
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual
power management:

[snipped other real and two ht cpus]

truffle:/home/ac56# time for I in $(seq 1 4085); do ip -6 addr add fe80::$(printf "%x" ${I})/64 dev dummy0; done

real    0m17.013s
user    0m4.004s
sys     0m11.417s
truffle:/home/ac56# ifconfig dummy0 | awk '/inet6? / { print $3 }' | wc
   4085    4085   52835
truffle:/home/ac56# time ifconfig dummy0 | awk '/inet6? / { print $3 }' | xargs -I{} ip addr del {} dev dummy0

real    0m5.897s
user    0m1.272s
sys     0m4.456s

# no idea why but, only 24 entries, re-running the above cleans up 
# properly in 4ms
truffle:/home/ac56# ifconfig dummy0 | awk '/inet6? / { print $3 }' | wc 
     24      24     310

# from the top again (but for '-P2' action):
truffle:/home/ac56# time ifconfig dummy0 | awk '/inet6? / { print $3 }' | xargs -I{} -P2 ip addr del {} dev dummy0

real    0m4.013s
user    0m1.268s
sys     0m5.072s

truffle:/home/ac56# ifconfig dummy0 | awk '/inet6? / { print $3 }' | wc
     40      40     516
----

Apart from the cleanup glitches in both cases, things are rather fast 
already?  Probably worth focusing at the 'ip (route|addr) add' slowness?

Bah, just my £0.02.

Cheers

[1] and anything more than 4085 for the sequence gives 'RTNETLINK 
	answers: Cannot allocate memory'

-- 
Alexander Clouter
.sigmonster says: Someone is speaking well of you.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ