summaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-10-24 01:33:25 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-24 10:01:18 +0200
commit54b8b2dfefae7d495aa17c3e187b317a0a6243cd (patch)
tree5e7de810ad5f60ed7ed0eaa952304ea2e47c7e93 /src/gb/gprs_ns.c
parentab852ee23439725360f28c63d20ab61b0d774b2b (diff)
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
Diffstat (limited to 'src/gb/gprs_ns.c')
-rw-r--r--src/gb/gprs_ns.c16
1 files changed, 12 insertions, 4 deletions
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 */