daniel has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-gbproxy/+/26037 )


Change subject: gbproxy: Correctly extract TLLI from DL/UL unitdata
......................................................................

gbproxy: Correctly extract TLLI from DL/UL unitdata

The unitdata PDUs have a different header structure so then need to be
parsed differently.

Fixes TTCN3 test TC_status_ptp_ul_tlli

Related: SYS#5235, OS#4892
Change-Id: I76896f2eee588c9a286b87b69b5b58232759a6d5
---
M src/gb_proxy.c
1 file changed, 14 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gbproxy refs/changes/37/26037/1

diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 7333e80..2be4b6b 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -1017,8 +1017,20 @@
        struct tlv_parsed tp_inner[2];

        /* TODO: Parse partial messages as well */
-       rc = osmo_tlv_prot_parse(&osmo_pdef_bssgp, tp_inner, 
ARRAY_SIZE(tp_inner), bgph->pdu_type, bgph->data,
-                                pdu_len - sizeof(*bgph), 0, 0, DGPRS, log_pfx);
+       if (bgph->pdu_type == BSSGP_PDUT_UL_UNITDATA || bgph->pdu_type == 
BSSGP_PDUT_DL_UNITDATA) {
+               const struct bssgp_ud_hdr *budh = (struct bssgp_ud_hdr *) 
(struct bssgp_ud_hdr *)pdu_data;
+               if (pdu_len < sizeof(*budh))
+                       return -EINVAL;
+               rc = osmo_tlv_prot_parse(&osmo_pdef_bssgp, tp_inner, 
ARRAY_SIZE(tp_inner), bgph->pdu_type, budh->data,
+                                        pdu_len - sizeof(*budh), 0, 0, DGPRS, 
log_pfx);
+               /* populate TLLI from the fixed headser into the TLV-parsed 
array so later code
+                * doesn't have to worry where the TLLI came from */
+               tp_inner[0].lv[BSSGP_IE_TLLI].len = 4;
+               tp_inner[0].lv[BSSGP_IE_TLLI].val = (const uint8_t *) 
&budh->tlli;
+       } else {
+               rc = osmo_tlv_prot_parse(&osmo_pdef_bssgp, tp_inner, 
ARRAY_SIZE(tp_inner), bgph->pdu_type, bgph->data,
+                                        pdu_len - sizeof(*bgph), 0, 0, DGPRS, 
log_pfx);
+       }

        if (rc < 0)
                return rc;

--
To view, visit https://gerrit.osmocom.org/c/osmo-gbproxy/+/26037
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: I76896f2eee588c9a286b87b69b5b58232759a6d5
Gerrit-Change-Number: 26037
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <[email protected]>
Gerrit-MessageType: newchange

Reply via email to