sockaddr_(in|in6) compatiblity
Hajimu UMEMOTO
ume at FreeBSD.org
Tue Mar 9 10:48:09 PST 2004
Hi,
>>>>> On Tue, 9 Mar 2004 19:28:57 +0100
>>>>> Lukasz Stelmach <Lukasz.Stelmach at telmark.waw.pl> said:
Lukasz> 1. I open socket AF_INET6/SOCK_DGRAM... OK
Lukasz> 2. bind it to ::ffff:127.0.0.1/53... OK
Why do you use IPv4-mapped IPv6 address for binding IPv4? When you
wish to bind to IPv4, just use AF_INET socket. This feature is
disabled by default on 5-CURRENT.
Lukasz> 3. recvfrom() data from the socket... OK
Lukasz> 4. *from (the 5th parameter to recvfrom) gets filled in like it was
Lukasz> a sockaddr_in (ipv4) structure which means that senders address
Lukasz> is in sin6_flowinfo instead of sin6_addr. Now this makes somehow
Lukasz> more difficult to use inet_ntop since first one has to check sin6_family
Lukasz> and decide wether to pass sin6_addr or sin6_flowinfo as an address
Lukasz> to print.
Use getnameinfo(3). You shouldn't need to use inet_ntop(3). Welcome
to an address family independent programming with getaddrinfo(3) and
getnameinfo(3).
Sincerely,
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
More information about the freebsd-stable
mailing list