IPV6_RECVPKTINFO not working for IPv4-mapped addresses on Linux?

Gert Doering gert at space.net
Sun Jan 19 22:40:05 CET 2014


Hi,

there is a lot of Linux IPv6 knowhow here, let's see if this rings a bell
for someone.

OpenVPN currently uses a single UDP socket for it's network communication,
which means that on a server with more than one IPv6 address, it needs to
use IPV6_RECVPKTINFO (RFC 3542, 6.2, last paragraph) to get it's *own* 
IPv6 address the packet went to, and reply with the correct address 
(other daemons like bind or ntpd use one udp socket per IPv6 address, 
which sucks in other ways).

To make things a bit more complicated, we have *one* UDP socket, and use 
that for IPv4 and for IPv6 packets, so IPv4 connections to a dual-stack 
server show up as "IPv6" connections coming from ::ffff:1.2.3.4 - which 
also works quite nicely, except for one catch...

... the IPV6_RECVPKTINFO code just returns *nothing* on Linux for this
case (specifically, CMSG_FIRSTHDR() is just NULL...) - so it looks as
if this is a case of "someone should propably implement this..."

(interesting enough, FreeBSD up to 8.x behaved the same way as Linux,
but in 9.x it works.  It also works on NetBSD.  Since OpenBSD does
not support dual-stack sockets, it's not relevant there)


Now the actual question: does this ring a bell for one of the Linux
kernel gurus reading here?

(Test code smaller than "install OpenVPN" is available at 
http://www.greenie.net/ipv6/mhome.c - run as "./mhome", and then
send an IPv6 or IPv4 packet UDP packet to port 50001 on that host.
The code is not very pretty and might have bugs on its own, but it 
*has* all the diagnostics to see what happens under the hood on 
the myriard just-so-slightly-different unix-alike systems...)

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