On 10/25/2012 05:33 PM, Alex Hermann wrote:
On Thursday 25 October 2012, Juha Heinanen wrote:
an ipv6 address can thus never be a valid domain
name. an ipv4 address,
on the other hand, is syntactically valid domain name and perhaps
someone has populated their local name server with such names.
But the application
(kamailio) should not attempt a DNS lookup if the hostname
is an IP(v4/v6) address, from RFC1123, section 2.1:
========
Whenever a user inputs the identity of an Internet host, it SHOULD
be possible to enter either (1) a host domain name or (2) an IP
address in dotted-decimal ("#.#.#.#") form. The host SHOULD check
the string syntactically for a dotted-decimal number before
looking it up in the Domain Name System.
.
.
Hello,
Didn't had time to check the RFCs (RFC 1123 is from 1989 so it might be
updated), but from what I know the rule of the thumb (and inet_pton(3)
is useful describing several cases where a string is considered an ip
address):
- if a string can represent a 32-bit number (ipv4), or a 128 bit number
(ipv6) than it represents and IP address of respective family (ping
0xdeadbeef in console to see that 0xdeadbeef is a correct ip address).
-quad doted formats (decimal, octal or hexa) are allowed for IPv4
(010.010.010.010 is actually 8.8.8.8)
-IPv6 addresses have several forms, eight groups or less, or the hybrid
notation (e.g. ::FFFF:192.168.0.2)
inet_pton(3), inet_aton(3), inet_addr(3) only handle part of these
types, the new resolver API getaddrinfo(3) handles all + a and quad-a
DNS request.
I think we should handle all as well...
Cheers,
Marius
.
However, a valid host name can never
have the dotted-decimal form #.#.#.#, since at least the
highest-level component label will be alphabetic.
========
It would be nice if Kamailio refuses to lookup both IPv4 and IPv6 addresses
independent of the address family of listening sockets (see my emails about
dispatcher and IPv6, where DNS lookups on IPv6 addressed are only skipped if
Kamailio is listening on an IPv6 address).
--
Zbihlei Marius
Head of
Linux Development Services Romania
1&1 Internet Development srl Tel KA: 754-9152
Str Mircea Eliade 18 Tel RO: +40-31-223-9152
Sect 1, Bucuresti mailto: marius.zbihlei(a)1and1.ro
71295, Romania