Change in libosmocore[master]: gprs_ns2_sns: free the NSE if the SIZE PDU is not valid

laforge gerrit-no-reply at lists.osmocom.org
Fri Aug 13 09:55:52 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24650 )

Change subject: gprs_ns2_sns: free the NSE if the SIZE PDU is not valid
......................................................................

gprs_ns2_sns: free the NSE if the SIZE PDU is not valid

The SGSN fsm should be freed when becoming invalid instead of going
into the unconfigured state. The unconfigured states should be only used
when creating the NSE (on the SGSN side).

Change-Id: Ife889091ecba4180a90743deb786767008fe863d
---
M src/gb/gprs_ns2_sns.c
1 file changed, 14 insertions(+), 0 deletions(-)

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



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 5e43d8c..a9ace5f 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2246,12 +2246,16 @@
 		    !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);
+			if (fi->state == GPRS_SNS_ST_UNCONFIGURED)
+				sns_failed(fi, "Rx Size: Missing essential IE");
 			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);
+			if (fi->state == GPRS_SNS_ST_UNCONFIGURED)
+				sns_failed(fi, "Rx Size: Missing essential IE");
 			break;
 		}
 		if (TLVP_PRES_LEN(tp, NS_IE_IPv4_EP_NR, 2))
@@ -2275,6 +2279,8 @@
 			else
 				cause = NS_CAUSE_INVAL_NR_IPv6_EP;
 			ns2_tx_sns_size_ack(gss->sns_nsvc, &cause);
+			if (fi->state == GPRS_SNS_ST_UNCONFIGURED)
+				sns_failed(fi, "Rx Size: Invalid Nr of IPv4/IPv6 EPs");
 			break;
 		}
 		/* ensure number of NS-VCs is sufficient for full mesh */
@@ -2285,6 +2291,8 @@
 				 num_remote_eps, num_local_eps * num_remote_eps, gss->num_max_nsvcs);
 			cause = NS_CAUSE_INVAL_NR_NS_VC;
 			ns2_tx_sns_size_ack(gss->sns_nsvc, &cause);
+			if (fi->state == GPRS_SNS_ST_UNCONFIGURED)
+				sns_failed(fi, NULL);
 			break;
 		}
 		/* perform state reset, if requested */
@@ -2309,6 +2317,12 @@
 			}
 			ns2_sns_compute_local_ep_from_binds(fi);
 		}
+
+		if (fi->state == GPRS_SNS_ST_UNCONFIGURED && !(flag & 1)) {
+			sns_failed(fi, "Rx Size without Reset flag, but NSE is unknown");
+			break;
+		}
+
 		/* send SIZE_ACK */
 		ns2_tx_sns_size_ack(gss->sns_nsvc, NULL);
 		/* only wait for SNS-CONFIG in case of Reset flag */

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ife889091ecba4180a90743deb786767008fe863d
Gerrit-Change-Number: 24650
Gerrit-PatchSet: 6
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
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/20210813/1745cd97/attachment.htm>


More information about the gerrit-log mailing list