Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Mar 2004 14:05:23 +0100
From:      Lukasz Stelmach <Lukasz.Stelmach@telmark.waw.pl>
To:        Hajimu UMEMOTO <ume@FreeBSD.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: sockaddr_(in|in6) compatiblity
Message-ID:  <20040318130523.GA20949@tygrys.k.telmark.waw.pl>
In-Reply-To: <ygen06pkgbh.wl%ume@FreeBSD.org>
References:  <20040309182857.GA818@tygrys.k.telmark.waw.pl> <ygen06pkgbh.wl%ume@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
 Byla godzina 03:48:02 w Wednesday 10 March, gdy do autobusu wsiadl kanar
 i wrzasnal:"Hajimu UMEMOTO!!! Bilecik do kontroli!!!" A on(a) na to:

LS>> 1. I open socket AF_INET6/SOCK_DGRAM... OK
LS>> 2. bind it to ::ffff:127.0.0.1/53...    OK
HU> Why do you use IPv4-mapped IPv6 address for binding IPv4?  When you
HU> wish to bind to IPv4, just use AF_INET socket.

It is not me in fact who ueses it. I try to setup djbdns with IPv6
support.

HU>  This feature is disabled by default on 5-CURRENT.

Can you tell me (or give some article to read) why? I am curious
because i think this is quite good for a programmer to use one
type of socket and the same set of structures for both protocols,
especially now when IPv6 just starts its go.

LS>> 3. recvfrom() data from the socket...   OK
LS>> 4. *from (the 5th parameter to recvfrom) gets filled in like it was
LS>>  a sockaddr_in (ipv4) structure
[...]

HU> Use getnameinfo(3).  You shouldn't need to use inet_ntop(3).  Welcome
HU> to an address family independent programming with getaddrinfo(3) and
HU> getnameinfo(3).

In fact it is not the matter of inet_ntop(3) but the way the djbdns patch
seems to work. get*info(3) won't do the thing since to get the address from
sockaddr structure (after recvfrom) i still need to check the family
field and do proper cast.

IMHO it would be much more logical that if I open AF_INET6 socket
(even v4 mapped) i *always* get sockaddr_in6 structure and need not to
cast it to sockaddr_in.

Best regards,
-- 
|/       |_,  _   .-  --,  Już z każdej strony pełzną, potworne żądze
|__ |_|. | \ |_|. ._' /_.         Będę uprawiał nierząd, za pieniąze

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQFAWZ6TNdzY8sm9K9wRAv3eAJwLEEfnsUTG09RV0+qhaqXoAmiLdQCffB+a
ee5cna/DXhiv5FF9f2v/XcI=
=Y8vJ
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040318130523.GA20949>