Change in libosmocore[master]: gprs_ns2_sns: Verify mandatory IE presence in incoming SNS-SIZE

laforge gerrit-no-reply at lists.osmocom.org
Fri Mar 19 12:38:55 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/23410 )


Change subject: gprs_ns2_sns: Verify mandatory IE presence in incoming SNS-SIZE
......................................................................

gprs_ns2_sns: Verify mandatory IE presence in incoming SNS-SIZE

Change-Id: I40571e313c3332d8cead8fb4aa9768d0d083804d
---
M src/gb/gprs_ns2_sns.c
1 file changed, 11 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/10/23410/1

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index e60664b..c2c5b5e 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2123,14 +2123,23 @@
 	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 	struct tlv_parsed *tp = NULL;
 	uint8_t flag;
+	uint8_t cause;
 
 	OSMO_ASSERT(gss->role == GPRS_SNS_ROLE_SGSN);
 
 	switch (event) {
 	case GPRS_SNS_EV_RX_SIZE:
 		tp = (struct tlv_parsed *) data;
-		if (!TLVP_PRES_LEN(tp, NS_IE_RESET_FLAG, 1)) {
-			uint8_t cause = NS_CAUSE_MISSING_ESSENT_IE;
+		/* check for mandatory / conditional IEs */
+		if (!TLVP_PRES_LEN(tp, NS_IE_RESET_FLAG, 1) ||
+		    !TLVP_PRES_LEN(tp, NS_IE_MAX_NR_NSVC, 2)) {
+			cause = NS_CAUSE_MISSING_ESSENT_IE;
+			ns2_tx_sns_size_ack(gss->sns_nsvc, &cause);
+			break;
+		}
+		if (!TLVP_PRES_LEN(tp, NS_IE_IPv4_EP_NR, 2) &&
+		    !TLVP_PRES_LEN(tp, NS_IE_IPv6_EP_NR, 2)) {
+			cause = NS_CAUSE_MISSING_ESSENT_IE;
 			ns2_tx_sns_size_ack(gss->sns_nsvc, &cause);
 			break;
 		}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I40571e313c3332d8cead8fb4aa9768d0d083804d
Gerrit-Change-Number: 23410
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210319/47fd4ede/attachment.htm>


More information about the gerrit-log mailing list