aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-27 13:13:50 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-27 13:43:03 +0200
commit6e3e594ee34dcc5858aa144d45e9c531bef2bd71 (patch)
tree4547243bbd2c8b717fe646e80d87d59c6c8fcd5b
parentc7ccdd490f84914754c72c7b3105772f74a40208 (diff)
hnbgw: cosmetic: local-ip config: drop getter function
Use the g_hnb_gw->config.iuh_local_ip directly, drop hnbgw_get_iuh_local_ip(). Change-Id: Ie91aea82ae5d128ad735a0857ea814b440c3232c Suggested-by: hwelte
-rw-r--r--include/osmocom/iuh/hnbgw.h2
-rw-r--r--src/hnbgw.c19
2 files changed, 5 insertions, 16 deletions
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 6b5a855..92d7674 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -148,5 +148,3 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
void hnb_context_release(struct hnb_context *ctx);
void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx);
-
-const char *hnbgw_get_iuh_local_ip(struct hnb_gw *gw);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index eb36367..2eecbea 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -76,6 +76,8 @@ static struct hnb_gw *hnb_gw_create(void *ctx)
{
struct hnb_gw *gw = talloc_zero(ctx, struct hnb_gw);
+ /* strdup so we can easily talloc_free in the VTY code */
+ gw->config.iuh_local_ip = talloc_strdup(gw, HNBGW_LOCAL_IP_DEFAULT);
gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
gw->next_ue_ctx_id = 23;
@@ -308,18 +310,6 @@ static int accept_cb(struct osmo_stream_srv_link *srv, int fd)
return 0;
}
-/*
- * Return IP address passed to the hnbgw/iuh/local-ip command, or
- * HNBGW_LOCAL_IP_DEFAULT.
- */
-const char *hnbgw_get_iuh_local_ip(struct hnb_gw *gw)
-{
- const char *addr = gw->config.iuh_local_ip;
- if (!addr)
- addr = HNBGW_LOCAL_IP_DEFAULT;
- return addr;
-}
-
static const struct log_info_cat log_cat[] = {
[DMAIN] = {
.name = "DMAIN", .loglevel = LOGL_DEBUG, .enabled = 1,
@@ -510,8 +500,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);
+ OSMO_ASSERT(g_hnb_gw->config.iuh_local_ip);
LOGP(DMAIN, LOGL_NOTICE, "Listening for Iuh at %s %d\n",
- hnbgw_get_iuh_local_ip(g_hnb_gw),
+ g_hnb_gw->config.iuh_local_ip,
g_hnb_gw->config.iuh_local_port);
srv = osmo_stream_srv_link_create(tall_hnb_ctx);
if (!srv) {
@@ -520,7 +511,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, hnbgw_get_iuh_local_ip(g_hnb_gw));
+ osmo_stream_srv_link_set_addr(srv, g_hnb_gw->config.iuh_local_ip);
osmo_stream_srv_link_set_port(srv, g_hnb_gw->config.iuh_local_port);
osmo_stream_srv_link_set_accept_cb(srv, accept_cb);