pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email )
Change subject: tbf_ul: Clean and assert code path generating new UL data block
......................................................................
tbf_ul: Clean and assert code path generating new UL data block
Clarify the several paths when generating a new BSN (UL data block).
The function create_new_bsn() is only called if there's some LLC frame
ready to be transmitted and put in ul_tbf->llc_tx_msg, so the do while
{} condition checking for no llc_tx_msg is guaranteed to only be run in
the event some LLC frame chunks have been included in the UL RLC block.
This fact allows simplifying the code and at the same time fix a
Coverity CID regarding a code path which could not really happen. We now
guard this case with an ASSERT.
Related: Coverity CID#345063
Change-Id: I6d4ae377a60839f76295c0e7e6aaa1fe53e37315
---
M src/rlcmac/tbf_ul.c
1 file changed, 37 insertions(+), 15 deletions(-)
Approvals:
jolly: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c
index 0ea0a9c..67c9e98 100644
--- a/src/rlcmac/tbf_ul.c
+++ b/src/rlcmac/tbf_ul.c
@@ -684,6 +684,7 @@
if (!ul_tbf->llc_tx_msg || msgb_length(ul_tbf->llc_tx_msg) == 0)
gprs_rlcmac_ul_tbf_schedule_next_llc_frame(ul_tbf);
+ /* This function shall only be called if there's some LLC payload not yet transmitted: */
OSMO_ASSERT(ul_tbf->llc_tx_msg);
OSMO_ASSERT(gprs_rlcmac_mcs_is_valid(cs));
@@ -734,27 +735,29 @@
int payload_written = 0;
if (!ul_tbf->llc_tx_msg || msgb_length(ul_tbf->llc_tx_msg) == 0) {
+ const int space = block_data_len - write_offset;
+ /* Only get here in case we already encoded the end of
+ * some LLC payload chunk and there's no more new LLC
+ * payloads to send */
+ OSMO_ASSERT(num_chunks > 0);
+
/* The data just drained, store the current fn */
if (ul_tbf->last_ul_drained_fn < 0)
ul_tbf->last_ul_drained_fn = bi->fn;
- int space = block_data_len - write_offset;
+ /* Nothing to send, and we already put some data in
+ * rlcmac data block, we are done */
+ LOGPTBFUL(ul_tbf, LOGL_DEBUG,
+ "LLC queue completely drained and there's "
+ "still %d free bytes in rlcmac data block\n", space);
- if (num_chunks != 0) {
- /* Nothing to send, and we already put some data in
- * rlcmac data block, we are done */
- LOGPTBFUL(ul_tbf, LOGL_DEBUG,
- "LLC queue completely drained and there's "
- "still %d free bytes in rlcmac data block\n", space);
-
- if (gprs_rlcmac_mcs_is_edge(cs)) {
- /* in EGPRS there's no M bit, so we need
- * to flag padding with LI=127 */
- gprs_rlcmac_rlc_data_to_ul_append_egprs_li_padding(
- rdbi, &write_offset, &num_chunks, data);
- }
- break;
+ if (gprs_rlcmac_mcs_is_edge(cs)) {
+ /* in EGPRS there's no M bit, so we need to flag
+ * padding with LI=127 */
+ gprs_rlcmac_rlc_data_to_ul_append_egprs_li_padding(
+ rdbi, &write_offset, &num_chunks, data);
}
+ break;
}
ar = gprs_rlcmac_enc_append_ul_data(rdbi, cs, ul_tbf->llc_tx_msg, &write_offset,
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6d4ae377a60839f76295c0e7e6aaa1fe53e37315
Gerrit-Change-Number: 35882
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: pespin.
jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email )
Change subject: tbf_ul: Clean and assert code path generating new UL data block
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35882?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6d4ae377a60839f76295c0e7e6aaa1fe53e37315
Gerrit-Change-Number: 35882
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Feb 2024 09:47:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35890?usp=email )
Change subject: global_platform: Add --suppress-key-check option to put_key command
......................................................................
global_platform: Add --suppress-key-check option to put_key command
In some cases we may not want to auto-generate the Key Check Values.
Change-Id: I244b717b3e3aae6eb3ad512f9e23ff0b65958bb7
---
M pySim/global_platform/__init__.py
1 file changed, 18 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/90/35890/1
diff --git a/pySim/global_platform/__init__.py b/pySim/global_platform/__init__.py
index ca99f5f..4d553a7 100644
--- a/pySim/global_platform/__init__.py
+++ b/pySim/global_platform/__init__.py
@@ -515,12 +515,17 @@
put_key_parser.add_argument('--key-type', choices=KeyType.ksymapping.values(), action='append', required=True, help='Key Type')
put_key_parser.add_argument('--key-data', type=is_hexstr, action='append', required=True, help='Key Data Block')
put_key_parser.add_argument('--key-check', type=is_hexstr, action='append', help='Key Check Value')
+ put_key_parser.add_argument('--suppress-key-check', action='store_true', help='Suppress generation of Key Check Values')
@cmd2.with_argparser(put_key_parser)
def do_put_key(self, opts):
"""Perform the GlobalPlatform PUT KEY command in order to store a new key on the card.
See GlobalPlatform CardSpecification v2.3 Section 11.8 for details.
+ The KCV (Key Check Values) can either be explicitly specified using `--key-check`, or will
+ otherwise be automatically generated for DES and AES keys. You can suppress the latter using
+ `--suppress-key-check`.
+
Example (SCP80 KIC/KID/KIK):
put_key --key-version-nr 1 --key-id 0x01 --key-type aes --key-data 000102030405060708090a0b0c0d0e0f
--key-type aes --key-data 101112131415161718191a1b1c1d1e1f
@@ -537,6 +542,8 @@
for i in range(0, len(opts.key_type)):
if opts.key_check and len(opts.key_check) > i:
kcv = opts.key_check[i]
+ elif opts.suppress_key_check:
+ kcv = ''
else:
kcv_bin = compute_kcv(opts.key_type[i], h2b(opts.key_data[i])) or b''
kcv = b2h(kcv_bin)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35890?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I244b717b3e3aae6eb3ad512f9e23ff0b65958bb7
Gerrit-Change-Number: 35890
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
Attention is currently required from: laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35884?usp=email )
Change subject: epdg: Introduce test TC_ho_lte_to_wifi
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> it's great that we have *that* kind of exotic test coverage. […]
Most of the stuff is really on other nodes, in ePDG/AAA it's just about adding Create/DeleteBearerRequest, and it helps me have the full state model in place.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35884?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibdfeda1fa5d7016b1952d64b306cd501cb33f61b
Gerrit-Change-Number: 35884
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 06 Feb 2024 17:51:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment