gprs_ns2_sns: Compute local endpoints before using them
This fixes some bug introduced in Change-Id I1638f04ba45fef3ba0b237948dff6022267141fb
Related: OS#3373
Change-Id: Ic0873e63f1f046b674c7898480ff070a18a7abc7
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 51e4e9e..7268809 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2179,10 +2179,12 @@
/* decide if we go for IPv4 or IPv6 */
if (gss->num_max_ip6_remote && ns2_sns_count_num_local_ep(fi, IPv6)) {
gss->ip = IPv6;
+ ns2_sns_compute_local_ep_from_binds(fi);
num_local_eps = gss->num_ip6_local;
num_remote_eps = gss->num_max_ip6_remote;
} else if (gss->num_max_ip4_remote && ns2_sns_count_num_local_ep(fi, IPv4)) {
gss->ip = IPv4;
+ ns2_sns_compute_local_ep_from_binds(fi);
num_local_eps = gss->num_ip4_local;
num_remote_eps = gss->num_max_ip4_remote;
} else {
@@ -2193,7 +2195,6 @@
ns2_tx_sns_size_ack(gss->sns_nsvc, &cause);
break;
}
- ns2_sns_compute_local_ep_from_binds(fi);
/* ensure number of NS-VCs is sufficient for full mesh */
gss->num_max_nsvcs = tlvp_val16be(tp, NS_IE_MAX_NR_NSVC);
if (gss->num_max_nsvcs < num_remote_eps * num_local_eps) {
@@ -2224,6 +2225,7 @@
gprs_ns2_free_nsvc(nsvc);
}
}
+ ns2_sns_compute_local_ep_from_binds(fi);
}
/* send SIZE_ACK */
ns2_tx_sns_size_ack(gss->sns_nsvc, NULL);