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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26014 )
Change subject: Set up Iuh conn params through VTY
......................................................................
Set up Iuh conn params through VTY
Change-Id: Id5a17742643e8f02c22228e3055bcc213423a416
---
M include/osmocom/hnodeb/hnodeb.h
M include/osmocom/hnodeb/vty.h
M src/osmo-hnodeb/hnb.c
M src/osmo-hnodeb/main.c
M src/osmo-hnodeb/vty.c
5 files changed, 146 insertions(+), 19 deletions(-)
Approvals:
pespin: Verified
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index 50432d1..effd1b8 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -70,8 +70,12 @@
};
struct hnb {
- const char *gw_addr;
- uint16_t gw_port;
+ struct {
+ char *local_addr;
+ uint16_t local_port;
+ char *remote_addr;
+ uint16_t remote_port;
+ } iuh;
/*! SCTP listen socket for incoming connections */
struct osmo_fd conn_fd;
@@ -91,8 +95,6 @@
uint32_t ctx_id;
- int ues;
-
struct {
struct hnb_chan *chan;
} cs;
diff --git a/include/osmocom/hnodeb/vty.h b/include/osmocom/hnodeb/vty.h
index 7e3f29f..7144d3f 100644
--- a/include/osmocom/hnodeb/vty.h
+++ b/include/osmocom/hnodeb/vty.h
@@ -25,7 +25,10 @@
#include <osmocom/vty/command.h>
enum hnb_vty_nodes {
- CHAN_NODE = _LAST_OSMOVTY_NODE,
+ HNODEB_NODE = _LAST_OSMOVTY_NODE,
+ IUH_NODE,
+ CHAN_NODE,
};
void hnb_vty_init(void);
+int hnb_vty_go_parent(struct vty *vty);
diff --git a/src/osmo-hnodeb/hnb.c b/src/osmo-hnodeb/hnb.c
index 335fd3a..85ca937 100644
--- a/src/osmo-hnodeb/hnb.c
+++ b/src/osmo-hnodeb/hnb.c
@@ -137,8 +137,10 @@
if (!hnb)
return NULL;
- hnb->gw_addr = "127.0.0.1",
- hnb->gw_port = IUH_DEFAULT_SCTP_PORT,
+ hnb->iuh.local_addr = NULL;
+ hnb->iuh.local_port = 0;
+ hnb->iuh.remote_addr = talloc_strdup(hnb, "127.0.0.1");
+ hnb->iuh.remote_port = IUH_DEFAULT_SCTP_PORT;
osmo_wqueue_init(&hnb->wqueue, 16);
hnb->wqueue.bfd.data = hnb;
@@ -151,9 +153,14 @@
int hnb_connect(struct hnb *hnb)
{
int rc;
- rc = osmo_sock_init_ofd(&hnb->wqueue.bfd, AF_INET, SOCK_STREAM,
- IPPROTO_SCTP, hnb->gw_addr,
- hnb->gw_port, OSMO_SOCK_F_CONNECT);
+
+ LOGP(DMAIN, LOGL_INFO, "Iuh Connect: %s[:%u] => %s[:%u]\n",
+ hnb->iuh.local_addr, hnb->iuh.local_port, hnb->iuh.remote_addr, hnb->iuh.remote_port);
+
+ rc = osmo_sock_init2_ofd(&hnb->wqueue.bfd, AF_INET, SOCK_STREAM, IPPROTO_SCTP,
+ hnb->iuh.local_addr, hnb->iuh.local_port,
+ hnb->iuh.remote_addr, hnb->iuh.remote_port,
+ OSMO_SOCK_F_BIND |OSMO_SOCK_F_CONNECT);
if (rc < 0)
return rc;
sctp_sock_init(hnb->wqueue.bfd.fd);
diff --git a/src/osmo-hnodeb/main.c b/src/osmo-hnodeb/main.c
index cbf606d..3376d8e 100644
--- a/src/osmo-hnodeb/main.c
+++ b/src/osmo-hnodeb/main.c
@@ -75,6 +75,7 @@
static struct vty_app_info vty_info = {
.name = "OsmoHNodeB",
.version = PACKAGE_VERSION,
+ .go_parent_cb = hnb_vty_go_parent,
};
static void print_usage()
@@ -140,12 +141,10 @@
{"log-level", 1, 0, 'e'},
{"vty-ref-mode", 1, &long_option, 1},
{"vty-ref-xml", 0, &long_option, 2},
- { "ues", 1, 0, 'u' },
- { "gw-addr", 1, 0, 'g' },
{ 0, 0, 0, 0 },
};
- c = getopt_long(argc, argv, "hd:Dc:sTVe:u:g:", long_options, &idx);
+ c = getopt_long(argc, argv, "hd:Dc:sTVe:", long_options, &idx);
if (c == -1)
break;
@@ -180,12 +179,6 @@
case 'e':
log_set_log_level(osmo_stderr_target, atoi(optarg));
break;
- case 'u':
- g_hnb->ues = atoi(optarg);
- break;
- case 'g':
- g_hnb->gw_addr = optarg;
- break;
default:
/* catch unknown options *as well as* missing arguments. */
fprintf(stderr, "Error in command line options. Exiting.\n");
diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c
index 114f1c0..4d665f8 100644
--- a/src/osmo-hnodeb/vty.c
+++ b/src/osmo-hnodeb/vty.c
@@ -37,6 +37,119 @@
#include <osmocom/hnodeb/vty.h>
#include <osmocom/hnodeb/hnodeb.h>
+int hnb_vty_go_parent(struct vty *vty)
+{
+ switch (vty->node) {
+ case IUH_NODE:
+ vty->node = HNODEB_NODE;
+ vty->index = g_hnb;
+ break;
+ case HNODEB_NODE:
+ vty->node = CONFIG_NODE;
+ vty->index = g_hnb;
+ break;
+ case CONFIG_NODE:
+ vty->node = ENABLE_NODE;
+ vty->index = NULL;
+ break;
+ default:
+ vty->node = CONFIG_NODE;
+ vty->index = NULL;
+ break;
+ }
+
+ return vty->node;
+}
+
+static struct cmd_node hnodeb_node = {
+ HNODEB_NODE,
+ "%s(config-hnodeb)# ",
+ 1,
+};
+
+#define HNODEB_STR "Configure the HNodeB\n"
+
+DEFUN(cfg_hnodeb,
+ cfg_hnodeb_cmd,
+ "hnodeb", HNODEB_STR)
+{
+ OSMO_ASSERT(g_hnb);
+ vty->index = g_hnb;
+ vty->node = HNODEB_NODE;
+
+ return CMD_SUCCESS;
+}
+
+static struct cmd_node iuh_node = {
+ IUH_NODE,
+ "%s(config-iuh)# ",
+ 1,
+};
+
+DEFUN(cfg_hnodeb_iuh,
+ cfg_hnodeb_iuh_cmd,
+ "iuh", "Configure Iuh options\n")
+{
+ OSMO_ASSERT(g_hnb);
+ vty->index = g_hnb;
+ vty->node = IUH_NODE;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_hnodeb_iuh_local_ip, cfg_hnodeb_iuh_local_ip_cmd,
+ "local-ip " VTY_IPV46_CMD,
+ "Bind Iuh connection on local IP address\n"
+ "Local interface IPv4 address\n"
+ "Local interface IPv6 address\n")
+{
+ osmo_talloc_replace_string(g_hnb, &g_hnb->iuh.local_addr, argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_hnodeb_iuh_local_port, cfg_hnodeb_iuh_local_port_cmd,
+ "local-port <1-65535>",
+ "Bind Iuh connection on local SCTP port\n"
+ "Local interface port\n")
+{
+ g_hnb->iuh.local_port = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_hnodeb_iuh_remote_ip, cfg_hnodeb_iuh_remote_ip_cmd,
+ "remote-ip " VTY_IPV46_CMD,
+ "Connect to HNBGW over Iuh on remote IP address\n"
+ "Remote interface IPv4 address\n"
+ "Remote interface IPv6 address\n")
+{
+ osmo_talloc_replace_string(g_hnb, &g_hnb->iuh.remote_addr, argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_hnodeb_iuh_remote_port, cfg_hnodeb_iuh_remote_port_cmd,
+ "remote-port <1-65535>",
+ "Connect to HNBGW over Iuh on remote SCTP port\n"
+ "Remote interface port (default: "OSMO_STRINGIFY_VAL(IUH_DEFAULT_SCTP_PORT) ")\n")
+{
+ g_hnb->iuh.remote_port = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+
+static int config_write_hnodeb(struct vty *vty)
+{
+ vty_out(vty, "hnodeb%s", VTY_NEWLINE);
+ vty_out(vty, " iuh%s", VTY_NEWLINE);
+ if (g_hnb->iuh.local_addr)
+ vty_out(vty, " local-ip %s%s", g_hnb->iuh.local_addr, VTY_NEWLINE);
+ if (g_hnb->iuh.local_port)
+ vty_out(vty, " local-port %u%s", g_hnb->iuh.local_port, VTY_NEWLINE);
+ vty_out(vty, " remote-ip %s%s", g_hnb->iuh.remote_addr, VTY_NEWLINE);
+ vty_out(vty, " remote-port %u%s", g_hnb->iuh.remote_port, VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
+
static struct cmd_node chan_node = {
CHAN_NODE,
"%s(chan)> ",
@@ -139,6 +252,15 @@
void hnb_vty_init(void)
{
+ install_element(CONFIG_NODE, &cfg_hnodeb_cmd);
+ install_node(&hnodeb_node, config_write_hnodeb);
+ install_element(HNODEB_NODE, &cfg_hnodeb_iuh_cmd);
+ install_node(&iuh_node, NULL);
+ install_element(IUH_NODE, &cfg_hnodeb_iuh_local_ip_cmd);
+ install_element(IUH_NODE, &cfg_hnodeb_iuh_local_port_cmd);
+ install_element(IUH_NODE, &cfg_hnodeb_iuh_remote_ip_cmd);
+ install_element(IUH_NODE, &cfg_hnodeb_iuh_remote_port_cmd);
+
install_element_ve(&asn_dbg_cmd);
install_element_ve(&hnb_register_cmd);
install_element_ve(&hnb_deregister_cmd);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/26014
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: Id5a17742643e8f02c22228e3055bcc213423a416
Gerrit-Change-Number: 26014
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211102/e2130831/attachment.htm>