<p>Jaco Kroon <strong>uploaded patch set #5</strong> to this change.</p><p><a href="https://gerrit.asterisk.org/9858">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip: tcp/tls honour insecure=port<br><br>Prior to b2c4e8660a9c89d07041271371151779b7ec75f6 (ASTERISK_27457)<br>insecure=port was the defacto standard.  That commit also prevented<br>insecure=port from being applied for sip/tcp or sip/tls.<br><br>This partially restores the previous behaviour:<br><br>For UDP, WS and WSS, insecure=port was required to match based only on<br>IP.<br>For TCP and TLS matching was always done only on IP.<br><br>Current behaviour is completely broken.<br><br>The new behaviour is a little bit more complex:<br><br>1.  Firstly the IP has to match (as per previous).<br>2.  The protocol has to match now (ie, if we're trying to find a UDP<br>peer, then the entry that we find needs to have UDP set as one of the<br>transports).<br>3.  If doing the first pass, then perform port-match irrespecive of<br>protocol.<br>4.  If doing the second pass (ie, with SIP_INSECURE_PORT), then handle<br>UDP as per previous (ie, if we have a matching peer with insecure=port,<br>match it).  For everything else, match only if we have a host= that is<br>not dynamic set for that peer.<br><br>This fully retains previous behaviour for UDP.<br><br>Sample config:<br><br>[peer1]<br>host=1.1.1.1<br>transport=tcp<br><br>[peer2]<br>host=1.1.1.1<br>transport=udp<br><br>[peer3]<br>host=1.1.1.2<br>transport=udp,tcp<br><br>[peer4]<br>host=dynamic<br>transport=udp,tcp<br><br>Use cases:<br><br>1 - Incoming TCP request from 1.1.1.1:<br> - will match peer1 unless a more specific match is made for peer4 by<br> way of port match (first pass, registration).  Previously this would<br> match whichever peer was earlier in the peer list.<br><br>2 - Incoming UDP request from 1.1.1.1:<br> - will match peer2 if the port is 5060; else<br> - will match peer4 if there registered port matches; else<br> - will match peer2 if if insecure=port is set for peer2.<br><br>For 1 and 2, would always match the first defined peer, possibly<br>resulting in peer not allowed to use transport during a later check.<br><br>3 - Incoming TCP/UDP from 1.1.1.2<br> - combined as per 1 + 2, against peer3 instead of peer1 or peer2, as<br> per previous.<br><br>Previously WS and WSS peers would need to be dynamic to match correctly,<br>or only have one registration from a given source IP.<br><br>Incoming UDP/TCP from anywhere else can only match peer4, if, and only<br>the source port matches the registered address, unless insecure=port is<br>set in which case incoming UDP could match (and will match the first<br>such peer) with insecure=port.<br><br>There is a possible problem here that for dynamic hosts we really should<br>match the registered protocol too, but I don't know how to do that, and<br>this wasn't previously the case anyway so should not be considered a<br>regression (and some existing use-case could conceivably conflict with<br>this).<br><br>ASTERISK-27881 #close<br><br>Change-Id: I61a9804e4feba9c7224c481f7a10bf7eb7c7f2a2<br>---<br>M channels/chan_sip.c<br>1 file changed, 23 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/58/9858/5</pre><p>To view, visit <a href="https://gerrit.asterisk.org/9858">change 9858</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9858"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>
<div style="display:none"> Gerrit-Change-Id: I61a9804e4feba9c7224c481f7a10bf7eb7c7f2a2 </div>
<div style="display:none"> Gerrit-Change-Number: 9858 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-Reviewer: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>