gbproxy: Fix handling of NSEI changes
The gbproxy looses NSEI changes on BVC_RESET and then tries to send
later messages to the wrong (not longer existing) destination.
This patch fixes this by updating the peer's nsei field on BVC_RESET.
Ticket: OW#874
Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index f008b3e..f900158 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -183,10 +183,10 @@
"BVCI=%u via NSEI=%u (expected NSEI=%u)\n",
peer->bvci, nsei, peer->nsei);
rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_INV_NSEI]);
- return 1;
+ return 0;
}
- return 0;
+ return 1;
}
static struct gbprox_peer *peer_alloc(uint16_t bvci)
@@ -432,7 +432,10 @@
from_peer = peer_alloc(bvci);
from_peer->nsei = nsei;
}
- check_peer_nsei(from_peer, nsei);
+
+ if (!check_peer_nsei(from_peer, nsei))
+ from_peer->nsei = nsei;
+
if (TLVP_PRESENT(&tp, BSSGP_IE_CELL_ID)) {
struct gprs_ra_id raid;
/* We have a Cell Identifier present in this