gbproxy: Ensure BVC0 is reset before handling PtP BVCs

Change-Id: I9c67f973f7bca00e8eb22a024ef2282c007dd84b
Related: SYS#5226
This commit is contained in:
Daniel Willmann 2020-11-30 14:28:52 +01:00
parent e50550e409
commit af7398acff
3 changed files with 125 additions and 6 deletions

View File

@ -1058,6 +1058,14 @@ static int gbprox_rx_sig_from_bss(struct gbproxy_config *cfg,
LOGP(DGPRS, LOGL_INFO, "NSEI=%u Rx BVC RESET (BVCI=%u)\n", LOGP(DGPRS, LOGL_INFO, "NSEI=%u Rx BVC RESET (BVCI=%u)\n",
nsei, bvci); nsei, bvci);
if (bvci == 0) { if (bvci == 0) {
struct gbproxy_nse *nse;
/* Ensure the NSE peer is there and clear all PtP BVCs */
nse = gbproxy_nse_by_nsei_or_new(cfg, nsei);
if (!nse)
LOGP(DGPRS, LOGL_ERROR, "Could not allocate NSE for NSEI=%u\n", nsei);
gbproxy_cleanup_peers(cfg, nsei, 0);
/* FIXME: only do this if SGSN is alive! */ /* FIXME: only do this if SGSN is alive! */
LOGP(DGPRS, LOGL_INFO, "NSEI=%u Tx fake " LOGP(DGPRS, LOGL_INFO, "NSEI=%u Tx fake "
"BVC RESET ACK of BVCI=0\n", nsei); "BVC RESET ACK of BVCI=0\n", nsei);
@ -1066,10 +1074,11 @@ static int gbprox_rx_sig_from_bss(struct gbproxy_config *cfg,
} }
from_peer = gbproxy_peer_by_bvci(cfg, bvci); from_peer = gbproxy_peer_by_bvci(cfg, bvci);
if (!from_peer) { if (!from_peer) {
struct gbproxy_nse *nse = gbproxy_nse_by_nsei_or_new(cfg, nsei); struct gbproxy_nse *nse = gbproxy_nse_by_nsei(cfg, nsei);
if (!nse) { if (!nse) {
LOGP(DGPRS, LOGL_ERROR, "Could not allocate NSE for NSEI=%u\n", nsei); LOGP(DGPRS, LOGL_NOTICE, "Got PtP BVC reset before signalling reset for "
return bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); "BVCI=%u NSEI=%u\n", bvci, nsei);
return bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_STATE, NULL, msg);
} }
/* if a PTP-BVC is reset, and we don't know that /* if a PTP-BVC is reset, and we don't know that
* PTP-BVCI yet, we should allocate a new peer */ * PTP-BVCI yet, we should allocate a new peer */
@ -1081,10 +1090,11 @@ static int gbprox_rx_sig_from_bss(struct gbproxy_config *cfg,
/* Could have moved to a different NSE */ /* Could have moved to a different NSE */
if (!check_peer_nsei(from_peer, nsei)) { if (!check_peer_nsei(from_peer, nsei)) {
struct gbproxy_nse *nse_old = from_peer->nse; struct gbproxy_nse *nse_old = from_peer->nse;
struct gbproxy_nse *nse_new = gbproxy_nse_by_nsei_or_new(cfg, nsei); struct gbproxy_nse *nse_new = gbproxy_nse_by_nsei(cfg, nsei);
if (!nse_new) { if (!nse_new) {
LOGP(DGPRS, LOGL_ERROR, "Could not allocate NSE for NSEI=%u\n", nsei); LOGP(DGPRS, LOGL_NOTICE, "Got PtP BVC reset before signalling reset for "
return bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg); "BVCI=%u NSEI=%u\n", bvci, nsei);
return bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_STATE, NULL, msg);
} }
LOGP(DGPRS, LOGL_NOTICE, "Peer for BVCI=%u moved from NSEI=%u to NSEI=%u\n", bvci, nse_old->nsei, nsei); LOGP(DGPRS, LOGL_NOTICE, "Peer for BVCI=%u moved from NSEI=%u to NSEI=%u\n", bvci, nse_old->nsei, nsei);

View File

@ -930,6 +930,7 @@ static void setup_ns(struct gprs_ns2_inst *nsi,
"NSEI 0x%04x(%d)\n\n", "NSEI 0x%04x(%d)\n\n",
nsei, nsei); nsei, nsei);
send_ns_avail(nsi, nsei); send_ns_avail(nsi, nsei);
send_bssgp_reset(nsi, nsei, 0);
} }
static void setup_bssgp(struct gprs_ns2_inst *nsi, static void setup_bssgp(struct gprs_ns2_inst *nsi,

View File

@ -13,6 +13,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -48,6 +57,15 @@ Setup NS-VC: NSEI 0x2000(8192)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 8192
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=8192 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x2002(8194) Setup BSSGP: BVCI 0x2002(8194)
PROCESSING BVC_RESET from NSEI 8192 PROCESSING BVC_RESET from NSEI 8192
@ -366,6 +384,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
--- Setup BVCI 1 --- --- Setup BVCI 1 ---
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
@ -488,6 +515,15 @@ Setup NS-VC: NSEI 0x2000(8192)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 8192
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=8192 BVCI=0):
23 04 82 00 00
--- Setup BVCI 1 --- --- Setup BVCI 1 ---
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
@ -679,6 +715,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -1057,6 +1102,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -1342,6 +1396,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -1991,6 +2054,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -2250,6 +2322,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -2966,6 +3047,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x0000(0) Setup BSSGP: BVCI 0x0000(0)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -4108,6 +4198,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096
@ -5716,6 +5815,15 @@ Setup NS-VC: NSEI 0x1000(4096)
NS2 CALLBACK, prim 2, bvci 0x0000 NS2 CALLBACK, prim 2, bvci 0x0000
PROCESSING BVC_RESET from NSEI 4096
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
NS2 CALLBACK, prim 0, msg length 18, bvci 0x0000
22 04 82 00 00 07 81 08 08 88 11 22 33 40 50 60 10 00
Message for BSS (NSEI=4096 BVCI=0):
23 04 82 00 00
Setup BSSGP: BVCI 0x1002(4098) Setup BSSGP: BVCI 0x1002(4098)
PROCESSING BVC_RESET from NSEI 4096 PROCESSING BVC_RESET from NSEI 4096