This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/6327
tlv_parser: Report *first* occurrence of repeated IEs
Most GSM related specifications require the receiver to use the
*first* occurrence of repeated IEs. The Osmocom TLV parser so
far did the opposite: It reported only the *last* occurrence in
case of repeated IEs. Let's change our implementation to be
more in-line with relevant specs, such as 3GPP TS 24.008 8.6.3.
Change-Id: Icde09e075f68c842a7a96cf7160c8e44b77cf82d
---
M src/gsm/tlv_parser.c
1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/6327/1
diff --git a/src/gsm/tlv_parser.c b/src/gsm/tlv_parser.c
index 9b1fb17..b8c7149 100644
--- a/src/gsm/tlv_parser.c
+++ b/src/gsm/tlv_parser.c
@@ -276,8 +276,13 @@
&buf[ofs], buf_len-ofs);
if (rv < 0)
return rv;
- dec->lv[tag].val = val;
- dec->lv[tag].len = len;
+ /* Most GSM related protocols clearly indicate that in case of duplicate
+ * IEs, only the first occurrence shall be used, while any further occurrences
+ * shall be ignored. See e.g. 3GPP TS 24.008 Section 8.6.3 */
+ if (dec->lv[tag].val == NULL) {
+ dec->lv[tag].val = val;
+ dec->lv[tag].len = len;
+ }
ofs += rv;
num_parsed++;
}
--
To view, visit https://gerrit.osmocom.org/6327
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icde09e075f68c842a7a96cf7160c8e44b77cf82d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>