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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-cbc/+/22401 )
Change subject: Make CBSP local bind IP+port VTY-configurable
......................................................................
Make CBSP local bind IP+port VTY-configurable
Change-Id: I9ba3f4cf129d6df4468defc92697f1df62348719
---
M doc/manuals/chapters/configuration.adoc
M src/cbc_data.h
M src/cbc_main.c
M src/cbc_vty.c
4 files changed, 74 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-cbc refs/changes/01/22401/1
diff --git a/doc/manuals/chapters/configuration.adoc b/doc/manuals/chapters/configuration.adoc
index 31a5370..c205d91 100644
--- a/doc/manuals/chapters/configuration.adoc
+++ b/doc/manuals/chapters/configuration.adoc
@@ -45,3 +45,18 @@
----
For more details on the available configuration commands, please check the OsmoCBC VTY Reference.
+
+=== Configuring the IP/Port for CBSP to bind to
+
+It can be configure to which IP and TCP port the CBSP protocol binds to.
+
+The default is to bind to the 3GPP standard port number 48049 for CBSP at the
+loopback IP address 127.0.0.1.
+
+.Example: Configure CBSP to bind to 127.0.0.1:48049
+----
+cbc
+ cbsp
+ local-ip 127.0.0.1
+ local-port 48049
+----
diff --git a/src/cbc_data.h b/src/cbc_data.h
index 7900fbc..76fdfad 100644
--- a/src/cbc_data.h
+++ b/src/cbc_data.h
@@ -165,6 +165,10 @@
struct cbc {
struct {
bool permit_unknown_peers;
+ struct {
+ char *local_host;
+ int local_port;
+ } cbsp;
} config;
struct llist_head messages; /* cbc_message.list */
diff --git a/src/cbc_main.c b/src/cbc_main.c
index 06969e7..168fd7d 100644
--- a/src/cbc_main.c
+++ b/src/cbc_main.c
@@ -219,6 +219,8 @@
INIT_LLIST_HEAD(&g_cbc->peers);
INIT_LLIST_HEAD(&g_cbc->messages);
INIT_LLIST_HEAD(&g_cbc->expired_messages);
+ g_cbc->config.cbsp.local_host = talloc_strdup(g_cbc, "127.0.0.1");
+ g_cbc->config.cbsp.local_port = CBSP_TCP_PORT;
cbc_vty_init();
@@ -240,7 +242,8 @@
exit(1);
}
- cbsp_cbc_create(tall_cbc_ctx, NULL, -1, &cbc_client_rx_cb);
+ cbsp_cbc_create(tall_cbc_ctx, g_cbc->config.cbsp.local_host, g_cbc->config.cbsp.local_port,
+ &cbc_client_rx_cb);
rest_api_init(tall_rest_ctx, 12345);
diff --git a/src/cbc_vty.c b/src/cbc_vty.c
index 3466428..b1aa34f 100644
--- a/src/cbc_vty.c
+++ b/src/cbc_vty.c
@@ -267,6 +267,7 @@
enum cbc_vty_node {
CBC_NODE = _LAST_OSMOVTY_NODE + 1,
PEER_NODE,
+ CBSP_NODE,
};
static struct cmd_node cbc_node = {
@@ -310,6 +311,51 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_cbsp, cfg_cbsp_cmd,
+ "cbsp",
+ "Cell Broadcast Service Protocol\n")
+{
+ vty->node = CBSP_NODE;
+ return CMD_SUCCESS;
+}
+
+
+/* CBSP */
+
+static struct cmd_node cbsp_node = {
+ CBSP_NODE,
+ "%s(config-cbsp)# ",
+ 1,
+};
+
+static int config_write_cbsp(struct vty *vty)
+{
+ vty_out(vty, " cbsp%s", VTY_NEWLINE);
+ vty_out(vty, " local-ip %s%s", g_cbc->config.cbsp.local_host, VTY_NEWLINE);
+ vty_out(vty, " local-port %u%s", g_cbc->config.cbsp.local_port, VTY_NEWLINE);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_cbsp_local_ip, cfg_cbsp_local_ip_cmd,
+ "local-ip (A.B.C.D|X:X::X:X)",
+ "Local IP address for CBSP\n"
+ "Local IPv4 address for CBSP\n" "Local IPv6 address for CBSP\n")
+{
+ osmo_talloc_replace_string(g_cbc, &g_cbc->config.cbsp.local_host, argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_cbsp_local_port, cfg_cbsp_local_port_cmd,
+ "local-port <0-65535>",
+ "Local TCP port for CBSP\n"
+ "Local TCP port for CBSP\n")
+{
+ g_cbc->config.cbsp.local_port = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+
/* PEER */
DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd,
@@ -418,6 +464,11 @@
install_node(&cbc_node, config_write_cbc);
install_lib_element(CBC_NODE, &cfg_permit_unknown_peers_cmd);
+ install_lib_element(CBC_NODE, &cfg_cbsp_cmd);
+ install_node(&cbsp_node, config_write_cbsp);
+ install_lib_element(CBSP_NODE, &cfg_cbsp_local_ip_cmd);
+ install_lib_element(CBSP_NODE, &cfg_cbsp_local_port_cmd);
+
install_lib_element(CBC_NODE, &cfg_cbc_peer_cmd);
install_lib_element(CBC_NODE, &cfg_cbc_no_peer_cmd);
install_node(&peer_node, config_write_peer);
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/22401
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I9ba3f4cf129d6df4468defc92697f1df62348719
Gerrit-Change-Number: 22401
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210124/ecaeb9bd/attachment.htm>