aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/lapd_core.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-26gsm/lapdm: Prevent LAPD tx_queue from filling up in polling modeDaniel Willmann1-0/+6
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-16lapd: Improve log message and mention the SAPI the dl is onHolger Hans Peter Freyther1-2/+2
When debugging an issue that involves SAPI=0 and SAPI=3 the log file does not have enough context. Add the SAPI to this message so we at least understand which SAPI we are talking about.
2014-02-09lapd: Use the right struct for the talloc_zero_array callHolger Hans Peter Freyther1-2/+2
I saw this while playing with talloc pools and wondered why lapd_core is creating a log_info. Use the right struct for the array.
2013-08-09lapd: Remove the double NULL check idiom with msgb_freeHolger Hans Peter Freyther1-22/+13
if (ptr) msgb_free(ptr) extends to: if (ptr) talloc_free(ptr) And according to the talloc documentation a talloc_free(NULL) will not crash: "... Likewise, if "ptr" is NULL, then the function will make no modifications and returns -1."
2013-07-10LAPD: Free resume/re-establishment msgb if it carries no contentAndreas Eversberg1-2/+5
lapdm.c takes the re-establishment message and forwards it to lapd_core.c, so we can assume that msgb is set at primitive. In case there is data in the re-establishment msg, it is moved into send_buffer. In case of no data (0 length), it must be freed. Fixes an issue spotted by Coverity Scan.
2013-07-06LAPDm: Fix re-establishment of datalinkAndreas Eversberg1-5/+14
If the datalink fails or if handover or assignment to a new channel fails, it is re-establised by sending SABM again. The length of establish message is 0 in this case. The length is used to differentiate between re-establishment and contention resolution, which has to be handled differently. See TS 04.06 Chapter 5.4.2.1
2013-06-18lapd_core: msgb_trim() the L2 padding from ESTABLISH.ind0.6.1Harald Welte1-2/+3
When a SABM(E) frame arrives, we have to trim the L2 padding (0x2b for gsm) before handing the data off to L3, just like we do with I frames. Also, we should use mggb_trim() or even msgb_l3trim() instead of manually fiddling with msgb->length and ->tail pointers.
2013-05-08lapd: Set the tx_hist to NULL after freeing itHolger Hans Peter Freyther1-0/+1
Make detecting use after free of the tx_hist easy and set the variable to NULL after talloc_free has been freed.
2013-04-06Fix: LAPDm contention resoltion must acknowledge subsequent SABMAndreas Eversberg1-2/+8
After reception of SABM, the network responds with UA and enters the establised multiframe state. If UA is not received by mobile, the SABM is transmitted again, and the network must respond with UA again, unless it is from a different mobile. Add LAPDm collision test (contention resolution on network side).
2013-02-15misc: Doxygen tweaks: fixed some typos and minor errorsKaterina Barone-Adesi1-1/+2
Doxygen generates quite a lot of warnings on libosmocore. Some of them are obvious typos - this patch aims to fix such low-hanging fruit.
2012-11-26lapd: Use LOGL_ERROR for messgaes that are wrong in the given contextHolger Hans Peter Freyther1-14/+14
Log message that are either too big or have the C/R bit set as error.
2012-11-22misc: Use static const struct for LAPD and AbisHolger Hans Peter Freyther1-1/+1
2012-03-16lapd: Remove unused variable t200_start in lapd_acknowledge.Holger Hans Peter Freyther1-2/+1
lapd_core.c: In function 'lapd_acknowledge': lapd_core.c:710:38: warning: variable 't200_start' set but not used [-Wunused-but-set-variable]
2012-01-12lapd: Warn if someone attempts to send an empty messageHolger Hans Peter Freyther1-0/+7
DATA REQ with a msgb_l3len(msg) == 0 message does not make any sense, log an error and return immediately before attempting to send an empty I frame in lapd_send_i.
2012-01-12lapd: Mention the L3 size of the payload being sentHolger Hans Peter Freyther1-1/+2
2012-01-10libosmocore/lapd: Fixed handling of sequence errors at lapd_core.cAndreas.Eversberg1-3/+21
If a sequence error is received, the N(R) variable must still be used to acknowledge previously transmitted frames. If there are two subsequent sequence errors received, ignore it. (Ignore every second subsequent error.) This happens if our reply with the REJ is too slow, so the remote gets a T200 timeout and sends another frame with a sequence error. Test showed that replying with two subsequent REJ messages could the remote L2 process to abort. Replying too slow shouldn't happen, but may happen over serial link between BB and LAPD. Written-by: Andreas.Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-20gsm/lapd_core: Make sure rc is initialize in lapd_rx_uSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-12lapd: Fixed possible double free buf in lapd_core.cAndreas Eversberg1-2/+3
Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-10-10LAPD: Moved timer handling into seperate functionsAndreas Eversberg1-72/+87
2011-10-10Split of LAPDm into a core part and a GSM specific partroot1-0/+2128
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)