Attention is currently required from: dexter, fixeria, laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/41229?usp=email
to look at the new patch set (#8).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: pySim-shell: add a logger class to centralize logging
......................................................................
pySim-shell: add a logger class to centralize logging
In many sub modules we still use print() to occassionally print status
messages or warnings. This technically does not hurt, but it is an unclean
solution which we should replace with something more mature.
Let's use python's built in logging framework to create a static logger
class that fits our needs. To maintain compatibility let's also make sure
that the logger class will behave like a normal print() statement when no
configuration parameters are supplied by the API user.
To illustrate how the approach can be used in sub-modules, this patch
replaces the print statements in runtime.py. The other print statements
will the be fixed in follow-up patches.
Related: OS#6864
Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
---
M pySim-shell.py
A pySim/log.py
M pySim/runtime.py
M tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
A tests/unittests/test_log.py
5 files changed, 289 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/29/41229/8
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41229?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
Gerrit-Change-Number: 41229
Gerrit-PatchSet: 8
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: fixeria, laforge.
Jenkins Builder has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/41229?usp=email )
Change subject: pySim-shell: add a logger class to centralize logging
......................................................................
Patch Set 7:
(1 comment)
File tests/unittests/test_log.py:
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/pysim/+/41229/comment/04959703_702d05f8?usp=em… :
PS7, Line 41: # When log messages are sent to an unconfigured PySimLogger class, we expect the unmodified message beeing
'beeing' may be misspelled - perhaps 'being'?
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41229?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: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
Gerrit-Change-Number: 41229
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 24 Oct 2025 10:36:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: fixeria, laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/41229?usp=email
to look at the new patch set (#7).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: pySim-shell: add a logger class to centralize logging
......................................................................
pySim-shell: add a logger class to centralize logging
In many sub modules we still use print() to occassionally print status
messages or warnings. This technically does not hurt, but it is an unclean
solution which we should replace with something more mature.
Let's use python's built in logging framework to create a static logger
class that fits our needs. To maintain compatibility let's also make sure
that the logger class will behave like a normal print() statement when no
configuration parameters are supplied by the API user.
To illustrate how the approach can be used in sub-modules, this patch
replaces the print statements in runtime.py. The other print statements
will the be fixed in follow-up patches.
Related: OS#6864
Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
---
M pySim-shell.py
A pySim/log.py
M pySim/runtime.py
M tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
A tests/unittests/test_log.py
5 files changed, 289 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/29/41229/7
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41229?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
Gerrit-Change-Number: 41229
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/41229?usp=email )
Change subject: pySim-shell: add a logger class to centralize logging
......................................................................
Patch Set 7:
(5 comments)
Patchset:
PS1:
> Yes, I think using pythons logging framework is the better option here.
Done
Patchset:
PS6:
> It would be nice to have a command line option `-v/--verbose` to increase logging verbosity of pySim […]
I have now added method to control the log level and the verbosity. In pySim-shell i have have now added a setable "verbose" that uses both methods in a simplified way. I also don't think that we need much here. In any case debugging will become a lot easier when we see the module name and the line number in the log.
File pySim/log.py:
https://gerrit.osmocom.org/c/pysim/+/41229/comment/307c21c4_a38fae9b?usp=em… :
PS6, Line 62: staticmethod
> You can use the `@classmethod` instead, which allows to reference "this class". […]
I think I have tried that, but _log_callback is passed to PySimLogHandler and this class may have problems with the cls parameter. I think I have tried that. At least @staticmethod worked better for me.
File pySim/runtime.py:
https://gerrit.osmocom.org/c/pysim/+/41229/comment/55f0c876_d059ad11?usp=em… :
PS6, Line 48: self.log = PySimLogger.get("RuntimeState")
> A more usual approach is to have a module-local logger: […]
I have now changed it to a module local logger. Makes sense. I found out that we can always get the module name from the logger (%(module)s). The parameter we give to getLogger may be just an arbitrary name (%(name)s).
So I think we should get the log using
log = PySimLogger.get("ABC")
"ABC" is then the log facility.
File tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok:
https://gerrit.osmocom.org/c/pysim/+/41229/comment/1c43327f_c68d1adb?usp=em… :
PS6, Line 9: USIM: a0000000871002
> is it intentional that we're loosing this output in the unit test? […]
This was intentional with the previous approach (even though it was not a good idea, but I thought that those messages were dispensable in the pySim-trace usecase).
Since the current approach should not alter the behavior of existing code by default we should not get the messages of course. However there still may be slight alterations. Insisting on not changing any output in the slightest way would require a lot of extra code in PySimLogger. At the moment we still lose the "warning: " prefix in one line. I think that this is acceptable.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41229?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: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb
Gerrit-Change-Number: 41229
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 24 Oct 2025 10:36:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: keith.
osmith has posted comments on this change by keith. ( https://gerrit.osmocom.org/c/osmo-msc/+/41221?usp=email )
Change subject: sqlite optimisation: check VLR earlier for dest. subscriber
......................................................................
Patch Set 2: Code-Review+1
(1 comment)
File src/libmsc/db.c:
https://gerrit.osmocom.org/c/osmo-msc/+/41221/comment/62c52f81_b797cdb2?usp… :
PS2, Line 759: "Subscriber %s%s is not attached, skipping SMS.\n",
```suggestion
"Subscriber %s%s is not attached, skipping SMS\n",
```
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/41221?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ibd07b9d200b48108d705ed4c461cc4ddfa421fd2
Gerrit-Change-Number: 41221
Gerrit-PatchSet: 2
Gerrit-Owner: keith <keith(a)rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: keith <keith(a)rhizomatica.org>
Gerrit-Comment-Date: Fri, 24 Oct 2025 07:00:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria, keith, pespin.
osmith has posted comments on this change by keith. ( https://gerrit.osmocom.org/c/osmo-msc/+/28340?usp=email )
Change subject: sqlite optimisation: Avoid unneeded database operation
......................................................................
Patch Set 7: Code-Review+2
(1 comment)
File src/libmsc/db.c:
https://gerrit.osmocom.org/c/osmo-msc/+/28340/comment/aabee786_c13e0fb3?usp… :
PS4, Line 302: id = $id LIMIT 1
> Not sure if this really a standard practice, given that not all database bacnends support the `LIMIT […]
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28340?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I777155c0f818b979c636bb59953719e472771603
Gerrit-Change-Number: 28340
Gerrit-PatchSet: 7
Gerrit-Owner: keith <keith(a)rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: keith <keith(a)rhizomatica.org>
Gerrit-Comment-Date: Fri, 24 Oct 2025 06:44:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: keith <keith(a)rhizomatica.org>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/41131?usp=email )
Change subject: vlr: Stop silent call before deduping subscribers
......................................................................
vlr: Stop silent call before deduping subscribers
Before this fix, A use count mismatch could be reached by:
* Completing a location updating procedure with TMSI.
* Disconnecting from the BTS.
* Starting a silent call from the MSC.
* Registering again with the same IMSI but a different TMSI.
This would cause the a new subscriber to be created without
the silent call use count, which in turn would cause the
assert in `vlr_subscr_put` in `trans_free` to fail with use count of -1.
Change-Id: If23f8b0e42d4a3a8bf1c8f5ca81b045834b6cccd
---
M include/osmocom/msc/silent_call.h
M src/libmsc/silent_call.c
M src/libvlr/vlr.c
3 files changed, 18 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
osmith: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/msc/silent_call.h b/include/osmocom/msc/silent_call.h
index fb53e90..6aea4c6 100644
--- a/include/osmocom/msc/silent_call.h
+++ b/include/osmocom/msc/silent_call.h
@@ -10,6 +10,7 @@
struct vty *vty);
extern int gsm_silent_call_stop(struct vlr_subscr *vsub);
+extern int gsm_silent_call_is_ongoing(struct vlr_subscr *vsub);
void trans_silent_call_free(struct gsm_trans *trans);
diff --git a/src/libmsc/silent_call.c b/src/libmsc/silent_call.c
index 327ed7f..9b89a62 100644
--- a/src/libmsc/silent_call.c
+++ b/src/libmsc/silent_call.c
@@ -186,3 +186,13 @@
trans_free(trans);
return 0;
}
+
+/* Does the subscriber have an ongoing silent call transaction? */
+int gsm_silent_call_is_ongoing(struct vlr_subscr *vsub)
+{
+ struct msc_a *msc_a = msc_a_for_vsub(vsub, true);
+ if (!msc_a)
+ return false;
+
+ return trans_find_by_type(msc_a, TRANS_SILENT_CALL) != NULL;
+}
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index c9055dc..21f9fc6 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -36,6 +36,7 @@
#include <osmocom/vlr/vlr.h>
#include <osmocom/gsupclient/gsup_client_mux.h>
#include <osmocom/msc/paging.h>
+#include <osmocom/msc/silent_call.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -642,6 +643,12 @@
if (!strcmp(vsub->imsi, imsi))
return;
+ /* If the same subscriber has silent call (probably pending) stop the silent call to prevent
+ * use count mismatch when freeing the transaction. */
+ exists = vlr_subscr_find_by_imsi(vsub->vlr, imsi, NULL);
+ if (gsm_silent_call_is_ongoing(exists))
+ gsm_silent_call_stop(exists);
+
/* We've just learned about this new IMSI, our primary key in the VLR. make sure to invalidate any prior VLR
* entries for this IMSI. */
exists = vlr_subscr_find_by_imsi(vsub->vlr, imsi, NULL);
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/41131?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: If23f8b0e42d4a3a8bf1c8f5ca81b045834b6cccd
Gerrit-Change-Number: 41131
Gerrit-PatchSet: 3
Gerrit-Owner: matanp <matan1008(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria, jolly, lynxis lazus, matanp, neels.
osmith has posted comments on this change by matanp. ( https://gerrit.osmocom.org/c/osmo-msc/+/41131?usp=email )
Change subject: vlr: Stop silent call before deduping subscribers
......................................................................
Patch Set 2: Code-Review+2
(2 comments)
Patchset:
PS2:
We already have a +1 from laforge and previously from jolly (before gsm_silent_call_is_ongoing was added). It looks like we don't have a better solution than this and it fixes running into an assert, so I'm adding +2 and merging it. Thanks @matan1008@gmail.com!
File src/libvlr/vlr.c:
https://gerrit.osmocom.org/c/osmo-msc/+/41131/comment/2ec1293c_beb9e04d?usp… :
PS1, Line 651: gsm_silent_call_stop(
> I added a check to make sure we stop only ongoing transactions
thanks!
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/41131?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: If23f8b0e42d4a3a8bf1c8f5ca81b045834b6cccd
Gerrit-Change-Number: 41131
Gerrit-PatchSet: 2
Gerrit-Owner: matanp <matan1008(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Attention: matanp <matan1008(a)gmail.com>
Gerrit-Comment-Date: Fri, 24 Oct 2025 06:22:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: matanp <matan1008(a)gmail.com>