diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-09-05 17:41:20 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-09-06 12:22:31 +0200 |
commit | 98146776dddb986fda78b5f028e79f041460ee4c (patch) | |
tree | 9ba1e9c37d07489d404d60d52d933196c9bb0d18 /ggsn/ggsn.c | |
parent | b5b02c2a513b46143179494d2ba156f27c7adcd1 (diff) |
ggsn: Add ability to specify local IP addresses for GTP-C and GTP-U
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.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index 0b877cf..46850a6 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -693,6 +693,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); |