AgeCommit message (Collapse)AuthorFilesLines
2020-12-10gprs_ns2: vty2: config_writelynxis/ns2_vtyAlexander Couzens1-1/+145
Change-Id: Idb7d867d76ef6deb5d087d50e99ecdd5e620cd79
2020-12-10gprs_ns2_vty: fixup: change dlci / nsvci orderAlexander Couzens1-3/+3
Change-Id: I1304df449c5109e6ab0eab0a65a3a9f3b993def3
2020-12-10gprs_ns2: add gprs_ns2_sns_write_vty()Alexander Couzens2-0/+23
Change-Id: I7d0041287f5489db827d989d21efb1def537bdb0
2020-12-10gprs_ns2: add gprs_ns2_fr_bind_role() to retrieve the fr roleAlexander Couzens2-0/+16
Change-Id: I277b805e588ba68536789b4a64a428ea0b31728a
2020-12-10gprs_ns2: make nsvc argument constAlexander Couzens2-2/+2
The nsvc isn't change. It can be const Change-Id: Ie5052f02781d7fdc639456c6f02515a927cee1f3
2020-12-10fixup vty snsAlexander Couzens1-11/+11
Change-Id: Ifc328455129ee3025b174d608e7c238e4252773b
2020-12-10WIP: gprs_ns2: add new vty2Alexander Couzens7-1/+1463
Change-Id: I163279cf57e84198dc8c53e1c109f5a9474670e9
2020-12-10gprs_ns2_sns: introduce SNS Size/Config retriesAlexander Couzens3-5/+19
According to 3GPP Size and Config procedure can have retries in case the timeout of the procedure runs out. Change-Id: I00e9023a6e7adc6ad48f4016fcaef189ac8b353e
2020-12-10gprs_ns2_sns: use different binds for the initial connectionAlexander Couzens1-5/+19
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
2020-12-10gprs_ns2_sns: rework IP-SNS initial remoteAlexander Couzens6-190/+361
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
2020-12-10gprs_ns2: add gprs_ns2_free_nsvcs() to free all NS-VC of a NSEAlexander Couzens3-6/+18
Change-Id: I909443b540dbf75146297f1d7f94940690be6c0d
2020-12-10gprs_ns2: rework gprs_ns2_fr_connect*()Alexander Couzens3-1/+44
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-10gprs_ns2: add member name to bindAlexander Couzens8-4/+75
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-10gprs_ns2: move allocation of the SNS fsm into create_nseAlexander Couzens1-6/+13
The allocation of the SNS fsm can be done in create_nse because the dialect is now known at that time. Change-Id: I64e1f3dcc63d38e65bb486c9ac08d4032b7ad222
2020-12-10gprs_ns2: introduce NS dialectsAlexander Couzens8-86/+77
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-09gprs_ns2_sns: correct dynamic calculationAlexander Couzens1-2/+2
The wrong argument was used to multiply by 4. However it was still compliant because the SNS code would always supports 16 NSVCs. Use the correct multiplier. Fixes: ttnc3 pcu sns test cases Fixes: 42ad54915285 ("gprs_ns2_sns: dynamic calculate the maximum NS-VCs") Change-Id: I58d706c6fffb4237b90b37cade4dc00c6aba6ac9
2020-12-08tlv.h: Add msgb_tvlv_put_{16,32}be()Harald Welte1-0/+15
Those routines are very useful when puzzling together BSSGP messages with 16-bit and 32bit sized IEs. Change-Id: I033f9a708c9d7ffad91336178231dc66233e1693
2020-12-08gsm_08_18.h: Add #defines for [extended] feature bitsHarald Welte1-0/+20
Change-Id: I7743cb901988c8fddd91127cfdca6e54b3d44ea8
2020-12-08bssgp: Add osmo_tlv_prot_def for BSSGPHarald Welte3-1/+317
Change-Id: I7e4226463f3c935134b5c2c737696fbfd1dd5815
2020-12-08tlv: Introduce enum with error codes for TLV parser functionsHarald Welte2-17/+29
Change-Id: I0b352792089c5c0c714712d2ea237beb92e1d73f
2020-12-08Introduce 'osmo_tlv_prot' abstraction for validation of TLV protocolsHarald Welte3-1/+159
This extends our existing TLV parser with the ability to * validate that mandatory IEs of a given message are present * validate that all present IEs are of required minimum length Introducing this generic layer will help us to reduce open-coded imperative verification across virtually all the protocols we implement, as well as add validation to those protocols where we don't properly perform related input validation yet. Change-Id: If1e1d9adfa141ca86001dbd62a6a339f9bf9a912
2020-12-08ns2: Accept NS-UNBLOCK-ACK in UNBLOCKED stateHarald Welte1-1/+1
if we transition to UNBLOCKED as a result of a locally-generated unblock action, then of course we will receive an inbound UNBLOCK-ACK. Let's avoid error log messages and confusign the peer with NS-STATUS in this case: DLNS DEBUG GPRS-NS2-VC(FR-hdlcnet3-DLCI18-NSEI2001-NSVCI3)[0x612000001720]{UNBLOCKED}: Received Event UNBLOCK_ACK (gprs_ns2_vc_fsm.c:692) DLNS ERROR GPRS-NS2-VC(FR-hdlcnet3-DLCI18-NSEI2001-NSVCI3)[0x612000001720]{UNBLOCKED}: Event UNBLOCK_ACK not permitted (gprs_ns2_vc_fsm.c:692) Change-Id: Icc4d960ddad82e3ebbf571d8ff9f24854b52a946
2020-12-07gprs_bssgp_util: complete bssgp_pdu_stringsPhilipp Maier1-0/+16
The value strings for the BSSGP lack some items, lets make it complete. Change-Id: I94956ca12df7f7ba912da05397b3fb39956277f7 Related: SYS#5103
2020-12-07gprs_ns2_sns: fix whitespaces and superflous commentAlexander Couzens1-5/+4
Change-Id: Ica0033c88cad71827ad843e92ccd54663426de23
2020-12-07gprs_ns2_sns: add missing S() to allow GPRS_SNS_EV_NO_NSVC happenAlexander Couzens1-1/+1
The event GPRS_SNS_EV_NO_NSVC was never dispatched because the S() was missing to convert it into a bitmask. Change-Id: I4af01293ff0ba8629e1426b1ba92f72f0520c7f0
2020-12-07gprs_ns2_sns: dynamic calculate the maximum NS-VCsAlexander Couzens1-2/+3
The previous hard-coded value could be not enough if the user configures too many local binds. Allow at least 8 NS-VCs. In case the user configures too many binds (> 2) increase the maximum NS-VCs to allow the SGSN to have 4 redundant connections. Change-Id: Iae859dc504716fd6f705e72db5fc293b4b3298e7
2020-12-07gprs_ns2_sns: add missing transistion UNCONFIGURED -> SIZEAlexander Couzens1-1/+2
The SNS FSM can go into the SIZE state when all NS-VC are failing. This is the case if the network connection to the SGSN got interrupted. Change-Id: I7e7da9451458505c1c2d73836dd916aee7704fda
2020-12-07gb: Import mnl.h iif --enable-libmnlPau Espin Pedrol1-1/+4
Change-Id: Ic0100493a9256e9c30a4bbb92be404270a8b9393
2020-12-07Include mnl.h iif --enable-libmnlPau Espin Pedrol1-1/+4
Change-Id: I06016e3a6e90b09b76634a00081d0d40a8e2f94b
2020-12-06log2.h: Avoid redefining __always_inlineHarald Welte1-3/+2
/build/deps/install/stow/libosmocore/include/osmocom/core/log2.h:10:0: error: "__always_inline" redefined [-Werror] #define __always_inline inline __attribute__((always_inline)) /usr/include/x86_64-linux-gnu/sys/cdefs.h:311:0: note: this is the location of the previous definition # define __always_inline __inline __attribute__ ((__always_inline__)) Change-Id: I738d2a72f835a29e30b8ba20456e5c4c9aa844c9
2020-12-06log2.h: Use uintXX_t instead of kernel specific typesHarald Welte1-2/+3
Change-Id: Ieb872551bdbe514f2c77f9aeb2b9ee42f6573909
2020-12-06hash/log2: Add generic implementations of fls() and fls64()Harald Welte1-0/+59
When importing the hashtable code in I8ef73a62fe9846ce45058eb21cf999dd3eed5741 I didn't import actual implementations of the fls() and fls64() implementations, as at least gcc-10 was smart enough to detect we only use it on constant types and hence the computation can happen at build time via const_ilog2() However, in our jenkins build verification' this doesn't appear to happen, as we get below errors: /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h: In function ‘__ilog2_u32’: /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h:20:9: error: implicit declaration of function ‘fls’ [-Werror=implicit-function-declaration] return fls(n) - 1; ^~~ /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h: In function ‘__ilog2_u64’: /build/deps/install/stow/libosmocore/include/osmocom/core/log2.h:28:9: error: implicit declaration of function ‘fls64’ [-Werror=implicit-function-declaration] return fls64(n) - 1; ^~~~~ Let's provide some generic implementations for this case. If needed one could also introduce architecture-specific assembly implementations like in the Linux kernel, but so far we managed to keep libosmocore free of any assembly tweaks. Change-Id: Ifa4898eb66c8d949618edd47961b7a0330ed35b5
2020-12-06gsm_08_18.h: Add some PDU definitions still missingHarald Welte1-0/+19
In I7da8b25c9a89a7e3ae6c1680ba838e136d7d5293 I seem to have failed to realize that 3GPP TS 48.018 v15.0.0.0 Table 11.3.26 continues on yet another page. Let's add those missing PDU types definitions. Change-Id: I9173c35240ff78048b2b76a1155d90467ef16b2d
2020-12-05Use explicit type-casting in hlist_del() for C++ compatibilityHarald Welte1-2/+2
/usr/local/include/osmocom/core/linuxlist.h:479:12: error: invalid conversion from ‘void*’ to ‘hlist_node*’ [-fpermissive] 479 | n->next = LLIST_POISON1; Fixes: I8ef73a62fe9846ce45058eb21cf999dd3eed5741 Change-Id: I75b0a5fe097562007c53987d8d41811e9f35798d
2020-12-05core/linuxlist: do not use 'new' as a parameter nameVadim Yanitskiy1-4/+4
'new' is a reserved keyword in C++, so including this header from a C++ project (like osmo-pcu) breaks compilation. Let's rename it in the same way as it's already done in this file: add '_'. Change-Id: I7f7d9143edca75ce932601386a8766b0a62c0e24 Fixes: I8ef73a62fe9846ce45058eb21cf999dd3eed5741
2020-12-05Add hlist and hashtable from Linux kernelHarald Welte5-0/+617
For more than a decade we've used the linuxlist.h for double-linked lists. Let's also add the hlist (double-linked lists with single pointer sized head, and the hashtable that builds on top of it. This reflects the versions included in Linux 5.8 with some modifications to make them build in userspace (remove RCU versions, adjust for userspace include files and types, convert to doxygen). Change-Id: I8ef73a62fe9846ce45058eb21cf999dd3eed5741
2020-12-04bssgp: Fix typo in BSSGP Message Type enumHarald Welte1-1/+4
Change-Id: I63941f8b38485e569f56ba5065c2c00232703028
2020-12-04bssgp: Update bssgp_pdu_strings with Release 15Harald Welte1-0/+19
In I7da8b25c9a89a7e3ae6c1680ba838e136d7d5293 we introduced the enum values for all the new BSSGP message types up to Release 15. Let's also add value_strings for them here. Change-Id: Ia108ba0d5f1f2c9d46f0c0bd11cd93104b9d62ea
2020-12-04gprs_ns2: Use TLVP_PRES_LEN instead of TLVP_PRESENTHarald Welte2-13/+14
With TLVP_PRESENT we only check if a given TLV/IE is present, but don't verify that it's length matches our expectation. This can lead to out-of-bounds reads, so let's always use TLVP_PRES_LEN. Change-Id: I4c438bc82ea6a48243db568f96a234adf784dc0b
2020-12-04bssgp: Use TLVP_PRES_LEN instead of TLVP_PRESENTHarald Welte2-33/+32
With TLVP_PRESENT we only check if a given TLV/IE is present, but don't verify that it's length matches our expectation. This can lead to out-of-bounds reads, so let's always use TLVP_PRES_LEN. Change-Id: I56e8b31ce51602d2681e3db501c48f84bfe7e438
2020-12-04ns2: Fix argv index in logging filter VTY commandsDaniel Willmann1-2/+2
Change-Id: I8adaf8094ef028b2d580e918532d6712d2ebbc2c Related: SYS#5232
2020-12-04gprs_ns2_fr: remove include <linux/if.h>Harald Welte1-1/+0
It's not needed because net/if.h already include the required parts. Furthermore the linux/if.h generates a compiler error in combination with net/if.h on older systems (e.g. debian jessie) Change-Id: I53650e9c55bb9dd98ba60269025e72673e9f82c1
2020-12-04mnl: Use mnl_socket_open() insatead of mnl_socket_open2()Harald Welte1-1/+1
mnl_socket_open2 is not yet available on e.g. Debian 8. Furthermore, osmo_fd_register() will set the CLOEXEC flag on every file descriptor anyway, so there is no benefit from using mnl_socket_open2() at all. Change-Id: I0b37ffa148ff0c0a22281b490820353f5fef00eb
2020-12-04libosmogb: Add missing LIBMNL_CFLAGSHarald Welte1-1/+4
In Change-Id I779556991bfc88b7751b2be17bb81c329cfb9e01 we introduced the use of libmnl via osmo_mnl to libosmogb. Howver, we didn't add LIBMNL_CFLAGS in Makefile.am, which now (rightfully) fails on some distributions like the SuSE family of distributions. Let's fix this. Change-Id: Ib8740e8fd677026efb9dad5d5fe6b95147fb3c23
2020-12-03ns2: Add log filtering by NSE/NSEI, fix NSVC filter on receiveDaniel Willmann5-2/+74
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-03gprs_ns2: use switch() case instead of multiple if in ns2_create_vc()Alexander Couzens1-19/+14
Improve readibilty and allows it to extend for future ns2 vty changes Change-Id: I8bd9c75fb04169a166b7a3f5e13a5902250cfd0e
2020-12-03gprs_ns2: fix typo in commentAlexander Couzens1-1/+1
Change-Id: Ic0653ce7de8d2d64bd7cf10e148b07da8cbeb0a2
2020-12-02gprs_ns2_vty: Re-introduce a 'show ns' commandHarald Welte1-0/+12
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-02gsm_08_18.h: Update enums for message types and IEs with Release 15Harald Welte1-2/+123
Lots of newly introduced message types and information elements. Change-Id: I7da8b25c9a89a7e3ae6c1680ba838e136d7d5293
2020-12-02gprs_ns2_fr: Monitor the kernel net-device link stateHarald Welte1-2/+125
We use the newly-introduced libmnl integration of libosmocore in order to receive netlink events from the kernel on link state changes. If one of "our" interfaces changed link state, we report this in the log and also store it within the "bind". Change-Id: I779556991bfc88b7751b2be17bb81c329cfb9e01