Attention is currently required from: daniel, fixeria, laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41911?usp=email )
Change subject: osmo_io: Support rx of segments up to ~UINT16_MAX
......................................................................
Patch Set 6:
(2 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/41911/comment/e03823ce_2168d2ac?… :
PS6, Line 394: memcpy
> formatting: same here
Done
https://gerrit.osmocom.org/c/libosmocore/+/41911/comment/75d3516d_c4af1c84?… :
PS6, Line 401: memcpy
> formatting: same here
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41911?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8c11a7edbed2335ada40a1f93d081041974c3586
Gerrit-Change-Number: 41911
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 23 Jan 2026 10:42:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: daniel, laforge, pespin.
fixeria has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41911?usp=email )
Change subject: osmo_io: Support rx of segments up to ~UINT16_MAX
......................................................................
Patch Set 6: Code-Review+1
(2 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/41911/comment/e4f3b460_796868d9?… :
PS6, Line 394: memcpy
formatting: same here
https://gerrit.osmocom.org/c/libosmocore/+/41911/comment/b999255f_f685b8d7?… :
PS6, Line 401: memcpy
formatting: same here
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41911?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8c11a7edbed2335ada40a1f93d081041974c3586
Gerrit-Change-Number: 41911
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 23 Jan 2026 10:19:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41893?usp=email )
Change subject: Remove unused private API log_target_create_file_stream()
......................................................................
Remove unused private API log_target_create_file_stream()
This function was never added to the logging.h (despite it was not
static and it was inside libosmocore.map).
It is actually used nowhere, and changing it to static made the compiler
warn about it. Remove it.
Change-Id: Ia30c6b47cfcbb54e7c2c43b877cd9554dc596abf
---
M src/core/libosmocore.map
M src/core/logging.c
2 files changed, 0 insertions(+), 24 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map
index 3ec322c..cb79843 100644
--- a/src/core/libosmocore.map
+++ b/src/core/libosmocore.map
@@ -96,7 +96,6 @@
log_set_use_color;
log_target_create;
log_target_create_file;
-log_target_create_file_stream;
log_target_create_gsmtap;
log_target_create_rb;
log_target_create_stderr;
diff --git a/src/core/logging.c b/src/core/logging.c
index ac10d00..479513a 100644
--- a/src/core/logging.c
+++ b/src/core/logging.c
@@ -1278,29 +1278,6 @@
}
#if (!EMBEDDED)
-/*! Create a new file-based log target using buffered, blocking stream output
- * \param[in] fname File name of the new log file
- * \returns Log target in case of success, NULL otherwise
- */
-struct log_target *log_target_create_file_stream(const char *fname)
-{
- struct log_target *target;
-
- target = log_target_create();
- if (!target)
- return NULL;
-
- target->type = LOG_TGT_TYPE_FILE;
- target->tgt_file.out = fopen(fname, "a");
- if (!target->tgt_file.out) {
- log_target_destroy(target);
- return NULL;
- }
- target->output = _file_output_stream;
- target->tgt_file.fname = talloc_strdup(target, fname);
-
- return target;
-}
/*! switch from non-blocking/write-queue to blocking + buffered stream output
* \param[in] target log target which we should switch
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41893?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia30c6b47cfcbb54e7c2c43b877cd9554dc596abf
Gerrit-Change-Number: 41893
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/41879?usp=email )
Change subject: logging: Add APIs to set/get log_{target,context} fields
......................................................................
logging: Add APIs to set/get log_{target,context} fields
Change-Id: Ie48e7e635feb91509b9c034394df4fb16cb931a3
---
M TODO-RELEASE
M include/osmocom/core/logging.h
M src/core/libosmocore.map
M src/core/logging.c
4 files changed, 115 insertions(+), 5 deletions(-)
Approvals:
fixeria: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
pespin: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 3c98f06..b7d1585 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -10,3 +10,4 @@
core added osmo_sock_set_nonblock(), osmo_sock_get_nonblock()
core added gsmtap_source_set_nonblock(), gsmtap_source_using_wq()
core added osmo_iofd_set_name_f()
+core added log_{get,set}_filter(_data)(), log_get_context()
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 44263fb..286f646 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -225,7 +225,7 @@
/*! Log context information, passed to filter */
struct log_context {
- void *ctx[LOG_MAX_CTX+1];
+ void *ctx[LOG_MAX_CTX+1] OSMO_DEPRECATED_OUTSIDE("Accessing struct log_context members directly is deprecated");
};
/*! Compatibility with older libosmocore versions */
@@ -298,13 +298,15 @@
};
/*! structure representing a logging target */
+#define OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET \
+ OSMO_DEPRECATED_OUTSIDE("Accessing struct log_target members directly is deprecated")
struct log_target {
struct llist_head entry; /*!< linked list */
/*! Internal data for filtering */
- int filter_map;
+ int filter_map OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET;
/*! Internal data for filtering */
- void *filter_data[LOG_MAX_FILTERS+1];
+ void *filter_data[LOG_MAX_FILTERS+1] OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE_LOG_TARGET;
/*! logging categories */
struct log_category *categories;
@@ -406,10 +408,16 @@
/* context management */
void log_reset_context(void);
-int log_set_context(uint8_t ctx, void *value);
+int log_set_context(uint8_t ctx_nr, void *value);
+void *log_get_context(const struct log_context *ctx, uint8_t ctx_nr);
/* filter on the targets */
void log_set_all_filter(struct log_target *target, int);
+bool log_get_filter(const struct log_target *target, int log_filter_index);
+int log_set_filter(struct log_target *target, int log_filter_index, bool enable);
+void *log_get_filter_data(const struct log_target *target, int log_filter_index);
+int log_set_filter_data(struct log_target *target, int log_filter_index, void *data);
+
int log_cache_enable(void);
void log_cache_update(int mapped_subsys, uint8_t enabled, uint8_t level);
void log_set_use_color(struct log_target *target, int);
diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map
index 2818f8a..3ec322c 100644
--- a/src/core/libosmocore.map
+++ b/src/core/libosmocore.map
@@ -75,8 +75,13 @@
log_parse_level;
logp_stub;
log_reset_context;
+log_get_context;
+log_get_filter;
+log_get_filter_data;
log_set_all_filter;
log_set_category_filter;
+log_set_filter;
+log_set_filter_data;
log_set_context;
log_set_log_level;
log_set_print_category;
diff --git a/src/core/logging.c b/src/core/logging.c
index 9e5ae9f..ac10d00 100644
--- a/src/core/logging.c
+++ b/src/core/logging.c
@@ -886,7 +886,42 @@
return 0;
}
-/*! Enable the \ref LOG_FLT_ALL log filter
+/*! Get the logging context
+ * \param[in] ctx logging context
+ * \param[in] ctx_nr logging context number
+ * \returns value set for the context
+ *
+ * A logging context is something like the subscriber identity to which
+ * the currently processed message relates, or the BTS through which it
+ * was received. The main use of this API is during
+ * (struct log_info)->filter_fn(ctx, log_tgt).
+ */
+void *log_get_context(const struct log_context *ctx, uint8_t ctx_nr)
+{
+ if (ctx_nr > LOG_MAX_CTX)
+ return NULL;
+ return ctx->ctx[ctx_nr];
+}
+
+/*! Query whether a log filter is enabled or disabled
+ * \param[in] target Log target to be queried
+ * \param[in] log_filter_index the index of the log filter to query
+ * \returns whether the filtering is enabled (true) or disabled (false)
+ */
+bool log_get_filter(const struct log_target *target, int log_filter_index)
+{
+ /* TODO: in the future we can support app-specified log filters here,
+ * similar to how we do dynamic cateogries defined by apps. */
+ if (log_filter_index < 0)
+ return false;
+
+ if (log_filter_index >= LOG_MAX_FILTERS)
+ return false;
+
+ return target->filter_map & (1 << log_filter_index);
+}
+
+/*! Enable/disable the \ref LOG_FLT_ALL log filter
* \param[in] target Log target to be affected
* \param[in] all enable (1) or disable (0) the ALL filter
*
@@ -902,6 +937,67 @@
target->filter_map &= ~(1 << LOG_FLT_ALL);
}
+/*! Enable/disable a log filter
+ * \param[in] target Log target to be affected
+ * \param[in] log_filter_index the index of the log filter to set
+ * \param[in] enable enable (true) or disable (false) the ALL filter
+ * \returns 0 on success, negative on error.
+ */
+int log_set_filter(struct log_target *target, int log_filter_index, bool enable)
+{
+ /* TODO: in the future we can support app-specified log filters here,
+ * similar to how we do dynamic cateogries defined by apps. */
+ if (log_filter_index < 0)
+ return -EINVAL;
+
+ if (log_filter_index >= LOG_MAX_FILTERS)
+ return -EINVAL;
+
+ if (enable)
+ target->filter_map |= (1 << log_filter_index);
+ else
+ target->filter_map &= ~(1 << log_filter_index);
+ return 0;
+}
+
+/*! Obtain data associated to a log filter
+ * \param[in] target Log target to be queried
+ * \param[in] log_filter_index the index of the log filter to query
+ * \returns data associated to the log filter
+ */
+void *log_get_filter_data(const struct log_target *target, int log_filter_index)
+{
+ /* TODO: in the future we can support app-specified log filters here,
+ * similar to how we do dynamic cateogries defined by apps. */
+ if (log_filter_index < 0)
+ return NULL;
+
+ if (log_filter_index >= LOG_MAX_FILTERS)
+ return NULL;
+
+ return target->filter_data[log_filter_index];
+}
+
+/*! Set data associated to a log filter
+ * \param[in] target Log target to be affected
+ * \param[in] log_filter_index the index of the log filter to set associate data for
+ * \param[in] data The user provided data pointer to associate to the log filter
+ * \returns 0 on success, negative on error.
+ */
+int log_set_filter_data(struct log_target *target, int log_filter_index, void *data)
+{
+ /* TODO: in the future we can support app-specified log filters here,
+ * similar to how we do dynamic cateogries defined by apps. */
+ if (log_filter_index < 0)
+ return -EINVAL;
+
+ if (log_filter_index >= LOG_MAX_FILTERS)
+ return -EINVAL;
+
+ target->filter_data[log_filter_index] = data;
+ return 0;
+}
+
/*! Enable or disable the use of colored output
* \param[in] target Log target to be affected
* \param[in] use_color Use color (1) or don't use color (0)
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41879?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie48e7e635feb91509b9c034394df4fb16cb931a3
Gerrit-Change-Number: 41879
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: daniel, fixeria, laforge.
Hello Jenkins Builder, daniel, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/41911?usp=email
to look at the new patch set (#6).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Verified+1 by Jenkins Builder
Change subject: osmo_io: Support rx of segments up to ~UINT16_MAX
......................................................................
osmo_io: Support rx of segments up to ~UINT16_MAX
Previously if we recevied a big chunk (near UINT16_MAX), we would hit
the following assert in iofd_msgb_alloc2(), because our msgb
implementation can only handle sizes up to 16 bit length, counting
headroom + data length:
"OSMO_ASSERT(size + headroom <= 0xffff);".
This new improved logic allows handling segments of up to ~UINT16_MAX
which may come in in multiple read calls. It also adds logic to catch
received segments greater than UINT16_MAX (or buggy segment_cb or buggy
peer transmitting to us) and notifies the user of a broken stream
through read_cb() in that case.
test_segmentation_uint16_max() is added to osmo_io_test, which would
abort without this patch applied.
Related: SYS#7842
Change-Id: I8c11a7edbed2335ada40a1f93d081041974c3586
---
M src/core/osmo_io.c
M tests/osmo_io/osmo_io_test.c
M tests/osmo_io/osmo_io_test.err
M tests/osmo_io/osmo_io_test.ok
4 files changed, 602 insertions(+), 34 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/11/41911/6
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41911?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8c11a7edbed2335ada40a1f93d081041974c3586
Gerrit-Change-Number: 41911
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Attention is currently required from: Timur Davydov, laforge.
fixeria has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/41878?usp=email )
Change subject: build: keep netns API public and gate features with HAVE_*
......................................................................
Patch Set 9: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41878?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2322eb2936bea35596f1fd6b6a713ea5f997b1ea
Gerrit-Change-Number: 41878
Gerrit-PatchSet: 9
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Fri, 23 Jan 2026 09:24:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov, laforge, osmith.
fixeria has posted comments on this change by Timur Davydov. ( https://gerrit.osmocom.org/c/libosmocore/+/41923?usp=email )
Change subject: core: fix printf format casts for struct timeval fields
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41923?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icac9e392c728948a7976970658e37f5e0da41709
Gerrit-Change-Number: 41923
Gerrit-PatchSet: 1
Gerrit-Owner: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Gerrit-Comment-Date: Fri, 23 Jan 2026 09:20:22 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes