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
Wed Nov 3 07:55:58 UTC 2021


daniel has submitted this change. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 0fa8be3..9845a09 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: 2
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211103/eac48a19/attachment.htm>


More information about the gerrit-log mailing list