From 17b42b81f026550f99ecb3b611dca944a8bc7bc5 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Fri, 29 Aug 2014 12:20:15 +0200 Subject: [PATCH] gbproxy: Make STATUS messages spec compliant Currently the gbproxy sends STATUS messages that are not compliant to GSM 08.18, 10.4.14.1: The BVCI must be included if (and only if) the cause is either "BVCI blocked" or "BVCI unknown". This patch adds a missing BVCI to UNKNOWN_BVCI and BVCI_BLOCKED status messages if the BVCI is available. Otherwise, INV_MAND_INF is used instead. Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gb_proxy.c | 8 ++++---- openbsc/tests/gbproxy/gbproxy_test.ok | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index e77d52792..b55bbae47 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -671,7 +671,7 @@ static int gbprox_rx_ptp_from_sgsn(struct gbproxy_config *cfg, "blocked BVCI=%u via NSVC=%u/NSEI=%u\n", ns_bvci, nsvci, nsei); rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_DROPPED]); - return bssgp_tx_status(BSSGP_CAUSE_BVCI_BLOCKED, NULL, msg); + return bssgp_tx_status(BSSGP_CAUSE_BVCI_BLOCKED, &ns_bvci, msg); } switch (pdu_type) { @@ -809,7 +809,7 @@ err_no_peer: LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(BSS) cannot find peer based on NSEI\n", nsei); rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_INV_NSEI]); - return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg); + return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg); err_mand_ie: LOGP(DGPRS, LOGL_ERROR, "NSEI=%u(BSS) missing mandatory RA IE\n", nsei); @@ -880,7 +880,7 @@ static int rx_reset_from_sgsn(struct gbproxy_config *cfg, rate_ctr_inc(&cfg->ctrg-> ctr[GBPROX_GLOB_CTR_INV_BVCI]); return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, - NULL, orig_msg); + &ptp_bvci, orig_msg); } return gbprox_relay2peer(msg, peer, ns_bvci); } @@ -1033,7 +1033,7 @@ err_no_peer: nsei); rate_ctr_inc(&cfg->ctrg-> ctr[GBPROX_GLOB_CTR_INV_RAI]); msgb_free(msg); - return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, orig_msg); + return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, orig_msg); } static int gbproxy_is_sgsn_nsei(struct gbproxy_config *cfg, uint16_t nsei) diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok index fc767a4ea..1cf3bb034 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.ok +++ b/openbsc/tests/gbproxy/gbproxy_test.ok @@ -1868,7 +1868,7 @@ CALLBACK, event 0, msg length 18, bvci 0x0000 NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 24 (gprs_ns_sendmsg) MESSAGE to SGSN at 0x05060708:32000, msg length 28 -00 00 00 00 41 07 81 05 15 92 0c 1f 84 cc d1 75 8b 1b 86 00 f1 99 00 63 60 1d 81 01 +00 00 00 00 41 07 81 21 15 92 0c 1f 84 cc d1 75 8b 1b 86 00 f1 99 00 63 60 1d 81 01 result (BVC_SUSPEND_ACK) = 28 @@ -2307,7 +2307,7 @@ CALLBACK, event 0, msg length 18, bvci 0x0000 NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 24 (gprs_ns_sendmsg) MESSAGE to SGSN at 0x05060708:32000, msg length 28 -00 00 00 00 41 07 81 05 15 92 0c 1f 84 ef e2 b7 00 1b 86 00 f1 99 00 63 60 1d 81 01 +00 00 00 00 41 07 81 21 15 92 0c 1f 84 ef e2 b7 00 1b 86 00 f1 99 00 63 60 1d 81 01 result (BVC_SUSPEND_ACK) = 28 @@ -2816,7 +2816,7 @@ CALLBACK, event 0, msg length 18, bvci 0x0000 NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 24 (gprs_ns_sendmsg) MESSAGE to SGSN at 0x05060708:32000, msg length 28 -00 00 00 00 41 07 81 05 15 92 0c 1f 84 ef e2 b7 00 1b 86 00 f1 99 00 63 60 1d 81 01 +00 00 00 00 41 07 81 21 15 92 0c 1f 84 ef e2 b7 00 1b 86 00 f1 99 00 63 60 1d 81 01 result (BVC_SUSPEND_ACK) = 28