Subject: Re: if_null
To: Steven M. Bellovin <smb@research.att.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-net
Date: 04/08/2004 09:42:53
>>>if_null is a clone device:
>>>
>>>        ifconfig null0 create
>>>        ifconfig null0 192.168.42.42
>>>
>>>and was derived from if_gre.c.  I *think* I deleted all of the
>>>no-longer-necessary code.
>>
>>i did this once, but i called it "nul" instead of "null".  i was
>>probably thinking that i liked cisco's name or something.  fwiw, i
>>copied if_loop.c instead, and ripped the bottom off it.  i've still
>>got it around here somewhere...
>
>I used if_gre.c because I wanted it to be a clone interface -- not to 
>make it easy to create more, but to make it easy to have fewer of them.

making something cloning is easy.  doing this was what led me to make
tun into a cloning device.

>>>You can pick up a copy at http://www.machshav.com/~smb/if_null .
>>>I compiled and tested it on 2.0beta; it will probably work on -current 
>>>without change.  I have no idea what would happen on 1.6.2.
>>
>>indeed, i had trouble making mine do "the right thing" with ipv6.
>>does yours do do?  for some reason, i was always able to ping whatever
>>v6 address i assigned to the interface, leading me to believe that v6
>>was something i needed to know yet more about when i had more time...
>
>Hmm, I'm seeing the same behavior.  The problem is, I think, at a 
>higher level -- the host IP address/128 is routed to lo0 when you 
>assign the v6 address.  I'll have to poke around to see where that's 
>happening, and what, if anything, can be done in the driver.

yeah.  if you don't have IFF_LOOPBACK set, the route to the local
address is set to the loopback interface.  otoh, if you *do* have it
set, the route to the address is (iirc) the interface itself, but v6
autoconfiguration assigns it ::1, so you end up with ::1 on more than
one interface.

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