Re: Does IPv6 sendmsg work with IPv4-mapped addresses?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <47BC4505.9020105@xxxxxxxxxxxx> (at Wed, 20 Feb 2008 10:19:33 -0500), Chinh Nguyen <cnguyen@xxxxxxxxxxxx> says:

> Theoretically, I can specify the source address of the outgoing packet 
> on an IPv6 socket by using sendmsg with IPV6_PKTINFO option enabled and 
> in6_pktinfo. However, I cannot do this when the source address I specify 
> is IPv4-mapped. The system still chooses the IPv4 source based on the 
> routing table. Does linux IPv6 support IPv4-mapped addresses for 
> sendmsg? Note I do not have trouble with the destination IPv4-mapped 
> address in the destination sockaddr_in6 structure.

Sendmsg itself, yes, but IPV6_PKTINFO, no.
Semantics of ipv4-mapped address (in basic API) in that socket option
(in advanced API) is undefined.

> If I have enabled IPV6_PKTINFO on an IPv6 socket, I would expect to 
> receive both IPv6 and IPv4 local address (as IPv4-mapped address) info 
> in an in6_pktinfo when using recvmsg. But I only receive data for IPv6 
> packets. To receive IPv4 local address info from an IPv4 incoming 
> packet, I have to also enable IP_PKTINFO on the IPv6 socket. 
> Furthermore, the data will be a regular IPv4 address in an in_pktinfo 
> structure.

If you need "advanced" things, go native way.
And, well, I'd even strongly suggest not to use IPv4-mapped addresses
unless you have very very good reason.

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux