aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-12-12 15:01:17 +0100
committerHarald Welte <laforge@osmocom.org>2020-12-12 15:18:05 +0100
commitcab858824233597a15debe4c78bd867e58aa6335 (patch)
tree3d7ef7e110ca382f2130d892efcee823aafafd9b
parent4b4c997dc5e0881fc0fd05ae84350cf2d77fd84a (diff)
gbproxy: (Re)allocate SGSN-side PTP BVC even if CELL already exists
After a SGSN-side RESET of the SIG-BVC, all PTP BVC on the SGSN side are gone. However, the CELLs and the BSS side BVCs continue to exist (as there may be other SGSNs). So if a PTP-BVC RESET from the BSS side arrives in such a situation, and we can find a matching CELL, we still need to check if we need to create any SGSN-side PTP BVCs instead of simply being happy with the CELLs already existing. Change-Id: I1d1562e421082fa4399c73ac31290e4c95718e49 Closes: OS#4903
-rw-r--r--src/gbproxy/gb_proxy.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c
index 0dd45d4ab..5e6f23897 100644
--- a/src/gbproxy/gb_proxy.c
+++ b/src/gbproxy/gb_proxy.c
@@ -479,6 +479,7 @@ static void bss_ptp_bvc_reset_notif(uint16_t nsei, uint16_t bvci, const struct g
{
struct gbproxy_bvc *bvc = priv;
struct gbproxy_config *cfg = bvc->nse->cfg;
+ struct gbproxy_nse *sgsn_nse;
unsigned int i;
OSMO_ASSERT(bvci != 0);
@@ -502,7 +503,6 @@ static void bss_ptp_bvc_reset_notif(uint16_t nsei, uint16_t bvci, const struct g
}
if (!bvc->cell) {
- struct gbproxy_nse *sgsn_nse;
/* if we end up here, it means this is the first time we received a BVC-RESET
* for this BVC. We need to create the 'cell' data structure and the SGSN-side
* BVC counterparts */
@@ -513,28 +513,26 @@ static void bss_ptp_bvc_reset_notif(uint16_t nsei, uint16_t bvci, const struct g
/* link us to the cell and vice-versa */
bvc->cell->bss_bvc = bvc;
+ }
- /* allocate the SGSN-side BVCs within the cell, and reset them */
- hash_for_each(cfg->sgsn_nses, i, sgsn_nse, list) {
- struct gbproxy_bvc *sgsn_bvc = gbproxy_bvc_by_bvci(sgsn_nse, bvci);
- if (sgsn_bvc)
- OSMO_ASSERT(!sgsn_bvc->cell);
-
- if (!sgsn_bvc) {
- sgsn_bvc = gbproxy_bvc_alloc(sgsn_nse, bvci);
- OSMO_ASSERT(sgsn_bvc);
-
- sgsn_bvc->cell = bvc->cell;
- memcpy(sgsn_bvc->ra, bvc->cell->ra, sizeof(sgsn_bvc->ra));
- sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,
- bvci, ra_id, cell_id);
- OSMO_ASSERT(sgsn_bvc->fi);
- bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);
-
- gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc);
- } else {
- OSMO_ASSERT(sgsn_bvc->cell == bvc->cell);
- }
+ /* allocate (any missing) SGSN-side BVCs within the cell, and reset them */
+ hash_for_each(cfg->sgsn_nses, i, sgsn_nse, list) {
+ struct gbproxy_bvc *sgsn_bvc = gbproxy_bvc_by_bvci(sgsn_nse, bvci);
+ if (sgsn_bvc)
+ OSMO_ASSERT(sgsn_bvc->cell == bvc->cell || !sgsn_bvc->cell);
+
+ if (!sgsn_bvc) {
+ sgsn_bvc = gbproxy_bvc_alloc(sgsn_nse, bvci);
+ OSMO_ASSERT(sgsn_bvc);
+
+ sgsn_bvc->cell = bvc->cell;
+ memcpy(sgsn_bvc->ra, bvc->cell->ra, sizeof(sgsn_bvc->ra));
+ sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,
+ bvci, ra_id, cell_id);
+ OSMO_ASSERT(sgsn_bvc->fi);
+ bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);
+
+ gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc);
}
}