pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33342 )
Change subject: stream: Drop recently added API osmo_stream_cli_create2
......................................................................
stream: Drop recently added API osmo_stream_cli_create2
It was later decided that since setting a name is not really required,
it is best to leave it out of the create() function and let the user use
the osmo_stream_cli_set_name() API if needed (otherwise a dynamic name
based on socket is selected).
Change-Id: I2a2fad318ef22c2ac117f95588a078ca3beccea5
---
M examples/ipa-stream-client.c
M examples/stream-client.c
M include/osmocom/netif/stream.h
M src/stream.c
4 files changed, 37 insertions(+), 35 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/42/33342/1
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index 91abfac..b66d93a 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -164,11 +164,12 @@
* initialize stream client.
*/
- conn = osmo_stream_cli_create2(tall_test, "ipa_test_client");
+ conn = osmo_stream_cli_create(tall_test);
if (conn == NULL) {
fprintf(stderr, "cannot create client\n");
exit(EXIT_FAILURE);
}
+ osmo_stream_cli_set_name(conn, "ipa_test_client");
osmo_stream_cli_set_addr(conn, "127.0.0.1");
osmo_stream_cli_set_port(conn, 10000);
osmo_stream_cli_set_connect_cb(conn, connect_cb);
diff --git a/examples/stream-client.c b/examples/stream-client.c
index 350535d..6781c72 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -103,11 +103,12 @@
* initialize stream cli.
*/
- conn = osmo_stream_cli_create2(tall_test, "stream_client");
+ conn = osmo_stream_cli_create(tall_test);
if (conn == NULL) {
fprintf(stderr, "cannot create cli\n");
exit(EXIT_FAILURE);
}
+ osmo_stream_cli_set_name(conn, "stream_client");
osmo_stream_cli_set_addr(conn, "127.0.0.1");
osmo_stream_cli_set_port(conn, 10000);
osmo_stream_cli_set_connect_cb(conn, connect_cb);
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 11e9070..c56b9a6 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -90,7 +90,6 @@
bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli);
struct osmo_stream_cli *osmo_stream_cli_create(void *ctx);
-struct osmo_stream_cli *osmo_stream_cli_create2(void *ctx, const char *name);
void osmo_stream_cli_destroy(struct osmo_stream_cli *cli);
int osmo_stream_cli_open(struct osmo_stream_cli *cli);
diff --git a/src/stream.c b/src/stream.c
index 5d8266d..014a3a3 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -590,7 +590,23 @@
*/
struct osmo_stream_cli *osmo_stream_cli_create(void *ctx)
{
- return osmo_stream_cli_create2(ctx, "");
+ struct osmo_stream_cli *cli;
+
+ cli = talloc_zero(ctx, struct osmo_stream_cli);
+ if (!cli)
+ return NULL;
+
+ cli->mode = OSMO_STREAM_MODE_UNKNOWN;
+ cli->sk_domain = AF_UNSPEC;
+ cli->sk_type = SOCK_STREAM;
+ cli->proto = IPPROTO_TCP;
+
+ cli->state = STREAM_CLI_STATE_CLOSED;
+ osmo_timer_setup(&cli->timer, cli_timer_cb, cli);
+ cli->reconnect_timeout = 5; /* default is 5 seconds. */
+ INIT_LLIST_HEAD(&cli->tx_queue);
+
+ return cli;
}
static void stream_cli_iofd_read_cb(struct osmo_io_fd *iofd, int res, struct msgb *msg)
@@ -638,35 +654,6 @@
.segmentation_cb = NULL,
};
-/*! \brief Create an Osmocom stream client
- * \param[in] ctx talloc context from which to allocate memory
- * This function allocates a new \ref osmo_stream_cli and initializes
- * it with default values (5s reconnect timer, TCP protocol)
- * \param[in] name a description of the stream client. Will be used in logging
- * \return allocated stream client, or NULL in case of error
- */
-struct osmo_stream_cli *osmo_stream_cli_create2(void *ctx, const char *name)
-{
- struct osmo_stream_cli *cli;
-
- cli = talloc_zero(ctx, struct osmo_stream_cli);
- if (!cli)
- return NULL;
-
- cli->name = talloc_strdup(cli, name);
- cli->mode = OSMO_STREAM_MODE_UNKNOWN;
- cli->sk_domain = AF_UNSPEC;
- cli->sk_type = SOCK_STREAM;
- cli->proto = IPPROTO_TCP;
-
- cli->state = STREAM_CLI_STATE_CLOSED;
- osmo_timer_setup(&cli->timer, cli_timer_cb, cli);
- cli->reconnect_timeout = 5; /* default is 5 seconds. */
- INIT_LLIST_HEAD(&cli->tx_queue);
-
- return cli;
-}
-
/*! \brief Set a name on the cli object (used during logging)
* \param[in] cli stream_cli whose name is to be set
* \param[in] name the name to be set on cli
@@ -887,7 +874,7 @@
}
/*! \brief Set the call-back function called to read from the stream client socket
- * Only for osmo_stream_cli created with osmo_stream_cli_create()
+ * This function will configure osmo_stream_cli to use osmo_ofd internally.
* \param[in] cli Stream Client to modify
* \param[in] read_cb Call-back function to be called when we want to read */
void
@@ -900,7 +887,7 @@
}
/*! \brief Set the call-back function called to read from the stream client socket
- * Only use this function for osmo_stream_cli created with osmo_stream_cli_create2()
+ * This function will configure osmo_stream_cli to use osmo_iofd internally.
* \param[in] cli Stream Client to modify
* \param[in] read_cb Call-back function to be called when data was read from the socket */
void
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33342
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I2a2fad318ef22c2ac117f95588a078ca3beccea5
Gerrit-Change-Number: 33342
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33343 )
Change subject: stream: Drop name param from recently added API osmo_stream_srv_create2()
......................................................................
stream: Drop name param from recently added API osmo_stream_srv_create2()
It was later decided that since setting a name is not really required,
it is best to leave it out of the create() function and let the user use
the osmo_stream_srv_set_name() API if needed (otherwise a dynamic name
based on socket is selected)
Change-Id: I5d677ef57b7db0aedd8c43282568c845097cb12b
---
M examples/ipa-stream-server.c
M examples/stream-server.c
M include/osmocom/netif/stream.h
M src/stream.c
4 files changed, 22 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/43/33343/1
diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c
index e490ff6..c72ed9a 100644
--- a/examples/ipa-stream-server.c
+++ b/examples/ipa-stream-server.c
@@ -75,12 +75,13 @@
return -1;
}
- conn = osmo_stream_srv_create2(tall_test, "ipa_srv", srv, fd, NULL);
+ conn = osmo_stream_srv_create2(tall_test, srv, fd, NULL);
if (conn == NULL) {
LOGP(DSTREAMTEST, LOGL_ERROR,
"error while creating connection\n");
return -1;
}
+ osmo_stream_srv_set_name(conn, "ipa_srv");
osmo_stream_srv_set_read_cb(conn, read_cb);
osmo_stream_srv_set_closed_cb(conn, close_cb);
diff --git a/examples/stream-server.c b/examples/stream-server.c
index d7c2aff..8aa8b9b 100644
--- a/examples/stream-server.c
+++ b/examples/stream-server.c
@@ -69,12 +69,13 @@
return -1;
}
- conn = osmo_stream_srv_create2(tall_test, "stream_server", srv, fd, NULL);
+ conn = osmo_stream_srv_create2(tall_test, srv, fd, NULL);
if (conn == NULL) {
LOGP(DSTREAMTEST, LOGL_ERROR,
"error while creating connection\n");
return -1;
}
+ osmo_stream_srv_set_name(conn, "stream_server");
osmo_stream_srv_set_read_cb(conn, read_cb);
osmo_stream_srv_set_closed_cb(conn, close_cb);
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index c56b9a6..057815b 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -46,7 +46,7 @@
struct osmo_stream_srv;
struct osmo_stream_srv *osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, int (*read_cb)(struct osmo_stream_srv *conn), int (*closed_cb)(struct osmo_stream_srv *conn), void *data);
-struct osmo_stream_srv *osmo_stream_srv_create2(void *ctx, const char *name, struct osmo_stream_srv_link *link, int fd, void *data);
+struct osmo_stream_srv *osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data);
void osmo_stream_srv_set_name(struct osmo_stream_srv *conn, const char *name);
void osmo_stream_srv_set_read_cb(struct osmo_stream_srv *conn, int (*read_cb)(struct osmo_stream_srv *conn, struct msgb *msg));
void osmo_stream_srv_set_closed_cb(struct osmo_stream_srv *conn, int (*closed_cb)(struct osmo_stream_srv *conn));
diff --git a/src/stream.c b/src/stream.c
index 014a3a3..a401da9 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1723,14 +1723,12 @@
/*! \brief Create a Stream Server inside the specified link
* \param[in] ctx talloc allocation context from which to allocate
- * \param[in] name name of the connection
* \param[in] link Stream Server Link to which we belong
* \param[in] fd system file descriptor of the new connection
* \param[in] data User data to save in the new Stream Server struct
* \returns Stream Server in case of success; NULL on error */
struct osmo_stream_srv *
-osmo_stream_srv_create2(void *ctx, const char *name,
- struct osmo_stream_srv_link *link, int fd, void *data)
+osmo_stream_srv_create2(void *ctx, struct osmo_stream_srv_link *link, int fd, void *data)
{
struct osmo_stream_srv *conn;
@@ -1743,12 +1741,8 @@
conn->mode = OSMO_STREAM_MODE_OSMO_IO;
conn->srv = link;
- if (name) {
- conn->name = talloc_strdup(conn, name);
- } else {
- conn->name_dynamic = true;
- conn->name = osmo_sock_get_name2_c(conn, fd);
- }
+ conn->name_dynamic = true;
+ conn->name = osmo_sock_get_name2_c(conn, fd);
conn->iofd = osmo_iofd_setup(conn, fd, conn->name, OSMO_IO_FD_MODE_READ_WRITE, &srv_ioops, conn);
if (!conn->iofd) {
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33343
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I5d677ef57b7db0aedd8c43282568c845097cb12b
Gerrit-Change-Number: 33343
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: daniel.
Hello Jenkins Builder, daniel,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/33341
to look at the new patch set (#2).
Change subject: osmo_io: Make name optional, add _set_name() API
......................................................................
osmo_io: Make name optional, add _set_name() API
This allows renaming the iofd at any later point in time. This is useful
for instance if the parent object holding the iofd changes its name.
Change-Id: If2772a3ccaa98616e0189862a49ab0243435e343
---
M include/osmocom/core/osmo_io.h
M src/core/libosmocore.map
M src/core/osmo_io.c
M src/core/osmo_io_internal.h
4 files changed, 27 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/33341/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/33341
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If2772a3ccaa98616e0189862a49ab0243435e343
Gerrit-Change-Number: 33341
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: newpatchset
pespin has abandoned this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/33334 )
Change subject: Set ASP name on related stream_cli
......................................................................
Abandoned
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/33334
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I1618da8c5b146729eeb32da3f882534b98144514
Gerrit-Change-Number: 33334
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: abandon
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/33339 )
Change subject: pcu_l1_if: use correct SAPI in PCUIF message PCU_IF_MSG_DATA_CNF_DT
......................................................................
pcu_l1_if: use correct SAPI in PCUIF message PCU_IF_MSG_DATA_CNF_DT
When we receive PCU_IF_MSG_DATA_CNF_DT, we check on PCU_IF_SAPI_PCH.
This is formally not correct, we should check on PCU_IF_SAPI_PCH_DT
instead.
(This patch will only affect osmo-bsc but not osmo-bts. The reason for
this is that osmo-bts still uses the older PCUIF v.10)
Depends: osmo-bsc.git Id5c799e625c56e57f7b51cd4fb57f5bea9c973d2
Change-Id: I0883b51fc232ec0267f1511c3a37c0bcd0967a08
---
M src/pcu_l1_if.cpp
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/39/33339/1
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 7437e16..686853c 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -539,7 +539,7 @@
data_cnf_dt->sapi, data_cnf_dt->fn, current_fn);
switch (data_cnf_dt->sapi) {
- case PCU_IF_SAPI_PCH:
+ case PCU_IF_SAPI_PCH_DT:
bts_rcv_imm_ass_cnf(bts, NULL, data_cnf_dt->tlli, data_cnf_dt->fn);
break;
default:
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/33339
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0883b51fc232ec0267f1511c3a37c0bcd0967a08
Gerrit-Change-Number: 33339
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
Hoernchen has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33329 )
Change subject: layer23: fix handling of logging category mask (-d option)
......................................................................
layer23: fix handling of logging category mask (-d option)
In change 67943df4 I broke handling of the logging category mask in
the mobile app. Adding this option results in a segfault:
ERROR: osmo_log_info == NULL! You must call log_init() before
using logging in log_parse_category_mask()!
Assert failed osmo_log_info src/libosmocore/src/core/logging.c:329
As can be seen, the problem is that we are calling
log_parse_category_mask() before initializing the logging.
As possible solution, I could rearrange the code to parse command
line options after calling osmo_init_logging2(). This would fix
the segfault, but would not fully solve the problem.
If we call log_parse_category_mask() before parsing the config file,
then logging configuration in the config file overwrites the logging
configuration specified via the command line. But we want the
opposite: the command line setting should overwrite the config file
parameters. This is handy because there is no need to edit the
config file if you quickly need to test something.
So let's call log_parse_category_mask() after parsing the config file.
Change-Id: I1b2b7804bf99b71f96e9197f7824cfd20431e8a1
Fixes: 67943df4 "layer23: fix parsing of command line options"
---
M src/host/layer23/src/common/main.c
M src/host/layer23/src/mobile/main.c
2 files changed, 43 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
Hoernchen: Looks good to me, approved
diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c
index a4b9441..919a231 100644
--- a/src/host/layer23/src/common/main.c
+++ b/src/host/layer23/src/common/main.c
@@ -58,6 +58,7 @@
struct llist_head ms_list;
static char *gsmtap_ip = NULL;
static char *config_file = NULL;
+static char *log_cat_mask = NULL;
int (*l23_app_start)(void) = NULL;
int (*l23_app_work)(void) = NULL;
@@ -162,7 +163,7 @@
config_file = optarg;
break;
case 'd':
- log_parse_category_mask(osmo_stderr_target, optarg);
+ log_cat_mask = optarg;
break;
default:
if (l23_app_info.cfg_handle_opt != NULL)
@@ -268,6 +269,9 @@
exit(1);
}
+ if (log_cat_mask != NULL)
+ log_parse_category_mask(osmo_stderr_target, log_cat_mask);
+
if (l23_app_info.opt_supported & L23_OPT_TAP) {
if (gsmtap_ip) {
if (l23_cfg.gsmtap.remote_host != NULL) {
diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c
index 71a16c1..8720ea7 100644
--- a/src/host/layer23/src/mobile/main.c
+++ b/src/host/layer23/src/mobile/main.c
@@ -54,6 +54,7 @@
struct l23_global_config l23_cfg;
struct llist_head ms_list;
static const char *custom_cfg_file = NULL;
+static const char *log_cat_mask = NULL;
static char *config_file = NULL;
char *config_dir = NULL;
int daemonize = 0;
@@ -118,7 +119,7 @@
custom_cfg_file = optarg;
break;
case 'd':
- log_parse_category_mask(osmo_stderr_target, optarg);
+ log_cat_mask = optarg;
break;
case 'D':
daemonize = 1;
@@ -297,6 +298,9 @@
exit(1);
}
+ if (log_cat_mask != NULL)
+ log_parse_category_mask(osmo_stderr_target, log_cat_mask);
+
if (l23_cfg.gsmtap.remote_host) {
l23_cfg.gsmtap.inst = gsmtap_source_init2(l23_cfg.gsmtap.local_host, 0,
l23_cfg.gsmtap.remote_host, GSMTAP_UDP_PORT, 1);
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33329
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I1b2b7804bf99b71f96e9197f7824cfd20431e8a1
Gerrit-Change-Number: 33329
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: pespin.
daniel has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33336 )
Change subject: stream: Allow setting name printed during logging
......................................................................
Patch Set 2:
(1 comment)
File src/stream.c:
https://gerrit.osmocom.org/c/libosmo-netif/+/33336/comment/444cf355_75c8ecd6
PS1, Line 1228: struct osmo_stream_srv_link *osmo_stream_srv_link_create(void *ctx)
> Did we add all the *2 APIs since around last week? Can we maybe remove the "name" param from all tho […]
Yes, that's basically what I was trying to say in my last sentence.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33336
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I539a0d29d11348efe702f971965a55cf56db5c59
Gerrit-Change-Number: 33336
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 16 Jun 2023 12:55:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: comment