[PATCH 2/2] gbproxy: Reject SGSN UNITDATA messages with an invalid BVCI

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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Fri Oct 18 20:12:17 UTC 2013


Currently such messages lead to a creation of a new peer with the
SGSN's NSEI, which results in echoing the message back to the SGSN.

This patch modifies this by sending a STATUS response (invalid BVCI)
instead back to the SGSN.

Sponsored-by: On-Waves ehf
---
 openbsc/src/gprs/gb_proxy.c           |   12 +++++++-----
 openbsc/tests/gbproxy/gbproxy_test.ok |   11 ++++++-----
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index a25a9f5..dea6e3f 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -693,11 +693,13 @@ int gbprox_rcvmsg(struct msgb *msg, uint16_t nsei, uint16_t ns_bvci, uint16_t ns
 
 		/* else: SGSN -> BSS direction */
 		if (!peer) {
-			LOGP(DGPRS, LOGL_INFO, "Allocationg new peer for "
-			     "BVCI=%u via NSVC=%u/NSEI=%u\n", ns_bvci,
-			     nsvci, nsei);
-			peer = peer_alloc(ns_bvci);
-			peer->nsei = nsei;
+			LOGP(DGPRS, LOGL_INFO, "Didn't find peer for "
+			     "BVCI=%u for message from NSVC=%u/NSEI=%u (SGSN)\n",
+			     ns_bvci, nsvci, nsei);
+			rate_ctr_inc(&get_global_ctrg()->
+				     ctr[GBPROX_GLOB_CTR_INV_BVCI]);
+			return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI,
+					       &ns_bvci, msg);
 		}
 		if (peer->blocked) {
 			LOGP(DGPRS, LOGL_NOTICE, "Dropping PDU for "
diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok
index fcde39f..35d97e7 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.ok
+++ b/openbsc/tests/gbproxy/gbproxy_test.ok
@@ -804,14 +804,15 @@ PROCESSING UNITDATA from 0x05060708:32000
 CALLBACK, event 0, msg length 0, bvci 0x10ff
 
 
-NS UNITDATA MESSAGE to SGSN, BVCI 0x10ff, msg length 0
+NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 10
+41 07 81 05 04 82 10 ff 15 80 
 
+MESSAGE to SGSN at 0x05060708:32000, msg length 14
+00 00 00 00 41 07 81 05 04 82 10 ff 15 80 
 
-MESSAGE to SGSN at 0x05060708:32000, msg length 4
-00 00 10 ff 
-
-result (UNITDATA) = 4
+result (UNITDATA) = 14
 
 Gbproxy global:
+    Invalid BVC Identifier          : 1
 ===== NS protocol test END
 
-- 
1.7.9.5





More information about the OpenBSC mailing list