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
Review at https://gerrit.osmocom.org/1060
hnbgw: parameterize iuh local port: add vty cmd
For completeness' sake, add VTY command to set the local Iuh port. Have the
configured port as 0 to represent the default, and to match
hnbgw_get_iuh_local_ip(), add hnbgw_get_iuh_local_port().
Change-Id: I4b5e9fe9fcfa489069a0728d47899ef4a61f7ce5
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_vty.c
3 files changed, 31 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/60/1060/1
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 6b5a855..4edd05f 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -150,3 +150,4 @@
void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx);
const char *hnbgw_get_iuh_local_ip(struct hnb_gw *gw);
+uint16_t hnbgw_get_iuh_local_port(struct hnb_gw *gw);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index eb36367..ebafae9 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -76,8 +76,6 @@
{
struct hnb_gw *gw = talloc_zero(ctx, struct hnb_gw);
- gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
-
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(&gw->hnb_list);
INIT_LLIST_HEAD(&gw->ue_list);
@@ -320,6 +318,17 @@
return addr;
}
+/*
+ * Return IP address passed to the hnbgw/iuh/local-port command, or
+ * IUH_DEFAULT_SCTP_PORT.
+ */
+uint16_t hnbgw_get_iuh_local_port(struct hnb_gw *gw)
+{
+ if (!g_hnb_gw->config.iuh_local_port)
+ return IUH_DEFAULT_SCTP_PORT;
+ return g_hnb_gw->config.iuh_local_port;
+}
+
static const struct log_info_cat log_cat[] = {
[DMAIN] = {
.name = "DMAIN", .loglevel = LOGL_DEBUG, .enabled = 1,
@@ -512,7 +521,7 @@
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_port);
+ hnbgw_get_iuh_local_port(g_hnb_gw));
srv = osmo_stream_srv_link_create(tall_hnb_ctx);
if (!srv) {
perror("cannot create server");
@@ -521,7 +530,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_port(srv, g_hnb_gw->config.iuh_local_port);
+ osmo_stream_srv_link_set_port(srv, hnbgw_get_iuh_local_port(g_hnb_gw));
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 93c1f9a..89fc124 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -114,6 +114,17 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_hnbgw_iuh_local_port, cfg_hnbgw_iuh_local_port_cmd, "local-port <1-65535>",
+ "Accept Iuh connections on local port\n"
+ "Local interface port (default: 29169)")
+{
+ uint16_t port = atoi(argv[0]);
+ if (port == IUH_DEFAULT_SCTP_PORT)
+ port = 0;
+ g_hnb_gw->config.iuh_local_port = port;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_hnbgw_iuh_hnbap_allow_tmsi, cfg_hnbgw_iuh_hnbap_allow_tmsi_cmd,
"hnbap-allow-tmsi (0|1)",
"Allow HNBAP UE Register messages with TMSI or PTMSI identity\n"
@@ -133,12 +144,17 @@
static int config_write_hnbgw_iuh(struct vty *vty)
{
const char *addr;
+ uint16_t port;
vty_out(vty, " iuh%s", VTY_NEWLINE);
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);
+
+ port = g_hnb_gw->config.iuh_local_port;
+ if (port && port != IUH_DEFAULT_SCTP_PORT)
+ vty_out(vty, " local-port %u%s", port, VTY_NEWLINE);
if (g_hnb_gw->config.hnbap_allow_tmsi)
vty_out(vty, " hnbap-allow-tmsi 1%s", VTY_NEWLINE);
@@ -160,6 +176,7 @@
vty_install_default(IUH_NODE);
install_element(IUH_NODE, &cfg_hnbgw_iuh_local_ip_cmd);
+ install_element(IUH_NODE, &cfg_hnbgw_iuh_local_port_cmd);
install_element(IUH_NODE, &cfg_hnbgw_iuh_hnbap_allow_tmsi_cmd);
install_element_ve(&show_hnb_cmd);
--
To view, visit https://gerrit.osmocom.org/1060
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b5e9fe9fcfa489069a0728d47899ef4a61f7ce5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>