diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-09-23 18:22:20 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-09-25 09:45:24 +0000 |
commit | 1f0625f214d912d23c9bd7a6805492d2ce4d230f (patch) | |
tree | 2a540e7fa69d936c20db97855ba7cb2e84309e39 | |
parent | ffd49d0757f040568326f00ccfb1cd69c4fb6fb2 (diff) |
ns2: vty: fix behavior of vtyvc_by_nsei when vtyvc isn't found
Fixes the parsing of persistent nsvcs.
Change-Id: I297409f557f17df680ac76018b4202eb99713021
-rw-r--r-- | src/gb/gprs_ns2_vty.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c index f204ff16..ab869c34 100644 --- a/src/gb/gprs_ns2_vty.c +++ b/src/gb/gprs_ns2_vty.c @@ -138,20 +138,21 @@ static void ns2_vc_free(struct ns2_vty_vc *vtyvc) { static struct ns2_vty_vc *vtyvc_by_nsei(uint16_t nsei, bool alloc_missing) { struct ns2_vty_vc *vtyvc; + llist_for_each_entry(vtyvc, &priv.vtyvc, list) { if (vtyvc->nsei == nsei) return vtyvc; } - if (alloc_missing) { - vtyvc = vtyvc_alloc(nsei); - if (!vtyvc) - return vtyvc; + if (!alloc_missing) + return NULL; - vtyvc->nsei = nsei; - } + vtyvc = vtyvc_alloc(nsei); + if (!vtyvc) + return vtyvc; - return NULL; + vtyvc->nsei = nsei; + return vtyvc; } static int config_write_ns(struct vty *vty) |