aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-12-16gprs_bssgp: add IE parser/generator for RIM Routing InformationPhilipp Maier8-1/+324
The RIM Routing Information IE (see also 3GPP TS 48.018, section 11.3.70) is used to control the flow of BSSGP rim messages at the SGSN. Change-Id: I6f88a9aeeb50a612d32e9efd23040c9740bc4f11 Related: SYS#5103
2020-12-16gprs_ns2_vty: udp: fixup dialect changesAlexander Couzens1-2/+6
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-16gors_ns2_vty: Fix saving of new NS2 timersHarald Welte1-0/+2
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-16Fix VTY syntax for newly-introduced NS2 timersHarald Welte1-1/+1
In I00e9023a6e7adc6ad48f4016fcaef189ac8b353e we introduced two new "timers": Number of retries for SNS-CONFIG and for SNS-SIZE. Yet, the VTY syntax only added one string (tsns-prov-retires), probably dating back to an earlier version. Change-Id: I25fa579c7d68a8e4cb1175ae2245f009ab40fda7
2020-12-15gprs_ns2: on ns2_create_vc parse the tlv before using itAlexander Couzens1-9/+9
reject_status_msg require a parsed tlv. Otherwise an uninitialized tlv is passed. Change-Id: I82cab518966b8b49c3522ff5f7b6f82d1027a526
2020-12-15gprs_ns2: add gprs_ns2_fr_bind_role() to retrieve the fr roleAlexander Couzens2-0/+16
Change-Id: I277b805e588ba68536789b4a64a428ea0b31728a
2020-12-15gprs_ns2: make nsvc argument constAlexander Couzens2-2/+2
The nsvc isn't change. It can be const Change-Id: Ie5052f02781d7fdc639456c6f02515a927cee1f3
2020-12-15gprs_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-15gprs_ns2_sns: use different binds for the initial connectionAlexander Couzens1-2/+13
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-15gprs_ns2_sns: rework IP-SNS initial remoteAlexander Couzens6-190/+364
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-15gprs_ns2: add gprs_ns2_free_nsvcs() to free all NS-VC of a NSEAlexander Couzens3-6/+18
Change-Id: I909443b540dbf75146297f1d7f94940690be6c0d
2020-12-15gprs_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-15gprs_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-15gprs_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-15gprs_ns2: introduce NS dialectsAlexander Couzens8-86/+79
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-15protocol/gsm_08_58.h: add Osmocom specific EWMA AVG algoVadim Yanitskiy1-1/+3
Change-Id: Ib436fd8b81afdb06c6d936f6839f847a705d00e2 Related: SYS#4918
2020-12-15protocol/gsm_08_58.h: add ip.access Power Control structuresVadim Yanitskiy1-0/+44
Change-Id: I9430bcb79c269efb4f9527f565cf4e12e4444940 Related: SYS#4918
2020-12-14gsm: append_eutran_neib_cell: Fix SI2quater EARFCN listPau Espin Pedrol1-1/+2
Commit bd6e7a9f2dd5d4e881a0a21ebdb29b7a76ebdc9a did the initial porting of rest_octet APIs from osmo-bsc, but introduced a bug when moving bts->e_offset to a generic pointer independent of bts structure. As a result, using this API from osmo-bsc makes gsm0408 unit test fail due to bad encoding of several EARFCNs in si2quater. Fixes: bd6e7a9f2dd5d4e881a0a21ebdb29b7a76ebdc9a Change-Id: I2bf5635b8536b11d69774d17ac1908019633e3af
2020-12-14si2quater: fix budget calculation for multiple EARFCNsPau Espin Pedrol1-1/+9
In rest_octets.c append_earfcn(), the unconditional bits added are 40, not 25. Removing only 25 bits from the budget resulted in malformed SI2quater starting with 4 configured EARFCNs, by adding more EARFCNs than fit in 20 bits. These malformed SI2quater were also expected in gsm0408_test.c. Update the expected SI2quater to what is being generated now. This patch passes the ttcn3 testing added in I45382f88686ca60e68569e93569fc4cfb63a0e0d, which provides some confidence that the coding expected in gsm0408_test.c is now correct. This commit is a cherry-pick of osmo-bsc.git 6589f7c3a8dfdaaf66dda3afa6bbb1118ec825f9 Change-Id: Icc1ece39ad162d09720e104c5cbc12b07d6771a8 Related: OS#4652
2020-12-14gsm: si13: Fix encode of EGPRS_PACKET_CHANNEL_REQUESTPau Espin Pedrol1-7/+2
Cherry-pick from osmo-bsc.git e981f17200bf3a5d5114f46d9f7515fd10b96dbb Change-Id: I0aae385a427205cc73f60feca161e38608e608d8
2020-12-14rest_octets: add Serving Cell Priority ParametersPau Espin Pedrol1-2/+19
When we add an EARFCN to to the SI2quater struct we do not add Serving Cell Priority Parameters. This essentially causes to MS to ignore the EARFCN because it is still undefined under which conditions the MS should change to LTE. This is a cherry-pick from osmo-bsc.git 295c965c063a8c431507191f6aef1ef78b720685 Related: SYS#4510 Change-Id: If9134759e9bc4ae0920800972632fd8c5dc9c2d9
2020-12-10gprs_ns2_fr: use ETH_P_HDLC instead of ETH_P_ALLHarald Welte1-1/+1
When opening the socket, use ETH_P_HLDC to restrict the socket to packet received on HLDC interfaces. This avoids packets from random other (ethernet, ...) interfaces to appear before we can bind() it to the actual hdlc-net-device we're interested in. We still are racing against other HLDC net-devices, but those have lower PPS and throughput ratese as 1G/10G or even higher speed ethernet devices that might exist on the same machine. Change-Id: I6a556e6e2d012c17a2777cc8b30fed0f318db178
2020-12-10gprs_ns2_fr: guard against race between socket(AF_PACKET) and bind()Harald Welte1-12/+23
An AF_PACKET socket will immediately receive packets of _all_ interfaces until it is bound to one specific interface. This introduces a race condition between the socket() and the bind() syscall. Let's use the ifindex passed for each packet in recvmsg() to drop any packets received for other interfaces. Change-Id: I8f708ba4f9b7f76525acce17b24a8f7b125a1c1c Related: SYS#5245
2020-12-10gprs_ns2_fr.c: Skip extraneous FIONBIOHarald Welte1-9/+1
The socket is marked non-blocking inside osmo_fd_register(), there is no need to do it twice. Change-Id: I2068ce8280357b14970d01e5c86de5c59c933650
2020-12-10bssgp: Remove newly added log line warning about NOOPPau Espin Pedrol1-1/+3
osmo-pcu unit tests fail ue to this new log line. Let's rather simply leave a comment there, since anyway known apps will be migrating soon the new APIs. Fixes: fde19ed579c3145959301bbe75fde15509276040 Change-Id: Ib9bf528db08f7aaa4adaf7b6a320679a4f11a53d
2020-12-09bssgp_bvc_fsm: Add basic BVC flow control rx/tx supportHarald Welte3-2/+44
The FSM doesn't actually implement the flow control logic, it only decodes / dispatches and encodes messages. Related: OS#4891 Change-Id: Ie59be6761177c43456898be9148727f15861a622
2020-12-09bssgp2: Encoding + Decoding functions for BVC and MS flow controlHarald Welte4-0/+259
Change-Id: I9c89bb1c03550930c07aad7ff8f67129ee7a6320 Related: OS#4891
2020-12-09logging: Assing different 8bit colors to built-in subsystemsHarald Welte1-0/+22
The 16 ANSI colors we started to use for OpenBSC in 2008 were sufficient for those few sub-systems that occurred in the BSC/NITB. Over time, most sub-systems did not get colors anymore. Let's change that and assign more or less random colors from the 8bit color palette. Change-Id: Ia8c0f91a61fbca0441faf66b3f368f45f886187c
2020-12-09gb: Add beginnings of a new BSSGP implementationHarald Welte7-0/+1139
Similar to ns2 superseding ns, we now also intoduce a next generation of BSSGP related code to libosmogb. However, this is not aiming to be a full implementation yet, but simply those parts that we currently need from the revamped osmo-gbproxy. The gprs_bssgp2.[ch] differs in two ways from the old code: * it separates message encoding from message transmission * it supports more recent specs / IEs bssgp_bvc_fsm.c is a genric implementation of the BSSGP BVC RESET/BLOCK/UNBLOCK logic with support for both PTP and signaling, both on the SGSN side and the BSS side. Change-Id: Icbe8e4f03b68fd73b8eae95f6f6cccd4fa9af95a
2020-12-09logging: Introduce DLBSSGP logging constantHarald Welte10-73/+75
Historically, BSSGP uses a non-constant, user-configurable integer varieable for the logging sub-system. Let's replace this with a statically-allocated library logging constant. This is required if we want to use the subsystem number in e.g. static initialized for osmo_fsm.log_subsys. Change-Id: I506190aae9217c0956e4b5764d1a0c0772268e93
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