Change in libosmocore[master]: gprs_ns2_sns: Don't clear remote IP endpoints in SGSN role

laforge gerrit-no-reply at lists.osmocom.org
Tue Mar 23 23:53:28 UTC 2021


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

Change subject: gprs_ns2_sns: Don't clear remote IP endpoints in SGSN role
......................................................................

gprs_ns2_sns: Don't clear remote IP endpoints in SGSN role

In BSS role, we can clear local + remote endpoints when sending
SNS-CONFIG, as we are first.

In SGSN role, we must not clear remote endpoints when sending
SNS-CONFIG, as we are last, and the BSS has just previously told
us its IP endpoints in the BSS-originated SNS-CONFIG.

Change-Id: I58549707ac5a3a0aae5f9348ed76f16c09ad3e46
Related: OS#3373
---
M src/gb/gprs_ns2_sns.c
1 file changed, 15 insertions(+), 7 deletions(-)

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



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 2bcd0df..f36e8d0 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -298,16 +298,21 @@
 	osmo_fsm_inst_dispatch(fi, GPRS_SNS_EV_REQ_NO_NSVC, NULL);
 }
 
-static void ns2_clear_ipv46_entries(struct ns2_sns_state *gss)
+static void ns2_clear_ipv46_entries_local(struct ns2_sns_state *gss)
 {
 	TALLOC_FREE(gss->ip4_local);
-	TALLOC_FREE(gss->ip4_remote);
 	TALLOC_FREE(gss->ip6_local);
-	TALLOC_FREE(gss->ip6_remote);
 
 	gss->num_ip4_local = 0;
-	gss->num_ip4_remote = 0;
 	gss->num_ip6_local = 0;
+}
+
+static void ns2_clear_ipv46_entries_remote(struct ns2_sns_state *gss)
+{
+	TALLOC_FREE(gss->ip4_remote);
+	TALLOC_FREE(gss->ip6_remote);
+
+	gss->num_ip4_remote = 0;
 	gss->num_ip6_remote = 0;
 }
 
@@ -757,7 +762,7 @@
 	struct osmo_sockaddr local;
 	int count;
 
-	ns2_clear_ipv46_entries(gss);
+	ns2_clear_ipv46_entries_local(gss);
 
 	/* no initial available */
 	if (gss->role == GPRS_SNS_ROLE_BSS) {
@@ -1490,7 +1495,8 @@
 		 * gprs_ns2_free_nsvcs() will trigger NO_NSVC, prevent this from triggering a reselection */
 		gss->reselection_running = true;
 		gprs_ns2_free_nsvcs(nse);
-		ns2_clear_ipv46_entries(gss);
+		ns2_clear_ipv46_entries_local(gss);
+		ns2_clear_ipv46_entries_remote(gss);
 
 		/* Choose the next sns endpoint. */
 		if (llist_empty(&gss->sns_endpoints) || llist_empty(&gss->binds)) {
@@ -2132,8 +2138,10 @@
 		if (flag & 1) {
 			struct gprs_ns2_vc *nsvc, *nsvc2;
 			/* clear all state */
+			osmo_fsm_inst_state_chg(fi, GPRS_SNS_ST_UNCONFIGURED, 0, 0);
 			gss->N = 0;
-			ns2_clear_ipv46_entries(gss);
+			ns2_clear_ipv46_entries_local(gss);
+			ns2_clear_ipv46_entries_remote(gss);
 			llist_for_each_entry_safe(nsvc, nsvc2, &gss->nse->nsvc, list) {
 				if (nsvc == gss->sns_nsvc) {
 					/* keep the NSVC we need for SNS, but unconfigure it */

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I58549707ac5a3a0aae5f9348ed76f16c09ad3e46
Gerrit-Change-Number: 23409
Gerrit-PatchSet: 6
Gerrit-Owner: laforge <laforge at osmocom.org>
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: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210323/b48d0ac9/attachment.htm>


More information about the gerrit-log mailing list