Subject: Re: dhcpd(8) _cannot_ be completely disabled on an interface
To: Michael Richardson <mcr@sandelman.ottawa.on.ca>
From: Andrew Brown <atatat@atatdot.net>
List: tech-net
Date: 01/14/2002 04:04:04
>    Andrew> does the interface pppoe0 get destroyed and created at each line drop,
>    Andrew> or just go up and down?  it's only destruction and creation that cause
>    Andrew> the interface index to get bumped...
>
>  Ah. I see. 
>  I'm still not clear why the 2 bytes here are so expensive, given typical
>padding issues.

from the point of view of a struct ifnet, no, it might not make much
difference, however, from the point of view of the struct sockaddr_dl,
it makes a huge difference.  that's very visible structure from
userland's point of view, and the two indices need to be the same
size.

i can't see that it's really an issue that the numbers roll over.  i
could just as easily cause a 32 bit counter to roll over as a 16 bit
counter.  it would just take longer.

# time sh -c 'for i in $(jot 100); do ifconfig tun0 create ; ifconfig tun0 destroy ; done'
0.012u 0.043s 0:00.25 20.0%     0+0k 0+0io 0pf+0w

there.  i just bumped it by 100 in a quarter of a second.  by
extrapolation, that's 65536 in about three minutes.  32 bits would
take over four months at that rate, but i could easily write a c
program that just called SIOCIFCREATE and SIOCIFDESTROY repeatedly and
avoided the fork/exec/parse command line overhead, as well as all the
other associated system calls.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."