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
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index 0845ff7..1673c0c 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -105,6 +105,15 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_hnbgw_iuh_bind, cfg_hnbgw_iuh_bind_cmd, "bind A.B.C.D",
+      "Accept Iuh connections on local interface\n"
+      "Local interface IP address (default: " HNBGW_IUH_BIND_ADDR_DEFAULT ")")
+{
+	talloc_free((void*)g_hnb_gw->config.iuh_bind_addr);
+	g_hnb_gw->config.iuh_bind_addr = talloc_strdup(tall_hnb_ctx, argv[0]);
+	return CMD_SUCCESS;
+}
+
 static int config_write_hnbgw(struct vty *vty)
 {
 	vty_out(vty, "hnbgw%s", VTY_NEWLINE);
@@ -113,7 +122,14 @@
 
 static int config_write_hnbgw_iuh(struct vty *vty)
 {
+	const char *addr;
+
 	vty_out(vty, " iuh%s", VTY_NEWLINE);
+
+	addr = g_hnb_gw->config.iuh_bind_addr;
+	if (addr && (strcmp(addr, HNBGW_IUH_BIND_ADDR_DEFAULT) != 0))
+		vty_out(vty, "  bind %s%s", addr, VTY_NEWLINE);
+
 	return CMD_SUCCESS;
 }
 
@@ -129,6 +145,7 @@
 	install_element(HNBGW_NODE, &cfg_hnbgw_iuh_cmd);
 	install_node(&iuh_node, config_write_hnbgw_iuh);
 	vty_install_default(IUH_NODE);
+	install_element(IUH_NODE, &cfg_hnbgw_iuh_bind_cmd);
 
 	install_element_ve(&show_hnb_cmd);
 	install_element_ve(&show_ue_cmd);