Summary: | ASTERISK-16383: [patch] IPv6: sip_uri_cmp | ||
Reporter: | Olle Johansson (oej) | Labels: | |
Date Opened: | 2010-07-16 07:41:50 | Date Closed: | 2010-07-26 16:12:06 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/IPv6 |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 17662.diff | |
Description: | The sip_uri_cmp function separates on two :'s /* Strip off "sip:" from the URI. We know this is present * because it was checked back in parse_request() */ strsep(&uri1, ":"); strsep(&uri2, ":"); and then compares hosts with strcmp... For IP addresses, you need to do a binary comparision. Since there are many ways to write the same IPv6 address, and there are ways to write IPv4 embedded in IPv6, you need to compare IP addresses here. The function also strips of header parameters, so sip:oej@edvina.net;transport=udp and sip:oej@edvina.net;transport=tcp becomes the same URI, which they are not. | ||
Comments: | By: Mark Michelson (mmichelson) 2010-07-16 11:06:45 Definitely a good point regarding the comparison of the IP addresses. That needs to be fixed because the current behavior is clearly incorrect. I think you are mistaken with regards to the parameters though. You can see that we call sip_uri_params_cmp() with the parameters later in the function. By: Olle Johansson (oej) 2010-07-16 11:22:00 Ok, I'll check that code too, sorry, I missed it. By: Mark Michelson (mmichelson) 2010-07-16 12:16:02 I've uploaded 17662.diff. It replaces the string comparison with a new function called sip_uri_domain_cmp(). Give it a look and let me know if you spot any problems. By: Mark Michelson (mmichelson) 2010-07-19 15:30:45 I've uploaded a Review Board review request. The link is in "Reviewboard Link" section of the issue report. By: Digium Subversion (svnbot) 2010-07-23 11:33:51 Repository: asterisk Revision: 278980 U trunk/channels/chan_sip.c U trunk/channels/sip/include/reqresp_parser.h U trunk/channels/sip/reqresp_parser.c ------------------------------------------------------------------------ r278980 | mmichelson | 2010-07-23 11:33:50 -0500 (Fri, 23 Jul 2010) | 17 lines SIP URI comparison fixes. This initially was created to work around the issue of using a string comparison instead of a binary comparison for IP addresses. It evolved a bit when test cases were created and it was discovered that comparison of URI parameters was not working exactly as it should. sip_uri_cmp() and its helpers have been moved to reqresp_parser.c and a new test has been added. (closes issue ASTERISK-16383) Reported by: oej Review: https://reviewboard.asterisk.org/r/792 ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=278980 |