[asterisk-dev] IPv4 and IPv6 preference

Simon Perreault simon.perreault at viagenie.ca
Fri Jul 16 08:33:32 CDT 2010


On 2010-07-16 09:23, Olle E. Johansson wrote:
> I've been trying to understand some of the DNS support for IPv6 and can't find traces here. It seems a bit random.

By default, on most OSes, getaddrinfo() will return IPv6 results first.

We make no attempt to change the default order. However, we don't want
to connect to IPv6 addresses if we are bound only to IPv4, and
vice-versa. So we implemented the following heuristic:

- If bindaddr is the IPv6 wildcard address (i.e. ::), we do not filter
results.
- If bindaddr is an IPv4 address, we only use IPv4 results.
- Otherwise, we only use IPv6 results.

Note also that throughout chan_sip, only the first DNS result is
considered. A major rearchitecturing would be required to try multiple
results in sequence.

> If I only use IPv6 on my Asterisk and call a domain that has both IPv4 and IPv6 SRV records, the call might fail randomly because the first one ending up is the ipv4 record. When calling srv record lookups, we need to tell the dns functions what we can handle and how we want to prioritize.
> 
> I would like to be able to set a preference for a dual stack host to say "I prefer IPv6" or "I hate IPv6, use IPv4 if available".

Note also that "prioritization" doesn't have the meaning it should have
when taken in the context of chan_sip. Since more often than not only
the first result is used and all others are simply discarded, "priority
for X" ends up meaning "only use X unconditionally".

Was that explanation of the current situation useful?

What can we do to improve it?

Simon
-- 
NAT64/DNS64 open-source --> http://ecdysis.viagenie.ca
STUN/TURN server        --> http://numb.viagenie.ca
vCard 4.0               --> http://www.vcarddav.org



More information about the asterisk-dev mailing list