dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/30637 )
Change subject: pySim-prog: rename write_parameters function.
......................................................................
pySim-prog: rename write_parameters function.
The function name "write_parameters" is very generic and since it is
called during the programming cycle it should be made clear that it is
not about writing parameters to the card.
Change-Id: Idaba672987230d7d0dd500409f9fe0b94ba39370
---
M pySim-prog.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/37/30637/1
diff --git a/pySim-prog.py b/pySim-prog.py
index d980901..61672ef 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -689,7 +689,7 @@
conn.close()
-def write_parameters(opts, params):
+def write_parameters_to_csv_and_hlr(opts, params):
write_params_csv(opts, params)
write_params_hlr(opts, params)
@@ -784,8 +784,8 @@
else:
print("Dry Run: NOT PROGRAMMING!")
- # Write parameters permanently
- write_parameters(opts, cp)
+ # Write parameters to a specified CSV file or an HLR database (not the card)
+ write_parameters_to_csv_and_hlr(opts, cp)
# Batch mode state update and save
if opts.num is not None:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/30637
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idaba672987230d7d0dd500409f9fe0b94ba39370
Gerrit-Change-Number: 30637
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/30635 )
Change subject: cards: check length of mnc more restrictively
......................................................................
cards: check length of mnc more restrictively
Since we now ensure that mnc always has a valid length lets make the
check in cards.py more strict.
Related: OS#5830
Change-Id: Iee8f25416e0cc3be96dff025affb1dc11d919fcd
---
M pySim/cards.py
1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/35/30635/1
diff --git a/pySim/cards.py b/pySim/cards.py
index 55965d7..9dfb1c2 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -205,10 +205,11 @@
# perform updates
if mnc and abstract_data['extensions']:
+ # Note: Since we derive the length of the MNC by the string length
+ # of the mnc parameter, the caller must ensure that mnc has the
+ # correct length and is padded with zeros (if necessary).
mnclen = len(str(mnc))
- if mnclen == 1:
- mnclen = 2
- if mnclen > 3:
+ if mnclen > 3 or mnclen < 2:
raise RuntimeError('invalid length of mnc "{}"'.format(mnc))
abstract_data['extensions']['mnc_len'] = mnclen
if opmode:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/30635
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iee8f25416e0cc3be96dff025affb1dc11d919fcd
Gerrit-Change-Number: 30635
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/30634 )
Change subject: pySim-prog: fix handling of mnclen parameter.
......................................................................
pySim-prog: fix handling of mnclen parameter.
The handling of the mnclen parameter does not work. Lets fix it so that
it can be used again with CSV and normal card programming. Lets ensure
that depending on the parameter and the defaults it is always ensured
that the mnc string has the correct length so that lower layers can
deduct the length of the mnc properly by the string length of the mnc.
Change-Id: I48a109296efcd7a3f37c183ff53c5fc9544e3cfc
Related: OS#5830
---
M pySim-prog.py
1 file changed, 36 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/34/30634/1
diff --git a/pySim-prog.py b/pySim-prog.py
index 335dcc3..5b452ee 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -114,8 +114,8 @@
)
parser.add_option("--mnclen", dest="mnclen", type="choice",
help="Length of Mobile Network Code [default: %default]",
- default=2,
- choices=[2, 3],
+ default="auto",
+ choices=["2", "3", "auto"],
)
parser.add_option("-m", "--smsc", dest="smsc",
help="SMSC number (Start with + for international no.) [default: '00 + country code + 5555']",
@@ -319,8 +319,15 @@
# MCC always has 3 digits
mcc = lpad(mcc, 3, "0")
- # MNC must be at least 2 digits
- mnc = lpad(mnc, 2, "0")
+
+ # The MNC must be at least 2 digits long. This is also the most common case.
+ # The user may specify an explicit length using the --mnclen option.
+ if opts.mnclen != "auto":
+ if len(mnc) > int(opts.mnclen):
+ raise ValueError('mcc is longer than specified in option --mnclen')
+ mnc = lpad(mnc, int(opts.mnclen), "0")
+ else:
+ mnc = lpad(mnc, 2, "0")
# Digitize country code (2 or 3 digits)
cc_digits = _cc_digits(opts.country)
@@ -591,10 +598,34 @@
def read_params_csv(opts, imsi=None, iccid=None):
+ """
+ Read the card parameters from a CSV file. This function will generate the
+ same dictionary that gen_parameters would generate from parameters passed as
+ commandline arguments.
+ """
+
row = find_row_in_csv_file(opts.read_csv, opts.num, iccid=iccid, imsi=imsi)
if row is not None:
row['mcc'] = row.get('mcc', mcc_from_imsi(row.get('imsi')))
- row['mnc'] = row.get('mnc', mnc_from_imsi(row.get('imsi')))
+
+ # We cannot determine the MNC length (2 or 3 digits?) from the IMSI
+ # alone. In cases where the user has specified an mnclen via the
+ # commandline options we can use that info, otherwise we guess that
+ # the length is 2, which is also the most common case.
+ if opts.mnclen != "auto":
+ if opts.mnclen is "2":
+ row['mnc'] = row.get('mnc', mnc_from_imsi(row.get('imsi'), False))
+ elif opts.mnclen is "3":
+ row['mnc'] = row.get('mnc', mnc_from_imsi(row.get('imsi'), True))
+ else:
+ raise ValueError("invalid parameter --mnclen, must be 2 or 3 or auto")
+ else:
+ row['mnc'] = row.get('mnc', mnc_from_imsi(row.get('imsi'), False))
+
+ # NOTE: We might concider to specify a new CSV field "mnclen" in our
+ # CSV files for a better automatization. However, this only makes sense
+ # when the tools and databases we export our files from will also add
+ # such a field.
pin_adm = None
# We need to escape the pin_adm we get from the csv
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/30634
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I48a109296efcd7a3f37c183ff53c5fc9544e3cfc
Gerrit-Change-Number: 30634
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/30636 )
Change subject: pySim-prog: make dry-run more realistic
......................................................................
pySim-prog: make dry-run more realistic
The process_card function has a dry-run mode where one can test
parameters without actually writing to the card. However, the dry-run
feature also does not perform read operations and connects to the card
reader at a different point in time. Lets be more accurate here and
perform all operations a normal programming cycle would perform but
without calling the card.program() method.
Change-Id: I3653bada1ad26bcf75109a935105273ee9d1525c
---
M pySim-prog.py
1 file changed, 14 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/36/30636/1
diff --git a/pySim-prog.py b/pySim-prog.py
index 5b452ee..d980901 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -738,22 +738,21 @@
def process_card(opts, first, ch):
+ # Connect transport
+ ch.get(first)
+
+ # Get card
+ card = card_detect(opts.type, scc)
+ if card is None:
+ print("No card detected!")
+ return -1
+
+ # Probe only
+ if opts.probe:
+ return 0
+
+ # Erase if requested (not in dry run mode!)
if opts.dry_run is False:
- # Connect transport
- ch.get(first)
-
- if opts.dry_run is False:
- # Get card
- card = card_detect(opts.type, scc)
- if card is None:
- print("No card detected!")
- return -1
-
- # Probe only
- if opts.probe:
- return 0
-
- # Erase if requested
if opts.erase:
print("Formatting ...")
card.erase()
@@ -766,15 +765,9 @@
imsi = None
iccid = None
if opts.read_iccid:
- if opts.dry_run:
- # Connect transport
- ch.get(False)
(res, _) = scc.read_binary(['3f00', '2fe2'], length=10)
iccid = dec_iccid(res)
elif opts.read_imsi:
- if opts.dry_run:
- # Connect transport
- ch.get(False)
(res, _) = scc.read_binary(EF['IMSI'])
imsi = swap_nibbles(res)[3:]
else:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/30636
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3653bada1ad26bcf75109a935105273ee9d1525c
Gerrit-Change-Number: 30636
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: Hoernchen.
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30633 )
Change subject: logging: add log level cache
......................................................................
Patch Set 2:
(3 comments)
File src/logging.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-1999):
https://gerrit.osmocom.org/c/libosmocore/+/30633/comment/adeb9050_702a0480
PS2, Line 101: static void log_cache_update_all()
Bad function definition - void log_cache_update_all() should probably be void log_cache_update_all(void)
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-1999):
https://gerrit.osmocom.org/c/libosmocore/+/30633/comment/584c2cfc_22ebdeec
PS2, Line 110: llist_for_each_entry (tgt, &osmo_log_target_list, entry) {
space prohibited between function name and open parenthesis '('
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-1999):
https://gerrit.osmocom.org/c/libosmocore/+/30633/comment/3786fff4_73033842
PS2, Line 131: llist_for_each_entry (tgt, &osmo_log_target_list, entry) {
space prohibited between function name and open parenthesis '('
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30633
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I35f8dd9127dd6e7feae392094fd6b3ce2d32558d
Gerrit-Change-Number: 30633
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 16 Dec 2022 16:09:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Hoernchen.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmocore/+/30633
to look at the new patch set (#2).
Change subject: logging: add log level cache
......................................................................
logging: add log level cache
This ensures multithreaded logging attempts, in particular ones that do
nothing, do not hold the lock just for checking the level, which
interferes with other logging attempts.
Change-Id: I35f8dd9127dd6e7feae392094fd6b3ce2d32558d
---
M include/osmocom/core/logging.h
M src/logging.c
M src/vty/logging_vty.c
3 files changed, 106 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/30633/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30633
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I35f8dd9127dd6e7feae392094fd6b3ce2d32558d
Gerrit-Change-Number: 30633
Gerrit-PatchSet: 2
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-MessageType: newpatchset
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/30620 )
Change subject: Convert tbf->control_ts to be a gprs_rlcmac_pdch*
......................................................................
Convert tbf->control_ts to be a gprs_rlcmac_pdch*
This allows having full information on the control TS easily reachable
(like TRX ofthe PDCH), and makes it easy to compare TS by simply
matching the pointer address.
Change-Id: I6a97b6528b2f9d78dfbca8fb97ab7c621f777fc7
---
M src/pcu_vty_functions.cpp
M src/pdch.cpp
M src/tbf.cpp
M src/tbf.h
M tests/alloc/AllocTest.cpp
M tests/alloc/AllocTest.err
M tests/alloc/AllocTest.ok
M tests/tbf/TbfTest.cpp
M tests/tbf/TbfTest.err
M tests/types/TypesTest.err
10 files changed, 51,486 insertions(+), 51,491 deletions(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/30620
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I6a97b6528b2f9d78dfbca8fb97ab7c621f777fc7
Gerrit-Change-Number: 30620
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(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>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: merged