Commit Graph

109 Commits

Author SHA1 Message Date
Daniel Willmann e64c92c660 gbproxy_main: Add ctrl vty commands
osmo-gbproxy already provides a ctrl interface, we should be able to
change ctrl-related configuration.

Change-Id: I3f3aa46aa032c1bd0ec88163bb89701d2250f414
2021-04-12 12:25:34 +02:00
Daniel Willmann f8cba65017 gbproxy: Use bssgp2_enc_status when sending STATUS
bssgp_tx_status() is not aware of the MTU and cannot truncate the PDU if
needed. Use the newer bssgp2_enc_status() which supports truncating the
PDU.

Related: OS#4889
Depends: Ic39d918c56399ceb0431299ce938e3bf276f678a (libosmocore.git)
Change-Id: Id5ddb10385655b339b2a4f04651c1da09b3efb62
2021-02-16 16:42:00 +01:00
Daniel Willmann a8b61659e6 Add SDU length for an NSE (== BSSGP PDU size)
Prepare tracking the SDU from NS. Initialize with a conservative default.
The value is not yet updated, that will happen in a later patch.

Related: OS#4889
Depends: I5016b295db6185ec131d83089cf6c806e34ef1b6 (libosmocore.git)
Depends: I9bb82ead27366b7370c9ff968e03ca2113ec11f0 (libosmocore.git)
Change-Id: Ic1080abde942ec5a2ae7cdee0ffe716a2fbddb1e
2021-02-16 16:39:45 +01:00
Daniel Willmann 2689c6e7d7 Move vty node into gbproxy_vty.c
This is no longer shared with osmo-sgsn and osmo-gtphub

Change-Id: I5329ca39e8ecfe29862b0b1f9afa7d35e678a181
2021-02-12 16:26:22 +01:00
Daniel Willmann 86ee31a7d7 Remove unused log categories
Change-Id: I519a687c07410fa3c1a0fa9a903d6c3ed9cbba45
2021-02-12 15:47:22 +01:00
Daniel Willmann 44fa20182e gbproxy: Use bssgp2_nsi_tx_ptp in gbprox_relay2nse
Use the function provided by bssgp2 instead of setting up the ns2 prim
request ourself.

Related: OS#4889
Change-Id: I0b8926eb903ed972edb2ed7ba3edbb3d77889564
2021-02-12 09:39:50 +00:00
Daniel Willmann 1ac920ba89 Remove trailing whitespace
Change-Id: If8fe9e65056e458e946ff202cf7ae93efc8abf17
2021-02-12 09:39:38 +00:00
Philipp Maier 4499cf49cb gb_proxy: fix wrong usage of bssgp_rim_ri_name()
In some logging statements the function bssgp_rim_ri_name() is used
twice. This is wrong since _name() functions use an internal buffer,
which can not be used twice in the same logging statement, so for the
affected log statements the function bssgp_rim_ri_name_buf() must be
used.

Change-Id: I8b6254a269770ddc141325d67d143f2a8130c519
Related: SYS#5103
2021-02-10 17:57:03 +01:00
Philipp Maier 1c5766b0ec gb_proxy: add support for relaying BSSGP RIM messages
BSSGP RIM messages are routed from a source to a destination cell by a
RIM routing information IE. Add parsing for the routing information and
support for relaying RIM messages to the destination cell/PCU. If the
destination cell/PCU is not directly connected to osmo-gbproxy route the
rim message to the first connected SGSN.

Change-Id: Idd1ea46832e044f0ade15af32250f90517d848d8
Related: SYS#5103
2021-02-10 16:43:33 +00:00
Daniel Willmann 3ea379395f Various comment/whitespace changes
Change-Id: I0eeef3ec16c249d65e9358889d21cc4984b7b51f
2021-02-10 16:41:18 +00:00
Daniel Willmann fe5d3b7a46 gbproxy_vty: Fix NRI overlap behaviour to match osmo-bsc
The MSC-pooling chapter in OsmoBSC mentions that overlapping NRI ranges will
warn if configured though the VTY interface, but fail when started with
such a config.

The manual for OsmoGbProxy promises a similar behaviour, this patch implements
it.

Change-Id: Id3815ed8d1736ea3ba1e498b2bc3cf30b772551d
2021-02-10 16:41:18 +00:00
Daniel Willmann 6cfedc4932 gbproxy_vty: Fix NRI VTY help MSC->SGSN
Change-Id: I33a60578c7dc28ec50b98c9b67b5cdb0d821d3d1
2021-02-10 16:41:18 +00:00
Philipp Maier 74882dc258 gb_proxy: extend TLV parser
In BSSGP RIM the routing information IE is appearing twice (source and
destination). The current one dimensional TLV parsing method would only
give us access to the first routing information IE (destination), so
lets increase the dimension to 2, so that we get also IEs that appear
twice.

Change-Id: Ieed7160e3005210a9cdeb5c4db28bc3ed031449c
Related: SYS#5103
2021-02-10 13:34:28 +01:00
Philipp Maier e4597ece46 gb_proxy_peer: Require ra_id and cid in gbproxy_cell_alloc
pass raid and cell id directly as parameter to gbproxy_cell_alloc so
that we do not need to fill tas parameter to gbproxy_cell_alloc so that
we do not need to fill the struct members later.

Change-Id: Ic7deae5ccf839b941d70557d28451d52f32cebbb
Related: SYS#5103
2021-02-09 22:45:27 +01:00
Philipp Maier 99adf1aee1 gb_proxy_peer: Remove unused function gbproxy_cell_by_bvci_or_new
Change-Id: I43ec049540c10c8ded5a668229447ab1acb6c832
Related: SYS#5103
2021-02-09 15:52:55 +01:00
Daniel Willmann fccbef0a28 gb_proxy_peer: Add Function to get gbproxy cell by cell id
Change-Id: I3403736eed9d6819634c26db0b90393ac6f4416a
Related: SYS#5103
2021-02-09 13:32:52 +01:00
Philipp Maier da3af94bf8 gb_proxy: simplify raid data storage
Instead of storing the raw ra_id in its unparsed binary form, store it
as a parsed struct. Also store the cell-id on cell allocation for later
use.

Change-Id: Ib58b9188e3ce4bd3fdadb03f158d56b29778387c
Related: OS#4894
2021-02-09 13:32:31 +01:00
Philipp Maier 55a22b8bc0 gb_proxy_ctrl: use mcc-mnc-lac-rac notation instead mcc,mnc,lac,rac
The notation for the RAI used in the log is not compliant to the spec.

Change-Id: I6c8c3f3c017918fe847bfbcc153a12cf5f408bdb
Related: OS#4894
2021-02-08 17:23:18 +00:00
Harald Welte 936dfd720a Further clean-up in osmo-sgsn -> osmo-gbproxy migration
* fix manuals builds, including vty reference generation
* fix vty tests
* remove manuals from osmo-sgsn
* update .gitreview
* update osmoappdesc.py

Related: OS#4992
Change-Id: I80439ab0d21a3fb33f38da42acbfe3fbb0941b91
2021-02-01 10:39:41 +01:00
Oliver Smith 29532c2a06 === Split osmo-gbproxy from osmo-sgsn ===
Adjust the build system, packaging etc. to split osmo-gbproxy into its
own git repository. Remove tests and configs that aren't related to
osmo-gbproxy.

Related: OS#4992
2021-01-29 16:57:29 +01:00
Alexander Couzens 3c75624e1e follow libosmocore/gprs_ns2 API changes (gprs_ns2_dynamic_create_nse)
The call gprs_ns2_dynamic_create_nse has been removed because it
was a workaround for the old/dropped vty api.

Depends-on: Ie924ead6da17657f3da334068c8ada82c8845495 (libosmocore)
Change-Id: Ie636cfd18d6d43da0e42f2c2de68dfa5c571d55c
2021-01-28 21:19:59 +00:00
Alexander Couzens b363e21022 gbproxy: follow gprs_ns2 API vty changes
The gprs_ns2_vty2 has been renamed to gprs_ns2_vty. The old
vty has been complete dropped.

API change which must be synchronized with libosmocore.

Depends-on: I8c3f2afecc74b78f7f914f7dce166cbcb63444eb (libosmocore)
Change-Id: If5bd6b86e130772e6c93d640b0c637985416136d
2021-01-28 21:19:59 +00:00
Harald Welte e30985ed92 gbproxy: Avoid depending on any of the SGSN code
The last remaining functin of the SGSN code base we used was
gprs_gb_parse_tlli().

Let's simply copy this function over and become  self-contained.

This would allow migrating osmo-gbproxy to a separate repository.

Change-Id: I6f3f86581b47ad71a3d97f07611a2e2709876d69
2021-01-28 19:14:32 +01:00
Alexander Couzens 55c36f9f18 follow libosmocore/gprs_ns2 API changes of GPRS enums
All gprs_ns2 enums have now GPRS_NS2 as prefix.

API change which must be synchronized with libosmocore

Depends-on: I548ff12f7277cbb7e1a630a3dc02b738ce89be72 (libosmocore)
Change-Id: I1af704cdd62ddaff4304479b837dc185b80d7dd6
2021-01-27 21:07:01 +01:00
Daniel Willmann 8b3ed29cc6 gbproxy: Fix radio status routing by TMSI
If a radio status message contains a TMSI it should be routed as if it
was a TLLI. Convert the TMSI to (foreign) TLLI so NRI-routing works.

Both foreign and local TLLIs are routed the same.

Fixes: OS#4954
Change-Id: Ifd64f02fa16b44f8e2e19eb8ba973f50a829ead5
2021-01-22 12:42:14 +01:00
Daniel Willmann cd21afeda4 gbproxy: Improve log messages in gbproxy_select_sgsn
Change-Id: Id7bc755b90c35ed7c8cfa8408073e2866d639f2d
Related: OS#4954
2021-01-22 12:36:13 +01:00
Daniel Willmann 8266918f40 gbproxy: Print the correct message type for dummy paging/paging reject
Change-Id: I5337abb27587fa2e8320b5bfc3765c9de5c57f6c
2021-01-19 11:37:55 +01:00
Daniel Willmann 5614e57b4a gbproxy: Use IMSI cache for PTP paging and implement DUMMY_PAGING_PS
Some code was missing to support PAGING_REJECT and DUMMY_PAGING_PS over both PTP
and signalling. This commit adds the missing pieces, notably:

* Use and route according to the IMSI cache for paging on PTP
* Ensure DUMMY_PAGING_PS is broadcast if no routing area is included

Change-Id: I7243e0d4470cb62fa6db36d26002ccd6542b5147
Related: OS#4951, OS#4472
2021-01-19 09:59:01 +01:00
Harald Welte 9b367d25e7 gb_proxy: Don't use orphan log subsystem DPCU
DPCU is defined in debug.h, but never registered as log subsystem,
so we shall not use it.  Also remove other similar "orphan" log
subsystems from debug.h

Change-Id: I8be54ee49e10d4004128352613923c4700063aa3
2021-01-18 20:32:25 +00:00
Daniel Willmann f2812fbbc6 gbproxy: Add VTY commands to query the TLLI/IMSI cache
OsmoGbProxy# show gbproxy tlli-cache
TLLI cache timeout 10s
 TLLI c2200024 -> NSE(02001/BSS) valid 10s
TLLI cache contains 1 entries

OsmoGbProxy# show gbproxy imsi-cache
IMSI cache timeout 10s
 IMSI 262420000001000 -> NSE(00102/SGSN): valid 5s
 IMSI 262420000000000 -> NSE(00101/SGSN): valid 3s
IMSI cache contains 2 entries

Change-Id: I03f1050573de9b241eb4fa82460c434155c15c6a
Related: OS#4951, OS#4472
2021-01-18 18:47:41 +01:00
Daniel Willmann 2c758f2bc1 gbproxy: Define and use help string for gbproxy
Change-Id: Ic9336c83147903e5af6622179f9394130f969a77
2021-01-18 18:46:32 +01:00
Daniel Willmann 182a0b6d8d gbproxy: Fix VTY cmd name
Change-Id: I5bb5f7cf93779a7a07965f2f35fdb59a7a2b731b
2021-01-18 18:46:32 +01:00
Daniel Willmann d0f26269c9 gbproxy: Remove unused variable assignment
Change-Id: I79684e0b27211d756912a63be5cae890ea44be82
2021-01-17 13:51:57 +01:00
Daniel Willmann 9170c341fd gbproxy: Move helper function to a more logical place
Change-Id: I3b39991fe2441334aaa9dda6c33c0b7b4484e455
2021-01-17 13:51:57 +01:00
Daniel Willmann 5193f224ea gbproxy: Use C-style comments
Change-Id: Ia3d27ef79a3370147395e7441149fd1231a760d5
2021-01-17 13:51:57 +01:00
Daniel Willmann 8613c9dfe8 gbproxy: Use IMSI cache to handle PAGING_PS_REJECT
Change-Id: I7d91d9ecfba757dc81edcf05efb7a2158348099d
Related: OS#4472, OS#4951
2021-01-17 13:51:57 +01:00
Daniel Willmann c8a500983a gbproxy: Implement IMSI cache
When SGSN pooling is enabled we need to route some responses based on
IMSI back to the correct SGSN, e.g. PAGING_PS_REJECT.

The IMSI cache keeps track of this IMSI <-> NSE(SGSN) mapping.

Change-Id: If0a8d6cc1d63f2fb2c395cc5d4373a915bc2cb87
Related: OS#4951, OS#4472
2021-01-17 13:51:57 +01:00
Daniel Willmann bd12f3f218 gbproxy: Increase TLLI cache timeout to 10s
The range of SUSPEND/RESUME timers T3/T4 is up to 10s so we should keep
the cache entries valid for this time.

Fixes: OS#4895
Change-Id: I9e88e49981098831f3255938deb868f4503f650f
Related: SYS#5235
2021-01-13 18:21:48 +01:00
Daniel Willmann 77493b1b26 gbproxy: Implement TLLI cache and use it for SUSPEND/RESUME
When routing a SUSPEND/RESUME we need to keep track of where it came
from so we can send the (N)ACK back to the correct BSS. Use the TLLI
which is present in both messages to cache and retrieve the correct BSS.

A timer runs every two seconds and expires entries that are older than
the timeout (hardcoded to 5 seconds for now).

Related: SYS#4865, OS#4472
Change-Id: I42adf70f560d2bb358a9e1c7614281e8d2967568
2021-01-11 15:09:05 +01:00
Daniel Willmann 3c56a2aeb5 Fix gbproxy_sgsn_by_tlli wraparound
Change-Id: I74ecb655f4d433f7ac14d00d934d237325aab606
Related: SYS#4865, OS#4472
2021-01-05 18:29:39 +01:00
Vadim Yanitskiy 6964e88948 gb_proxy_peer: fix NULL pointer dereference in gbproxy_sgsn_alloc()
LOGPSGSN_CAT() dereferences sgsn->nse in order to get NSEI.

Change-Id: I1c592dd6f0da5f167290f38de3b30a1a04c4313d
Fixes: CID#215868
2021-01-05 15:26:30 +01:00
Vadim Yanitskiy 4dba67a66f gb_proxy_peer: sgsn can never be NULL in gbproxy_sgsn_by_nri()
Redundant check makes Coverity think that sgsn can be NULL...

Change-Id: Iffdeb18e0a5575a2a09129eed9b8a41c3340dcbf
Fixes: CID#215870
2021-01-05 14:38:05 +01:00
Daniel Willmann b387c1ee93 gbproxy: Add VTY command to override the node selection function
This is mainly useful when testing SGSN pooling

Change-Id: I2894320413dbd0b9aec9a9bc9b88ce7cdeed206b
Related: SYS#5115, OS#4472
2021-01-04 18:33:52 +01:00
Daniel Willmann a648f3c676 gbproxy: Add config option to name an SGSN
This is useful for logging and configuration to identify an SGSN by name

Change-Id: I2a3410dd9bebb242957e13a63ed70e447204203c
Related: SYS#5115, OS#4472
2021-01-04 18:33:52 +01:00
Alexander Couzens 7305ba3f1c gbproxy: use ns2 vty2
The new gprs_ns2 vty2 support ip-sns and reorganize the
network service configuration

Depends: I163279cf57e84198dc8c53e1c109f5a9474670e9 (libosmocore)
Change-Id: I2a18dcf035f1fc7304a0c7c7c83b5e8e15429d2b
2021-01-04 16:27:41 +00:00
Harald Welte 02d7c48e71 gbproxy: Fix build on Deiban 8
[  258s]   CC       gb_proxy.o
[  258s] gb_proxy.c: In function 'gbproxy_select_sgsn_bvc':
[  258s] gb_proxy.c:293:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  258s]   for (int i = 0; i < ARRAY_SIZE(cell->sgsn_bvc); i++) {
[  258s]   ^
[  258s] gb_proxy.c:293:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your
code

Change-Id: I717410b11f1ee38d49e9ca5af593cb59a244ae0a
2020-12-30 12:13:56 +01:00
Daniel Willmann 216dff83d3 gbproxy: Add comments to sgsn functions
Change-Id: I8c96308045112f25292b0e57c306d8486a2524cc
2020-12-29 16:41:43 +01:00
Daniel Willmann d4ab1f98bd gbproxy: Add SGSN pooling support
Change-Id: I58b9f55065f6bd43450e4b07cffe7ba132b1fd9b
Related: OS#4472
2020-12-29 16:41:29 +01:00
Daniel Willmann ee834af5d9 gbproxy: Add SGSN NRI configuration
In order to support SGSN pooling we need to configure the various NRI
parameters such as the bitlen, NULL NRI, and which NRIs are assigned to
which SGSN.

Related: OS#4890, OS#4472
Change-Id: Id67592aa7712e5e04e7264b2fb8f26d57eb7e69e
2020-12-29 16:38:49 +01:00
Harald Welte 9151b4a7d5 gbproxy: Add "show gbproxy cell ..." VTY command
This allows the user to inspect CELL related gb-proxy state.

Change-Id: Iad1e8bbc358df9a3b3392404a70445a169dfebd5
2020-12-22 19:33:34 +00:00