Change in osmo-gbproxy[master]: gbproxy: Only use one struct tlv_parsed for gbproxy_decode_bssgp

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/.

daniel gerrit-no-reply at lists.osmocom.org
Tue Nov 2 13:36:29 UTC 2021


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


Change subject: gbproxy: Only use one struct tlv_parsed for gbproxy_decode_bssgp
......................................................................

gbproxy: Only use one struct tlv_parsed for gbproxy_decode_bssgp

Change-Id: I7965a4b68866c619159c524a63e051b0d9cbe80f
---
M src/gb_proxy.c
1 file changed, 10 insertions(+), 10 deletions(-)



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

diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index ca8f998..c42e872 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -1009,18 +1009,18 @@
 	int pdu_len = TLVP_LEN(&tp[0], BSSGP_IE_PDU_IN_ERROR);
 	const uint8_t *pdu_data = TLVP_VAL(&tp[0], BSSGP_IE_PDU_IN_ERROR);
 	struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *)pdu_data;
-	struct tlv_parsed tp_inner[2];
+	struct tlv_parsed tp_inner;
 
 	/* TODO: Parse partial messages as well */
-	rc = gbproxy_decode_bssgp(bgph, pdu_len, &tp_inner[0], log_pfx);
+	rc = gbproxy_decode_bssgp(bgph, pdu_len, &tp_inner, log_pfx);
 	if (rc < 0)
 		return rc;
 
-	if (TLVP_PRESENT(&tp_inner[0], BSSGP_IE_TLLI)) {
-		*tlli = osmo_load32be(TLVP_VAL(&tp_inner[0], BSSGP_IE_TLLI));
-	} else if (TLVP_PRESENT(&tp_inner[0], BSSGP_IE_TMSI)) {
+	if (TLVP_PRESENT(&tp_inner, BSSGP_IE_TLLI)) {
+		*tlli = osmo_load32be(TLVP_VAL(&tp_inner, BSSGP_IE_TLLI));
+	} else if (TLVP_PRESENT(&tp_inner, BSSGP_IE_TMSI)) {
 		/* we treat the TMSI like a TLLI and extract the NRI from it */
-		*tlli = osmo_load32be(TLVP_VAL(&tp_inner[0], BSSGP_IE_TMSI));
+		*tlli = osmo_load32be(TLVP_VAL(&tp_inner, BSSGP_IE_TMSI));
 		/* Convert the TMSI into a FOREIGN TLLI so it is routed appropriately */
 		*tlli = gprs_tmsi2tlli(*tlli, TLLI_FOREIGN);
 	} else {
@@ -1037,15 +1037,15 @@
 	int pdu_len = TLVP_LEN(&tp[0], BSSGP_IE_PDU_IN_ERROR);
 	const uint8_t *pdu_data = TLVP_VAL(&tp[0], BSSGP_IE_PDU_IN_ERROR);
 	struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *)pdu_data;
-	struct tlv_parsed tp_inner[2];
+	struct tlv_parsed tp_inner;
 
 	/* TODO: Parse partial messages as well */
-	rc = gbproxy_decode_bssgp(bgph, pdu_len, &tp_inner[0], log_pfx);
+	rc = gbproxy_decode_bssgp(bgph, pdu_len, &tp_inner, log_pfx);
 	if (rc < 0)
 		return rc;
 
-	if (TLVP_PRESENT(&tp_inner[0], BSSGP_IE_BVCI))
-		*bvci = ntohs(tlvp_val16_unal(&tp_inner[0], BSSGP_IE_BVCI));
+	if (TLVP_PRESENT(&tp_inner, BSSGP_IE_BVCI))
+		*bvci = ntohs(tlvp_val16_unal(&tp_inner, BSSGP_IE_BVCI));
 	else
 		return -ENOENT;
 

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

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: I7965a4b68866c619159c524a63e051b0d9cbe80f
Gerrit-Change-Number: 26064
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211102/4460a510/attachment.htm>


More information about the gerrit-log mailing list