I am only using IPv4-mapped address because it is the "recommended" (?)
way to specify an IPv4 destination address when using an IPv6 socket. By
recommendation, I mean this is the way unix networking books/man
pages/etc. describe the standard usage of a dual-stack socket (IPv6
socket supporting both IPv4 and IPv6 addresses).
Obviously, I am using an IPv6 socket to be efficient. Otherwise, I would
simply bind IPv6 and an IPv4 sockets separately.
I understand there are security concerns with IPv4-mapped addresses. If
there's a better way to send/receive IPv4 over IPv6 sockets (as well as
send/receive IPv6) in linux, I'd love to learn about it.
Regards,
Chinh
--
http://www.certicom.com
YOSHIFUJI Hideaki / 吉藤英明 wrote:
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