Change in libosmocore[master]: gprs_ns2_sns: refactor ns2_clear_ipv46_entries_local to use new elems...

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

laforge gerrit-no-reply at lists.osmocom.org
Mon Jun 7 12:39:48 UTC 2021


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

Change subject: gprs_ns2_sns: refactor ns2_clear_ipv46_entries_local to use new elems functions
......................................................................

gprs_ns2_sns: refactor ns2_clear_ipv46_entries_local to use new elems functions

Related: OS#5036
Change-Id: I7225f7a4215842f0ea601ce6d9d38220f98f808d
---
M src/gb/gprs_ns2_sns.c
1 file changed, 10 insertions(+), 19 deletions(-)

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



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 66dd421..0c1ca6d 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -295,22 +295,13 @@
 	osmo_fsm_inst_dispatch(fi, GPRS_SNS_EV_REQ_NO_NSVC, NULL);
 }
 
-static void ns2_clear_ipv46_entries_local(struct ns2_sns_state *gss)
+static void ns2_clear_elems(struct ns2_sns_elems *elems)
 {
-	TALLOC_FREE(gss->local.ip4);
-	TALLOC_FREE(gss->local.ip6);
+	TALLOC_FREE(elems->ip4);
+	TALLOC_FREE(elems->ip6);
 
-	gss->local.num_ip4 = 0;
-	gss->local.num_ip6 = 0;
-}
-
-static void ns2_clear_ipv46_entries_remote(struct ns2_sns_state *gss)
-{
-	TALLOC_FREE(gss->remote.ip4);
-	TALLOC_FREE(gss->remote.ip6);
-
-	gss->remote.num_ip4 = 0;
-	gss->remote.num_ip6 = 0;
+	elems->num_ip4 = 0;
+	elems->num_ip6 = 0;
 }
 
 static void ns2_vc_create_ip(struct osmo_fsm_inst *fi, struct gprs_ns2_nse *nse, const struct osmo_sockaddr *remote,
@@ -789,7 +780,7 @@
 	struct osmo_sockaddr local;
 	int count;
 
-	ns2_clear_ipv46_entries_local(gss);
+	ns2_clear_elems(&gss->local);
 
 	/* no initial available */
 	if (gss->role == GPRS_SNS_ROLE_BSS) {
@@ -1585,8 +1576,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_local(gss);
-		ns2_clear_ipv46_entries_remote(gss);
+		ns2_clear_elems(&gss->local);
+		ns2_clear_elems(&gss->remote);
 
 		/* Choose the next sns endpoint. */
 		if (!ns2_sns_bss_valid_configuration(gss)) {
@@ -2282,8 +2273,8 @@
 			/* clear all state */
 			osmo_fsm_inst_state_chg(fi, GPRS_SNS_ST_UNCONFIGURED, 0, 0);
 			gss->N = 0;
-			ns2_clear_ipv46_entries_local(gss);
-			ns2_clear_ipv46_entries_remote(gss);
+			ns2_clear_elems(&gss->local);
+			ns2_clear_elems(&gss->remote);
 			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/+/24583
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7225f7a4215842f0ea601ce6d9d38220f98f808d
Gerrit-Change-Number: 24583
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20210607/19e7dd59/attachment.htm>


More information about the gerrit-log mailing list