[asterisk-dev] [Code Review] Add getnameinfo() to ast_sockaddr_resolve()
Paul Belanger
reviewboard at asterisk.org
Tue May 3 14:57:31 CDT 2011
> On 2011-05-03 13:53:54, Simon Perreault wrote:
> > This patch looks very wrong to me.
> >
> > What are you trying to accomplish?
>
> Paul Belanger wrote:
> The problem is documented in the issue, but basically if you dial an no exist SIP peer, Asterisk will continue to dial and transmit INVITES to a bogus IP.
>
> https://issues.asterisk.org/file_download.php?file_id=28015&type=bug
>
> Simon Perreault wrote:
> Yes I understand that. But I don't understand how your patch addresses that issue. Can you please explain what the new code in your patch is intended to do, at a lower level than just "fix issue 18514"? I'm having trouble understanding why a call to getnameinfo() is needed at all.
Sure, at first pass getaddrinfo() would return success for SIP/1050. But SIP/1050 is not a peer, so Asterisk assume it is a hostname.
[Dec 20 23:45:29] DEBUG[2288] netsock2.c: Splitting '1050' gives...
Adding getaddrinfo() does a second level check to confirm it is a valid hostname and if not returns the following error:
[Apr 29 10:08:44] ERROR[12988]: netsock2.c:263 ast_sockaddr_resolve: Unable to resolve hostname '1050': Name or service not known
Which we can handle and stop Dial() from continuing. If it is correct, that is why I'm asking for a review. My socket programing is weak, and looking for feedback / suggestions.
- Paul
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1202/#review3460
-----------------------------------------------------------
On 2011-05-03 13:36:52, Paul Belanger wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1202/
> -----------------------------------------------------------
>
> (Updated 2011-05-03 13:36:52)
>
>
> Review request for Asterisk Developers.
>
>
> Summary
> -------
>
> I spend some time last week trying to resolve an issue when you Dial() an unknown SIP peer. EG: Dial(SIP/blah). When we moved to IPv6 support we changed the way lookups were done. I took some time to research on the Internet, and found a few examples of how to use getnameinfo() as an additional error check for getaddrinfo().
>
>
> This addresses bug 18514.
> https://issues.asterisk.org/view.php?id=18514
>
>
> Diffs
> -----
>
> trunk/channels/chan_sip.c 314598
> trunk/main/netsock2.c 314598
>
> Diff: https://reviewboard.asterisk.org/r/1202/diff
>
>
> Testing
> -------
>
> Local testing and user on issue tracker.
>
>
> Thanks,
>
> Paul
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110503/3c3cc620/attachment.htm>
More information about the asterisk-dev
mailing list