Hello,
Le lundi 2 Août 2004 00:23, Marco d'Itri a écrit :
> On Aug 01, Rémi Denis-Courmont <remi-usenet1-ms-ipv6@simutrans.fr.st>
wrote:
> > It is NOT safe to assume that you have a DNS name when using IPv6,
> > so, sending one's IPv6 address is very much the only sensible
> > option to me.
>
> It's about as save as with IPv4.
Eh? I don't think so. gethostname() will often return a result that does
NOT resolve (from the server's perspective) to the address being used
to connect to the server, whether with IPv4 or IPv6.
In today's IPv4 world, most serious ISP set up reverse DNS for their
customers public IP addresses. As such, the best way to find a valid
DNS name from a programmer's point of view, is to call getsockname() to
determine which addresses it is using, and then perform a reverse DNS
lookup on the result to the SMTP server.
That works because most people have a working reverse DNS name.
In IPv6, there are many reason why you often do not have a valid reverse
DNS, so that this scheme does not work:
- you may be using automatic tunneling address space such as 6to4 or
Teredo, that do not provide reverse DNS (at least at the moment),
- if your ISP support IPv6, it probably provide a whole address range to
you, such as a /48 or a /64 prefix. It probably does not provide 2^64
or 2^80 reverse DNS names (I don't think it is possible to generate
these with BIND, but I'd like more input on that), and yet, I doubt all
ISP delegate IPv6 reverse DNS zones to their customers.
- if you're on a "managed" network such as a campus, where MAC addresses
for allowed computers are tracked, you may have a reverse DNS for your
permanent IPv6 address... but it is likely that you are using a
temporary address, as defined by IPv6 Privacy Extension, that might not
have a reverse DNS.
> > Yes it is correct. IP addresses have a different format for SMTP:
> > "[1.2.3.4]" for IPv4 and "[IPv6:1:2:3:4:5:6:7:8]" for IPv6.
>
> Where is this defined?
Quoting RFC 2821
4.1.3 Address Literals
Sometimes a host is not known to the domain name system and
communication (and, in particular, communication to report and repair
the error) is blocked. To bypass this barrier a special literal form
of the address is allowed as an alternative to a domain name. For
IPv4 addresses, this form uses four small decimal integers separated
by dots and enclosed by brackets such as [123.255.37.2], which
indicates an (IPv4) Internet Address in sequence-of-octets form. For
IPv6 and other forms of addressing that might eventually be
standardized, the form consists of a standardized "tag" that
identifies the address syntax, a colon, and the address itself, in a
format specified as part of the IPv6 standards [17].
Specifically:
IPv4-address-literal = Snum 3("." Snum)
IPv6-address-literal = "IPv6:" IPv6-addr
(...)
--
Rémi Denis-Courmont
http://www.simphalempin.com/home/infos/cv.shtml.fr
Attachment:
pgpe6x1VydlEt.pgp
Description: signature