aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-12-06 02:40:44 +0100
committerlaforge <laforge@osmocom.org>2020-12-07 13:13:06 +0000
commit42ad54915285f689ea487b1fbbaed3d08bcfedef (patch)
treeb6f1f9159ce839e3fa5cdc089020e78be7b74bec
parente03d863e1fa65f3587499cb50d1e04537d215611 (diff)
gprs_ns2_sns: dynamic calculate the maximum NS-VCs
The previous hard-coded value could be not enough if the user configures too many local binds. Allow at least 8 NS-VCs. In case the user configures too many binds (> 2) increase the maximum NS-VCs to allow the SGSN to have 4 redundant connections. Change-Id: Iae859dc504716fd6f705e72db5fc293b4b3298e7
-rw-r--r--src/gb/gprs_ns2_sns.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 9091c9a9..50a1f9b8 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -1265,6 +1265,7 @@ int ns2_sns_bss_fsm_start(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc,
gss->sns_nsvc = nsvc;
nsvc->sns_only = true;
+ /* count how many bindings are available (only UDP binds) */
int count = 0;
llist_for_each_entry(bind, &nsi->binding, list) {
if (!gprs_ns2_is_ip_bind(bind))
@@ -1320,6 +1321,7 @@ int ns2_sns_bss_fsm_start(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc,
gss->num_ip4_local = count;
gss->num_max_ip4_remote = 4;
+ gss->num_max_nsvcs = OSMO_MAX(gss->num_max_ip4_remote * 4, 8);
break;
case IPv6:
/* IPv6 */
@@ -1358,11 +1360,10 @@ int ns2_sns_bss_fsm_start(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc,
}
gss->num_ip6_local = count;
gss->num_max_ip6_remote = 4;
+ gss->num_max_nsvcs = OSMO_MAX(gss->num_max_ip6_remote * 4, 8);
break;
}
- gss->num_max_nsvcs = 8;
-
return osmo_fsm_inst_dispatch(nse->bss_sns_fi, GPRS_SNS_EV_START, NULL);
err: