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
This commit is contained in:
Vadim Yanitskiy 2020-10-10 06:00:05 +07:00
parent d038361e95
commit 974cc7b324
1 changed files with 15 additions and 10 deletions

View File

@ -930,6 +930,21 @@ int gprs_nsvc_create_and_connect(struct gprs_rlcmac_bts *bts,
struct gprs_ns2_vc_bind *bind;
int rc;
bts->nse = gprs_ns2_nse_by_nsei(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");
return 1;
}
rc = gprs_ns2_ip_bind(bts->nsi, local, 0, &bind);
if (rc < 0) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create socket\n");
@ -937,16 +952,6 @@ int gprs_nsvc_create_and_connect(struct gprs_rlcmac_bts *bts,
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) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create NSE\n");
gprs_ns2_free_bind(bind);
return 1;
}
if (bts->gb_dialect_sns) {
rc = gprs_ns2_ip_connect_sns(bind, sgsn, nsei);
} else {