msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/30671 )
Change subject: ctrl: take both address and port from vty config
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/30671
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id7d1425e603cc62a62a63d1057291861f02782ba
Gerrit-Change-Number: 30671
Gerrit-PatchSet: 1
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 20 Dec 2022 15:21:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
msuraev has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30444 )
Change subject: ctrl: add optional port to bind command
......................................................................
ctrl: add optional port to bind command
So far ctrl interface did not allow to specify port to bind to.
Let's fix this and make it consistent with the way vty bind works.
N. B: the functions which ignore port configured via vty are marked as deprecated,
the sw which uses them should be ported to either newly added ctrl_init_default()
or simplified ctrl_interface_setup()
The similar change for vty interface will be addressed via separate patch series.
Related: OS#5809
Change-Id: I0fd87fd41fd3ac975273968d24f477daa3cd3aa9
---
M include/osmocom/ctrl/control_if.h
M include/osmocom/ctrl/control_vty.h
M src/ctrl/control_if.c
M src/ctrl/control_vty.c
M src/ctrl/libosmoctrl.map
M utils/osmo-ns-dummy.c
6 files changed, 37 insertions(+), 7 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
msuraev: Looks good to me, approved
diff --git a/include/osmocom/ctrl/control_if.h b/include/osmocom/ctrl/control_if.h
index b73296f..98cd100 100644
--- a/include/osmocom/ctrl/control_if.h
+++ b/include/osmocom/ctrl/control_if.h
@@ -36,19 +36,20 @@
unsigned int node_count);
struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
ctrl_cmd_lookup lookup);
+struct ctrl_handle *ctrl_interface_setup2(void *data, uint16_t default_port, ctrl_cmd_lookup lookup,
+ unsigned int node_count);
struct ctrl_handle *ctrl_interface_setup_dynip(void *data,
const char *bind_addr,
uint16_t port,
- ctrl_cmd_lookup lookup);
+ ctrl_cmd_lookup lookup) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
struct ctrl_handle *ctrl_interface_setup_dynip2(void *data,
const char *bind_addr,
uint16_t port,
ctrl_cmd_lookup lookup,
- unsigned int node_count);
+ unsigned int node_count) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE;
struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data);
int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd, void *data);
struct ctrl_cmd *ctrl_cmd_exec_from_string(struct ctrl_handle *ch, const char *cmdstr);
int ctrl_lookup_register(ctrl_cmd_lookup lookup);
-
int ctrl_handle_msg(struct ctrl_handle *ctrl, struct ctrl_connection *ccon, struct msgb *msg);
diff --git a/include/osmocom/ctrl/control_vty.h b/include/osmocom/ctrl/control_vty.h
index af9ee99..a6cd012 100644
--- a/include/osmocom/ctrl/control_vty.h
+++ b/include/osmocom/ctrl/control_vty.h
@@ -2,6 +2,8 @@
#pragma once
+#include <stdint.h>
+
/* Add the 'ctrl' section to VTY, containing the 'bind' command. */
int ctrl_vty_init(void *ctx);
@@ -9,3 +11,6 @@
* This should be fed to ctrl_interface_setup() once the configuration has been
* read. */
const char *ctrl_vty_get_bind_addr(void);
+
+/* Returns configured port passed to the 'line ctrl'/'bind' command or default_port. */
+uint16_t ctrl_vty_get_bind_port(uint16_t default_port);
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index 37e430f..9438f7e 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -47,6 +47,7 @@
#include <osmocom/ctrl/control_cmd.h>
#include <osmocom/ctrl/control_if.h>
+#include <osmocom/ctrl/control_vty.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/rate_ctr.h>
@@ -878,7 +879,7 @@
struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
ctrl_cmd_lookup lookup)
{
- return ctrl_interface_setup_dynip(data, "127.0.0.1", port, lookup);
+ return ctrl_interface_setup2(data, port, lookup, 0);
}
static int ctrl_initialized = 0;
@@ -1030,6 +1031,18 @@
return ctrl_interface_setup_dynip2(data, bind_addr, port, lookup, 0);
}
+/*! Initializes CTRL interface using the configured bind addr/port.
+ * \param[in] data Pointer which will be made available to each set_..() get_..() verify_..() control command function
+ * \param[in] default_port TCP port number to bind to if not explicitly configured
+ * \param[in] lookup Lookup function pointer, can be NULL
+ * \param[in] node_count Number of CTRL nodes to allocate, 0 for default.
+ */
+struct ctrl_handle *ctrl_interface_setup2(void *data, uint16_t default_port, ctrl_cmd_lookup lookup,
+ unsigned int node_count)
+{
+ return ctrl_interface_setup_dynip2(data, ctrl_vty_get_bind_addr(), ctrl_vty_get_bind_port(default_port), lookup,
+ node_count);
+}
/*! Install a lookup helper function for control nodes
* This function is used by e.g. library code to install lookup helpers
diff --git a/src/ctrl/control_vty.c b/src/ctrl/control_vty.c
index 6910d4c..a7ebddc 100644
--- a/src/ctrl/control_vty.c
+++ b/src/ctrl/control_vty.c
@@ -26,16 +26,20 @@
static void *ctrl_vty_ctx = NULL;
static const char *ctrl_vty_bind_addr = NULL;
+/* Port the CTRL should bind to: -1 means not configured */
+static int ctrl_bind_port = -1;
DEFUN(cfg_ctrl_bind_addr,
cfg_ctrl_bind_addr_cmd,
- "bind A.B.C.D",
+ "bind A.B.C.D [<0-65535>]",
"Set bind address to listen for Control connections\n"
- "Local IP address (default 127.0.0.1)\n")
+ "Local IP address (default 127.0.0.1)\n"
+ "Local TCP port number\n")
{
talloc_free((char*)ctrl_vty_bind_addr);
ctrl_vty_bind_addr = NULL;
ctrl_vty_bind_addr = talloc_strdup(ctrl_vty_ctx, argv[0]);
+ ctrl_bind_port = argc > 1 ? atoi(argv[1]) : -1;
return CMD_SUCCESS;
}
@@ -46,6 +50,11 @@
return ctrl_vty_bind_addr;
}
+uint16_t ctrl_vty_get_bind_port(uint16_t default_port)
+{
+ return ctrl_bind_port >= 0 ? ctrl_bind_port : default_port;
+}
+
static struct cmd_node ctrl_node = {
L_CTRL_NODE,
"%s(config-ctrl)# ",
diff --git a/src/ctrl/libosmoctrl.map b/src/ctrl/libosmoctrl.map
index f995467..306ad3f 100644
--- a/src/ctrl/libosmoctrl.map
+++ b/src/ctrl/libosmoctrl.map
@@ -22,12 +22,14 @@
ctrl_handle_alloc2; /* could be removed? */
ctrl_handle_msg; /* only used in unit test */
ctrl_interface_setup;
+ctrl_interface_setup2;
ctrl_interface_setup_dynip;
ctrl_interface_setup_dynip2;
ctrl_lookup_register;
ctrl_parse_get_num;
ctrl_type_vals;
ctrl_vty_get_bind_addr;
+ctrl_vty_get_bind_port;
ctrl_vty_init;
osmo_ctrl_conn_alloc;
diff --git a/utils/osmo-ns-dummy.c b/utils/osmo-ns-dummy.c
index a85775e..e2662a2 100644
--- a/utils/osmo-ns-dummy.c
+++ b/utils/osmo-ns-dummy.c
@@ -280,7 +280,7 @@
}
if (ctrl_port > 0) {
- ctrl = ctrl_interface_setup_dynip(NULL, ctrl_vty_get_bind_addr(), ctrl_port, NULL);
+ ctrl = ctrl_interface_setup(NULL, ctrl_port, NULL);
if (!ctrl) {
fprintf(stderr, "Failed to initialize control interface. Exiting.\n");
exit(1);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30444
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0fd87fd41fd3ac975273968d24f477daa3cd3aa9
Gerrit-Change-Number: 30444
Gerrit-PatchSet: 12
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
Attention is currently required from: laforge, pespin.
arehbein has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30703 )
Change subject: libosmocore: Transition to use of 'telnet_init_default'
......................................................................
Patch Set 2:
(1 comment)
File src/vty/telnet_interface.c:
https://gerrit.osmocom.org/c/libosmocore/+/30703/comment/120b20a7_f2ee2b10
PS2, Line 71: #pragma GCC diagnostic push
> So what about the original telnet_init_dynif function? Keep it as is?
I suppose so
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30703
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibd05d3bc2736256aa45e9e7ec15a98bd14a10454
Gerrit-Change-Number: 30703
Gerrit-PatchSet: 2
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Dec 2022 15:17:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: arehbein <arehbein(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/30723 )
Change subject: context_map: Lower loglevel to INFO when deallocating context IDs
......................................................................
context_map: Lower loglevel to INFO when deallocating context IDs
Change-Id: Iefe13934d097d646db232127040feb02db37bc38
---
M src/osmo-hnbgw/context_map.c
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/23/30723/1
diff --git a/src/osmo-hnbgw/context_map.c b/src/osmo-hnbgw/context_map.c
index 7549942..98dffad 100644
--- a/src/osmo-hnbgw/context_map.c
+++ b/src/osmo-hnbgw/context_map.c
@@ -165,7 +165,7 @@
void context_map_deactivate(struct hnbgw_context_map *map)
{
- LOG_MAP(map, DMAIN, LOGL_NOTICE, "Deactivating\n");
+ LOG_MAP(map, DMAIN, LOGL_INFO, "Deactivating\n");
/* set the state to reserved. We still show up in the list and
* avoid re-allocation of the context-id until we are cleaned up
@@ -205,7 +205,7 @@
case MAP_S_RESERVED2:
/* second time we see this reserved
* entry: remove it */
- LOG_MAP(map, DMAIN, LOGL_NOTICE, "Deallocating\n");
+ LOG_MAP(map, DMAIN, LOGL_INFO, "Deallocating\n");
map->state = MAP_S_NULL;
llist_del(&map->cn_list);
llist_del(&map->hnb_list);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/30723
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Iefe13934d097d646db232127040feb02db37bc38
Gerrit-Change-Number: 30723
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: laforge, pespin.
arehbein has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30703 )
Change subject: libosmocore: Transition to use of 'telnet_init_default'
......................................................................
Patch Set 2:
(1 comment)
File src/vty/telnet_interface.c:
https://gerrit.osmocom.org/c/libosmocore/+/30703/comment/9f36823c_5e42aea3
PS2, Line 71: #pragma GCC diagnostic push
> Instead of all this, better have a static int _telnet_init_dynif(void *tall_ctx, void *priv, const c […]
So what about the original telnet_init_dynif function? Keep it as is?
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30703
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibd05d3bc2736256aa45e9e7ec15a98bd14a10454
Gerrit-Change-Number: 30703
Gerrit-PatchSet: 2
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Dec 2022 15:11:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/30682 )
Change subject: fixup: ttcn3-tcpdump*.sh: Fix output of special chars
......................................................................
fixup: ttcn3-tcpdump*.sh: Fix output of special chars
On ArchLinux /bin/sh is actually a symlink to bash, so bash is running
in limited mode and emulating the Bourne Shell. The shell detection
logic added in [1] does not work correctly for me because the cmdline
would be 'sh' or '/bin/sh', not 'bash'. This is what I am getting:
\033[1;32m====== FooBar_Tests.TC_foo_bar pass ======\033[0m
Let's switch to printf, which does interpret the backslash escapes
as expected by default, regardless of the actual shell in use.
Also fix ttcn3-dumpcap-stop.sh, which was left untouched by [1].
Change-Id: Id28193a7ca00b5501a6852e5b4a5412fbaa5e063
Fixes: [1] bf45a5cff890a6103c68d76c1cf088c26ca9aa80
---
M ttcn3-dumpcap-stop.sh
M ttcn3-tcpdump-stop.sh
2 files changed, 4 insertions(+), 15 deletions(-)
Approvals:
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
msuraev: Looks good to me, but someone else must approve
arehbein: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/ttcn3-dumpcap-stop.sh b/ttcn3-dumpcap-stop.sh
index e13fbc0..188b8da 100755
--- a/ttcn3-dumpcap-stop.sh
+++ b/ttcn3-dumpcap-stop.sh
@@ -22,11 +22,10 @@
date
if [ x"$VERDICT" = x"pass" ]; then
- echo -e "\033[1;32m====== $TESTCASE $VERDICT ======\033[0m"
+ printf "\033[1;32m====== $TESTCASE $VERDICT ======\033[0m\n\n"
else
- echo -e "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m"
+ printf "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m\n\n"
fi
-echo
if [ "z$TTCN3_PCAP_PATH" = "z" ]; then
TTCN3_PCAP_PATH=/tmp
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index 0feaeaa..82d3a4f 100755
--- a/ttcn3-tcpdump-stop.sh
+++ b/ttcn3-tcpdump-stop.sh
@@ -26,21 +26,11 @@
date
-# -e only works/is required only in Bash; in dash/POSIX shells it isn't required and will be part of the output
-# SHELL environment variable doesn't always give name of current shell (e.g. for dash run inside bash...)
-SHELL_NAME="$(cat /proc/$$/cmdline | tr -d '\0')"
-if [ "$SHELL_NAME" = "bash" ]; then
- ESCAPE_OPT="-e"
-else
- ESCAPE_OPT=""
-fi
-
if [ x"$VERDICT" = x"pass" ]; then
- echo $ESCAPE_OPT "\033[1;32m====== $TESTCASE $VERDICT ======\033[0m"
+ printf "\033[1;32m====== $TESTCASE $VERDICT ======\033[0m\n\n"
else
- echo $ESCAPE_OPT "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m"
+ printf "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m\n\n"
fi
-echo
if [ "z$TTCN3_PCAP_PATH" = "z" ]; then
TTCN3_PCAP_PATH=/tmp
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/30682
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id28193a7ca00b5501a6852e5b4a5412fbaa5e063
Gerrit-Change-Number: 30682
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: arehbein, laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30703 )
Change subject: libosmocore: Transition to use of 'telnet_init_default'
......................................................................
Patch Set 2:
(1 comment)
File src/vty/telnet_interface.c:
https://gerrit.osmocom.org/c/libosmocore/+/30703/comment/1e2b9fce_4c4808a8
PS2, Line 71: #pragma GCC diagnostic push
Instead of all this, better have a static int _telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port) with the whole implementation, and make all functions call the static one.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30703
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibd05d3bc2736256aa45e9e7ec15a98bd14a10454
Gerrit-Change-Number: 30703
Gerrit-PatchSet: 2
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: arehbein <arehbein(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 20 Dec 2022 15:01:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment