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
This commit is contained in:
Oliver Smith 2022-01-31 17:07:53 +01:00
parent 8f7b750b22
commit 6afc0e3314
3 changed files with 1 additions and 22 deletions

View File

@ -28,4 +28,3 @@ enum bsc_nat_vty_nodes {
};
void bsc_nat_vty_init(void);
int bsc_nat_vty_go_parent(struct vty *vty);

View File

@ -49,7 +49,7 @@ struct bsc_nat *g_bsc_nat;
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 {

View File

@ -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)# ",