From 9b591b7da8e3de13b87002af668431dc0dea6806 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 11 Nov 2013 09:43:05 +0100 Subject: gprs: Fix VTY NSVC initialisation bug by changing gprs_nsvc_create() Currently the field nsvci_is_valid is set to 0 in the NSVC object returned by gprs_nsvc_create(). This was a semantic change probably introduced by commit 5e6d679d. As a result, NSVC created via the VTY have this flag set to 0 causing RESET_ACK messages to be rejected. This patch changes the default behaviour of gprs_nsvc_create() to always set this flag. So it must be set to 0 explicitely if needed which is more intuitive and thus less error prone. It fixes breaking connections from the Gbproxy to the SGSN. Ticket: OW#874 Sponsored-by: On-Waves ehf --- src/gb/gprs_ns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 55535ad7..b500d9a8 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -200,6 +200,7 @@ struct gprs_nsvc *gprs_nsvc_create(struct gprs_ns_inst *nsi, uint16_t nsvci) nsvc = talloc_zero(nsi, struct gprs_nsvc); nsvc->nsvci = nsvci; + nsvc->nsvci_is_valid = 1; /* before RESET procedure: BLOCKED and DEAD */ nsvc->state = NSE_S_BLOCKED; nsvc->nsi = nsi; @@ -794,7 +795,6 @@ static int gprs_ns_rx_reset(struct gprs_nsvc **nsvc, struct msgb *msg) gprs_ns_ll_str(*nsvc)); orig_nsvc = *nsvc; *nsvc = gprs_nsvc_create((*nsvc)->nsi, nsvci); - (*nsvc)->nsvci_is_valid = 1; (*nsvc)->nsei = nsei; } } @@ -1193,6 +1193,7 @@ int gprs_ns_vc_create(struct gprs_ns_inst *nsi, struct msgb *msg, existing_nsvc = gprs_nsvc_by_nsvci(nsi, nsvci); if (!existing_nsvc) { *new_nsvc = gprs_nsvc_create(nsi, 0xffff); + (*new_nsvc)->nsvci_is_valid = 0; log_set_context(GPRS_CTX_NSVC, *new_nsvc); gprs_ns_ll_copy(*new_nsvc, fallback_nsvc); LOGP(DNS, LOGL_INFO, "Creating NS-VC for BSS at %s\n", @@ -1327,6 +1328,7 @@ struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb, void *ctx) /* Create the dummy NSVC that we use for sending * messages to non-existant/unknown NS-VC's */ nsi->unknown_nsvc = gprs_nsvc_create(nsi, 0xfffe); + nsi->unknown_nsvc->nsvci_is_valid = 0; llist_del(&nsi->unknown_nsvc->list); return nsi; @@ -1527,8 +1529,6 @@ struct gprs_nsvc *gprs_ns_nsip_connect(struct gprs_ns_inst *nsi, nsvc = gprs_nsvc_create(nsi, nsvci); nsvc->ip.bts_addr = *dest; nsvc->nsei = nsei; - nsvc->nsvci = nsvci; - nsvc->nsvci_is_valid = 1; nsvc->remote_end_is_sgsn = 1; gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); -- cgit v1.2.3