diff options
author | Keith <keith@rhizomatica.org> | 2020-10-19 22:24:48 +0200 |
---|---|---|
committer | keith <keith@rhizomatica.org> | 2020-10-20 13:21:37 +0000 |
commit | c70e8388c7266a562da8bd737da29a8af50e4c69 (patch) | |
tree | 80b729a65797e9f42a0a2a8721243a34380f2ed3 | |
parent | 5ce54ba1e68ba2233f4d0cf94b12d6b4a3537399 (diff) |
VTY: Add gtp state-dir command
The SGSN initialises GTP with gtp_statedir of "./" which may
not be the desired path for writing the gsn_restart file.
When starting from systemd for example, we might write
to the system root.
This patch allows override via the config file.
Closes: OS#4820
Change-Id: Ib3ffb7fd6ea1d9b0286111d8c2cba9da5394ca58
-rw-r--r-- | src/sgsn/sgsn_vty.c | 14 | ||||
-rw-r--r-- | tests/test_nodes.vty | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index 14248d1d..33a652c9 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -186,6 +186,8 @@ static int config_write_sgsn(struct vty *vty) vty_out(vty, "sgsn%s", VTY_NEWLINE); + vty_out(vty, " gtp state-dir %s%s", + g_cfg->gtp_statedir, VTY_NEWLINE); vty_out(vty, " gtp local-ip %s%s", inet_ntoa(g_cfg->gtp_listenaddr.sin_addr), VTY_NEWLINE); @@ -315,6 +317,17 @@ DEFUN(cfg_sgsn, cfg_sgsn_cmd, return CMD_SUCCESS; } +DEFUN(cfg_sgsn_state_dir, cfg_sgsn_state_dir_cmd, + "gtp state-dir PATH", + "GTP Parameters\n" + "Set the directory for the GTP State file\n" + "Local Directory\n") +{ + osmo_talloc_replace_string(sgsn, &sgsn->cfg.gtp_statedir, argv[0]); + + return CMD_SUCCESS; +} + DEFUN(cfg_sgsn_bind_addr, cfg_sgsn_bind_addr_cmd, "gtp local-ip A.B.C.D", "GTP Parameters\n" @@ -1432,6 +1445,7 @@ int sgsn_vty_init(struct sgsn_config *cfg) install_element(CONFIG_NODE, &cfg_sgsn_cmd); install_node(&sgsn_node, config_write_sgsn); + install_element(SGSN_NODE, &cfg_sgsn_state_dir_cmd); install_element(SGSN_NODE, &cfg_sgsn_bind_addr_cmd); install_element(SGSN_NODE, &cfg_ggsn_remote_ip_cmd); //install_element(SGSN_NODE, &cfg_ggsn_remote_port_cmd); diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty index 18bccc8f..109e2ece 100644 --- a/tests/test_nodes.vty +++ b/tests/test_nodes.vty @@ -27,6 +27,7 @@ OsmoSGSN(config)# list OsmoSGSN(config)# sgsn OsmoSGSN(config-sgsn)# list ... + gtp state-dir PATH gtp local-ip A.B.C.D ggsn <0-255> remote-ip A.B.C.D ggsn <0-255> gtp-version (0|1) |