[asterisk-dev] IPv4 and IPv6 preference

Mark Michelson mmichelson at digium.com
Fri Jul 16 12:49:53 CDT 2010


On 07/16/2010 11:28 AM, Olle E. Johansson wrote:
> 16 jul 2010 kl. 16.51 skrev Mark Michelson:
>
>    
>> On 07/16/2010 08:45 AM, Olle E. Johansson wrote:
>>      
>>> 16 jul 2010 kl. 15.33 skrev Simon Perreault:
>>>
>>>
>>>        
>>>> 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.
>>>>
>>>>          
>>> 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...
>>>
>>>        
>> While the mention of dnsmgr.c has merit, acl.c doesn't need such a
>> distinction because users are required to use IP addresses. Host names
>> are not allowed in ACLs so DNS will not come into the picture.
>>      
> ACL.c for some strange reason actually has some DNS lookup code in it if you take a look ;-)
> We should propably move it out now that we have other files where it fits better.
>
> So yes, that file is involved, but not the ACL part of the code in acl.c.
>
> /O
>    

Yes, there is a lot of code in acl.c that really doesn't belong there if 
you ask me. I was limiting my thought process to the actual access 
control list section of acl.c instead of all the other functions to 
retrieve our local IP address and such.

Mark Michelson



More information about the asterisk-dev mailing list