diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-12-07 05:49:43 +0100 |
---|---|---|
committer | lynxis lazus <lynxis@fe80.eu> | 2020-12-15 11:46:45 +0000 |
commit | 81ae0aa67fdcf7a791a968131a28836d6f6bc902 (patch) | |
tree | 4552a844ae8f6df1a65b052ba777e462c0b29d8b /src/gb | |
parent | e769f5226be6b0f8d59366c7b9a156e9cf8fc22d (diff) |
gprs_ns2_sns: use different binds for the initial connection
In case the first bind is not working the SNS would never build a
succesful connection to the SGSN. Iterate over all binds by
using an offset.
Instead of tracking the binds use an offset instead of a direct pointer.
This might result in skipping the order of the next bind.
Change-Id: I4a0a0608dac6ad8b5769ada2a14ca23f61eb0bcb
Diffstat (limited to 'src/gb')
-rw-r--r-- | src/gb/gprs_ns2_sns.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c index b7fbbf80..0676b619 100644 --- a/src/gb/gprs_ns2_sns.c +++ b/src/gb/gprs_ns2_sns.c @@ -117,6 +117,8 @@ struct ns2_sns_state { struct sns_endpoint *initial; /* all SNS PDU will be sent over this nsvc */ struct gprs_ns2_vc *sns_nsvc; + /* iterate over the binds after all remote has been tested */ + int bind_offset; /* local configuration to send to the remote end */ struct gprs_ns_ie_ip4_elem *ip4_local; @@ -714,9 +716,15 @@ static void ns2_sns_st_size_onenter(struct osmo_fsm_inst *fi, uint32_t old_state return; } - bind = ns2_ip_get_bind_by_index(nsi, remote, 0); + bind = ns2_ip_get_bind_by_index(nsi, remote, gss->bind_offset); if (!bind) { - return; + if (gss->bind_offset) { + gss->bind_offset = 0; + bind = ns2_ip_get_bind_by_index(nsi, remote, gss->bind_offset); + } + + if (!bind) + return; } /* setup the NSVC */ @@ -1335,9 +1343,12 @@ static void ns2_sns_st_all_action(struct osmo_fsm_inst *fi, uint32_t event, void return; } else if (!gss->initial) { gss->initial = llist_first_entry(&gss->sns_endpoints, struct sns_endpoint, list); + gss->bind_offset = 0; } else if (gss->initial->list.next == &gss->sns_endpoints) { /* last entry, continue with first */ gss->initial = llist_first_entry(&gss->sns_endpoints, struct sns_endpoint, list); + gss->bind_offset++; + gss->bind_offset %= ns2_ip_count_bind(nse->nsi, &gss->initial->saddr); } else { /* next element is an entry */ gss->initial = llist_entry(gss->initial->list.next, struct sns_endpoint, list); |