[PATCH] libosmo-sccp[master]: add various debug logging to help figure out complex SCCP ro...

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 Jun 22 19:18:07 UTC 2017


Review at  https://gerrit.osmocom.org/3012

add various debug logging to help figure out complex SCCP routing

Change-Id: Ia3243606d6cad7721f7da7f6caba2caa90ae2bbd
---
M src/m3ua.c
M src/osmo_ss7.c
M src/osmo_ss7_hmrt.c
M src/sccp_scoc.c
M src/sccp_scrc.c
5 files changed, 32 insertions(+), 2 deletions(-)


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

diff --git a/src/m3ua.c b/src/m3ua.c
index d96bd18..22e1f9c 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -536,6 +536,8 @@
 	struct m3ua_data_hdr *dh;
 	struct osmo_ss7_as *as;
 
+	LOGPASP(asp, DLM3UA, LOGL_DEBUG, "m3ua_rx_xfer\n");
+
 	if (xua->hdr.msg_type != M3UA_XFER_DATA)
 		return M3UA_ERR_UNSUPP_MSG_TYPE;
 
@@ -556,6 +558,9 @@
 	dh = data_hdr_from_m3ua(xua);
 	OSMO_ASSERT(dh);
 	m3ua_dh_to_xfer_param(&xua->mtp, dh);
+	LOGPASP(asp, DLM3UA, LOGL_DEBUG,
+		"m3ua data hdr opc=%u dpc=%u\n",
+		xua->mtp.opc, xua->mtp.dpc);
 
 	/* remove ROUTE_CTX as in the routing case we want to add a new
 	 * routing context on the outbound side */
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 78b22a7..1ef04ca 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -740,10 +740,15 @@
 	rt->cfg.pc = pc;
 	rt->cfg.mask = mask;
 	rt->cfg.linkset_name = talloc_strdup(rt, linkset_name);
-	if (lset)
+	if (lset) {
 		rt->dest.linkset = lset;
-	else
+		DEBUGP(DLSS7, "Created route pc=%u mask=%u name=%s linkset %s\n", pc, mask, linkset_name,
+		       lset->cfg.name);
+	} else {
 		rt->dest.as = as;
+		DEBUGP(DLSS7, "Created route pc=%u mask=%u name=%s as %s\n", pc, mask, linkset_name,
+		       as->cfg.name);
+	}
 	rt->rtable = rtbl;
 
 	route_insert_sorted(rtbl, rt);
diff --git a/src/osmo_ss7_hmrt.c b/src/osmo_ss7_hmrt.c
index e66762d..b018639 100644
--- a/src/osmo_ss7_hmrt.c
+++ b/src/osmo_ss7_hmrt.c
@@ -132,6 +132,15 @@
 	/* FIXME: unify with gen_mtp_transfer_req_xua() */
 	rt = osmo_ss7_route_lookup(inst, dpc);
 	if (rt) {
+		DEBUGP(DLSS7, "found route for dpc %u: %s pc=%u mask=%u %s:%s\n", dpc,
+		       rt->cfg.linkset_name,
+		       rt->cfg.pc,
+		       rt->cfg.mask,
+		       rt->dest.linkset ? "linkset"
+				        : (rt->dest.as ? "as" : "-"),
+		       rt->dest.linkset ? rt->dest.linkset->cfg.name
+				        : (rt->dest.as ? rt->dest.as->cfg.name : "-")
+		       );
 		/* FIXME: DPC SP restart? */
 		/* FIXME: DPC Congested? */
 		/* FIXME: Select link based on SLS */
@@ -140,6 +149,7 @@
 			struct osmo_ss7_as *as = rt->dest.as;
 			switch (as->cfg.proto) {
 			case OSMO_SS7_ASP_PROT_M3UA:
+				DEBUGP(DLSS7, "rt->dest.as proto is M3UA for dpc %u\n", dpc);
 				return m3ua_tx_xua_as(as,xua);
 			case OSMO_SS7_ASP_PROT_IPA:
 				return ipa_tx_xua_as(as, xua);
@@ -171,8 +181,10 @@
 {
 	uint32_t dpc = xua->mtp.dpc;
 	if (osmo_ss7_pc_is_local(inst, dpc)) {
+		DEBUGP(DLSS7, "dpc %u is local\n", dpc);
 		return hmdt_message_for_distribution(inst, xua);
 	} else {
+		DEBUGP(DLSS7, "dpc %u is for routing\n", dpc);
 		return hmrt_message_for_routing(inst, xua);
 	}
 }
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index fbb6ef8..54ce707 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -1544,6 +1544,8 @@
 			 * the one we saved in local state */
 			src_loc_ref = xua_msg_get_u32(xua, SUA_IEI_SRC_REF);
 			if (src_loc_ref != conn->remote_ref) {
+				DEBUGP(DLSCCP, "src_loc_ref(%u) != conn->remote_ref(%u)\n",
+				       src_loc_ref, conn->remote_ref);
 				sccp_scoc_rx_inval_src_ref(conn, xua);
 				return;
 			}
@@ -1551,6 +1553,8 @@
 
 		/* Check if received OPC != the remote_pc we stored locally */
 		if (xua->mtp.opc != conn->remote_pc) {
+			DEBUGP(DLSCCP, "xua->mtp.opc(%u) != conn->remote_pc(%u)\n",
+			       xua->mtp.opc, conn->remote_pc);
 			sccp_scoc_rx_inval_opc(inst, xua);
 			return;
 		}
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c
index a4ce34c..333ab61 100644
--- a/src/sccp_scrc.c
+++ b/src/sccp_scrc.c
@@ -238,6 +238,7 @@
 static int scrc_node_4(struct osmo_sccp_instance *inst,
 		       struct xua_msg *xua, uint32_t return_cause)
 {
+	LOGP(DLSS7, LOGL_DEBUG, "scrc_node_4\n");
 	/* TODO: Routing Failure SCRC -> OMAP */
 	if (sua_is_connectionless(xua)) {
 		/* Routing Failure SCRC -> SCLC */
@@ -436,6 +437,7 @@
 	if (!sua_is_connectionless(xua) && !sua_is_cr(xua)) {
 		/* Node 1 (Sheet 3) */
 		/* deliver to SCOC */
+		LOGP(DLSS7, LOGL_DEBUG, "deliver to SCOC\n");
 		sccp_scoc_rx_from_scrc(inst, xua);
 		return 0;
 	}
@@ -446,6 +448,7 @@
 	/* Route on GT? */
 	if (called.ri != OSMO_SCCP_RI_GT) {
 		/* Node 6 (Sheet 3) */
+		LOGP(DLSS7, LOGL_DEBUG, "called.ri != OSMO_SCCP_RI_GT\n");
 		return scrc_node_6(inst, xua, &called);
 	}
 	/* Message with hop-counter? */
@@ -455,6 +458,7 @@
 		if (hop_counter <= 1) {
 			/* Error: hop-counter violation */
 			/* node 4 */
+			LOGP(DLSS7, LOGL_DEBUG, "hop-counter violation\n");
 			return scrc_node_4(inst, xua, SCCP_RETURN_CAUSE_HOP_COUNTER_VIOLATION);
 		}
 		/* Decrement hop-counter */

-- 
To view, visit https://gerrit.osmocom.org/3012
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3243606d6cad7721f7da7f6caba2caa90ae2bbd
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list