aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_sns.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-03-04 17:49:59 +0100
committerHarald Welte <laforge@osmocom.org>2021-03-24 00:30:22 +0100
commit46eb7643c9293afbc863de84b1e782c5f8bf859f (patch)
treec1d1dad89121a676e383642697b58da676e8e5a9 /src/gb/gprs_ns2_sns.c
parent579699bc2d9a7777f748eadeb151103794ce6a79 (diff)
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
Diffstat (limited to 'src/gb/gprs_ns2_sns.c')
-rw-r--r--src/gb/gprs_ns2_sns.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 2bcd0df3..f36e8d0b 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -298,16 +298,21 @@ void ns2_sns_replace_nsvc(struct gprs_ns2_vc *nsvc)
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 @@ static void ns2_sns_compute_local_ep_from_binds(struct osmo_fsm_inst *fi)
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 @@ static void ns2_sns_st_all_action_bss(struct osmo_fsm_inst *fi, uint32_t event,
* 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 @@ static void ns2_sns_st_all_action_sgsn(struct osmo_fsm_inst *fi, uint32_t event,
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 */