Subject: Re: dhcpd(8) _cannot_ be completely disabled on an interface
To: None <tech-net@netbsd.org, tech-security@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-security
Date: 01/08/2002 01:18:25
>> IP_RECVIF gets you the if_index value for the interface in question.
>> Mapping that to anything useful is up to the packet recipient.
> egad.  i thought it was more useful than that.  i wonder what sort of
> issues would be be incurred by *making* it more useful...

What would you consider "useful"?  The if_index values are the only
unambiguous fixed-size names interfaces have, as far as I know.

> i tried adding an arp entry via a routing socket once.  i wasn't sure
> of the exact formatting and construction of the routing messages,

They _are_ poorly documented.  IIRC there's at least one define that
you need but which isn't provided by any .h file; hazy memory says it's
something about padding.

> what i did expect, however, was that the kernel would not let you add
> an arp entry for an ip address which was not "local" to one of the
> interfaces.  this is not so?

Well, if I change identifying details, it looks like this:

if0: 192.168.1.1/24
if1: 10.0.1.1/24
if2: 10.0.2.1/32
if3: 10.0.2.2/24

Note that if2's netmask is a /32.  The major reason for it to have an
address at all is to make the machine recognize 10.0.2.1 as one of its
own addresses.

Using arp(8) to add an arp entry for (say) 10.0.2.3 will make it point
to if3.  But for this application, I needed to make it point out if2.
According to the netmasks, this was off-subnet for that interface, but
did what in these circumstances was the Right Thing (send packets out
if2 with the MAC address from the arp entry in the Ethernet destination
field).

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B