Date: Wed, 10 Mar 2004 03:48:02 +0900 From: Hajimu UMEMOTO <ume@FreeBSD.org> To: Lukasz Stelmach <Lukasz.Stelmach@k.telmark.waw.pl> Cc: freebsd-stable@freebsd.org Subject: Re: sockaddr_(in|in6) compatiblity Message-ID: <ygen06pkgbh.wl%ume@FreeBSD.org> In-Reply-To: <20040309182857.GA818@tygrys.k.telmark.waw.pl> References: <20040309182857.GA818@tygrys.k.telmark.waw.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, >>>>> On Tue, 9 Mar 2004 19:28:57 +0100 >>>>> Lukasz Stelmach <Lukasz.Stelmach@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@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ygen06pkgbh.wl%ume>