diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-01-12 22:32:19 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-01-12 22:32:36 +0100 |
commit | c32bfd5824b99b9af14b66d17a58fdf9c3bddb45 (patch) | |
tree | 00defbd3f9230a23216d73144105e4250f212697 /src/gb | |
parent | 1251afe2542417426ffe9a4aace2603f06eb15bd (diff) |
gprs_ns_vty: guard against duplicate VTY elements
The TbfTest in osmo-pcu calls gprs_ns_vty_init() repeatedly, which aborts
because of duplicate VTY elements. Fix this by skipping the VTY init if
it already happened.
Change-Id: I05c7f25a4e873ae76b206819180b8b043b60103e
Diffstat (limited to 'src/gb')
-rw-r--r-- | src/gb/gprs_ns_vty.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c index 5a951dca..ee305ba5 100644 --- a/src/gb/gprs_ns_vty.c +++ b/src/gb/gprs_ns_vty.c @@ -573,8 +573,16 @@ DEFUN(logging_fltr_nsvc, int gprs_ns_vty_init(struct gprs_ns_inst *nsi) { + static bool vty_elements_installed = false; + vty_nsi = nsi; + /* Regression test code may call this function repeatedly, so make sure + * that VTY elements are not duplicated, which would assert. */ + if (vty_elements_installed) + return 0; + vty_elements_installed = true; + install_element_ve(&show_ns_cmd); install_element_ve(&show_ns_stats_cmd); install_element_ve(&show_nse_cmd); |