[asterisk-dev] IPv4 and IPv6 preference

Simon Perreault simon.perreault at viagenie.ca
Fri Jul 16 08:59:34 CDT 2010


On 2010-07-16 09:45, Olle E. Johansson wrote:
>> - 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.
> Hmm. I need to revisit the code, because I saw nothing doing this in dnsmgr or acl.c. Must have put my brain in weekend-mode early...

It's SIP-specific. It's a big ugly hack and nobody else should use it.
Since we don't want to facilitate hack propagation, it's restricted to
chan_sip. See ast_sockaddr_resolve_first().

> Yes. At least the first ipv4 and the first IPv6 is needed now, if we can't get it right. Otherwise it will fail miserably in dual stack environments.

What do you mean by "fail miserably"? If a host has both AAAA and A
records, and we try just one of them, how are we worse off than we were
before?

> Considering me configuring my SRV set with the first record ONLY resolving to IPv6 and the second one ONLY resolving to IPv4 - with a lower priority. Will an IPv4 only asterisk find the IPv4 SRV record or fail since the first one with highest priority was only IPv6?

This is SRV-specific. The discussion above was only related to a single
host name that has multiple AAAA and A records.

In your example, if you replace the IPv6 address with an IPv4 address
that is unreachable, will Asterisk try the second one? If so, then it
will fall back on the IPv4 address in your example after being unable to
reach the IPv6 address.

> Btw, this is the recommendation we came up with at SIPit to control IPv6/ipv4 services and show my preference for RECEIVING calls to my domain. Even if it's the same host, add two host names with different resolution on different priorities.

Yes, this is indeed *the* way to do 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