Summary: | ASTERISK-16429: [patch] sip/reqresp_parser.c:sip_uri_cmp_test failure | ||
Reporter: | Paul Belanger (pabelanger) | Labels: | |
Date Opened: | 2010-07-25 20:53:02 | Date Closed: | 2011-06-07 14:00:46 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/IPv6 |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) sip_uri_cmp_test.log ( 1) sip_uri_cmp_test.patch ( 2) sip_uri_cmp_test.patch.v2 | |
Description: | Managed to track down an issue with ast_sockaddr_parse(), but all tests seemed to pass. sip_uri_cmp_test does not check to see if ast_sockaddr_parse() fails, I've uploaded a patch, now checking for the error. As a result, the test will now fail. ****** ADDITIONAL INFORMATION ****** Jul 25 21:44:40] ERROR[22921]: netsock2.c:202 ast_sockaddr_parse: getaddrinfo("example.com", "(null)", ...): Name or service not known | ||
Comments: | By: Paul Belanger (pabelanger) 2010-07-25 21:59:44 And example with patch, showing failure. By: Paul Belanger (pabelanger) 2010-07-25 22:36:43 A second test uses ast_sockaddr_parse, but does not handle error checking. Fixed. By: Mark Michelson (mmichelson) 2010-07-26 10:06:46 The reported issue is actually not an issue. One stage of the URI comparison is to place the domain names through the sip_uri_domain_cmp() function. The first thing this function does is to call ast_sockaddr_parse() on the content. ast_sockaddr_parse() is intended to take an IP address and optional port specification as a string and place the content into an ast_sockaddr structure. ast_sockaddr_parse() will fail to parse a hostname, though. So in a case where a URI like "sip:bob@example.com" is being compared to something else, ast_sockaddr_parse() will fail to parse "example.com" from the URI since it is not an IP address. This is not an error in the URI comparison though since "example.com" is a valid hostname. The problem happens if ast_sockaddr_parse() fails for one host and does not for another host. This means that we are trying to compare a hostname and an IP address, which are always considered to not be equal by SIP URI comparison rules. Using the return values for ast_sockaddr_parse(), we can then determine whether to do a binary comparison or string comparison to determine if the URIs are the same. |