[asterisk-dev] [Code Review] Make ACLs IPv6-capable

Mark Michelson mmichelson at digium.com
Thu Jul 15 09:35:15 CDT 2010


On 07/15/2010 08:07 AM, Simon Perreault wrote:
> On 2010-07-14 17:42, Mark Michelson wrote:
>    
>> * I do a lot of manual setting of sin_addr6::sin6_addrs rather than
>> using ast_sockaddr_parse() or getaddrinfo(). The reason for this is
>> to avoid unnecessary system calls when applying host access rules.
>>      
> This is wrong. ast_sockaddr_parse() does not perform any system calls.
> Why should it need to? If it does, then it's a bug that should be fixed.
>    

ast_sockaddr_parse() calls getaddrinfo(), which while actually a library 
call, I assumed used ioctls or some other system call in order to get an 
appropriate IP address. At the very least it's allocating and freeing 
memory.

My thoughts were that when converting to an IPv6 address, it was a much 
easier and quicker process to directly set the bits of the IPv6 address 
than to convert the to a string and then call ast_sockaddr_parse(). 
Based on feedback I'm seeing from you and Olle, the idea to always store 
ACLs as IPv6 addresses was errant on my part and a lot of the code I 
wrote to map IPv4 addresses as IPv6 addresses may go away completely 
before anything gets committed.

> Also, the reason for not using getaddrinfo() in ACL code should not be
> that it performs system calls (even though it may). The reason should be
> that you're supposed to use the netsock2 API instead of calling
> getaddrinfo() directly.
>
>    
Yes, my mention of getaddrinfo() was completely unnecessary. I can't 
give a good reason why I even thought to put it in the description.
> Simon
>    

Mark Michelson



More information about the asterisk-dev mailing list