binding on IPv6

Stefan Winter stefan.winter at
Fri Jan 11 10:39:11 CET 2008


>   Hmm... the opposite is possible.  i.e. listening on ::0 (v6), and
>  The code in src/lib/packet.c sets the "IPV6 ONLY" flag for
> IPv6 sockets.  I don't think there's a similar flag for IPv4.
>   From what I understand, v4 IP's only affect v6 IP's when the v6 IP's
> do 6-to-4 mapping, OR v6 is listening on ::0.
>   Maybe that's wrong, but I can't find a way to force v4 sockets to not
> affect v6 ones.  Just the other way around.

A colleague of mine played around with netcat and FR and straced both. There 
is one difference in the socket() call:

netcat, IPv4, UDP:
  setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
  bind(3, {sa_family=AF_INET, sin_port=htons(1802),
           sin_addr=inet_addr("")}, 16) = 0

freeradius, IPv4, UDP:
  bind(3, {sa_family=AF_INET, sin_port=htons(1812),
           sin_addr=inet_addr("")}, 16) = 0

The difference being:   socket(..., IPPROTO_UDP <-> IPPROTO_IP) (the 
setsockopt looks harmless, but not sure).

Why that would be a difference is not clear to me. A wild guess is that 
SOCK_DGRAM+IPPROTO_IP binds to all datagram-based IP payload protocols, which 
may be more than UDP, and that one of those non-UDP bindings clashes when 
trying to bind, even to an IPv6 address. Weird.



Stiftung RESTENA - Réseau Téléinformatique de l'Education Nationale et de 
la Recherche
Ingenieur Forschung & Entwicklung

6, rue Richard Coudenhove-Kalergi
L-1359 Luxembourg
E-Mail: stefan.winter at     Tel.:     +352 424409-1                Fax:      +352 422473
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the Freeradius-Devel mailing list