osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27028 )
Change subject: vty: use osmo_ss7_vty_go_parent ......................................................................
vty: use osmo_ss7_vty_go_parent
Remove unnecessary bsc_nat_vty_go_parent function, and use osmo_ss7_vty_go_parent instead. Without the latter, it segfaults while attempting to parse a config segment like this:
cs7 instance 0 point-code 0.23.3 asp asp-clnt-OsmoBSCNAT-CN 2905 0 m3ua remote-ip 127.0.0.1 local-ip 127.0.0.3 sccp-address msc # segfault here, vty->index == NULL routing-indicator PC point-code 0.23.1
Related: SYS#5560 Related: https://gerrit.osmocom.org/c/osmo-bsc-nat/+/26659/comment/c99b8cca_865449aa/ Change-Id: Iee6ece062f11694acb771463be7effb7342e92f2 --- M include/osmocom/bsc_nat/vty.h M src/osmo-bsc-nat/main.c M src/osmo-bsc-nat/vty.c 3 files changed, 1 insertion(+), 22 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc-nat refs/changes/28/27028/1
diff --git a/include/osmocom/bsc_nat/vty.h b/include/osmocom/bsc_nat/vty.h index f882c23..9a842b5 100644 --- a/include/osmocom/bsc_nat/vty.h +++ b/include/osmocom/bsc_nat/vty.h @@ -28,4 +28,3 @@ };
void bsc_nat_vty_init(void); -int bsc_nat_vty_go_parent(struct vty *vty); diff --git a/src/osmo-bsc-nat/main.c b/src/osmo-bsc-nat/main.c index 006382d..7a5d503 100644 --- a/src/osmo-bsc-nat/main.c +++ b/src/osmo-bsc-nat/main.c @@ -49,7 +49,7 @@ static struct vty_app_info vty_info = { .name = "OsmoBSCNAT", .version = PACKAGE_VERSION, - .go_parent_cb = bsc_nat_vty_go_parent, + .go_parent_cb = osmo_ss7_vty_go_parent, };
static struct { diff --git a/src/osmo-bsc-nat/vty.c b/src/osmo-bsc-nat/vty.c index 128940e..41681d4 100644 --- a/src/osmo-bsc-nat/vty.c +++ b/src/osmo-bsc-nat/vty.c @@ -28,26 +28,6 @@ #include <osmocom/bsc_nat/bsc_nat.h> #include <osmocom/bsc_nat/vty.h>
-int bsc_nat_vty_go_parent(struct vty *vty) -{ - switch (vty->node) { - case BSC_NAT_NODE: - vty->node = CONFIG_NODE; - vty->index = g_bsc_nat; - break; - case CONFIG_NODE: - vty->node = ENABLE_NODE; - vty->index = NULL; - break; - default: - vty->node = CONFIG_NODE; - vty->index = NULL; - break; - } - - return vty->node; -} - static struct cmd_node bsc_nat_node = { BSC_NAT_NODE, "%s(config-bsc-nat)# ",