diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-02-05 03:42:06 +0700 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2023-02-08 11:06:35 +0100 |
commit | 1ed5fbf65767a81a3827fc2cc5b10add66e11779 (patch) | |
tree | 9a66a16fbb9ffc5e735bea5887cb9e4088c167bc | |
parent | abbb8bbbc4aa98769d48f53115fd9989a468afa8 (diff) |
fix bsc_vty_go_parent(): add missing case for MGW_NODE
A new VTY node was added in commit [1], but bsc_vty_go_parent() was
not updated. Because of that, commands following the MGW node may
crash osmo-bsc. In the example below:
network
network country code 901
mobile network code 70
...
mgw 0
remote-ip 127.0.0.1
local-ip 127.0.0.1
periodic location update 30
the 'periodic location update 30' will trigger a segfault:
(gdb) bt
#0 0x00005555555dfc09 in cfg_net_per_loc_upd ()
#1 0x00007ffff7af6c3f in cmd_execute_command_strict () from /usr/local/lib/libosmovty.so.9
#2 0x00007ffff7af6f1c in config_from_file () from /usr/local/lib/libosmovty.so.9
#3 0x00007ffff7afd4e1 in vty_read_config_filep () from /usr/local/lib/libosmovty.so.9
#4 0x00007ffff7afe375 in vty_read_config_file () from /usr/local/lib/libosmovty.so.9
#5 0x0000555555579616 in bsc_network_configure ()
#6 0x000055555557a352 in main ()
because vty->index would be NULL after returning from the MGW node.
Fix this by adding the missing case to bsc_vty_go_parent().
Change-Id: Id3050ff7e2402c33ee76c7bf0cc83603c0cc6dfc
Fixes: [1] 8d22e6870637ed6d392a8a77aeaebc51b23a8a50
(cherry picked from commit 57800ec48e0768ee66a897afd4f1a518ae6c3501)
-rw-r--r-- | src/osmo-bsc/osmo_bsc_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c index 920693f6c..82e7265f4 100644 --- a/src/osmo-bsc/osmo_bsc_main.c +++ b/src/osmo-bsc/osmo_bsc_main.c @@ -518,6 +518,11 @@ static int bsc_vty_go_parent(struct vty *vty) vty->node = CONFIG_NODE; vty->index = NULL; break; + case MGW_NODE: + vty->node = GSMNET_NODE; + vty->index = bsc_gsmnet; + vty->index_sub = NULL; + break; case BTS_NODE: vty->node = GSMNET_NODE; { |