aboutsummaryrefslogtreecommitdiffstats
path: root/src/hnbgw.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-08-18 02:18:00 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-08-18 03:21:22 +0200
commitf495b2347bfc0c974e33988f8240be5cb7b2db3b (patch)
tree6ffbbf0f52ea6b418cc1e1fc49a99d46e6b16b9f /src/hnbgw.c
parent926153b9af0659e8c214f40424e29cda0c821607 (diff)
hnbgw: make Iuh bind address configurable via VTY
Add config node hnbgw/iuh/bind, taking an IPv4 address. Use this address to bind the Iuh server. This is particularly useful for the ip.access nano3G, which is very sensitive with SCTP addresses that don't respond to SCTP heartbeats. If the hnbgw listens on 0.0.0.0, there will be SCTP heartbeats for all local interfaces on the machine that the hnbgw runs on; the nano3G will interpret the "missing", or rather, redundant heartbeat acks for the interfaces that aren't really related to the Iuh server and assume a broken Iuh link, leading to an Iuh shutdown and reconnection, looping every minute or so. By binding the hnbgw to only one local interface, the SCTP addresses can be reduced and "missing" heartbeat acks can be avoided. Change-Id: Ie2749c152b878e17aa65dfb806826357d5c494f1
Diffstat (limited to 'src/hnbgw.c')
-rw-r--r--src/hnbgw.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hnbgw.c b/src/hnbgw.c
index d2e7b30..4f23e8d 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -289,6 +289,14 @@ static int accept_cb(struct osmo_stream_srv_link *srv, int fd)
return 0;
}
+const char *hnbgw_get_iuh_bind_addr(struct hnb_gw *gw)
+{
+ const char *addr = gw->config.iuh_bind_addr;
+ if (!addr)
+ addr = HNBGW_IUH_BIND_ADDR_DEFAULT;
+ return addr;
+}
+
static const struct log_info_cat log_cat[] = {
[DMAIN] = {
.name = "DMAIN", .loglevel = LOGL_DEBUG, .enabled = 1,
@@ -480,6 +488,9 @@ int main(int argc, char **argv)
g_hnb_gw->cnlink_cs = hnbgw_cnlink_init(g_hnb_gw, "127.0.0.1", SUA_PORT, 0);
g_hnb_gw->cnlink_ps = hnbgw_cnlink_init(g_hnb_gw, "127.0.0.2", SUA_PORT, 1);
+ LOGP(DMAIN, LOGL_NOTICE, "Listening for Iuh at %s %d\n",
+ hnbgw_get_iuh_bind_addr(g_hnb_gw),
+ g_hnb_gw->config.iuh_listen_port);
srv = osmo_stream_srv_link_create(tall_hnb_ctx);
if (!srv) {
perror("cannot create server");
@@ -487,7 +498,7 @@ int main(int argc, char **argv)
}
osmo_stream_srv_link_set_data(srv, g_hnb_gw);
osmo_stream_srv_link_set_proto(srv, IPPROTO_SCTP);
- osmo_stream_srv_link_set_addr(srv, "0.0.0.0");
+ osmo_stream_srv_link_set_addr(srv, hnbgw_get_iuh_bind_addr(g_hnb_gw));
osmo_stream_srv_link_set_port(srv, g_hnb_gw->config.iuh_listen_port);
osmo_stream_srv_link_set_accept_cb(srv, accept_cb);