<p>Alexander Traud has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7430">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip: Peers with distinct source ports don't match, regardless of transport.<br><br>Previously, peers connected via TCP (or TLS) were matched by ignoring their<br>source port. One cannot say anything when protocol:IP:port match, yes (see<br><http://stackoverflow.com/q/3329641>). However, when the ports do not match, the<br>peers do not match as well.<br><br>This change allows two peers connected to an Asterisk server via TCP (or TLS)<br>behind a NAT (= same source IP address) to be differentiated via their port as<br>well.<br><br>ASTERISK-27457<br>Reported by: Stephane Chazelas<br><br>Change-Id: Id190428bf1d931f2dbfd4b293f53ff8f20d98efa<br>---<br>M channels/chan_sip.c<br>1 file changed, 3 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/30/7430/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_sip.c b/channels/chan_sip.c<br>index 559e5c0..dacc717 100644<br>--- a/channels/chan_sip.c<br>+++ b/channels/chan_sip.c<br>@@ -34129,10 +34129,9 @@<br> }<br> <br> /* We matched the IP, check to see if we need to match by port as well. */<br>- if ((peer->transports & peer2->transports) & (AST_TRANSPORT_TLS | AST_TRANSPORT_TCP)) {<br>- /* peer matching on port is not possible with TCP/TLS */<br>- return CMP_MATCH | CMP_STOP;<br>- } else if (ast_test_flag(&peer2->flags[0], SIP_INSECURE_PORT)) {<br>+ if (((peer->transports & peer2->transports) &<br>+ (AST_TRANSPORT_UDP | AST_TRANSPORT_WS | AST_TRANSPORT_WSS)) &&<br>+ ast_test_flag(&peer2->flags[0], SIP_INSECURE_PORT)) {<br> /* We are allowing match without port for peers configured that<br> * way in this pass through the peers. */<br> return ast_test_flag(&peer->flags[0], SIP_INSECURE_PORT) ?<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7430">change 7430</a>. To unsubscribe, 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/7430"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id190428bf1d931f2dbfd4b293f53ff8f20d98efa </div>
<div style="display:none"> Gerrit-Change-Number: 7430 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>