When the bind to be removed is not the last entry, it would
remove the wrong SNS bind resulting in use-after-free memory.
Change-Id: I79062d404ebba9d5c8f7f209bebde146fa08c71f
A SNS configuration can be done over a NSVC, however this initial NSVC doesn't
need to be part of the configuration.
Those NSVC need to be removed when the configuration is done.
This wrong behaviour can be seen in the vty `show ns` on
NSEI 00001: UDP, ALIVE
FSM Instance Name: 'GPRS-NS2-SNS-BSS(NSE00001-SNS)[0x55c72c09b420]', ID: 'NSE00001-SNS'
Log-Level: 'DEBUG', State: 'CONFIGURED'
Maximum number of remote NS-VCs: 8192, IPv4 Endpoints: 8192, IPv6 Endpoints: 8192
Local IPv4 Endpoints:
10.0.0.1:23000, Signalling Weight: 1, Data Weight: 1
Remote IPv4 Endpoints:
10.0.2.2:23000, Signalling Weight: 1, Data Weight: 0
10.0.2.2:23001, Signalling Weight: 0, Data Weight: 1
3 NS-VC:
NSVCI none: UNBLOCKED DYNAMIC data_weight=1 sig_weight=0 udp)[10.0.0.1]:23000<>[10.0.2.2]:23000
NSVCI none: UNBLOCKED DYNAMIC data_weight=0 sig_weight=1 udp)[10.0.0.1]:23000<>[10.0.2.2]:23001
NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[10.0.0.1]:23000<>[10.0.2.2]:8888
The UNCONFIGURED NSVC should not be present in when SNS is in CONFIGURED.
Related: SYS#5416
Change-Id: I4045ac6c033ae084743b17a16eef4fcff76589b9
The SNS fsms also track the NSE however since the NSVC
starts now in ALIVE for SNS the SNS must check when synchronize
the alive state when entering the ST_CONFIGURED.
Related: SYS#5416
Change-Id: Ib6a1cc1fd84959e69c07b72ef780642205d2cd18
Prior to this patch, we would unconditionally allocate new memory
for the local SNS IP endpoints. This results in a memory leak
on every SNS-SIZE procedure.
Let's move to talloc_realloc() which recycles any previously allocated
memory.
Change-Id: I12cb670e087c6d6190f3f5bf8483ea62008ae06f
We may very well have any number of binds configured, but which
are not part of the current NSE. When creating the "full mesh" of
NS-VCs after SNS-CONFIG, we must only iterate over those binds that
are part of the NSE (or 'ipa-sns-default bind' in cae of SGSN role),
but not over all the other binds that may exist in the system.
Closes: OS#5092
Change-Id: Ida361fa02ad1d86844d54c8f0664c996ed28e30a
This fixes some bug introduced in Change-Id I1638f04ba45fef3ba0b237948dff6022267141fb
Related: OS#3373
Change-Id: Ic0873e63f1f046b674c7898480ff070a18a7abc7
As per 3GPP TS 48.016 section 6.2.4.1, we need to perform some
consistency checks during the SNS-SIZE procedure. Let's implement them.
Change-Id: I1638f04ba45fef3ba0b237948dff6022267141fb
Related: OS#3373
It is the SGSN's job to ensure sufficient NS-VC capacity. As the SGSN
doesn't tell the BSS, we should not make assumptions of only 4.
Change-Id: I41f493643cf51d7853959ab9c7bbc0ffae4e1f4b
The SNS-SIZE sent from BSS to SGSN contains the actual number of local
IP endpoints on the BSS side, and not the maximum number of remote IP
endpoints supported.
Change-Id: I62a8bca4a3f7c47bcb9f292b045fa867d8877a09
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
Clearly separate those states that only occur on the BSS side from
those of the SGSN side (which already have a prefix)
Change-Id: Iebc97637063b2676abff4a7dce50272d9b4e336b
Related: OS#3373
Some functions are only to be called when operating in BSS role,
let's enforce that by sprinkling some OSMO_ASSERT() around.
Related: OS#3373
Change-Id: I20d1bd8df62e0bb84696e291756e2d96acf49246
This adds the core functionality of implementing the SGSN-side of IP-SNS
inside a new FSM. The SGSN-side FSM shares states, events, structures
and code with the BSS-side whenever possible.
Note that this commit does not yet use the SGSN-side FSM, that is part
of subsequent commits.
Closes: OS#3373
Change-Id: I780413ffacd9cb71f64cc38057aae781eeb59b2b
Let's move computing of the local IP endpoints to a separate function,
so it can not only be used when entering the SNS_SIZE state. Preparation
for SGSN-side IP-SNS.
Change-Id: I5d7ce419135a8ef538cf9abcb76a49049ed7d5f9
Related: OS#3373
We don't really handle inbound SNS-ACK yet (as we don't originate
SNS ADD/DEL/CHGWEIGHT procedures yet). However, the message
receive code should already dispatch those events to the FSM,
just like we do for the (equally unimplemented) handling of inbound
SNS-SIZE which is already dispatched to the FSM.
Change-Id: If6d5f96d85e6f05534fe49376f4473d912535ad4
An event which originates by a received PDU is prefixed by RX.
An event which originates by code gets a REQ prefix.
Fixes: OS#5014
Change-Id: Ia8a6378cdca19b086e89058b1cc055f45c0bba7b
Introduce a `ip-sns-bind BINDID` vty command within a `nse` vty object.
The ip-sns-bind defines the binds which will be used by the dynamic
configuration with IP-SNS.
This is only the first part which only uses the binds when doing a
new SNS configuration.
The outgoing add procedure will be supported in a later patch
when the SNS fsm supports outgoing procedures.
This is a behaviour change of the API and must be synchronized with
the osmo-pcu. Otherwise SNS won't work with osmo-pcu.
Related: SYS#5354
Change-Id: I9ab8092bf286e7d90e92f5702a5404425e959c84
Allow to assign a signalling and data weight to UDP binds.
Those weights will be used when doing dynamic configuration over
IP-SNS.
This is only the first part which only uses the assigned weights
when doing a new SNS configuration.
The outgoing change weight procedure will be supported in a later patch
when the SNS fsm supports outgoing procedures.
Related: SYS#5354
Change-Id: I5133e4229377d44772a9af28628a2bc420fea34b
In prepration to introduce more commands e.g. ip-sns-bind rename the ip-sns-remote
Related: SYS#5354
Change-Id: Ida979f3b9daa5f7280a629441e4006a7635653b0
The SNS must know when all NS-VC have failed. Further more
there might be a corner case when the SNS configuration succeeds but
no NS-VC comes up afterwards.
Related: OS#5355
Change-Id: Ie72da9adeefe0c2850d49a9208b2d0a4556f9101
All public enum should have the prefix GPRS_NS2_.
API change which must be synchronized with osmo-pcu,
osmo-gbproxy, osmo-sgsn.
Change-Id: I548ff12f7277cbb7e1a630a3dc02b738ce89be72
All functions which are exposed by gprs_ns2_internal.h should not contain
the public prefix gprs_. Internal function should only contain ns2_ prefix.
Change-Id: Icecc5a918902cd10efac72bbac20780d39aab272
Let's avoid open-coding the printing of log context and rather rely on
log macros to prefix each log line with the relevant context. This
helps log readability, log post processing whether by grep or more
sophisticated tools.
Change-Id: I946c0e77686d91efc5afb62031e1ac1033a9a586
If multiple objects are printed in the VTY, only the first line of each
object should be on the first character of the line, all others should
be indented. With this patch the "snow ns entities" output becomes
much more readable:
OsmoGbProxy> show ns entities
NSEI 00102: UDP, DEAD
FSM Instance Name: 'GPRS-NS2-SNS-BSS(NSE00102-SNS)[0x6120000018a0]', ID: 'NSE00102-SNS'
Log-Level: 'DEBUG', State: 'SIZE'
Timer: 1
Maximum number of remote NS-VCs: 8, IPv4 Endpoints: 4, IPv6 Endpoints: 0
NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[127.0.0.1]:23000<>[127.0.0.11]:8888
NSEI 00101: UDP, DEAD
FSM Instance Name: 'GPRS-NS2-SNS-BSS(NSE00101-SNS)[0x6120000015a0]', ID: 'NSE00101-SNS'
Log-Level: 'DEBUG', State: 'SIZE'
Timer: 1
Maximum number of remote NS-VCs: 8, IPv4 Endpoints: 4, IPv6 Endpoints: 0
NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[127.0.0.1]:23000<>[127.0.0.10]:7777
Change-Id: Id1b4c80a6caef410076a68b4301adaa01ba7e57a
The local and remote entries should be cleared on SNS Size.
Further it can be cleared when SNS failed (e.g. all NSVC become dead)
so VTY doesn't show old entries before entering SNS Size.
Related: OS#4949
Change-Id: Ie4db81acdd5f8ddf1a1f5dc7645d1144545d9c73
The SNS code ignored the link type of the bind and just bound to every
bind it could find. This resulted in a segfault when an SNS NSVC tries
to send its UDP messages though frame relay.
Fixes: OS#4948
Change-Id: Ibb832a39876362d094cce635192f7b4f84dc2b10
Writing a configuration that will be rejected by the VTY parser
is not the best solution, but still better than printing values
from previous iterations or the stack garbage. In any case,
this is unlikely to happen, just making Coverity happy.
Change-Id: I26644fe544c82c90767ec1a9709918474bd1be53
Fixes: CID#215852
According to 3GPP Size and Config procedure can
have retries in case the timeout of the procedure runs out.
Change-Id: I00e9023a6e7adc6ad48f4016fcaef189ac8b353e
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
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