Commit Graph

3773 Commits

Author SHA1 Message Date
Philipp Maier 4d40047c50 gprs_bssgp: agregate RIM related code in gprs_bssgp_rim.c
gprs_bssgp and gprs_bssgp_util.c also contains code related to send and
receive RIM PDUs via BSSGP and also code to encode and decode RAN
INFORMATION PDUs. Lets move this to gprs_bssgp_rim.c

Change-Id: Icda279452962b06e552cb1361d2a27b7dc8a6b04
Related: SYS#5103
2021-01-29 21:27:18 +00:00
Pau Espin 3e3f377749 gsm: bts_features: Introduce BTS_FEAT_CCN
This feature is used by BSC to gain knowledge on whether a given BTS
supports GPRS Cell Change Notification (CCN) related procedures on PDCH,
and as a result enable or not by default the CCN_ACTIVE bit in SI13 to
announce the support it is allowed to use the feature.

Related: SYS#4909
Change-Id: I61991266b95d0c13d51b47906cc07846e9cf1390
2021-01-29 18:01:14 +01:00
Pau Espin 5b6f1d7d7a gsm: Fix wrong length in SI13 GPRS Cell Options IE
Older commit adding the 2 bits for Rel-4 extension forgot to increase
the length field (see TS 44.060 Table 12.24.1)

Fixes: 946bb95af1
Change-Id: I20efb4403cdf6c5bc717502a7075630044142f17
2021-01-29 18:01:14 +01:00
Pau Espin 5f2b8e5edf cosmetic: fix typo in comment
Change-Id: I787cca5a032c57202a86dab18e1790ef3ad1509a
2021-01-29 17:04:14 +01:00
Pau Espin 377645d600 ctrl_connection: Initialize write_queue.bfd.fd to -1 during allocation
Otherwise fd is set to 0 by default, let's avoid accidentally closing
it if something goes wrong.

Change-Id: I98f744d2880fbb883719cdf1d3eb31f2b22a13b6
2021-01-29 11:21:09 +00:00
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 2e1a3a982a gprs_ns2: remove api call gprs_ns2_dynamic_create_nse
The call was only introduced as workaround for the first implementation
of vty. There is no need for this anymore. The configuration can
just add "accept-ipaccess" to the bind to allow creation of dynamic
ipaccess NSE.

Change-Id: Ie924ead6da17657f3da334068c8ada82c8845495
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
Oliver Smith f2afb98c83 configure.ac: set -std=gnu11
Avoid using different dialects by accident (and resulting compiler
errors if compiler assumes a different dialect), like in
I72310886bef4db635078b75715c9d98ee45391cc.

Related: https://lists.osmocom.org/pipermail/openbsc/2019-September/013030.html
Related: https://lists.osmocom.org/pipermail/openbsc/2021-January/013360.html
Related: osmo-pcu Ia57ba101627e3cc0babeca82631e207a3e2e0960
Change-Id: Id79b13d3c498acb565f91eba650328fccb5a13ef
2021-01-27 13:42:12 +01:00
Philipp Maier 0fb33d2ed2 gprs_bssgp: log source and destination RIM routing information
Whenever a RIM PDU is received, log to which RIM routing information
(address) it is going to and where it is comming from.

Change-Id: Ia08d3b162a4f6257cccaa7f0764fa7ea498355ef
Related: SYS#5103
2021-01-26 16:36:53 +01:00
Philipp Maier 0a7e85ae81 gprs_bssgp_rim: cosmetic: connect routing identifier strings with "-"
The bssgp_rim_routing_info_discr_strs string list contains whitespaces,
when the whitespaces are replaced with a "-" the log output looks better

Change-Id: I26facd3dc160603da89dcd787cccf78b19a20f02
Related: SYS#5103
2021-01-26 16:36:53 +01:00
Philipp Maier c08a3fd30e gprs_bssgp_rim: add functions to convert a RIM-RI to a string
RIM routing formation structs can contain different variants of address
identifiers, so it is difficult for an API user to pick the _name()
function to generate a human readable string. Lets add
bssgp_rim_ri_name() and bssgp_rim_ri_name_buf() to make printing a
routing identifier easier.

Change-Id: Idca6bdccffe663aea71a0183ca3ea5bb5b59e702
Related: SYS#5103
2021-01-26 16:36:53 +01:00
Pau Espin 445a366c8a gprs_bssgp_prim.h: Add missing includes
Includes for struct gprs_ra_id and osmo_eutran_tai were missing.

Change-Id: I1c068b6841561003d4d7722daa6c2abb21363dda
2021-01-26 13:06:53 +01:00
Alexander Couzens f7e2cace2c gprs_ns2: drop the public prefix gprs_ from all static functions/structs/..
Change-Id: I6ba0599e5a6d6fabf93851dd3ec7716f2ef2d840
2021-01-25 16:18:21 +01: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
Alexander Couzens ba5a9927b6 gprs_ns2: drop GPRS_ prefix of gprs_ns2_cs
gprs_ns2_cs is a privat enum while GPRS_ should only used
for public enums.

Change-Id: I79be92ca716366c2e07ea061c08d95bea817a8c7
2021-01-25 16:03:23 +01:00
Alexander Couzens 3f576ab486 gprs_ns2_vc_fsm: check NSVCI match the NSE
The NSVCI must match the PDUs. The only exception is a RESET with
dialect ipaccess. However those will be handled later.

Change-Id: I0ebdd4f4135b03a7d44a93aff3846c8ec19f333b
2021-01-25 15:35:14 +01:00
Alexander Couzens 43771df63f gprs_ns2_vc_fsm: check NSEI match the NSE
The NSE must match the PDUs. The only exception is a RESET with
dialect ipaccess. However those will be handled later.

Change-Id: I00bc04f3f46f5ae8ddd8b4b7d5479fb8e6463e1e
2021-01-25 15:35:14 +01:00
Alexander Couzens ba6345310f gprs_ns2: always pass a tp to gprs_ns2_vc_rx
In preparation of checking the NSEI/NSVCI in ns2_vc_rx. It
makes the function less error prone as the *tp is always defined.

Change-Id: I3cd6ed20cdc1390075669e1d0101154c51f3997f
2021-01-25 15:34:39 +01:00
Alexander Couzens 8f215c9fc9 tests: gprs_ns2: add unitdata unit test
test sending unitdata over a alive and blocked NSVC.

Change-Id: I2c44b711d004d2ca08e05d4f54519ad8dbd77c27
2021-01-25 15:28:47 +01:00
Philipp Maier cf11411ebb gprs_bssgp_rim: add value strings for enum bssgp_rim_routing_info_discr
Change-Id: Idd06d2e3df0d60409a89a474018a9d97f7772090
Related: SYS#5103
2021-01-22 19:59:31 +00:00
Philipp Maier 8b19d06643 gprs_bssgp_rim: add value strings for enum bssgp_ran_inf_app_id
Change-Id: I581d1176f82d6657d6136c32daa9c76dffb802a6
Related: SYS#5103
2021-01-22 19:59:31 +00:00
Philipp Maier 139c4ae003 gprs_bssgp_rim: add value strings for enum bssgp_nacc_cause
Change-Id: I3354699555569c2b0bd1b4313cffd32a0cbeffe9
Related: SYS#5103
2021-01-22 19:59:31 +00:00
Pau Espin d426ba6730 gsm: Introduce osmo_{rai,cgi_ps}_cmp() APIs
Similar to what we already have for other data types, such as
osmo_lai_cmp or osmo_cgi_cmp.

Change-Id: I00e329bc5be8674b30267dec238e7656ddfc21db
2021-01-22 20:32:45 +01:00
Pau Espin cc885fb0b6 gsm: Add missing osmo_*_cmp symbols to libosmogsm.map
Change-Id: I8ff677aa381118466d065abee7db20b15880352f
2021-01-22 17:44:04 +01:00
Oliver Smith 55934c4754 tests/*: fix control reaches end of non-void func
Prepare to set -std=gnu89 in a future commit, which will cause gcc warn
about "control reaches end of non-void function" in main().

Change-Id: I7c33cac30e5859060f083813d8433011f5eaf0d0
2021-01-21 12:13:42 +00:00
Harald Welte b3d4778efb Revert "gprs_ns2_vc_fsm: check NSEI match the NSE"
This reverts commit 842599ca62.
Closes: OS#4965

Change-Id: I96882961e179bb63e3f4095571135244148dde20
2021-01-21 12:48:46 +01:00
Harald Welte 43cb90ff5d Revert "gprs_ns2_vc_fsm: check NSVCI match the NSE"
This reverts commit 9c1e04e580.
Related: OS#4965

Change-Id: Ic26e6ee8c225266dc31850e38976460cb0e81ebd
2021-01-21 12:46:59 +01:00
Harald Welte 2846ee2624 gprs_ns2_test: Fix compilation on Debian 8
[  352s] gb/gprs_ns2_test.c: In function 'test_block_unblock_nsvc':
[  352s] gb/gprs_ns2_test.c:200:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  352s]   for (int i=0; i<2; i++) {
[  352s]   ^
[  352s] gb/gprs_ns2_test.c:200:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

Change-Id: I72310886bef4db635078b75715c9d98ee45391cc
2021-01-21 10:23:20 +01:00
Harald Welte 8d6ca6933f logging_vty: Fix saving of "logging print file .. last"
Back in 2018 in I393907b3c9e0cc1145e102328adad0a83ee13a9f Neels
introduced "last" as an optional flag to log the file/line number at the
end of the line, rather than at the end of the header.  It seems nobody
has been usingi this feature, or at least never tried to save a related
config file, as there was no code whatsoever that would ever save this
optional "last" flag.

Change-Id: I7b6245256aecc425722242aaabc154ac58ba27a0
2021-01-21 10:23:19 +01:00
Alexander Couzens 9c1e04e580 gprs_ns2_vc_fsm: check NSVCI match the NSE
The NSVCI must match the PDUs. The only exception is a RESET with
dialect ipaccess. However those will be handled later.

Change-Id: I8518bdb03e9e33b04b77a2a346d04c5d29544a6c
2021-01-20 17:50:55 +01:00
Alexander Couzens 842599ca62 gprs_ns2_vc_fsm: check NSEI match the NSE
The NSE must match the PDUs. The only exception is a RESET with
dialect ipaccess. However those will be handled later.

Change-Id: Ic8fc49d850490feb0ff69171a6b0881ae8696c0b
2021-01-20 17:47:10 +01:00
Harald Welte f294974e05 ns2: Unify logging context via log macros
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
2021-01-20 16:42:33 +00:00
Alexander Couzens 718e37e5cc gprs_ns2_message: remove wrong comment
It's a leftover from converting NS1 -> NS2 code

Change-Id: I934c7905f8396e74bb1f14d68097c03463816720
2021-01-20 16:42:33 +00:00
Philipp Maier 2b11fa9b3e gprs_bssgp_rim: fix bug in dub_tlvp_header()
When the length field is written the function writes the lower and the
higher half of the length at the same position, so the higher half is
overwritten with the lower half, this is wrong.

Change-Id: I3cce0b2796793554a421fd3ce8e749c52d22eaea
Related: CID#216670
Related: SYS#5103
2021-01-20 16:10:18 +00:00
Philipp Maier 836c6dac65 gprs_bssgp_rim: Return with EOPNOTSUPP on unsupported containers
The current version of libosmocore only supports NACC related RIM
application containers. If the parser detects a different application
container it returns with EINVAL. Unfortunately this means that the
caller can not distinguish if there is a lack of support or a real
parsing error.

Change-Id: Ib5ada3554c04259764352888cf95bc4460cb2a54
Related: SYS#5103
2021-01-20 16:09:00 +00:00
Alexander Couzens 191c2d7de9 gprs_ns2_vc_fsm: fix transitions for ALIVE state
Alive can never reach RESET. However ALIVE -> ALIVE is allowed.

Change-Id: Ic414d7ca96b1ec6db1665cd4c072c7ebbee787f1
2021-01-20 14:59:28 +00: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
Harald Welte cec4bbed73 vty/fsm_vty: Add vty_out_fsm2() + vty_out_fsm_inst2() with prefix
Callers other than "show fsm" / "show fsm-instances" may want to
indent the output.

Change-Id: I10e01ef91116369868cdb878a99634c8681728af
2021-01-20 14:59:03 +00:00
Alexander Couzens 273f063f94 gprs_ns2_vc_fsm: in RESET accept RESET as ACK
When both side sends RESET at the same time 48.016

Change-Id: I49d2a4f257f45b7bc4f0a7a6c5b8381071893686
2021-01-20 13:11:26 +01:00
Alexander Couzens ea01bf2b29 gprs_ns2_vc_fsm: ensure all state is resetted via force_unconf
Change-Id: I240225ce82fa27dfcb5b4b8e2981bb4d8cc4cd70
2021-01-20 13:04:33 +01:00
Alexander Couzens f577543887 gprs_ns2_vc_fsm: rename all event to match RX_ or REQ_
Similiar to the BSSGP layer prefix events with RX if it's an received PDU
or REQ if it's a request from the code.

Change-Id: I341fa28fb671d439c050d985c88ece1521430a99
2021-01-19 20:19:08 +01:00
Alexander Couzens 856b94cd7b gprs_ns2: correct handle BLOCK message on initator
A BLOCK message can be received when waiting for a UNBLOCK message
in state BLOCK

Related: SYS#5208
Change-Id: Ie7b34b3ef04aa28304143191222324e1a3786cb2
2021-01-19 20:18:49 +01:00
Alexander Couzens 47afc424c3 gprs_ns2: implement BLOCK/UNBLOCK of a NSVC by vty
The vty should be able to block or unblock a specific NSVC.
Further more this case is special for the UNITDATA as those
can be still received until the other side response to the BLOCK PDU.

Related: OS#4939
Change-Id: Ic0ce3c5fabc8644cc1ee71a8f6dd783fadf7b84d
2021-01-19 19:42:03 +01:00
Alexander Couzens fd96dc5343 osmo-ns-dummy: don't leak primitive messages
The message in the primitive must be freed by the user

Change-Id: I2a7b19f019485c7b1f15baf20b62edc19b663415
2021-01-19 19:33:41 +01:00