aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs/sgsn_vty.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-09 20:37:47 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-07-13 11:51:50 +0200
commitfa1201004f85b6e44d746d6044d5a43d04634fa4 (patch)
tree057657da9a1e30376ecc86372d242c51a4c70dfa /src/gprs/sgsn_vty.c
parenta98fead4642ba0ecf7ab0e7862fb468d0ae911ad (diff)
osmo-sgsn: ping GGSN periodically and check for restart counter
Before this commit, echo req/rsp logic was implemented in libgtp but never used in osmo-sgsn. This commit adds a timer which periodically sends a GTP ECHO Request to every GGSN if there's at least one pdpd context associated with it. This way by checking the restart counter in the ECHO Reply it can be known if the GGSN was restarted. In this case, logic already present in osmo-sgsn will terminate all pdp contexts associated with that GGSN. Change-Id: I9d714726785407859f26bbef052cd0efc28e8dae
Diffstat (limited to 'src/gprs/sgsn_vty.c')
-rw-r--r--src/gprs/sgsn_vty.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c
index 07d4293db..9f9332c32 100644
--- a/src/gprs/sgsn_vty.c
+++ b/src/gprs/sgsn_vty.c
@@ -23,6 +23,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
+#include <inttypes.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
@@ -181,6 +182,9 @@ static int config_write_sgsn(struct vty *vty)
inet_ntoa(gctx->remote_addr), VTY_NEWLINE);
vty_out(vty, " ggsn %u gtp-version %u%s", gctx->id,
gctx->gtp_version, VTY_NEWLINE);
+ if (gctx->echo_interval != -1)
+ vty_out(vty, " ggsn %u echo-interval %"PRId32"%s",
+ gctx->id, gctx->echo_interval, VTY_NEWLINE);
}
if (sgsn->cfg.dynamic_lookup)
@@ -356,6 +360,26 @@ DEFUN(cfg_ggsn_gtp_version, cfg_ggsn_gtp_version_cmd,
return CMD_SUCCESS;
}
+/* Seee 3GPP TS 29.060 section 7.2.1 */
+DEFUN(cfg_ggsn_echo_interval, cfg_ggsn_echo_interval_cmd,
+ "ggsn <0-255> echo-interval <1-36000>",
+ GGSN_STR "GGSN Number\n"
+ "Send an echo request to this static GGSN every interval.\n"
+ "Interval between echo requests in seconds.\n")
+{
+ uint32_t id = atoi(argv[0]);
+ struct sgsn_ggsn_ctx *ggc = sgsn_ggsn_ctx_find_alloc(id);
+
+ ggc->echo_interval = atoi(argv[1]);
+
+ if (ggc->echo_interval < 60)
+ vty_out(vty, "%% 3GPP TS 29.060 section states inteval should " \
+ "not be lower than 60 seconds, use this value for " \
+ "testing purposes only!%s", VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_ggsn_dynamic_lookup, cfg_ggsn_dynamic_lookup_cmd,
"ggsn dynamic",
GGSN_STR
@@ -1277,6 +1301,7 @@ int sgsn_vty_init(struct sgsn_config *cfg)
install_element(SGSN_NODE, &cfg_ggsn_remote_ip_cmd);
//install_element(SGSN_NODE, &cfg_ggsn_remote_port_cmd);
install_element(SGSN_NODE, &cfg_ggsn_gtp_version_cmd);
+ install_element(SGSN_NODE, &cfg_ggsn_echo_interval_cmd);
install_element(SGSN_NODE, &cfg_imsi_acl_cmd);
install_element(SGSN_NODE, &cfg_auth_policy_cmd);
install_element(SGSN_NODE, &cfg_encrypt_cmd);