This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/1166 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 --- M include/osmocom/iuh/hnbgw.h M src/hnbgw.c 2 files changed, 5 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/66/1166/1 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 @@ 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 @@ { 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 @@ 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 @@ 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 @@ } 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); -- To view, visit https://gerrit.osmocom.org/1166 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie91aea82ae5d128ad735a0857ea814b440c3232c Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>