[asterisk-dev] [Code Review] Don't include IPv6 link-local scope-ids in SIP messages

Terry Wilson reviewboard at asterisk.org
Wed Jun 22 09:14:42 CDT 2011


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

(Updated 2011-06-22 09:14:42.638423)


Review request for Asterisk Developers.


Changes
-------

Addresses Simon's review.


Summary
-------

chan_sip incorrectly would send IPv6 link-local addresses with the scope-id in SIP messages. This is usually an interface name on the local machine and means nothing to the remote host and should not be sent.

The original patch submitted on the issue just stripped the '%' and everything after it from the host before doing any kind of stringification. I was uncomfortable with making a global change to how these functions operated and instead added new _remote versions of the stringification functions and had chan_sip use them when the results would end up in a SIP message. The non-remote versions of the functions are still used in things like debug messages and anywhere we might be using the information to make an outbound connection since the scope-id is necessary information in those cases.

Since registrations were the focus of the bug report, I also noticed that the URI, From, and To of the registration also included the scope-id and didn't use the stringification functions, so I added sip_sanitized_host() which would take a host and if it happened to be a link-local ipv6 address, would "do the right thing".

I also added some netsock2 parsing tests.

I am not an IPv6 guru, so I would appreciate someone who is verifying this patch is a good idea.


This addresses bug ASTERISK-17711.
    https://issues.asterisk.org/jira/browse/ASTERISK-17711


Diffs (updated)
-----

  /branches/1.8/include/asterisk/netsock2.h 324299 
  /branches/1.8/main/netsock2.c 324299 
  /branches/1.8/channels/chan_sip.c 324299 
  /branches/1.8/tests/test_netsock2.c PRE-CREATION 

Diff: https://reviewboard.asterisk.org/r/1278/diff


Testing
-------

I tested registering two asterisk boxes to each other using link-local ipv6 addresses. They failed before the patch and succeeded after.


Thanks,

Terry

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


More information about the asterisk-dev mailing list