Change in osmo-gbproxy[master]: WIP STATUS handling

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/.

daniel gerrit-no-reply at lists.osmocom.org
Wed Jul 28 11:04:51 UTC 2021


daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gbproxy/+/25079 )


Change subject: WIP STATUS handling
......................................................................

WIP STATUS handling

Related: OS#4892
Change-Id: I29adb77a94ab759f5d557dada60b4b7df9616f17
---
M src/gb_proxy.c
1 file changed, 35 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gbproxy refs/changes/79/25079/1

diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 0815041..3826b0c 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -996,6 +996,7 @@
 	struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *)pdu_data;
 	struct tlv_parsed tp_inner[2];
 
+	/* TODO: Parse partial messages as well */
 	rc = osmo_tlv_prot_parse(&osmo_pdef_bssgp, tp, ARRAY_SIZE(tp_inner), bgph->pdu_type, bgph->data, pdu_len - sizeof(*bgph), 0, 0, DGPRS, "FOO");
 
 	if (rc < 0)
@@ -1108,16 +1109,19 @@
 	{
 		/* Check if the status needs to be terminated locally */
 		uint8_t cause = *TLVP_VAL(&tp[0], BSSGP_IE_CAUSE);
+
 		if (cause == BSSGP_CAUSE_UNKNOWN_BVCI || cause == BSSGP_CAUSE_BVCI_BLOCKED) {
 			/* Log and handle locally */
 			ptp_bvci = ntohs(tlvp_val16_unal(&tp[0], BSSGP_IE_BVCI));
-			LOGP(DGPRS, LOGL_ERROR, "%s Rx STATUS with cause %s for PtP-BVC %05u\n", log_pfx,
-				bssgp_cause_str (cause), ptp_bvci);
+			LOGPNSE(nse, LOGL_ERROR, "Rx STATUS cause=0x%02x(%s) for PtP-BVC %05u\n", cause,
+				bssgp_cause_str(cause), ptp_bvci);
 			/* FIXME: Remove/block our BVC if present? */
 			break;
 		}
 
-		LOGP(DGPRS, LOGL_INFO, "Forwarding STATUS with cause %s\n", bssgp_cause_str(cause));
+		LOGPNSE(nse, LOGL_NOTICE, "Rx STATUS cause=0x%02x(%s) ", cause,
+			bssgp_cause_str(cause));
+
 		struct gbproxy_sgsn *sgsn;
 		if (gbproxy_tlli_from_status_pdu(msg, tp, &tlli) == 0) {
 			sgsn = gbproxy_select_sgsn(nse->cfg, &tlli);
@@ -1131,8 +1135,6 @@
 		}
 
 		rc = gbprox_relay2nse(msg, sgsn->nse, 0);
-		/* FIXME: inspect the erroneous PDU IE (if any) and check
-		 * if we can extract a TLLI/RNI to route it to the correct SGSN */
 		break;
 	}
 	case BSSGP_PDUT_RAN_INFO:
@@ -1468,20 +1470,36 @@
 		rc = gbprox_rx_paging(nse, msg, pdut_name, &tp[0], ns_bvci, paging_bc);
 		break;
 	case BSSGP_PDUT_STATUS:
-		/* Some exception has occurred */
-		cause = *TLVP_VAL(&tp[0], BSSGP_IE_CAUSE);
-		LOGPNSE(nse, LOGL_NOTICE, "Rx STATUS cause=0x%02x(%s) ", cause,
+	{
+		struct gbproxy_nse *nse_peer;
+		uint32_t tlli;
+
+		/* Check if the status needs to be terminated locally */
+		uint8_t cause = *TLVP_VAL(&tp[0], BSSGP_IE_CAUSE);
+
+		if (cause == BSSGP_CAUSE_UNKNOWN_BVCI || cause == BSSGP_CAUSE_BVCI_BLOCKED) {
+			/* Log and handle locally */
+			uint16_t ptp_bvci = ntohs(tlvp_val16_unal(&tp[0], BSSGP_IE_BVCI));
+			LOGPNSE(nse, LOGL_ERROR, "Rx STATUS cause=0x%02x(%s) for PtP-BVC %05u\n", cause,
+				bssgp_cause_str(cause), ptp_bvci);
+			/* FIXME: Remove/block our BVC if present? */
+			break;
+		}
+
+		LOGPNSE(nse, LOGL_NOTICE, "Rx STATUS cause=0x%02x(%s)\n", cause,
 			bssgp_cause_str(cause));
-		if (TLVP_PRES_LEN(&tp[0], BSSGP_IE_BVCI, 2)) {
-			bvci = ntohs(tlvp_val16_unal(&tp[0], BSSGP_IE_BVCI));
-			LOGPC(DGPRS, LOGL_NOTICE, "BVCI=%05u\n", bvci);
-			sgsn_bvc = gbproxy_bvc_by_bvci(nse, bvci);
-			/* don't send STATUS in response to STATUS if !bvc */
-			if (sgsn_bvc && sgsn_bvc->cell && sgsn_bvc->cell->bss_bvc)
-				rc = gbprox_relay2peer(msg, sgsn_bvc->cell->bss_bvc, ns_bvci);
-		} else
-			LOGPC(DGPRS, LOGL_NOTICE, "\n");
+
+		if (gbproxy_tlli_from_status_pdu(msg, tp, &tlli) == 0) {
+			nse_peer = gbproxy_nse_by_tlli(cfg, tlli);
+			if (nse_peer)
+				return gbprox_relay2nse(msg, nse_peer, 0);
+		}
+
+		LOGPNSE(nse, LOGL_ERROR, "Unable to handle STATUS cause=0x%02x(%s)\n", cause,
+			bssgp_cause_str(cause));
+
 		break;
+	}
 	/* those only exist in the SGSN -> BSS direction */
 	case BSSGP_PDUT_SUSPEND_ACK:
 	case BSSGP_PDUT_SUSPEND_NACK:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gbproxy/+/25079
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: I29adb77a94ab759f5d557dada60b4b7df9616f17
Gerrit-Change-Number: 25079
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210728/4de83b13/attachment.htm>


More information about the gerrit-log mailing list