Change in libosmo-sccp[master]: ipa: if there are PCs in the msg, use them for routing

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jul 26 00:32:45 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/10163


Change subject: ipa: if there are PCs in the msg, use them for routing
......................................................................

ipa: if there are PCs in the msg, use them for routing

patch_sccp_with_pc() overwrites the SCCP addresses' point-codes only if there
are none yet in the message.

ipa_rx_msg_sccp() feeds opc and dpc to patch into the message, and so far uses
these opc and dpc in the xua_msg_hdr even if there are different PCs in the
SCCP message already, and these opc and dpc were never patched into the msg.

Change the opc and dpc args of patch_sccp_with_pc() as in+out params, and if
not patched into the message, return the opc and dpc actually found in the
message.

Hence in ipa_rx_msg_sccp() compose the m3ua_data_hdr with the point-codes found
in the message, instead of those that would have been but were not actually
patched into the message and potentially mismatch it.

Testing with an SCCPlite MSC actually gives me complete SCCP addresses with
point-codes, so it is not set in stone to receive no point-codes over IPA.

If the cs7 vty config matches the point-codes received, there is no problem,
but I faced a weird situation when the config is wrong: osmo-bsc logs the PCs
received in the message while it confusingly uses the config ones for routing.

Change-Id: I157c43a5dc12f6e24828efef1dceac246497e313
---
M src/ipa.c
1 file changed, 17 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/63/10163/1

diff --git a/src/ipa.c b/src/ipa.c
index f3a7a52..dc0c603 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -138,9 +138,10 @@
 	return NULL;
 }
 
-/* Patch a SCCP message and add point codes to Called/Calling Party (if missing) */
+/* Patch a SCCP message and add point codes to Called/Calling Party (if missing).
+ * If not missing, report back the actually present opc and dpc. */
 static struct msgb *patch_sccp_with_pc(struct osmo_ss7_asp *asp, struct msgb *sccp_msg_in,
-					uint32_t opc, uint32_t dpc)
+				       uint32_t *opc, uint32_t *dpc)
 {
 	struct osmo_sccp_addr addr;
 	struct msgb *sccp_msg_out;
@@ -161,11 +162,13 @@
 	rc = sua_addr_parse(&addr, sua, SUA_IEI_DEST_ADDR);
 	switch (rc) {
 	case 0:
-		if (addr.presence & OSMO_SCCP_ADDR_T_PC)
+		if (addr.presence & OSMO_SCCP_ADDR_T_PC) {
+			*dpc = addr.pc;
 			break;
+		}
 		/* if there's no point code in dest_addr, add one */
 		addr.presence |= OSMO_SCCP_ADDR_T_PC;
-		addr.pc = dpc;
+		addr.pc = *dpc;
 		xua_msg_free_tag(sua, SUA_IEI_DEST_ADDR);
 		xua_msg_add_sccp_addr(sua, SUA_IEI_DEST_ADDR, &addr);
 		break;
@@ -179,11 +182,13 @@
 	rc = sua_addr_parse(&addr, sua, SUA_IEI_SRC_ADDR);
 	switch (rc) {
 	case 0:
-		if (addr.presence & OSMO_SCCP_ADDR_T_PC)
+		if (addr.presence & OSMO_SCCP_ADDR_T_PC) {
+			*opc = addr.pc;
 			break;
+		}
 		/* if there's no point code in src_addr, add one */
 		addr.presence |= OSMO_SCCP_ADDR_T_PC;
-		addr.pc = opc;
+		addr.pc = *opc;
 		xua_msg_free_tag(sua, SUA_IEI_SRC_ADDR);
 		xua_msg_add_sccp_addr(sua, SUA_IEI_SRC_ADDR, &addr);
 		break;
@@ -219,7 +224,7 @@
 
 	/* We have received an IPA-encapsulated SCCP message, without
 	 * any MTP routing label.  Furthermore, the SCCP Called/Calling
-	 * Party are SSN-only, with no GT or PC.  This means we have no
+	 * Party possibly are SSN-only, with no GT or PC.  This means we have no
 	 * real idea where it came from, nor where it goes to.  We could
 	 * simply treat it as being for the local point code, but then
 	 * this means that we would have to implement SCCP connection
@@ -247,10 +252,13 @@
 		opc = as->cfg.pc_override.dpc;
 		/* Destination: PC of the routing key */
 		dpc = as->cfg.routing_key.pc;
+
+		LOGPASP(asp, DLSS7, LOGL_INFO, "Rx message: setting opc=%u dpc=%u\n",
+			opc, dpc);
 	}
 
-	/* Second, patch this into the SCCP message */
-	msg = patch_sccp_with_pc(asp, msg, opc, dpc);
+	/* Second, patch this into the SCCP message, if they lack PCs */
+	msg = patch_sccp_with_pc(asp, msg, &opc, &dpc);
 
 	/* Third, create a MTP3/M3UA label with those point codes */
 	memset(&data_hdr, 0, sizeof(data_hdr));

-- 
To view, visit https://gerrit.osmocom.org/10163
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I157c43a5dc12f6e24828efef1dceac246497e313
Gerrit-Change-Number: 10163
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180726/4acc4978/attachment.htm>


More information about the gerrit-log mailing list