[MERGED] osmo-iuh[master]: cosmetic: hnbgw: addr related renames, move define, move com...

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.org
Thu Oct 20 11:42:36 UTC 2016


Neels Hofmeyr has submitted this change and it was merged.

Change subject: cosmetic: hnbgw: addr related renames, move define, move comment
......................................................................


cosmetic: hnbgw: addr related renames, move define, move comment

Prepare for parameterization of IuCS and IuPS addresses:

Conform internal variable naming to local-ip, local-port, remote-ip,
remote-port (instead of bind-ip).

Rename HNBGW_IUH_LOCAL_IP_DEFAULT to HNGGW_LOCAL_IP_DEFAULT to be more general
and move it to the top.

Move a function doc comment to the .c file.

Change-Id: Ice85941c978498e3ddf41d151248507e7f56cb5d
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_vty.c
3 files changed, 22 insertions(+), 22 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index dfc9d82..6b5a855 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -19,6 +19,8 @@
 };
 
 
+#define HNBGW_LOCAL_IP_DEFAULT "0.0.0.0"
+
 /* 25.467 Section 7.1 */
 #define IUH_DEFAULT_SCTP_PORT	29169
 #define RNA_DEFAULT_SCTP_PORT	25471
@@ -106,13 +108,11 @@
 	struct hnb_context *hnb;
 };
 
-#define HNBGW_IUH_LOCAL_IP_DEFAULT "0.0.0.0"
-
 struct hnb_gw {
 	struct {
-		const char *iuh_bind_addr;
+		const char *iuh_local_ip;
 		/*! SCTP port for Iuh listening */
-		uint16_t iuh_listen_port;
+		uint16_t iuh_local_port;
 		/*! The UDP port where we receive multiplexed CS user
 		 * plane traffic from HNBs */
 		uint16_t iuh_cs_mux_port;
@@ -149,8 +149,4 @@
 
 void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx);
 
-/*
- * Return IP address passed to the hnbgw/iuh/bind command, or
- * IUH_BIND_ADDR_DEFAULT
- */
-const char *hnbgw_get_iuh_bind_addr(struct hnb_gw *gw);
+const char *hnbgw_get_iuh_local_ip(struct hnb_gw *gw);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 8d6dbb1..eb36367 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -76,7 +76,7 @@
 {
 	struct hnb_gw *gw = talloc_zero(ctx, struct hnb_gw);
 
-	gw->config.iuh_listen_port = IUH_DEFAULT_SCTP_PORT;
+	gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
 
 	gw->next_ue_ctx_id = 23;
 	INIT_LLIST_HEAD(&gw->hnb_list);
@@ -308,11 +308,15 @@
 	return 0;
 }
 
-const char *hnbgw_get_iuh_bind_addr(struct hnb_gw *gw)
+/*
+ * 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_bind_addr;
+	const char *addr = gw->config.iuh_local_ip;
 	if (!addr)
-		addr = HNBGW_IUH_LOCAL_IP_DEFAULT;
+		addr = HNBGW_LOCAL_IP_DEFAULT;
 	return addr;
 }
 
@@ -507,8 +511,8 @@
 	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);
+	     hnbgw_get_iuh_local_ip(g_hnb_gw),
+	     g_hnb_gw->config.iuh_local_port);
 	srv = osmo_stream_srv_link_create(tall_hnb_ctx);
 	if (!srv) {
 		perror("cannot create server");
@@ -516,8 +520,8 @@
 	}
 	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_bind_addr(g_hnb_gw));
-	osmo_stream_srv_link_set_port(srv, g_hnb_gw->config.iuh_listen_port);
+	osmo_stream_srv_link_set_addr(srv, hnbgw_get_iuh_local_ip(g_hnb_gw));
+	osmo_stream_srv_link_set_port(srv, g_hnb_gw->config.iuh_local_port);
 	osmo_stream_srv_link_set_accept_cb(srv, accept_cb);
 
 	if (osmo_stream_srv_link_open(srv) < 0) {
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index 5dee41a..93c1f9a 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -107,10 +107,10 @@
 
 DEFUN(cfg_hnbgw_iuh_local_ip, cfg_hnbgw_iuh_local_ip_cmd, "local-ip A.B.C.D",
       "Accept Iuh connections on local interface\n"
-      "Local interface IP address (default: " HNBGW_IUH_LOCAL_IP_DEFAULT ")")
+      "Local interface IP address (default: " HNBGW_LOCAL_IP_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]);
+	talloc_free((void*)g_hnb_gw->config.iuh_local_ip);
+	g_hnb_gw->config.iuh_local_ip = talloc_strdup(tall_hnb_ctx, argv[0]);
 	return CMD_SUCCESS;
 }
 
@@ -136,8 +136,8 @@
 
 	vty_out(vty, " iuh%s", VTY_NEWLINE);
 
-	addr = g_hnb_gw->config.iuh_bind_addr;
-	if (addr && (strcmp(addr, HNBGW_IUH_LOCAL_IP_DEFAULT) != 0))
+	addr = g_hnb_gw->config.iuh_local_ip;
+	if (addr && (strcmp(addr, HNBGW_LOCAL_IP_DEFAULT) != 0))
 		vty_out(vty, "  local-ip %s%s", addr, VTY_NEWLINE);
 
 	if (g_hnb_gw->config.hnbap_allow_tmsi)

-- 
To view, visit https://gerrit.osmocom.org/1059
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice85941c978498e3ddf41d151248507e7f56cb5d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list