IPV6_RECVPKTINFO not working for IPv4-mapped addresses on Linux?

Gert Doering gert at space.net
Wed Jan 22 18:31:04 CET 2014


On Wed, Jan 22, 2014 at 05:10:17PM +0000, Nick Hilliard wrote:
> On 22/01/2014 16:54, Francis Dupont wrote:
> >  - there is no standard/portable way to do this without the one
> >   socket per address in IPv4 (if you need an argument, just ask what
> >   this discussion is about :-)
> i thought recvfrom() fixed this issue?  Forgive me if I'm wrong here - it's
> been far too long since I've done any socket related stuff.

recvfrom() will give you the source address of the packet, but not
the destination address (*your* address where you received the packet

recvmsg() will give that to you, but the interface for IPv4 is system 
dependent, and I'm fairly sure, "not present everywhere bind runs".

RFC 2292 / 3542 talk about the socket API extentions to get IPv6 destination
addresses (IPV6_RECVPKTINFO), so with that and a bit of source code reading,
you can figure out how it works for IPv4 (I haven't found actual docs for
that yet).

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