Implementing SO_BINDTODEVICE

Robert Watson rwatson at freebsd.org
Mon Apr 28 08:26:21 PDT 2003


On Fri, 18 Apr 2003, Martin Blapp wrote:

> How difficult would it be to implement SO_BINDTODEVICE on FreeBSD ? I
> need the to make is possible to run more than one instance of dhclient
> on one host with more than one NIC. 
> 
> We would need this to support removable devices properly. 
> 
> There is a tool called omshell which should be able to change variables
> so the interface is added to the lists.  Unfortunatly the documentation
> is bad and I only found hooks to dhcpd. 

Hmm.  My impression was that dhclient used solely BPF descriptors on
FreeBSD to perform interface-specific DHCP client communications, and that
SO_BINDTODEVICE was used only in the DHCP server?  BPF requires you to
specifically identify an interface to bind to, as it's an interface-layer
communications primitive.

Last time I tried, the only real issue in using dhclient on multiple
interfaces was making sure that pid files didn't collide, but that was
several years ago, things could easily have changed.

What semantics does SO_BINDTODEVICE offer?  Normally, IP sockets make IP
address binding and routing decisions based on the process optionally
specifying IP addresses for local binding, and based on the destination of
a connection/transmission.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Network Associates Laboratories




More information about the freebsd-net mailing list