Change in libosmocore[master]: gprs_ns2_sns: clear local and remote entries when SNS failed

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Fri Jan 15 00:46:15 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22206 )


Change subject: gprs_ns2_sns: clear local and remote entries when SNS failed
......................................................................

gprs_ns2_sns: clear local and remote entries when SNS failed

The local and remote entries should be cleared on SNS Size.
Further it can be cleared when SNS failed (e.g. all NSVC become dead)
so VTY doesn't show old entries before entering SNS Size.

Related: OS#4949
Change-Id: Ie4db81acdd5f8ddf1a1f5dc7645d1144545d9c73
---
M src/gb/gprs_ns2_sns.c
1 file changed, 28 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/06/22206/1

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 1958477..dc40a26 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -255,6 +255,31 @@
 	}
 }
 
+static void ns2_clear_ipv46_entries(struct ns2_sns_state *gss)
+{
+	if (gss->ip4_local) {
+		talloc_free(gss->ip4_local);
+		gss->ip4_local = NULL;
+	}
+	if (gss->ip4_remote) {
+		talloc_free(gss->ip4_remote);
+		gss->ip4_remote = NULL;
+	}
+	if (gss->ip6_local) {
+		talloc_free(gss->ip6_local);
+		gss->ip6_local = NULL;
+	}
+	if (gss->ip6_remote) {
+		talloc_free(gss->ip6_remote);
+		gss->ip6_remote = NULL;
+	}
+
+	gss->num_ip4_local = 0;
+	gss->num_ip4_remote = 0;
+	gss->num_ip6_local = 0;
+	gss->num_ip6_remote = 0;
+}
+
 static void ns2_nsvc_create_ip4(struct osmo_fsm_inst *fi,
 				 struct gprs_ns2_nse *nse,
 				 const struct gprs_ns_ie_ip4_elem *ip4)
@@ -713,6 +738,8 @@
 	if (old_state != GPRS_SNS_ST_UNCONFIGURED)
 		ns2_prim_status_ind(gss->nse, NULL, 0, NS_AFF_CAUSE_SNS_FAILURE);
 
+	ns2_clear_ipv46_entries(gss);
+
 	/* no initial available */
 	if (!gss->initial)
 		return;
@@ -1360,6 +1387,7 @@
 		 * 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);
 
 		/* Choose the next sns endpoint. */
 		if (llist_empty(&gss->sns_endpoints)) {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie4db81acdd5f8ddf1a1f5dc7645d1144545d9c73
Gerrit-Change-Number: 22206
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210115/3a4a05d6/attachment.htm>


More information about the gerrit-log mailing list