binding on IPv6

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


Hi,

>   Hmm... the opposite is possible.  i.e. listening on ::0 (v6), and
> 192.168.1.2.  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:
  socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
  setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
  bind(3, {sa_family=AF_INET, sin_port=htons(1802),
           sin_addr=inet_addr("0.0.0.0")}, 16) = 0

freeradius, IPv4, UDP:
  socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
  bind(3, {sa_family=AF_INET, sin_port=htons(1812),
           sin_addr=inet_addr("0.0.0.0")}, 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.

Stefan

-- 
Stefan WINTER

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 restena.lu     Tel.:     +352 424409-1
http://www.restena.lu                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: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20080111/402f5f10/attachment.pgp>


More information about the Freeradius-Devel mailing list