From 182412d37146c6b0bf7f111d3b35397820996528 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 28 Dec 2020 18:07:27 +0100 Subject: gbproxy: Add SGSN name This is useful for logging and configuration to identify an SGSN by name Change-Id: I2a3410dd9bebb242957e13a63ed70e447204203c Related: SYS#5115, OS#4472 --- src/gbproxy/gb_proxy_vty.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gbproxy/gb_proxy_vty.c') diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c index dd0c1588c..adcdf7069 100644 --- a/src/gbproxy/gb_proxy_vty.c +++ b/src/gbproxy/gb_proxy_vty.c @@ -188,6 +188,7 @@ static void sgsn_write_nri(struct vty *vty, struct gbproxy_sgsn *sgsn, bool verb static void write_sgsn(struct vty *vty, struct gbproxy_sgsn *sgsn) { vty_out(vty, "sgsn nsei %u%s", sgsn->nse->nsei, VTY_NEWLINE); + vty_out(vty, " name %s%s", sgsn->name, VTY_NEWLINE); vty_out(vty, " %sallow-attach%s", sgsn->pool.allow_attach ? "" : "no ", VTY_NEWLINE); sgsn_write_nri(vty, sgsn, false); } @@ -256,6 +257,28 @@ free_nothing: return CMD_WARNING; } +DEFUN(cfg_sgsn_name, + cfg_sgsn_name_cmd, + "name NAME", + "Configure the SGSN\n" + "Name the SGSN\n" + "The name\n") +{ + struct gbproxy_sgsn *sgsn = vty->index; + const char *name = argv[0]; + + if (sgsn->name) + talloc_free((void *)sgsn->name); + + sgsn->name = talloc_strdup(sgsn, name); + if (!sgsn->name) { + vty_out(vty, "%% Unable to set name for SGSN with nsei %05u%s", sgsn->nse->nsei, VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + DEFUN_ATTR(cfg_sgsn_nri_add, cfg_sgsn_nri_add_cmd, "nri add <0-32767> [<0-32767>]", NRI_STR "Add NRI value or range to the NRI mapping for this MSC\n" @@ -647,6 +670,7 @@ int gbproxy_vty_init(void) install_element(CONFIG_NODE, &cfg_sgsn_nsei_cmd); install_node(&sgsn_node, config_write_sgsn); + install_element(SGSN_NODE, &cfg_sgsn_name_cmd); install_element(SGSN_NODE, &cfg_sgsn_allow_attach_cmd); install_element(SGSN_NODE, &cfg_sgsn_no_allow_attach_cmd); install_element(SGSN_NODE, &cfg_sgsn_nri_add_cmd); -- cgit v1.2.3