lynxis lazus has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/83/24583/1

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: 1
Gerrit-Owner: lynxis lazus <lyn...@fe80.eu>
Gerrit-MessageType: newchange

Reply via email to