From 54b8b2dfefae7d495aa17c3e187b317a0a6243cd Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 24 Oct 2013 01:33:25 +0200 Subject: gb: Create new NSVC object instead of patching the NSVCI When a RESET is received on the same link with a different NSVCI from a BSS on a dynamically created NS connection do not patch the nsvc object but create a new one instead. Thus the NSVCI is never modified at a nsvc object after the NS-VC has been established. Sponsored-by: On-Waves ehf --- src/gb/gprs_ns.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 043a66c0..1754501a 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -729,9 +729,6 @@ static int gprs_nsvc_replace_if_found(uint16_t nsvci, talloc_free(old_peer); - /* Do statistics */ - rate_ctr_inc(&(*nsvc)->ctrg->ctr[NS_CTR_REPLACED]); - return 1; } @@ -784,7 +781,16 @@ static int gprs_ns_rx_reset(struct gprs_nsvc **nsvc, struct msgb *msg) } /* NS-VCI has changed */ - gprs_nsvc_replace_if_found(nsvci, nsvc, &orig_nsvc); + if (!gprs_nsvc_replace_if_found(nsvci, nsvc, &orig_nsvc)) { + LOGP(DNS, LOGL_INFO, "Creating NS-VC %d replacing %d " + "at %s\n", + nsvci, (*nsvc)->nsvci, + gprs_ns_ll_str(*nsvc)); + orig_nsvc = *nsvc; + *nsvc = gprs_nsvc_create((*nsvc)->nsi, nsvci); + (*nsvc)->nsvci_is_valid = 1; + (*nsvc)->nsei = nsei; + } } if ((*nsvc)->nsvci_is_valid && (*nsvc)->nsei != nsei) { @@ -810,6 +816,7 @@ static int gprs_ns_rx_reset(struct gprs_nsvc **nsvc, struct msgb *msg) (*nsvc)->state = NSE_S_BLOCKED | NSE_S_ALIVE; if (orig_nsvc) { + rate_ctr_inc(&(*nsvc)->ctrg->ctr[NS_CTR_REPLACED]); ns_osmo_signal_dispatch_replaced(*nsvc, orig_nsvc); /* Update the ll info fields */ @@ -916,6 +923,7 @@ static int gprs_ns_rx_reset_ack(struct gprs_nsvc **nsvc, struct msgb *msg) } /* Notify others */ + rate_ctr_inc(&(*nsvc)->ctrg->ctr[NS_CTR_REPLACED]); ns_osmo_signal_dispatch_replaced(*nsvc, orig_nsvc); /* Update the ll info fields */ -- cgit v1.2.3