IPV6_RECVPKTINFO not working for IPv4-mapped addresses on Linux?

Gert Doering gert at space.net
Mon Jan 20 15:00:33 CET 2014


Hi,

On Mon, Jan 20, 2014 at 12:49:56PM +0000, Benedikt Stockebrand wrote:
> Gert Doering <gert at space.net> writes:
> 
> > So I would activate both IPPROTO_IPV6/IPV6_RECVPKTINFO *and* 
> > SOL_IP/IP_PKTINFO, and depending on the "real" address family I'll see 
> > one or the other?
> 
> I've run into this sort of problems a few years ago, but I used a
> different solution: I didn't use mapped addresses but two separate
> sockets, one for IPv4 and another for IPv6.  It isn't nice, but it
> sorted out the problem in a way that worked on all platforms I tested
> without any problems or #ifdefs or whatever.

I expected that suggestion :-)  (actually I expected a much longer 
discussion about the evilness of IPv4-mapped addresses on an IPv6 
socket, but to my pleasant surprise, the actual fix came much faster)

(I'm surprised your code didn't need #ifdefs for the IPv4 part, as the
ancilliary socket stuff is completely different on Linux and the BSDs
here...  IP_PKTINFO vs. IP_RECVDSTADDR... for IPv6 it's the same, but
even there you have 2292-only and 3542 implementations)


> Of course, the key question then is how much trouble is it to fix that
> in the existing application code base.

Much :-).  

This *is* a long-term goal, though, to enable OpenVPN to listen on multiple
sockets in parallel (including "udp and tcp" in the same server), but this 
part of the code is *old*, has way too many options, and runs on way too 
many systems with their own specific surprises.

We're slowly working our way through it, and what we'll have in 
OpenVPN 2.4 is "clean dual-stack handling with a single socket" 
(2.3 has "IPv4 and IPv6", but no real "call getaddrinfo(), use IPv4 
or IPv6, depending on what getaddrinfo() returns and what works"
mechanics).

So, for the time being, the decision was to go for a single server 
socket at this point and fix other stuff first.  Then come back.

Gert Doering
        -- NetMaster
-- 
have you enabled IPv6 on something today...?

SpaceNet AG                        Vorstand: Sebastian v. Bomhard
Joseph-Dollinger-Bogen 14          Aufsichtsratsvors.: A. Grundner-Culemann
D-80807 Muenchen                   HRB: 136055 (AG Muenchen)
Tel: +49 (0)89/32356-444           USt-IdNr.: DE813185279


More information about the ipv6-ops mailing list