aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-01-22gsm: Introduce osmo_{rai,cgi_ps}_cmp() APIsPau Espin Pedrol4-0/+39
Similar to what we already have for other data types, such as osmo_lai_cmp or osmo_cgi_cmp. Change-Id: I00e329bc5be8674b30267dec238e7656ddfc21db
2021-01-22gsm: Add missing osmo_*_cmp symbols to libosmogsm.mapPau Espin Pedrol1-0/+2
Change-Id: I8ff677aa381118466d065abee7db20b15880352f
2021-01-21tests/*: fix control reaches end of non-void funcOliver Smith2-0/+2
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-21Revert "gprs_ns2_vc_fsm: check NSEI match the NSE"Harald Welte1-14/+0
This reverts commit 842599ca6252b9d65504fbe55148c6aad86f7025. Closes: OS#4965 Change-Id: I96882961e179bb63e3f4095571135244148dde20
2021-01-21Revert "gprs_ns2_vc_fsm: check NSVCI match the NSE"Harald Welte1-14/+2
This reverts commit 9c1e04e5802dfa25fcab3ca2c947897a1b7e7485. Related: OS#4965 Change-Id: Ic26e6ee8c225266dc31850e38976460cb0e81ebd
2021-01-21gprs_ns2_test: Fix compilation on Debian 8Harald Welte1-1/+2
[ 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-21logging_vty: Fix saving of "logging print file .. last"Harald Welte1-1/+2
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-20gprs_ns2_vc_fsm: check NSVCI match the NSEAlexander Couzens1-2/+14
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-20gprs_ns2_vc_fsm: check NSEI match the NSEAlexander Couzens1-0/+14
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-20ns2: Unify logging context via log macrosHarald Welte8-119/+112
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-20gprs_ns2_message: remove wrong commentAlexander Couzens1-1/+0
It's a leftover from converting NS1 -> NS2 code Change-Id: I934c7905f8396e74bb1f14d68097c03463816720
2021-01-20gprs_bssgp_rim: fix bug in dub_tlvp_header()Philipp Maier1-1/+1
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-20gprs_bssgp_rim: Return with EOPNOTSUPP on unsupported containersPhilipp Maier1-8/+8
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-20gprs_ns2_vc_fsm: fix transitions for ALIVE stateAlexander Couzens1-1/+1
Alive can never reach RESET. However ALIVE -> ALIVE is allowed. Change-Id: Ic414d7ca96b1ec6db1665cd4c072c7ebbee787f1
2021-01-20ns2: Properly indent VTY outputHarald Welte4-19/+20
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-20vty/fsm_vty: Add vty_out_fsm2() + vty_out_fsm_inst2() with prefixHarald Welte2-12/+34
Callers other than "show fsm" / "show fsm-instances" may want to indent the output. Change-Id: I10e01ef91116369868cdb878a99634c8681728af
2021-01-20gprs_ns2_vc_fsm: in RESET accept RESET as ACKAlexander Couzens1-0/+3
When both side sends RESET at the same time 48.016 Change-Id: I49d2a4f257f45b7bc4f0a7a6c5b8381071893686
2021-01-20gprs_ns2_vc_fsm: ensure all state is resetted via force_unconfAlexander Couzens1-2/+5
Change-Id: I240225ce82fa27dfcb5b4b8e2981bb4d8cc4cd70
2021-01-19gprs_ns2_vc_fsm: rename all event to match RX_ or REQ_Alexander Couzens1-71/+71
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-19gprs_ns2: correct handle BLOCK message on initatorAlexander Couzens1-0/+3
A BLOCK message can be received when waiting for a UNBLOCK message in state BLOCK Related: SYS#5208 Change-Id: Ie7b34b3ef04aa28304143191222324e1a3786cb2
2021-01-19gprs_ns2: implement BLOCK/UNBLOCK of a NSVC by vtyAlexander Couzens5-8/+206
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-19osmo-ns-dummy: don't leak primitive messagesAlexander Couzens1-0/+3
The message in the primitive must be freed by the user Change-Id: I2a7b19f019485c7b1f15baf20b62edc19b663415
2021-01-19gprs_ns2: allow to use free_vc() with NULLAlexander Couzens2-1/+5
Usually talloc_free() and other free functions in osmocom allows to be called with NULL which is then ignored. Change-Id: If7b0c6916a29d4611d0a40c388414076eb83e6b5
2021-01-19gprs_ns2: add assert on most bind callsAlexander Couzens2-1/+19
Add a OSMO_ASSERT to all bind calls which doesn't check if the bind is from the expected type. The only exception is rx and tx functions (hot path). Change-Id: Ia4f8932263c60618c7f0dfc32d50ba5a8d57602b
2021-01-19gprs_bssgp: add utilities to send and parse BSSGP rim PDUsPhilipp Maier6-4/+269
At the moment libosmogb offers no convinient way to send RIM PDUs. Also parsing an incoming RIM messages into destination, source routing info and RIM container is not available. Change-Id: I18134fd9938040d2facb6beee3732628b167ce8c Related: SYS#5103
2021-01-19test: gprs_ns2: free the nsi after each testAlexander Couzens1-0/+1
Change-Id: I700da48d7afe6b1a81484a0725faf0c56073446d
2021-01-19test: gprs_ns2: replace free_bind() with clear_pdus()Alexander Couzens1-4/+4
free_bind() should free up all driver specific state but NOT the bind itself. As the only thing left is clearing the pdus rename the function to it. Change-Id: Iac506734c93aca8be045ac13788d07d1bdc78eb3
2021-01-18bssgp_rim: move bssgp_parse_rim_ri and bssgp_create_rim_ri to gprs_bssgp_rimPhilipp Maier8-311/+312
The function bssgp_parse_rim_ri() and bssgp_create_rim_ri() are located in gprs_bssgp.c, since there is now a gprs_bssgp_rim.c module it makes more sense to put them there. Also adjust the code a bit so that its more intuitive to read. Change-Id: Icd667f41d5735de56cd9fb257670337c679dd258 Related: SYS#5103
2021-01-18bssgp_rim: add encoder/decoder for NACC related RIM containersPhilipp Maier9-2/+1859
BSSGP RIM uses a number of nested containers to signal RIM application specific payload information in a generic way. Lets add the container structurs required for NACC. Depends: libosmocore If48f412c32e8e5a3e604a78d12b74787a4786374 Change-Id: Ibbc7fd67658e3040c12abb5706fe9d1f31894352 Related: SYS#5103
2021-01-18ns2: delay NS_AFF_CAUSE_RECOVERY until NS-VC for data + sig are unblockedHarald Welte2-16/+17
Right now we end up in situations where only a NS-VC for data (BVCI != 0) becomes unblocked, but the BSSGP and/or user application code is notified that the NSE has recovered. In the case of osmo-gbproxy, this will trigger a BVC-RESET on the BVCI=0, but that obviously only works if the sig_weight > 0... Closes: OS#4956 Change-Id: I933ee3969c052394d61ec6cf8c7c21d17957d9ab
2021-01-18gprs_ns2: Give NS-VC FSMs a proper name/identifierHarald Welte5-9/+25
Log output without a proper identifier is mostly useless. Change-Id: Id9d5b0684584d03685900c6298fe70246793de14 Closes: OS#4876
2021-01-18gprs_ns2_fr: reduce duplication between gprs_ns2_fr_connect / connect2Harald Welte1-18/+1
gprs_sn2_fr_connect2() is the same as gprs_ns2_fr_connect() with the lookup-and-create-on-demand of the NSE first. Rather than copy+paste, they should simply invoke each other. Change-Id: If835bf138f213e7f58205018e7efe3ecb772c624
2021-01-18test: gprs_ns2: don't leak the talloc contextAlexander Couzens1-0/+1
Makes the address sanitizer happy Change-Id: Ibf926d8db88cdb403d29de5e666dfb71eefc7b72
2021-01-18gprs_ns2_vc_fsm: fix spaces and remove wrong commentAlexander Couzens1-3/+2
Change-Id: I52799d8ce8244fae7512a6e14a3cf2408a218c2d
2021-01-18gprs_ns2: flag then NSE as dead in nse_free()Alexander Couzens1-0/+1
The transfer cap call in ns2_prim_status_ind() asserts if NSE is in an invalid state (nse is either alive or has NSVCS). Change-Id: I535b3e5dd7240d19dd685652173775b250f5cc2d
2021-01-18gprs_ns2_sns: clear local and remote entries when SNS failedAlexander Couzens1-0/+16
The local and remote entries should be cleared on SNS Size. Further it can be cleared when SNS failed (e.g. all NSVC become dead) so VTY doesn't show old entries before entering SNS Size. Related: OS#4949 Change-Id: Ie4db81acdd5f8ddf1a1f5dc7645d1144545d9c73
2021-01-18gprs_ns2: when calling nsvc_force_unconf for a dynamic NSE drop the NSE.Alexander Couzens1-1/+3
The vty command is used for test cases to reset NSE state. So dynamic NSE shouldn't present. Related: SYS#5208 Change-Id: I0a4f35c974c8c3b79c48f2f56170722c95254332
2021-01-17gprs_ns2_vc: answer UNBLOCK on unblocked nsvcAlexander Couzens1-1/+5
48.016 7.2: says an UNBLOCK pdu should be answered with UNBLOCK_ACK on already unblocked NSVC Related: SYS#5208 Change-Id: Ic92e99b2607d1e54ecb4668667065502a55a2ce0
2021-01-17osmo-ns-dummy: allow to create dynamic NSEsAlexander Couzens1-0/+1
Without setting the flag the osmo-ns-dummy won't create any dynamic NSEs. This flag will be removed in a future release but for now it will be included. Related: SYS#5208 Change-Id: I196cc454b5d7bc53848f73596a2f92730b78922b
2021-01-17gprs_ns2: check if persistent nsei or nsvc exists when creating dynamic NSEAlexander Couzens1-4/+34
When receiving a NS Reset over an unknown NSVC the NS code would create a dynamic NSE. If the NSEI or NSVCI is already configured to a persistant NSE/NSVC the packet should be ignored. Related: SYS#5208 Change-Id: I855911e7d364f2e5b08ea05857747aa63fcf1cd3
2021-01-17ns2: Fix memory leak in IP-SNSDaniel Willmann1-2/+2
Don't allocate msg twice - it's not nice. Change-Id: I3fa0076eb480a7bcadb74cc86760dc29b77ac600 Related: OS#4874
2021-01-17Refactor ns2_nsvc_create_ip*Daniel Willmann1-30/+19
Move code common in ipv4/6 into a separate function and call that function. Change-Id: I076d53bee2e67e1cb3ad6ee5cd05c63ebe3359fb Related: OS#4948
2021-01-16ns2: Add sanity checkDaniel Willmann1-0/+3
Prevent memory corruption or segfaults by asserting that NSE and bind link layer match. A mismatch should never happen and might cause the bind to access invalid memory when sending because nsvc->priv doesn't match what it expects. Change-Id: I7ca4cd1c5dac8b5e44ffc4825b9373b2d04911ab Related: OS#4948
2021-01-14NS2: Fix bind selection of SNS NSVCsDaniel Willmann1-0/+8
The SNS code ignored the link type of the bind and just bound to every bind it could find. This resulted in a segfault when an SNS NSVC tries to send its UDP messages though frame relay. Fixes: OS#4948 Change-Id: Ibb832a39876362d094cce635192f7b4f84dc2b10
2021-01-14fixup: configure.ac: fix: do not define HAVE_NEON unconditionallyVadim Yanitskiy1-0/+3
Instead of removing AC_DEFINE(), I should have used AS_IF(). Change-Id: I20e256bd6fdb0256c95ab7073e07b7437af6a12f Fixes: I761a7afaeda9d232ac26edff47949e911f8f1f0c
2021-01-13ctrl: ports.h: Add OSMO_CTRL_PORT_BSC_NEIGHPau Espin Pedrol1-0/+1
Hence 4248 becomes the well-known port for osmo-bsc's Neighbor Resolution Service. Related: SYS#4909 Change-Id: Ic77a8cff022c2f939a684ebd1f9f62a82e0de510
2021-01-12tlv_parser: Fix various out-of-bounds accessesHarald Welte3-15/+115
The libosmocore TLV parser had a number of insufficient bounds checks leading to reads beyond the end of the respective input buffer. This patch * adds proper out-of-bounds checks to all TLV types * simplifies some of the existing checks * introduces test cases to test all the corner cases where either TAG, or length, or value are not fully contained in the input buffer. Thanks to Ilja Van Sprundel for reporting these problems. Change-Id: I98b02c914c9e3ecf56050af846292aa6979d7508
2021-01-11Intoduce Packet Switch CGIPau Espin Pedrol6-0/+136
This structure is needed in order to identify a given cell within the BSS during RIM transactions. The naming was made up by myself since I couldn't find any naming reference for this kind of data (RAI + CI). Since LAI + CI = CGI, then RAI + CI = CGI-PS osmo_rai_name2 family of functions get a "2" suffix due to already existing functions handling struct struct gprs_ra_id in gsm48.h Change-Id: If48f412c32e8e5a3e604a78d12b74787a4786374
2021-01-11gprs_bssgp: abuse gsm48_encode_ra() to encode TACVadim Yanitskiy1-1/+2
Both LAC and TAC take 2 octets and follow MCC/MNC fields on the wire. We abuse gsm48_encode_ra() for encoding of MCC/MNC, but it can also be abused to encode TAC in bssgp_create_rim_ri(). There is no need to encode '0000'O and then override it with osmo_store16be(). Change-Id: I986552aa52cf38b1c5290d2e5cd3ff2d1c36a4e5
2021-01-08Revert "pkgconfig: link to mnl if available"laforge1-1/+1
This reverts commit 2253224b33ae9f54f14dc54f0098c4d5ee27fdbf. Reason for revert: Causes massive build failure for osmo-pcu and osmo-sgsn on all the distributions/architectures we build for Change-Id: I6dbe4507701bee013b29dcc26f32c4e1a3c23613 Closes: OS#4936