Does IPv6 sendmsg work with IPv4-mapped addresses?

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

 



Hi,

I know that linux networking stack is dual-stack. I can send/receive to both IPv4 and IPv6 addresses with an IPv6 socket using send, sendto, recvfrom, etc. For IPv4 addresses, I simply convert to IPv4-mapped IPv6 address when populating sockaddr_in6.

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.

My own guess is no because IPv6 is not as tightly integrated as it seems, linux dual-stack is a bit odd. Yes, I can send and receive IPv4 packets via IPv4-mapped addresses. But consider this example.

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.

Chinh

--
http://www.certicom.com
-
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