Commit Graph

4 Commits

Author SHA1 Message Date
Vadim Yanitskiy b7344d08df gb/gprs_ns_sns.c: fix incorrect sizeof() calculation
Calling sizeof() on a pointer would result in getting size of the
pointer (usually 4 or 8 bytes) itself, but not the size of the
memory it points to.

Change-Id: I83f55a9638b75d9097d37992f7c84707791f10f6
Fixes: CID#194266
2019-04-12 22:16:18 +07:00
Harald Welte fa90cfd8d2 gprs_ns_sns: Properly initialize sockaddr_in in gprs_nsvc_create_ip4()
When putting together a sockaddr_in, we must not only set the IP
address and port, but also set the address family to AF_INET.  And
while at it, let's zero-initialize the entire 'struct sockdadr_in'.

Change-Id: I1c8d8fe7f79a2ec737baa7800247269c3271983e
2019-03-20 08:32:30 +01:00
Harald Welte 24e67f86dd gprs_ns_sns: Use "correct" remote IP address for local IP endpoint
we cannot use "nsi->nsip.remote_ip", as this address is not set
when SNS is in use.  We can only have a valid nsi->nsip.remote_ip
if there's only a single NS-VC inside the NS Instance, as this would
connect() the UDP socket to the remote IP/port, breaking any possibility
to have multiple NS-VCs to different SGNS-side IP addresses.

Closes: OS#3845
Change-Id: Ic094621eb01d7458063f531289d5eeadf52bf330
2019-03-16 18:34:58 +01:00
Harald Welte 047f3872f5 NS: Add support for GPRS NS IP Sub-Network-Service (SNS)
The NS implementation part of the Gb implementation libosmogb
so far implemented a rather classic dialect of Gb, with lots of
heritage to FR (Frame Relay) transports.  At least since Release 6
of the NS specification, there's an IP Sub-Network Service (SNS),
which
* permits for dynamic configuration of IP endpoints and their NS-VCs
* abandons the concept of a NSVCI on IP transport
* forbids the use of RESET/BLOCK/UNBLOCK procedures on IP transport

This commit introduces BSS-side IP-SNS support to libosmogb in a
minimally invasive way.  It adds a corresponding SNS FSM to each NS
instance, and implements the new SIZE/CONFIG/ADD/DELETE/CHANGE_WEIGHT
procedures very closely aligned with the spec.

In order to use the SNS flavor (rather than the classic one),
a BSS implementation should use gprs_ns_nsip_connect_sns() instead
of the existing gprs_ns_nsip_connect().

This implementation comes with a set of TTCN-3 tests in
PCU_Tests_RAW_SNS.ttcn, see Change-ID
I0fe3d4579960bab0494c294ec7ab8032feed4fb2 of osmo-ttcn3-hacks.git

Closes: OS#3372
Closes: OS#3617
Change-Id: I84786c3b43a8ae34ef3b3ba84b33c90042d234ea
2019-02-26 12:18:30 +01:00