aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/lapdm.c
AgeCommit message (Collapse)AuthorFilesLines
2015-04-10msgb: Check the return value of msgb_alloc (Coverity)Jacob Erlbeck1-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
2014-03-26gsm/lapdm: Prevent LAPD tx_queue from filling up in polling modeDaniel Willmann1-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.
2014-03-26lapdm: Make lapdm_datalink_for_sapi publicDaniel Willmann1-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.
2014-03-10ladpm: Fix msgb handling and SAPI=3 establishment delayJacob Erlbeck1-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
2014-01-23lapdm: Fix typo in the commentHolger Hans Peter Freyther1-1/+1
2013-07-06LAPDm: Allow sending unit data on DCCHAndreas Eversberg1-10/+18
It is used to transfer PHYSICAL INFORMATION message to the MS.
2013-04-06Fix of potential memory leaks at lapdm.cAndreas Eversberg1-4/+17
2012-12-26lapd: Check in rslms_rx_rll() if lapdm context was initialized earlierDaniel Willmann1-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.
2012-04-26LAPDm: Ensure there is no payload in DISC frames0.4.2Harald Welte1-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.
2012-04-18doc: Fix the Doxygen section endingsSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-04-05lapdm: fix RSL message format in RLL ERROR INDICATIONHarald Welte1-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.
2012-01-12lapdm: Make sure that the msgb_l3len(msg) == length...Holger Hans Peter Freyther1-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.
2011-11-12gsm/lapdm: Display SAPI in debug message for easier debugAndreas.Eversberg1-2/+2
Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12gsm/lapdm: Fix UI frames from BTS->MS have length (B4 format)Andreas.Eversberg1-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>
2011-11-12gsm/lapdm: Fix TA and power level handling in the ACCH headerAndreas.Eversberg1-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>
2011-11-12gsm/lapdm: Set N201 depending on the frame typeAndreas.Eversberg1-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>
2011-11-12gsm/lapdm: Make T200 timer depends on the link type (SACCH is slower)Andreas.Eversberg1-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>
2011-11-12gsm/lapdm: Add missing msgb_free in rslms_rx_rll error casesAndreas.Eversberg1-0/+2
Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-10Added defines to use primitive/operation tuples in switch/case statementsAndreas Eversberg1-58/+20
2011-10-10Split of LAPDm into a core part and a GSM specific partroot1-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)
2011-09-03LAPDm: Fix encoding of RLL ERROR IE0.3.8Harald Welte1-1/+0
2011-08-17doxygen: Add documentation for LAPDm codeHarald Welte1-4/+38
2011-07-16lapdm: fix memory leak due to unreachable codeHarald Welte1-1/+0
detected by Smatch
2011-06-29lapdm: make sure we flush all queues whenever entering IDLE state0.3.4Harald Welte1-0/+11
this fixes a memory leak where the final UA would always remain in memory after a LAPDm entity has been disconnected.
2011-06-29LAPDm: Uplink SACCH frames use format B, not format B4Harald Welte1-5/+12
2011-06-27LAPDm: When Rx DATA from L1, L1 does not know the SAPIHarald Welte1-13/+14
We have to determine the SAPI ourselves inside the LAPDm header.
2011-06-27add LAPDm code from osmocom-bb into libosmocore0.3.3Harald Welte1-0/+2510