[asterisk-dev] [Code Review]: chan_sip check_via does a hostname lookup but discards results anyway

elguero reviewboard at asterisk.org
Mon Mar 18 14:47:27 CDT 2013



On March 18, 2013, 12:44 p.m., wdoekes wrote:
> > These were just some ideas that I had when looking at this review.
> 
> wdoekes wrote:
>     Thanks for the review.
>     
>     PARSE_PORT_REQUIRED is not good, since not supplying a port is valid. 
>     
>     Using ast_parse_arg() could be an option, I didn't know that existed.
>     
>     Checking peer ports against >= 1024 is wrong. There is nothing that says a port cannot be below that. (And technically I think port 0 might be legal too.. but using that would be.. strange.)

Ah, you are right... sorry for focusing on the port part of this code and also for temporarily crossing in my head client (peer) vs server on the port range part of this.


- elguero


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2400/#review8075
-----------------------------------------------------------


On March 18, 2013, 9:16 a.m., wdoekes wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2400/
> -----------------------------------------------------------
> 
> (Updated March 18, 2013, 9:16 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> The sent-by-addr address in the Via is supposed to get ignored and the sent-by-port is only used if we're not doing force_rport.
> 
> Nevertheless did check_via do hostname lookups even though it only wanted to get at the port.
> 
> I've changed the code around so it uses ast_sockaddr_split_hostport() instead of ast_sockaddr_resolve_first(). This also removes an ERROR notice which isn't worthy of such severity.
> 
> 
> Before, when someone sent something resolvable in the Via:
> 
>   chan_sip did an DNS A lookup, but ignored the results.
> 
> Now:
> 
>   chan_sip just looks at the port.
> 
> 
> Before, when someone sent a bad via header:
> 
>   ERROR[29769]: netsock2.c:269 ast_sockaddr_resolve: getaddrinfo("127.0.1.1", "5061branch=z9hG4bK-11063-1-0", ...): Servname not supported for ai_socktype
>   WARNING[29769]: chan_sip.c:16921 check_via: Could not resolve socket address for '127.0.1.1:5061branch=z9hG4bK-11063-1-0'
> 
> Now:
> 
>   WARNING[10229]: chan_sip.c:16928 check_via: Could not split host/port for '127.0.1.1:5061branch=z9hG4bK-11049-1-0'
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 383308 
> 
> Diff: https://reviewboard.asterisk.org/r/2400/diff
> 
> 
> Testing
> -------
> 
> 57 SIP tests ran successfully with and without the patch.
> 
> 
> Thanks,
> 
> wdoekes
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130318/60a433d3/attachment.htm>


More information about the asterisk-dev mailing list