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