<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/24218">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sccp_scrc: Ensure we have not just SSN but at least OPC+SSN in CallingParty<br><br>There are implementations out there which send us traffic, specifically<br>in this case SCMG (SST) that has only SSN in both Called and Calling<br>Party. This means the inbound SST message is routed correctly to the<br>local SCCP user of libosmo-sigtran. But when that local SCCP user<br>responds with inverting Called/Calling Party, the new destination again<br>just contains a SSN.<br><br>As a result, we don't know where to route the message (we always need a PC).<br><br>Change-Id: Id66ae960ebe3cb3b09c6dd5454f9ac9c073f46d7<br>Closes: OS#5146<br>---<br>M src/sccp_scrc.c<br>1 file changed, 23 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/18/24218/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c</span><br><span>index b46b4f2..5c3cefe 100644</span><br><span>--- a/src/sccp_scrc.c</span><br><span>+++ b/src/sccp_scrc.c</span><br><span>@@ -440,6 +440,26 @@</span><br><span>       return scrc_local_out_common(inst, xua, &called);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* ensure the CallingParty address doesn't just contain SSN, but at least SSN+PC */</span><br><span style="color: hsl(120, 100%, 40%);">+static void ensure_opc_in_calling_ssn(struct osmo_sccp_instance *inst,</span><br><span style="color: hsl(120, 100%, 40%);">+                                     struct xua_msg *xua)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct osmo_sccp_addr calling;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      sua_addr_parse(&calling, xua, SUA_IEI_SRC_ADDR);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        /* if we route on SSN and only have a SSN in the address... */</span><br><span style="color: hsl(120, 100%, 40%);">+        if (calling.ri == OSMO_SCCP_RI_SSN_PC &&</span><br><span style="color: hsl(120, 100%, 40%);">+          calling.presence == OSMO_SCCP_ADDR_T_SSN) {</span><br><span style="color: hsl(120, 100%, 40%);">+               /* add the M3UA OPC to the address to ensure that the recipient</span><br><span style="color: hsl(120, 100%, 40%);">+                * can actually respond back to the source */</span><br><span style="color: hsl(120, 100%, 40%);">+         calling.presence |= OSMO_SCCP_ADDR_T_PC;</span><br><span style="color: hsl(120, 100%, 40%);">+              calling.pc = xua->mtp.opc;</span><br><span style="color: hsl(120, 100%, 40%);">+         xua_msg_free_tag(xua, SUA_IEI_SRC_ADDR);</span><br><span style="color: hsl(120, 100%, 40%);">+              xua_msg_add_sccp_addr(xua, SUA_IEI_SRC_ADDR, &calling);</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Figure C.1/Q.714 Sheet 1 of 12, after we converted the</span><br><span>  * MTP-TRANSFER.ind to SUA. */</span><br><span> int scrc_rx_mtp_xfer_ind_xua(struct osmo_sccp_instance *inst,</span><br><span>@@ -461,6 +481,9 @@</span><br><span>         }</span><br><span>    /* We only treat connectionless and CR below */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   ensure_opc_in_calling_ssn(inst, xua);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* ensure we have at least OPC+SSN and not just SSN in CallingParty (OS#5146) */</span><br><span>     sua_addr_parse(&called, xua, SUA_IEI_DEST_ADDR);</span><br><span> </span><br><span>     /* Route on GT? */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/24218">change 24218</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/c/libosmo-sccp/+/24218"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-sccp </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Id66ae960ebe3cb3b09c6dd5454f9ac9c073f46d7 </div>
<div style="display:none"> Gerrit-Change-Number: 24218 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>