summaryrefslogtreecommitdiffstats
path: root/src/gsm/lapdm.c
Commit message (Collapse)AuthorAgeFilesLines
* gsm: lapdm.c: Add missing new line char in notice log stringPau Espin Pedrol2018-06-181-1/+1
| | | | Change-Id: I92c78ea01570dc1f4be11b113c07f0aa3b342c8f
* lapdm: don't enforce contention resolution on SAPI0/DCCHHarald Welte2018-05-091-5/+2
| | | | | | | | | | | | | | | | | | | In Change-Id: I8c2c103cdc7f9a45d7b2080c572f559fc3db58e4 we introduced a check to enforce contention resolution always being used in MS-originated LAPDm establishment on the main DCCH / SAPI0. This is only required after RACH request (IMM.ASS.) and not after a normal assignment command which was sent already via a dedicated channel. Hence, we cannot enforce a strict requirement for contention resolution in those cases. We *could* use the RSL Channel Activation type as a constraint on whether or not to enforce contention-resoluiton-only LAPDm establishment, but this is out of the scope of the LAPDm code but would have to be done inside OsmoBTS. Related: OS#3252 Change-Id: Id903492ee90809fe98defcf4abc0419b8150069f
* lapdm: send_rslms_rll_l3_ui(): Don't include B4/SACCH IE unless neededHarald Welte2018-05-081-3/+5
| | | | | | | | | | | | | | The RSL_IE_MS_POWER / RSL_IE_TIMING_ADVANCE is how we communicate the SACCH L1 header values on the MS side between LAPDm and L3 (which is a non-standard use of RSL). However, those IEs only maek sense on the SACCH, where we have B4 frame format and where we actually have a L1 header containing related information. Let's make sure to skip those IEs on regular RLL UNIT DATA INDICATION happening on other channel types. Change-Id: I6f13e02192531479287f71de674d17ca2ceabdc6 Closes: OS#3249
* lapdm: cleanup: send_rslms_rll_l3_ui(): Use msgb_tv_push()Harald Welte2018-05-081-9/+5
| | | | | | | | This is a purely cosmetic clean-up to use the msgb_tv_push() API to pre-pend a Tag-Value IE to a msgb, rather than the existing open-coding approach. Change-Id: I19bbfa1e327a617685ed11d4182e533df33215cb
* lapdm: Implement SABM related constraintsHarald Welte2018-05-081-0/+45
| | | | | | | | | | * MO SAPI0 establishment *must always* have L3 payload for contention resolution * SAPI3 establishment *must never* use contention resolution * MT establish must never use contention resolution Change-Id: I8c2c103cdc7f9a45d7b2080c572f559fc3db58e4 Closes: OS#2370
* lapdm: Fix back-pointer from lapdm_entity to lapdm_channelHarald Welte2018-05-041-0/+2
| | | | | | | | It seems that during all those years it has never been noted that the back-pointer from the lapdm_entity to the lapdm_channel was never initialized. Let's fix that. Change-Id: Iaca66cd6a2c9f315561e365b51163927868fc346
* RSL/LAPDm: Not all RLL message are "transparent"Harald Welte2018-04-191-3/+21
| | | | | | | | | | 3GPP TS 48.058 has a very clear definition of which messages are "transparent" and hence have the T-bit == 1. This is *not* just all RLL messages, but basically only RLL_DATA.{ind,req} and RLL_UNITDATA.{ind,req}. All other messages are non-transparent. Change-Id: I9f83654af189d818563d799bf623325b7fee8e70 Closes: OS#3188
* Fix malformed Abis/RSL messages with extra L3 Information fieldPau Espin Pedrol2017-12-101-5/+0
| | | | | | | | | | | | | | | | | Some Abis/RSL messages such as "Release Indication" contained 3 extra bytes from an L3 Information header which should not be there according to specs in GSM 08.58 (section 8.3 "Radio link layer management messages"). Other RSL messages were affected by the same issue, except for "Establish Indication", which had already a workaround in send_rslms_dlsap. This commit fixes the issue in a generic way, removes the "Establish Indication" and fixes the test accounting for the bug, as it otherwise fails after applying the changes. Fixes: OS#1635, OS#2336 Change-Id: Ibb116214e8b1798d65a8b0917150496a3c14f344
* cosmetic: Fix trailing whitespacePau Espin Pedrol2017-12-101-2/+2
| | | | Change-Id: I0c7a414789f8ce6516369327430f71164e2cbd94
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-131-1/+4
| | | | | | | | Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-7/+5
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-16/+16
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* update/extend doxygen documentationHarald Welte2017-06-121-0/+1
| | | | | | | | | It's a pity that even with this patch we still are fare away from having the whole API documented. However, at least we have a more solid foundation. Updates not only extend the documentation, but also make sure it is rendered properly in the doxygen HTML. Change-Id: I1344bd1a6869fb00de7c1899a8db93bba9bafce3
* use osmo_{htonl,htons,ntohl,ntohs}() functions all over libosmocoreHarald Welte2017-05-151-1/+0
| | | | | | This gets us one step closer to fixing the embedded build Change-Id: I3fc2639b6ade9ab138766987eceab7ec9498fdc7
* Check for proper lapdm_datalink entityMax2017-03-021-2/+8
| | | | | | | | | | Previously lapdm_datalink->entity->mode was dereferenced without checking if correct entity is present. This might lead to segfault. Check it explicitly before dereferencing, log error and gracefully return if necessary. Change-Id: I0361e3731e86712b415a370cab1128d611988f56 Related: OS#1898
* Add strings with PH primitive namesMax2016-05-301-0/+12
| | | | | | | | | | It's useful debugging helper while troubleshooting L1-related issues. Change-Id: Id7a6d478fd725c51f54ad746bdf9b9095579ff77 Reviewed-on: https://gerrit.osmocom.org/117 Tested-by: Jenkins Builder Reviewed-by: Max <msuraev@sysmocom.de> Reviewed-by: Holger Freyther <holger@freyther.de>
* LaPDm: Refuse SUSPEND/RESUME/RECONNECT in BTS modeHarald Welte2015-12-191-0/+17
| | | | | | The primitives for SUSPEND, RESUME and RECONNECT are only permitted on the MS side of the LAPDm link, not on the BTS side. So we should check for this and reject, accordingly.
* msgb: Check the return value of msgb_alloc (Coverity)Jacob Erlbeck2015-04-101-0/+3
| | | | | | | | | | | In some places, the return value of msgb_alloc/msgb_alloc_headroom is not checked before it is dereferenced. This commit adds NULL checks to return with -ENOMEM from the calling functions if the alloc function has failed. Fixes: Coverity CID 1249692, 1293376 Sponsored-by: On-Waves ehf
* gsm/lapdm: Prevent LAPD tx_queue from filling up in polling modeDaniel Willmann2014-03-261-0/+21
| | | | | | | If LAPDm receives an I-Frame while there already is an I-Frame in the tx_queue the code generates an additional RR (to acknowledge the received I-Frame). Instead, N(R) of the I-Frame in the tx_queue should be updated to ACK the data.
* lapdm: Make lapdm_datalink_for_sapi publicDaniel Willmann2014-03-261-3/+3
| | | | | This API allows you to get the lapdm_datalink for a SAPI. It's needed in the lapdm_test, so make it public.
* ladpm: Fix msgb handling and SAPI=3 establishment delayJacob Erlbeck2014-03-101-27/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently it takes 3s to establish a SAPI 3 SACCH connection with osmo-bts. This is due to the fact, that a broken SABME request is sent first and and is ignored by the MS. Then, after a T200 timeout (2s) the SABME command is sent again (this time correctly) and answered by the MS. The first SABME message is broken (it has a length field of 3 and ends with 3 bytes from the tail of the original RSL message), because of it is expected throughout lapdm.c that msg buffers containing RSL have msg->l2h == msg->data. Some abis input drivers fulfill this but IPA doesn't, thus the 3 bytes of the IPA header are still part of the msg and confuse length computation. Since internal fields of the msg are modified directly, this is difficult to see. This patch adds a new function msgb_pull_to_l3() that explicitely skips over all headers prepending L3 and therefore resets l1h and l2h. This function is then used instead of msgb_pull_l2h() which only worked correctly when msg->l2h == msg->data. In addition, code manipulating msg->tail and msg->len directly has been replaced by calls to msgb_trim(). Note that this patch does not fix all issues of this case in the LADP related code. Ticket: SYS#192 Sponsored-by: On-Waves ehf
* lapdm: Fix typo in the commentHolger Hans Peter Freyther2014-01-231-1/+1
|
* LAPDm: Allow sending unit data on DCCHAndreas Eversberg2013-07-061-10/+18
| | | | It is used to transfer PHYSICAL INFORMATION message to the MS.
* Fix of potential memory leaks at lapdm.cAndreas Eversberg2013-04-061-4/+17
|
* lapd: Check in rslms_rx_rll() if lapdm context was initialized earlierDaniel Willmann2012-12-261-2/+18
| | | | | | | | | | | | | | | | | | This was found while implementing handover on a sysmobts. When we receive a channel release request for a channel that was never really activated (set_lapdm_context() was not called) we segfault in lapd_recv_dlsap(). We now return early with -EINVAL in rslms_rx_rll() if we receive a message that assumes set_lapdm_context() was already called. These are: * RSL_MT_UNIT_DATA_REQ * RSL_MT_DATA_REQ * RSL_MT_SUSP_REQ * RSL_MT_REL_REQ A test case was added to trigger the issue.
* LAPDm: Ensure there is no payload in DISC framesHarald Welte2012-04-261-1/+6
| | | | | | When we send DISC frames (especially generated from RSL), we don't want any remaining bytes from the RSL message showing up as bogus DISC payload.
* doc: Fix the Doxygen section endingsSylvain Munaut2012-04-181-1/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* lapdm: fix RSL message format in RLL ERROR INDICATIONHarald Welte2012-04-051-1/+0
| | | | | | In rsl_rll_error() we don't need to re-set the msg->l2h as that would corrupt the message. The recipient would interpret any cause value as 0.
* lapdm: Make sure that the msgb_l3len(msg) == length...Holger Hans Peter Freyther2012-01-121-4/+4
| | | | | | | | | | This code should not play with the internals of the msgb like this, this code got introduced in af48bed55607931307 and is breaking the osmo-bts usecase of forwarding an RSL message. Add a test case that fails without the new code. I would prefer if we could get rid of the manipulating the msgb like this, it is prone to errors like this one.
* gsm/lapdm: Display SAPI in debug message for easier debugAndreas.Eversberg2011-11-121-2/+2
| | | | | Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsm/lapdm: Fix UI frames from BTS->MS have length (B4 format)Andreas.Eversberg2011-11-121-7/+11
| | | | | | | | | | This is part of a set of commit to fix LAPDm to handle datalink connection on ACCH (SAPI 3) This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4). Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsm/lapdm: Fix TA and power level handling in the ACCH headerAndreas.Eversberg2011-11-121-6/+14
| | | | | | | | | | | | | Timing advance and power level indicated by MS (measurement reports) and BTS (SI 5/6) are now stored for use at ACCH data link connection. This is part of a set of commit to fix LAPDm to handle datalink connection on ACCH (SAPI 3) This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4). Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsm/lapdm: Set N201 depending on the frame typeAndreas.Eversberg2011-11-121-5/+5
| | | | | | | | | | This is part of a set of commit to fix LAPDm to handle datalink connection on ACCH (SAPI 3) This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4). Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsm/lapdm: Make T200 timer depends on the link type (SACCH is slower)Andreas.Eversberg2011-11-121-5/+6
| | | | | | | | | | This is part of a set of commit to fix LAPDm to handle datalink connection on ACCH (SAPI 3) This is required to transfer SMS on SACCH of TCH/f or SDCCH/8 (4). Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* gsm/lapdm: Add missing msgb_free in rslms_rx_rll error casesAndreas.Eversberg2011-11-121-0/+2
| | | | | Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* Added defines to use primitive/operation tuples in switch/case statementsAndreas Eversberg2011-10-101-58/+20
|
* Split of LAPDm into a core part and a GSM specific partroot2011-10-101-1620/+327
| | | | | | | | | | | | | | Instead of mixing together the GSM layer 1 interface and RSL interface with the implementation of LAPD, the core function of LAPD is now extracted from LAPDm. The core implementation is now in lapd_core.c and lapd_core.h respectively. The lapd_core.c implements exactly one datalink instance for one SAP. The surrounding implementation "lapdm.c" codes/decodes the layer 2 headers and handles multiplexing and datalink instances, as well as translates primitives from/to RSL layer. lapd_core.c can now be used for other LAPD implementations. (ISDN/ABIS)
* LAPDm: Fix encoding of RLL ERROR IEHarald Welte2011-09-031-1/+0
|
* doxygen: Add documentation for LAPDm codeHarald Welte2011-08-171-4/+38
|
* lapdm: fix memory leak due to unreachable codeHarald Welte2011-07-161-1/+0
| | | | detected by Smatch
* lapdm: make sure we flush all queues whenever entering IDLE stateHarald Welte2011-06-291-0/+11
| | | | | this fixes a memory leak where the final UA would always remain in memory after a LAPDm entity has been disconnected.
* LAPDm: Uplink SACCH frames use format B, not format B4Harald Welte2011-06-291-5/+12
|
* LAPDm: When Rx DATA from L1, L1 does not know the SAPIHarald Welte2011-06-271-13/+14
| | | | We have to determine the SAPI ourselves inside the LAPDm header.
* add LAPDm code from osmocom-bb into libosmocoreHarald Welte2011-06-271-0/+2510