Commit Graph

46 Commits

Author SHA1 Message Date
Daniel Willmann 9043205cd9 ns2: Fix assert when removing a bind listen
Change-Id: I3edd1e838f7516d9224045710047419039aa0ec0
Fixes: OS#4977
2021-01-29 11:37:41 +01:00
Alexander Couzens 260cd52bd0 gprs_ns2: correct vty config write
The vty configuration was wrong when any other node was
in between the vty configuration (e.g. gb or ss7).
The vty code doesn't have a relation between parent and child node.
It wasn't detected because this only happened in the sgsn.
The pcu doesn't have any binds defined.

Change-Id: I8a3d67d41baca36b4d1a951a574cd41e556355c5
2021-01-28 20:32:51 +01:00
Alexander Couzens e43b46e018 gprs_ns2: introduce gprs_ns2_vty_init_reduced() for the PCU
The gprs_ns2_vty_init_reduced() call initialized the ns2 vty without
configuration nodes (except timeout). The PCU can be only configured
by the BTS/BSC. It should not configured by vty.

Change-Id: I4437da74bd48ba64d3f16ea67afc26c45b6d3ac9
2021-01-28 13:54:32 +01:00
Alexander Couzens da1bf8e835 gprs_ns2: drop gprs_ns2_vty, rename vty2 -> vty
Drop the vty(1) code and replace it with vty2. The vty(1) was only
used as intermediate to not develop a vty while developing a new
code base behind. Users of gprs_ns2_ has to use the new vty code.

API change which must be synchronized with osmo-pcu,
osmo-gbproxy, osmo-sgsn.

Change-Id: Ic2059e75d8ede8e5c29c4fef6be608ed79c8a97c
2021-01-28 13:54:24 +01:00
Pau Espin caf5317412 Revert "gprs_ns2: drop gprs_ns2_vty, rename vty2 -> vty"
This reverts commit b306094448.

It was merged too quickly and patches for projects using related
features are not yet prepared.

Change-Id: I8a2aaf74a47de8f4f0adb37d16426d199788e3fe
2021-01-28 13:38:23 +01:00
Alexander Couzens b306094448 gprs_ns2: drop gprs_ns2_vty, rename vty2 -> vty
Drop the vty(1) code and replace it with vty2. The vty(1) was only
used as intermediate to not develop a vty while developing a new
code base behind. Users of gprs_ns2_ has to use the new vty code.

API change which must be synchronized with osmo-pcu,
osmo-gbproxy, osmo-sgsn.

Change-Id: I8c3f2afecc74b78f7f914f7dce166cbcb63444eb
2021-01-28 11:56:37 +00:00
Alexander Couzens 138b96f21c gprs_ns2: refactor: ensure all enums have GPRS_NS2_
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
2021-01-28 11:56:37 +00:00
Alexander Couzens 8dfc24cb47 gprs_ns2: drop prefix of all internal exposed function
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
2021-01-25 16:09:23 +01:00
Harald Welte 1262c4f18e ns2: Properly indent VTY output
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
2021-01-20 14:59:03 +00:00
Alexander Couzens 280ed789a8 gprs_ns2: fix force-unconfigured for IP-SNS NSE
The IP-SNS need to do a reselection of the IP-SNS remote
for testing. Freeing all nsvc will force this.

Change-Id: I367c215a830c02eae2a470cba314828b5e0fb5c9
2020-12-23 06:32:29 +01:00
Alexander Couzens 412bc3494d gprs_ns2: add new vty2
Change-Id: I163279cf57e84198dc8c53e1c109f5a9474670e9
2020-12-22 16:36:19 +01:00
Alexander Couzens 8806796976 gprs_ns2_vty: udp: fixup dialect changes
Only accept receiving ipaccess style messages when use-reset-block
is selected.
If use-reset-block is disabled allow static NSVCs.

Change-Id: Ia787528b1a6fac6bf1570c21643ef6cd8c209108
2020-12-16 21:34:03 +01:00
Harald Welte 33c3c0655b gors_ns2_vty: Fix saving of new NS2 timers
In I00e9023a6e7adc6ad48f4016fcaef189ac8b353e we introduced
two new timers, but failed to add the related value_string[]
entries.  This caused the VTY code to save something like

 timer unknown 0x8 3
 timer unknown 0x9 3

which fails to parse on re-start.

Change-Id: If5cfdf1ef68d98933985406d0ac071a0a1185646
2020-12-16 12:05:37 +01:00
Alexander Couzens ebcbd726ee gprs_ns2: rework gprs_ns2_fr_connect*()
Add gprs_ns2_fr_connect2() and change gprs_ns2_fr_connect() to
be similar to gprs_ns2_ip_connect() and gprs_ns2_connect2().

This is an API break but there wasn't yet a release with NS2.

Change-Id: I4e1374b0e979b3293302c5ed46a91a58f3a5a916
2020-12-15 11:46:45 +00:00
Alexander Couzens aaa55a663e gprs_ns2: add member name to bind
Every bind will have a unique name. Add a name argument
to all bind creating functions and require them to be unique.

This is an API break but there wasn't yet a release with NS2.

Change-Id: I8f1d66b7b3b12da12db8b5e6bd08c1beff085b3e
2020-12-15 11:46:45 +00:00
Alexander Couzens d923cff170 gprs_ns2: introduce NS dialects
A NS dialect describes how the NS Entity interacts with
different virtual circuits. E.g. ipaccess use reset/block on udp
and is a dynamic connection.
A single NS Entity can only support one dialect. This can be later
used to protect a NS Entity against dynamic NS virtual circuits of a
different type.

It further allows a bind to support multiple dialects at the same time.

Change-Id: Ia118bb6f994845d84db09de7a94856f5ca573404
2020-12-15 11:46:45 +00:00
Daniel Willmann 89106524a0 ns2: Fix argv index in logging filter VTY commands
Change-Id: I8adaf8094ef028b2d580e918532d6712d2ebbc2c
Related: SYS#5232
2020-12-04 16:52:11 +00:00
Daniel Willmann 751977be6f ns2: Add log filtering by NSE/NSEI, fix NSVC filter on receive
NSVC filtering was only implemented on sending messages, this also adds
log_set_context() calls to  ns2_recv_vc()
Filtering by NSE is implemented similar to NSVC.

Change-Id: I63c0e85f82f5d08c5a6f535da94b8648498439d2
Related: SYS#5232
2020-12-03 15:14:18 +01:00
Harald Welte 25ee755cc7 gprs_ns2_vty: Re-introduce a 'show ns' command
In I157467d6a74d6109bc23521c978c5aac6d29fe50 we introduced a split
between 'show ns entities' and 'show ns binds'.  However, there is
at least one test case in osmo-sgsn.git which depends on 'show ns'
working.  So let's re-add it as a backwards compatible, hidden command.

Change-Id: I7571c6d82f7a712803d09d165abb6c7cb5ae2e5c
2020-12-02 22:15:34 +01:00
Daniel Willmann cb3e9b5847 ns2: Fix docs for some NS2 vty commands
Change-Id: Ie58607424340c102c930330e444c2e219c1803e0
2020-12-02 15:50:22 +01:00
Harald Welte dc2d080813 gprs_ns2_vty: Print all relevant data on each NS-VC
After this patch, we can finally see the BLOCKED/UNBLOCKED state,
weights, persistence, etc. in the VTY.

Example:

OsmoGbProxy> show ns entities
NSEI 00101: UDP, DEAD
 NSVCI 00101: RESET PERSIST data_weight=1 sig_wight=1 udp)[127.0.0.1]:23000<101>[127.0.0.1]:7777
NSEI 00001: FR, ALIVE
 NSVCI 00001: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet1 dlci: 16
 NSVCI 00002: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet2 dlci: 17
 NSVCI 00003: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet3 dlci: 18
 NSVCI 00004: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet4 dlci: 19

Change-Id: I1cf8fe55d1d0cecc46113532c8550880558b0155
2020-12-01 18:19:02 +01:00
Harald Welte 7aa609929c gprs_ns2_vty: Show NSVCI in dump_nsvc()
also, indent the statistics one more character

Change-Id: I2726d6f1c5f83255925d6a1b22f1ee71b8d6fdc5
2020-12-01 18:01:43 +01:00
Harald Welte 2fce19a243 gprs_ns2_vty: Differentiate 'show ns binds' and 'show ns entities'
Change-Id: I157467d6a74d6109bc23521c978c5aac6d29fe50
2020-12-01 18:01:43 +01:00
Harald Welte 0ff12ad0ba gprs_ns2: Print link layer and global ALIVE/DEAD state
Change-Id: I56455d1fef2f99d72bc0c4811f307428aec12b96
2020-12-01 18:01:43 +01:00
Harald Welte 920491936e gprs_ns2_vty: Fix VTY documentation errors
Those two documentation errors made e.g. gb-proxy VTY tests fail.

Change-Id: I487ee3532aed4de38494005106ae9686d590608d
2020-11-25 20:57:09 +01:00
Harald Welte 6d4db2367d Revert "ns2: permit multiple nsvci in one nse in VTY"
This reverts commit 0bd8a4b5b3, which
was causing massive VTY test failures for osmo-pcu.git and osmo-sgsn.git

Change-Id: I0236d1e835111604e58c5d8c3f84221e055ce59d
2020-11-25 20:56:46 +01:00
Alexander Couzens 10e991b224 ns2: remove obsolete type GPRS_NS2_LL_E1
There is already frame relay type GRPS_NS2_LL_FR
to support frame relay.

Change-Id: Iabb4608d91ccb32a07cad67519166dabfba76612
2020-11-24 03:53:22 +01:00
Alexander Couzens aac9016570 ns2: move link layer type into NSE
Even it was in theory possible to mix NS-VC ll types within
a NSE. This is an unrealistic configuration.
Further more to select the correct load sharing mechanism
the NSE must know the correct link layer.

Change-Id: I18dfd40a2429cd61b7c4a3dad5f226c64296f7d8
2020-11-24 03:53:22 +01:00
Alexander Couzens 24a14ac80c ns2: move LL into public api
Also fix prefix. GPRS_NS -> GPRS_NS2.
In preparation to move LL into upper layer.

Change-Id: I3b5e0d51ce69b095095e5160ca0cf0d4534db1b8
2020-11-24 03:53:22 +01:00
Harald Welte 0bd8a4b5b3 ns2: permit multiple nsvci in one nse in VTY
Change-Id: I4ad454320d0a03e81b399f55e8bd0ee57402dad0
2020-11-24 03:53:22 +01:00
Alexander Couzens 841817ec52 ns2: add support for frame relay
Add support for frame relay over dahdi hdlc device.
It's supporting lmi by q933 and supports both
SGSN and BSS.

Change-Id: Id3b49f93d33c271f77cd9c9db03cde6b727a4d30
2020-11-24 03:53:22 +01:00
Daniel Willmann dbab714343 ns2: Add a VTY command to reset NSVC FSM
Mainly useful for testing so implemented as a hidden command

Change-Id: I83b9cd7381c25da0e8aa847038a2d422c8dd63cf
Related: SYS#5002
2020-11-20 15:38:00 +01:00
Daniel Willmann ed1fa018c3 ns2: Improve NSVC output
In show ns lots of info was printed many times. We can just use
gprs_ns2_ll_str() to get the information about an NSVC so use that and
ensure newlines.
The NSVC are still printed twice - at least for the UDP bind: Once in
dump_nse and once in dump_bind.

Change-Id: I6f734d92ec1e17f339f7b32e449ffd614efa7319
Related: SYS#4998
2020-11-06 15:40:27 +01: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
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 d745a0e7f3 gprs_ns2_vty_create: remove bind pointer check
The bind pointer can't be NULL because gprs_ns2_ip_bind()
is either return 0 and bind is valid or != 0 and returning.

Found-by: Coverity
Fixes: CID#214854
Change-Id: I11d86c9cb36226701e51942f14d7a6412c3eff26
2020-10-07 10:16:40 +00:00
Vadim Yanitskiy 8e7c49649e vty: use install_lib_element() and install_lib_element_ve()
See https://lists.osmocom.org/pipermail/openbsc/2020-October/013278.html.

Change-Id: Ic541126ffd4975daf87199abfafb465e2055e44f
Related: SYS#4937
2020-10-06 00:22:22 +07:00
Alexander Couzens 22f34710d9 ns2: vty: on `show ns` add information of NS binds
Change-Id: I6cef42749555e577d5573f2ed8b8bce4cf842a98
2020-10-05 14:23:33 +00:00
Alexander Couzens 1fac6f7452 ns2: vty: allow the users (pcu/sgsn) to set a default bind
The SGSN will always bind to 0.0.0.0 in difference the PCU bind is depending
on the info indication. Allow to the user to define a default bind
address.

Change-Id: I2a9dcd14f4ad16211c0f6d98812ad4a13e910c2a
2020-10-05 14:23:33 +00:00
Alexander Couzens a3373e3394 ns2: vty: show all nse
Don't stop after dumping the first nse

Change-Id: I0ca1807692854b23b77ca9042768529df3f80289
2020-10-03 07:19:59 +00:00
Alexander Couzens 477ffb0e72 ns2: parse the return code of gprs_ns2_ip_bind
Fixes a crash when the bind fails.

Change-Id: I96c8e871a350f8f7b9ba2450bb37b90b535f42e2
2020-10-01 19:33:00 +02:00
Daniel Willmann 4fb27a80d2 gprs_ns2: Make reason const
Change-Id: Ia0db18703d9fd137a5c5fe4474e2d76868a9af9d
2020-09-25 15:39:46 +02:00
Alexander Couzens 1f0625f214 ns2: vty: fix behavior of vtyvc_by_nsei when vtyvc isn't found
Fixes the parsing of persistent nsvcs.

Change-Id: I297409f557f17df680ac76018b4202eb99713021
2020-09-25 09:45:24 +00:00
Alexander Couzens c82c40aa53 ns2: vty: add missing docs for IPv6 address
Change-Id: I0ac04e1352ceadb7b787bcb3358c70e5bfd7c65b
2020-09-24 23:32:18 +00: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