aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_bssgp_pcu.cpp
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-10 06:00:05 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-10 06:16:11 +0700
commit974cc7b32447a85d95e45f66e878234232bbe227 (patch)
treec9044a4bf3ce649f54ca196029a93a9921808646 /src/gprs_bssgp_pcu.cpp
parentd038361e95f5247d10f14d4337f1fb001a247bb6 (diff)
gprs_bssgp_pcu: fix: do not crash on receipt of subsequent INFO.ind
It's expected to receive subsequent INFO.ind messages at run-time, e.g. when a dynamic TCH/F_TCH/H_PDCH timeslot is switched from PDCH to TCH/F or TCH/H, osmo-bts would send us INFO.ind with the updated PDCH slot-mask indicating that this timeslot is disabled. In gprs_nsvc_create_and_connect(), do not bind() on the received NSVC address unconditionally - we may already be bound to it. Instead, return early and keep everything unchanged. I don't know how the PCU is supposed to handle NSVC address change, at least the new NS2 library does not handle this internally, nor it provides any API for that. Let's leave it for later. Change-Id: I159138e41e147cd30212da548b0ccd3f81d61b4e Related: I4c3bc883d795e5d1ee5ab175ac03684924692a7c Fixes: Ib389925cf5c9f18951af6242c31ea70476218e9a Related: SYS#5108
Diffstat (limited to 'src/gprs_bssgp_pcu.cpp')
-rw-r--r--src/gprs_bssgp_pcu.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index e0cfc378..adf5bf3c 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -930,20 +930,25 @@ int gprs_nsvc_create_and_connect(struct gprs_rlcmac_bts *bts,
struct gprs_ns2_vc_bind *bind;
int rc;
- rc = gprs_ns2_ip_bind(bts->nsi, local, 0, &bind);
- if (rc < 0) {
- LOGP(DBSSGP, LOGL_ERROR, "Failed to create socket\n");
- gprs_ns2_free(bts->nsi);
- return 1;
- }
-
bts->nse = gprs_ns2_nse_by_nsei(bts->nsi, nsei);
- if (!bts->nse)
- bts->nse = gprs_ns2_create_nse(bts->nsi, nsei);
+ if (bts->nse != NULL) {
+ /* FIXME: we end up here on receipt of subsequent INFO.ind.
+ * What are we supposed to do? Re-establish the connection? */
+ LOGP(DBSSGP, LOGL_INFO, "NSE with NSEI %u is already configured, "
+ "keeping it unchanged\n", nsei);
+ return 0;
+ }
+ bts->nse = gprs_ns2_create_nse(bts->nsi, nsei);
if (!bts->nse) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create NSE\n");
- gprs_ns2_free_bind(bind);
+ return 1;
+ }
+
+ rc = gprs_ns2_ip_bind(bts->nsi, local, 0, &bind);
+ if (rc < 0) {
+ LOGP(DBSSGP, LOGL_ERROR, "Failed to create socket\n");
+ gprs_ns2_free(bts->nsi);
return 1;
}