SO_BINDTODEVICE and ipv6

/dev/rob0 rob0 at gmx.co.uk
Sat May 31 16:29:22 UTC 2014


On Thu, May 29, 2014 at 07:21:18AM -0700, John Newlin wrote:
> In socket.c SO_BINDTODEVICE is not used for ipv6.  Is there any 
> reason this isn't used for ipv6?
> 
> Our system has two interfaces we want to run dhclient on, and
> this is causing issues as the dhcpv6 Reply is going to the
> wrong instance of dhclient.  Before I change it, I'd like to
> know the rationale for disabling it for ipv6.

I admit to being mostly out of my league with this question, however 
in this case I think I have the right answer. :)

DHCPv6, rather than using raw sockets as DHCPv4 did, communicates 
using the IPv6 link-local address.

(I'd appreciate confirmation or correction from someone who knows 
better, thanks.)

As for the problem at hand, perhaps you could run a single dhclient 
instance for both interfaces?

> // socket.c  relevant code.
> #if defined(SO_BINDTODEVICE)
>         /* Bind this socket to this interface. */
>         if ((local_family != AF_INET6) && (info->ifp != NULL) &&
>             setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE,
>                         (char *)(info -> ifp), sizeof(*(info -> ifp))) < 0)
> {
>                 log_fatal("setsockopt: SO_BINDTODEVICE: %m");
>         }
> #endif
-- 
  http://rob0.nodns4.us/
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:


More information about the dhcp-users mailing list