aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn/ggsn.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-09-05 17:41:20 +0200
committerHarald Welte <laforge@gnumonks.org>2017-09-05 22:43:45 +0200
commitadfaa57b536bc59f3a03e0e92ebea4f3d6f6fe83 (patch)
tree0e330d551e52c299a736499e0a147118160a1786 /ggsn/ggsn.c
parent76bd17bba01eaeabc2ba689ec651714fc6754fa7 (diff)
ggsn: Add ability to specify local IP addresses for GTP-C and GTP-Ulaforge/osmo-ggsn
In case the GGSN is behind some kind of DNAT, the public GTP-C and GTP-U IP addresses as exposed inside the GTP payload information elements are different from the (internal, behind-nat) IP address to which it listens/binds. Change-Id: I548c9011c9abd66d46f963b1def61575f3dabb89
Diffstat (limited to 'ggsn/ggsn.c')
-rw-r--r--ggsn/ggsn.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 5e85180..8e9f694 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -691,6 +691,14 @@ int ggsn_start(struct ggsn_ctx *ggsn)
}
ggsn->gsn->priv = ggsn;
+ /* patch in different addresses to use (in case we're behind NAT, the listen
+ * address is different from what we advertise externally) */
+ if (ggsn->cfg.gtpc_addr.v4.s_addr)
+ ggsn->gsn->gsnc = ggsn->cfg.gtpc_addr.v4;
+
+ if (ggsn->cfg.gtpu_addr.v4.s_addr)
+ ggsn->gsn->gsnu = ggsn->cfg.gtpu_addr.v4;
+
/* Register File Descriptors */
osmo_fd_setup(&ggsn->gtp_fd0, ggsn->gsn->fd0, BSC_FD_READ, ggsn_gtp_fd_cb, ggsn, 0);
rc = osmo_fd_register(&ggsn->gtp_fd0);