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
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 @@
 	}
 	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);