diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2015-12-03 14:12:44 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2015-12-03 14:14:43 +0100 |
commit | ca2361c23717fd13e33088d6dfe4e2370b714097 (patch) | |
tree | 92557322eb5aa947552cce4297c0c4bf44de271c /openbsc/src/gprs/gtphub_vty.c | |
parent | d53c6046bc315cd2ddbdeac86d3b574b371985b6 (diff) |
gtphub: implement sgsn_use_sender for NAT.
If an SGSN is behind NAT, we cannot rely on the default ports. Specifically,
if a GGSN sends a message, the forwarding to the SGSN should go to whichever
port the SGSN last sent from (whether sequence nr is known or not).
Add sgsn_use_sender config and VTY command, and store the sender instead
of the GSN Address IE and default port if set.
Sponsored-by: On-Waves ehi
Diffstat (limited to 'openbsc/src/gprs/gtphub_vty.c')
-rw-r--r-- | openbsc/src/gprs/gtphub_vty.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gtphub_vty.c b/openbsc/src/gprs/gtphub_vty.c index 204d1deeb..324d155b9 100644 --- a/openbsc/src/gprs/gtphub_vty.c +++ b/openbsc/src/gprs/gtphub_vty.c @@ -87,6 +87,10 @@ static int config_write_gtphub(struct vty *vty) &g_cfg->to_gsns[GTPH_SIDE_GGSN][GTPH_PLANE_CTRL].bind, &g_cfg->to_gsns[GTPH_SIDE_GGSN][GTPH_PLANE_USER].bind); + if (g_cfg->sgsn_use_sender) { + vty_out(vty, "sgsn-use-sender%s", VTY_NEWLINE); + } + if (g_cfg->proxy[GTPH_SIDE_SGSN][GTPH_PLANE_CTRL].addr_str) { write_addrs(vty, "sgsn-proxy", &g_cfg->proxy[GTPH_SIDE_SGSN][GTPH_PLANE_CTRL], @@ -237,6 +241,28 @@ DEFUN(cfg_gtphub_sgsn_proxy, cfg_gtphub_sgsn_proxy_cmd, } +#define SGSN_USE_SENDER_STR \ + "Ignore SGSN's Address IEs, use sender address and port (useful over NAT)\n" + +DEFUN(cfg_gtphub_sgsn_use_sender, + cfg_gtphub_sgsn_use_sender_cmd, + "sgsn-use-sender", + SGSN_USE_SENDER_STR) +{ + g_cfg->sgsn_use_sender = 1; + return CMD_SUCCESS; +} + +DEFUN(cfg_gtphub_no_sgsn_use_sender, + cfg_gtphub_no_sgsn_use_sender_cmd, + "no sgsn-use-sender", + NO_STR SGSN_USE_SENDER_STR) +{ + g_cfg->sgsn_use_sender = 0; + return CMD_SUCCESS; +} + + /* Copied from sgsn_vty.h */ DEFUN(cfg_grx_ggsn, cfg_grx_ggsn_cmd, "grx-dns-add A.B.C.D", @@ -425,6 +451,8 @@ int gtphub_vty_init(struct gtphub *global_hub, struct gtphub_cfg *global_cfg) install_element(GTPHUB_NODE, &cfg_gtphub_ggsn_proxy_cmd); install_element(GTPHUB_NODE, &cfg_gtphub_sgsn_proxy_short_cmd); install_element(GTPHUB_NODE, &cfg_gtphub_sgsn_proxy_cmd); + install_element(GTPHUB_NODE, &cfg_gtphub_sgsn_use_sender_cmd); + install_element(GTPHUB_NODE, &cfg_gtphub_no_sgsn_use_sender_cmd); install_element(GTPHUB_NODE, &cfg_grx_ggsn_cmd); return 0; |