Jenkins Builder has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmocore/+/41879?usp=email )
Change subject: logging: Add APIs to set/get log_{target,context} fields
......................................................................
Patch Set 1:
(1 comment)
File src/core/logging.c:
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/libosmocore/+/41879/comment/f961be5e_246d9271?… :
PS1, Line 921: return target->filter_map & (1 << log_filter_index);
space prohibited after that '&' (ctx:WxW)
--
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: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie48e7e635feb91509b9c034394df4fb16cb931a3
Gerrit-Change-Number: 41879
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Tue, 20 Jan 2026 11:25:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
pespin has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/79/41879/1
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: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie48e7e635feb91509b9c034394df4fb16cb931a3
Gerrit-Change-Number: 41879
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria, phcoder.
dexter has posted comments on this change by phcoder. ( https://gerrit.osmocom.org/c/pysim/+/41786?usp=email )
Change subject: Print SMSC in pySim-read.py
......................................................................
Patch Set 15: Code-Review+1 Verified+1
(1 comment)
Patchset:
PS15:
I have tried this out and it works fine. I have also set the EF.SMSP record 1 to all FF to see what happens. No problem, it just shows "SMSC: "
I would suggest to indent the SMSC: output to make more clear that it is related to SMSP. (similar to SIM Service Table, there you have the hex string and below are the parsed results with an indentation. Maybe also print "SMSC: (none)" in case it is not set.
In any case, those are just cosmetic suggestions. I think its ok the way it is and I don't want to block you. Also the output of pySim-read.py has some consistency issues here and there anyway.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41786?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I17067b68086316d51fd71ba77049874605594e3f
Gerrit-Change-Number: 41786
Gerrit-PatchSet: 15
Gerrit-Owner: phcoder <phcoder(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: phcoder <phcoder(a)gmail.com>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Jan 2026 10:49:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: Timur Davydov, laforge, neels.
Hello Jenkins Builder, fixeria, neels, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/41813?usp=email
to look at the new patch set (#9).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: Add Emscripten build support and JS callback logging backend
......................................................................
Add Emscripten build support and JS callback logging backend
This change enables building libosmocore for sandboxed, non-POSIX
environments, specifically WebAssembly targets produced via the
Emscripten toolchain.
The broader motivation is to allow partial execution of selected
Osmocom components in isolated runtime environments where direct access
to hardware and traditional operating system facilities (filesystem,
sockets, privileged execution) is not available.
One intended use case is running a GSM 2G base station where the
radio-facing components are executed inside a web environment, while
the remaining Osmocom stack and core network components continue to run
unchanged on a conventional backend server. In this model, highly
stripped-down variants of osmo-bts and osmo-trx are built as static
WebAssembly libraries and executed in the browser, while depending on
core libraries such as libosmocore, libosmo-netif, and libosmo-abis.
A practical advantage of this approach is that no deployment or
privileged setup is required on the radio endpoint side. A user can
instantiate a radio endpoint with minimal configuration, while all
stateful logic and operational complexity remains centralized on the
backend. Multiple such radio endpoints may connect to the same backend
core network, effectively forming a single logical network from the
core network perspective, independent of the physical location of the
radio endpoints.
Existing libosmocore build logic and platform assumptions rely on the
availability of POSIX APIs and OS services which are not present in
WebAssembly runtimes. This currently prevents libosmocore from being
built for such targets without targeted, build-time adjustments. This
patch introduces the minimal set of changes required to enable such
builds, without affecting native platforms.
As part of this groundwork, a minimal callback-based logging hook is
introduced. When building for Emscripten, this hook allows forwarding
log messages to an external environment via a user-provided JavaScript
callback. This enables integration with browser-side logging or UI
infrastructure without introducing new logging backends or runtime
dependencies. For all other build targets, the hook resolves to a no-op
implementation and does not alter existing logging behavior.
No runtime behavior, protocol semantics, or network interactions are
changed by this patch. All modifications are strictly limited to
build-time and platform-specific code paths and are only active when
targeting Emscripten. Native builds and existing deployment scenarios
remain unaffected.
This patch is intended as groundwork. Follow-up changes, proposed
separately and incrementally, may extend similar support to other
Osmocom components such as libosmo-netif, libosmo-abis, osmo-bts, and
osmo-trx, while keeping all such changes optional and isolated from
native builds.
Change-Id: Ia8d5f4bb6570b5e055826f3a051e5e5896866e31
---
M .gitignore
M configure.ac
M include/osmocom/core/logging.h
M include/osmocom/core/netns.h
M src/core/Makefile.am
M src/core/libosmocore.map
A src/core/logging_emscripten.c
M src/core/netdev.c
M src/core/osmo_io_internal.h
M src/core/socket.c
M src/core/stats_tcp.c
M src/core/tun.c
M src/vty/logging_vty.c
13 files changed, 206 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/13/41813/9
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41813?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: Ia8d5f4bb6570b5e055826f3a051e5e5896866e31
Gerrit-Change-Number: 41813
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: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Timur Davydov <dtv.comp(a)gmail.com>
Attention is currently required from: fixeria, laforge.
dexter has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/pysim/+/37925?usp=email )
Change subject: pySim.apdu_source.stdin_hex
......................................................................
Patch Set 1:
(2 comments)
Patchset:
PS1:
I have tried this out. and fed it some APDUs (the testcases from current master, /tests/pySim-shell_test/apdu/test_apdu.script). Case 1-3 seem to work fine but when I enter 00a40004023f0000 (case 4) it seems to have problems. Leaving out the Le field also does not help.
Here is what I tried:
./pySim-trace.py stdin-hex
INFO root: Opening source stdin-hex...
Detected UICC Add-on "SIM"
Detected UICC Add-on "GSM-R"
Detected UICC Add-on "RUIM"
Can't read AIDs from SIM -- 'list' object has no attribute 'lower'
warning: EF.DIR seems to be empty!
ADF.ECASD: a0000005591010ffffffff8900000200
ADF.ISD-R: a0000005591010ffffffff8900000100
ISIM: a0000000871004
USIM: a0000000871002
INFO root: Entering main loop...
C-APDU >00a40004023f0000
C-APDU >
(nothing happens, so I just press enter...)
Traceback (most recent call last):
File "/home/user/work/git_master/pysim/./pySim-trace.py", line 220, in <module>
tracer.main()
File "/home/user/work/git_master/pysim/./pySim-trace.py", line 117, in main
apdu = self.source.read()
^^^^^^^^^^^^^^^^^^
File "/home/user/work/git_master/pysim/pySim/apdu_source/__init__.py", line 23, in read
r = self.read_packet()
^^^^^^^^^^^^^^^^^^
File "/home/user/work/git_master/pysim/pySim/apdu_source/stdin_hex.py", line 40, in read_packet
return ApduCommands.parse_cmd_bytes(h2b(command) + h2b(response))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/work/git_master/pysim/pySim/apdu/__init__.py", line 405, in parse_cmd_bytes
raise ValueError('Unknown CLA=%02X INS=%02X' % (cla, ins))
ValueError: Unknown CLA=90 INS=00
I also wonder what is with the responses? Those aren't intended to be analyzed?. Maybe I am just using it wrong. As I said, some more info in the commit message would be helpful.
Commit Message:
https://gerrit.osmocom.org/c/pysim/+/37925/comment/81eab98c_0a6648d1?usp=em… :
PS1, Line 7: pySim.apdu_source.stdin_hex
I think it would be good to write a sentence or two what this is patch is about and how it can be useful. I can see it is for pySim-trace, but I do not get the usecase.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37925?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I5aacf13b7c27cea9efd42f01dacca61068c3aa33
Gerrit-Change-Number: 37925
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Jan 2026 10:25:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41868?usp=email )
Change subject: testenv: less cluttered output for failed cmds
......................................................................
testenv: less cluttered output for failed cmds
The testenv.cmd.run() already prints the command to run at the start,
prints the command output and blocks until the command is done.
If the command fails, do not print the command again, and do not print a
python stack trace. The reason for the failure is most likely in the
output shown by the program itself (e.g. a prepare= script that failed).
Make it easier for the user to spot this error by uncluttering the
output.
Change-Id: I508322b017e5ed9c21396384ef759a4c49c8d3da
---
M _testenv/testenv/cmd.py
1 file changed, 4 insertions(+), 11 deletions(-)
Approvals:
osmith: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/_testenv/testenv/cmd.py b/_testenv/testenv/cmd.py
index c14f694..bde0bf3 100644
--- a/_testenv/testenv/cmd.py
+++ b/_testenv/testenv/cmd.py
@@ -1,10 +1,11 @@
-# Copyright 2024 sysmocom - s.f.m.c. GmbH
+# Copyright 2026 sysmocom - s.f.m.c. GmbH
# SPDX-License-Identifier: GPL-3.0-or-later
import logging
import os
import os.path
import re
import subprocess
+import sys
import testenv
import testenv.testsuite
@@ -79,15 +80,6 @@
env_extra["TESTENV_QEMU_SCRIPTS"] = os.path.join(testenv.data_dir, "scripts/qemu")
-def exit_error_cmd(completed, error_msg):
- """:param completed: return from run_cmd() below"""
-
- logging.error(error_msg)
- logging.debug(f"Command: {completed.args}")
- logging.debug(f"Returncode: {completed.returncode}")
- raise RuntimeError("shell command related error, find details right above this python trace")
-
-
def generate_env(env={}, podman=False):
ret = dict(env_extra)
path = os.path.join(testenv.data_dir, "scripts")
@@ -139,4 +131,5 @@
if p.returncode == 0 or not check:
return p
- exit_error_cmd(p, "Command failed unexpectedly")
+ logging.error(f"Command failed unexpectedly (returncode: {p.returncode})")
+ sys.exit(1)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41868?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I508322b017e5ed9c21396384ef759a4c49c8d3da
Gerrit-Change-Number: 41868
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>