AgeCommit message (Collapse)AuthorFilesLines
2021-01-14WIP Fixdaniel/ns2Daniel Willmann1-0/+8
Change-Id: Ibb832a39876362d094cce635192f7b4f84dc2b10
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
2021-01-07bssgp_bvc_fsm: Handle block request from application correctlyDaniel Willmann1-1/+4
This is no event from an incoming message so rx is NULL, and we can't send a status PDU. Also blocking the signalling BVC is not allowed (unblocking it is already forbidden). Change-Id: I3e384b71d57e939efc1596ac1d92380ed5eb916d Fixes: CID#215716
2021-01-07ns2_frgre: Fix missing break statement for recv from IPV6Daniel Willmann1-0/+1
Change-Id: I549277483fee55f390e0b5ae1dafec6f2d68eae7 Fixes: CID#215836
2021-01-07logging: Remove duplicate color for DLSMSDaniel Willmann1-1/+0
Change-Id: Ia797efce36e0afff74de54374d568521ecedf486
2021-01-07pkgconfig: link to mnl if availableEric1-1/+1
The dependency on mnl breaks builds of osmo-pcu et al if mnl is used for libosmogb, but not linked in for lib users Change-Id: Ib4df95d5c922f8edfa33e68645652fd30d321ff8
2021-01-07bts_features: s/Repeation/Repetition/ in osmo_bts_features_descs[]Vadim Yanitskiy1-1/+1
Change-Id: Ia8c77766842ce80eae969774959cbf46e86f97b9
2021-01-06gsm_08_18: add struct to parse RIM PDU IndicationsPhilipp Maier1-0/+22
3GPP TS 48.018, section 11.3.65 describes an IE to transfer some control flags via a RIM container. The IE is essentially just a bitfield, so it can be parsed by overlaying it with a C-struct. Lets add an appropiate struct to protocol/gsm_08_18.h Change-Id: I781ab838bd02ac1b13d384ce3f4259e26cedb61e Related: SYS#5103
2021-01-06ctrl: Allow handling CTRL get/set replies in user defined codePau Espin Pedrol3-0/+12
Prior to this patch, it was not possible to gather SET/GET reply information when implementing a CTRL client using libosmocontrol. This is specially important when using the GET command, since one wants to receive the queried value. CTRL traps can also be handled this way by extending this patch in the future if needed. Change-Id: Id3c4631cd32c13e78e11b6e8194b8c16307ec4f1
2021-01-06Add inter-thread queueHarald Welte9-1/+487
This adds an inter-thread queue "it_q" to libosmocore. With it_q, one can perform thread-safe enqueing of messages to another thread, who will receive the related messages triggered via an eventfd handled in the usual libosmocore select loop abstraction. Change-Id: Ie7d0c5fec715a2a577fae014b0b8a0e9c38418ef
2021-01-05gitignore: Ignore *~Pau Espin Pedrol1-0/+1
They seem to be generated by newer versions of autofoo. Change-Id: Ia4514da3c3dcbc383487a3d98b322a5ecb918568
2021-01-05bssgp: Add SUSPEND_NACK to osmo_pdef_bssgpDaniel Willmann1-0/+2
Change-Id: Ic996a343215ad32e3f301712411006e5d41f9084 Related: SYS#4865
2021-01-05gprs_bssgp: fix uninitialized struct fields in bssgp_create_rim_ri()Vadim Yanitskiy1-3/+6
Change-Id: Ifc3dda1fe5e9743072751dbb14c2d973388cb3b2 Fixes: CID#215836
2021-01-05gprs_ns2_fr: fix resource leaks due to early return in set_ifupdown()Vadim Yanitskiy1-2/+6
Change-Id: Ie52bf8ac6d62e7f2d760294bf2fe90119cc96b4b Related: CID#215869
2021-01-05gprs_ns2_sns: always check rc of osmo_sockaddr_str_from_sockaddr()Vadim Yanitskiy1-1/+3
Writing a configuration that will be rejected by the VTY parser is not the best solution, but still better than printing values from previous iterations or the stack garbage. In any case, this is unlikely to happen, just making Coverity happy. Change-Id: I26644fe544c82c90767ec1a9709918474bd1be53 Fixes: CID#215852
2021-01-05gprs_ns2: set transfer cap in NS Status primitiveAlexander Couzens10-2/+276
Related: SYS#5153 OS#4835 Change-Id: Ia1046db9e0d50855bff9de670b612ffc57af9995
2021-01-04gprs_bssgp: add handling for BSSGP RIM primitivesPhilipp Maier3-0/+46
Receive and forward RIM messages to bssgp_prim_cb() Change-Id: Idfd0a65872a2cc6089885afd8d31b0b029d85d47 Related: SYS#5103
2021-01-04gsmtap_util: SNR can be negative, use a signed integerVadim Yanitskiy2-8/+8
In 'struct gsmtap_hdr' field 'snr_db' is defined as a signed integer, however all functions that fill this structure accept an unsigned integer. This is wrong, because SNR can be negative. Let's use 'int8_t' instead of 'uint8_t'. Changing from unsigned to signed should be relatively safe compared to the opposite. Most of the callers I am aware of always do pass 0 anyway. Change-Id: I9f432be5c346d563bf518111c14ff04d4a63f592 Related: SYS#5073
2021-01-03gsm_08_58: add flexible array member to 'struct ipac_preproc_ave_cfg'Vadim Yanitskiy2-0/+3
Some averaging methods may have additional parameters, so let's make it easier to access them for the API user. Change-Id: I2f4ed56837dd479dbbd10c0a7df0ed7565d3946a Related: SYS#4918
2021-01-03cbsp: Fix parsing DCS in decode of WRITE-REPLACEHarald Welte1-0/+1
The encoder generates the DCS IE, but the decoder forgot to parse it :/ Change-Id: I05d489f91a2cc5df372e8e695126659eedac9485
2021-01-03cbsp: Fix osmo_cbsp_recv_buffered() for KEEP-ALIVE-COMPLETEHarald Welte1-6/+1
We used to suppress/drop any "zero length" messages, but we didn't include the header when computing the length. However, in CBSP there are messages (at least KEEP-ALIVE-COMPLETE) which only consist of the header without any information elements. We cannot simply drop such messages. This also fixes the return value of osmo_cbsp_recv_buffered() to be the total number of received octets (including the header). Change-Id: Ib620128a167cb77f061ee57e8f8ad707b96b1c0d
2021-01-03cbsp: Fix encoding of "ETWS Warning Security Info" IEHarald Welte1-2/+5
This is a fixed-length Tag-Value IE. Our decoder already parsed it correctly, but the encoder encoded it as TLV, which is wrong. Change-Id: I7e1d7eab8b8e51acd9a24c38e2d3d30bbf00847a
2021-01-01gprs_ns2: call python vty testsAlexander Couzens3-1/+30
Also checks vty docs Change-Id: Ia8b77ae5bc3fed835dd1fc2cce0acbc41f199d54
2021-01-01utils: add osmo-ns-dummyAlexander Couzens4-3/+334
A dummy client to do integration tests of the ns2 layer. It drop all unit data. But allows vty tests. Change-Id: I127c178426bc1a3da8de251740eda93853030d6d
2021-01-01gprs_ns2: use zero initialized memory for vty_bindsAlexander Couzens1-1/+1
Change-Id: I5635d98c52948fddcc375e1be9b1cd04aa32bc3c
2020-12-29gprs_ns2: fr: check the device state before changing stateAlexander Couzens1-0/+7
Reduce the required capabilities if the device is already set up. Change-Id: I72eb2567078758694c648a493324b212461ee735
2020-12-28Declare osmo_ctx_init() in talloc.hDaniel Willmann1-0/+2
This function is called automatically on the main thread, but needs to ba called explicitly in order to run the select loop on another thread. Make it available for applications through talloc.h Change-Id: Ie710ca9ad01d3fadb9f4ff344a55d6c01004727b
2020-12-27gprs_ns2_fr: setup_device: allow to setup a new dahdi deviceAlexander Couzens1-4/+6
When a dahdi device hasn't been set up yet, ioctl IF_GET_PROTO fails with invalid argument. Also fix the device check to skip ioctl's if the device is also in the correct state. Change-Id: I398d056546e35465a2944e1b4a86a8c93b3e5f7a
2020-12-26gprs_ns2: rework frame relay load distribution functionAlexander Couzens2-23/+18
For frame relay the traffic will be even distributed across all NS-VCs. Do not differentiate between signalling and data traffic. Change-Id: I6c060941db335a7a6a555ac8d1b9269fa8fb2023
2020-12-23rest_octets: Fix decoding of SI3 3G Early Classmark Sending RestrictionPau Espin Pedrol1-2/+2
Restriction is applied if the value is L, so fix it. Fixes: f85b33f68fcf9b34e723e4571078d7eeb0de5d59 Change-Id: Idd170bc0f12e8b215a624e0632a106bde076179b
2020-12-23Revert "rest_octets: fix encoding of 3G Early Classmark Sending Restriction"Pau Espin Pedrol1-2/+2
This reverts commit c9eab828ea4a9f508a013cf5cc1e0384a0e62e4c. The initial code was correct, which has also been used in osmo-bsc until recently, where it moved to use this function from libosmocore and errors started to show up in TTCN3 tests. See 3GPP TS 44.018 Section / Table "SI 3 Rest Octets information element": """ <SI3 Rest Octet> ::= ... <3G Early Classmark Sending Restriction> ... <3G Early Classmark Sending Restriction>::= L | H; """ Change-Id: I0ee48d3240c62c4d2e15063b26da7a2a617f383e Related: OS#3075 Related: SYS#4021
2020-12-23frame_relay: link_alloc: move log message to the endAlexander Couzens1-3/+2
The link->name is still not set resulting in logging a (null) Change-Id: I67cd4bce8238340e6ecb8d04a9a39c8b8d7d63e7
2020-12-23frame_relay: prevent null pointer exception when talloc failsAlexander Couzens1-0/+2
Change-Id: Ib39682ad0c7f30c97303b3d0bb6240fddd23ec0b
2020-12-23gprs_ns2: fix force-unconfigured for IP-SNS NSEAlexander Couzens2-4/+12
The IP-SNS need to do a reselection of the IP-SNS remote for testing. Freeing all nsvc will force this. Change-Id: I367c215a830c02eae2a470cba314828b5e0fb5c9
2020-12-23gprs_ns2: don't start unconfigured fsm via FORCE_UNCONFIGUREDAlexander Couzens1-4/+6
IP-SNS NSVC are unconfigured and not started when the IP-SNS is doing the SNS configuration. If those NSVC would be started it would result in unsolicitated NS-Alive PDUs. Change-Id: Ifec7288dbe71f10109e8b5c3849bf8f23ac7b557
2020-12-23gprs_ns2: sns: add log message when size/config retries exhaustedAlexander Couzens1-4/+8
Change-Id: I5f7c04b364807418f5ba22132fc889b46d66aed0
2020-12-23gprs_ns2: sns: don't send duplicated packets on retriesAlexander Couzens1-4/+4
When all retries are exhausted it should change the state and not send out a packet. Change-Id: Ie33df4a12298882bc46633200486dc34c6e34d8e
2020-12-23gprs_ns2: sns: correct log message when no nsvcs availableAlexander Couzens1-3/+6
The log message should only shown if a reselection will be triggered. Change-Id: I96b280a927aba6ac09ce88aedfcf469243c4dffe
2020-12-22gprs_ns2: add new vty2Alexander Couzens8-1/+1675
Change-Id: I163279cf57e84198dc8c53e1c109f5a9474670e9
2020-12-21lapd_core: Don't dereference data link after sending PRIM_DL_RELHarald Welte1-5/+4
We must always send the RELEASE.{indication,confirm} last before returning from a function. We cannot rely on the datalink to still be around after the call, as the SAP user might have destroyed the data link meanwhile. This fixes a heap use-after-free (at least) with RBS2000 when the BTS is fully brought up and the OML data link is lost, see OS#1762 Change-Id: I8ccca8d5e5d07b666557afe12ab8ac4910ddfb00 Related: OS#1761 Related: OS#1762
2020-12-21vty: Fix left shifting out of range on signed variableHarald Welte1-1/+1
Fixes following ASan runtime errors while running vty tests: command.c:730:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Somehow we didn't catch this one in Ie11ff18d6fd9f6e1e91a51b6156fb6b0b7d3a9a8 Change-Id: I601caf7daa947f3cf391316f1011007ef9188c90
2020-12-21fsm: Add osmo_fsm_inst_broadcast_children()Harald Welte2-0/+31
This is a helper function to broadcast an event to all of the siblings of a specified FSM instance. Change-Id: I2ce398741a8672d7b7c4058d056f46e2fe7353c1
2020-12-21gprs_ns2_fr: Use OSMO_STRLCPY_ARRAY() where possibleHarald Welte1-2/+2
Change-Id: I8ce461ecc36a81a4221336e82a36a69f49f89a0a
2020-12-21gprs_ns2_fr: Avoid stringop-truncation warningHarald Welte1-1/+1
gprs_ns2_fr.c:448:2: error: ‘strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation] 448 | strncpy(req.ifr_name, netif, IFNAMSIZ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Ied9fd1bea091075fad266258da39e674d10d4dcb
2020-12-20gprs_ns2: fr: setup the device to correct FR/LMI settingsAlexander Couzens1-4/+110
A hdlc can be used in different modes. Also a FR device can be used with lmi and certain settings as without it. ns2 will use FR with no lmi in the kernel. Related: SYS#5169 Change-Id: I04786d2b864860b08c2e1afdb199470f4b80cc3b
2020-12-20gprs_ns2: fr: implement a write queueAlexander Couzens1-29/+19
Related: SYS#5228 Change-Id: Id6eba04d5fb744f791b333c168729bbbd28cabd9