IPV6_RECVPKTINFO not working for IPv4-mapped addresses on Linux?
Hannes Frederic Sowa
hannes at stressinduktion.org
Sun Jan 19 23:00:00 CET 2014
On Sun, Jan 19, 2014 at 10:40:05PM +0100, Gert Doering wrote:
> 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..."
I see the problem and yes, this is unfortunate, I see.
Let me cook up a patch this week and depending on the size we maybe can
get this into stable.
You can also use IP_PKTINFO on IPv6 socket with correct protocol level in
setsockopt, it will report the the local address via IPv4 SOL in_pktinfo
ancillary data, then.
Greetings,
Hannes
More information about the ipv6-ops
mailing list