Commit Graph

19 Commits

Author SHA1 Message Date
Alexander Couzens e769f5226b gprs_ns2_sns: rework IP-SNS initial remote
The IP-SNS requires at least one initial remote address of the SGSN.
However it should be multiple initial remote address instead of a single
in case the interface might fail.
Rework the SNS to support multiple initial remote addresses.

Change-Id: I71cdbfb53e361e6112fed5e2712236d797ef3ab2
2020-12-15 11:46:45 +00:00
Alexander Couzens 45a25a3222 gprs_ns2_sns: correct dynamic calculation
The wrong argument was used to multiply by 4. However it was still
compliant because the SNS code would always supports 16 NSVCs.
Use the correct multiplier.

Fixes: ttnc3 pcu sns test cases
Fixes: 42ad549152 ("gprs_ns2_sns: dynamic calculate the maximum NS-VCs")

Change-Id: I58d706c6fffb4237b90b37cade4dc00c6aba6ac9
2020-12-09 16:13:42 +00:00
Alexander Couzens e78207f16b gprs_ns2_sns: fix whitespaces and superflous comment
Change-Id: Ica0033c88cad71827ad843e92ccd54663426de23
2020-12-07 13:13:06 +00:00
Alexander Couzens db1c3fb114 gprs_ns2_sns: add missing S() to allow GPRS_SNS_EV_NO_NSVC happen
The event GPRS_SNS_EV_NO_NSVC was never dispatched because the
S() was missing to convert it into a bitmask.

Change-Id: I4af01293ff0ba8629e1426b1ba92f72f0520c7f0
2020-12-07 13:13:06 +00:00
Alexander Couzens 42ad549152 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
2020-12-07 13:13:06 +00:00
Alexander Couzens e03d863e1f gprs_ns2_sns: add missing transistion UNCONFIGURED -> SIZE
The SNS FSM can go into the SIZE state when all NS-VC are failing.
This is the case if the network connection to the SGSN got interrupted.

Change-Id: I7e7da9451458505c1c2d73836dd916aee7704fda
2020-12-07 13:13:06 +00:00
Daniel Willmann 15c09a81e9 ns2: Send NSVC representation in NS_AFF_CAUSE_VC_* status indication
NS_AFF_CAUSE_VC_* failure and recovery should indicate the NSVC in
question. Use the string representation reported by gprs_ns2_ll_str()
for that.

NS_AFF_CAUSE_VC_RECOVERY was never sent so do that on unblock as well.

Change-Id: Iad6f0dc4565a46868cbbe17c361dcd473006c83d
Related: SYS#4998
2020-11-06 11:41:16 +01:00
Pau Espin 0a446a1804 gb: ns2_sns: Add missing value_string entry for GPRS_SNS_EV_NO_NSVC
Change-Id: Ifd4501676217f1a27f3ee02156be4e3dcb847703
2020-10-27 13:30:08 +01:00
Pau Espin 7fbe7cfcd7 gb: ns2_sns: Fix missing trailing newline char in log line
Change-Id: I8dc45237a605e76e852a74a0de91ac2a812387d0
2020-10-27 13:27:18 +01:00
Alexander Couzens 125298f2b5 gprs_ns2: add gprs_ns2_nse_sns_remote() returns the initial SNS address
Allows the PCU to get the SNS remote address.

Change-Id: I54f110acc3acccb362f6e554324d08cc42b7c328
2020-10-12 15:54:21 +02:00
Alexander Couzens c4229a458c gprs_ns2: rename gprs_ns2_ip_vc_sockaddr -> gprs_ns2_ip_vc_remote
It's more clear which part of the address is returned.
In preparation to add a gprs_ns2_ip_vc_local.

Change-Id: I6110ff573362961c713a990da7ef3f3dbedf6c57
2020-10-12 15:54:21 +02:00
Alexander Couzens 9a4cf275b2 gprs_ns2: const the return value of gprs_ns2_ip_vc_sockaddr / gprs_ns2_ip_bind_sockaddr
The sockaddr should not be changed.
free and create the bind/nsvc if the address should be changed.

Change-Id: I371ac2361b569e36722b02fc9cd82ec8da2fa9e3
2020-10-12 13:08:42 +00:00
Alexander Couzens c068d860a5 gprs_ns2: fix SNS_ADD for IPv4
The remote must be initialized because the osmo_sockaddr_cmp is using a memcmp() and might fail
on spare bytes in the struct. The same was already done for IPv6.

Related: OS#4792
Change-Id: Iefeef969bb2b5ae4d5db6a6358293ef9eeda858a
2020-10-12 10:54:39 +00:00
Vadim Yanitskiy a07f25e3ba gprs_ns2: make struct osmo_sockaddr pointers const
Using the 'const' qualifier allows the compiler to spot some
programming errors and further optimize the code.

Change-Id: I0df6a00ac1830bd64a10b9336b827e113fa772bb
2020-10-09 15:24:09 +00:00
Alexander Couzens bf95f0fb2e ns2: refactor ns2_prim_status_ind()
Replace parameters nsi + nsei with a single nse pointer.

Change-Id: I35f6381110ba7ba1e013f21120e971362bdff55b
2020-10-03 07:17:54 +00:00
Alexander Couzens 38b19e88bb ns2: refactor nsvc_by_ functions
gprs_ns2_nsvc_by_sockaddr_nsei is doing the lookup within a NSE.
gprs_ns2_nsvc_by_sockaddr_bind is doing the lookup within a bind.
Make both function look similiar and take similiar arguments.

Change-Id: Ia499fc279013668abe7348e578a0768f7d16faf9
2020-09-25 09:45:24 +00:00
Harald Welte 5bef2cc4bd ns2: Improve/extend doxygen comments for new ns2 implementation
I was reading through the code and noticed many functions not
documented yet, or with incomplete documentation. Change that.

Change-Id: I85a2419604a9fd9ff3c4828a7463e222652f77bf
2020-09-18 23:14:36 +02:00
Harald Welte 7da6ace594 gprs_ns2_sns: Fix compilation on Debian 8
[  198s]     for (unsigned i = 0; i < gss->num_ip6_remote; i++) {
[  198s]     ^
[  198s] gprs_ns2_sns.c: In function 'ns2_sns_st_configured_change':
[  198s] gprs_ns2_sns.c:1053:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  198s]    for (int i = 0; i < num_v4; i++) {
[  198s]    ^
[  198s] gprs_ns2_sns.c:1067:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  198s]    for (int i = 0; i < num_v6; i++) {
[  198s]    ^
[  198s] Makefile:535: recipe for target 'gprs_ns2_sns.lo' failed

Change-Id: I4b7c576fcdf9d35f85e00ad076af7c48d5eb34a5
2020-09-18 09:48:05 +02:00
Alexander Couzens 6a161497cf Gb: add a second NS implementation
Reimplement NS with FSM.

Change-Id: I3525beef205588dfab9d3880a34115f1a2676e48
2020-09-15 11:54:41 +00:00