aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-07-03 19:28:53 +0200
committerHarald Welte <laforge@osmocom.org>2020-07-03 19:28:53 +0200
commit8617d09ee375c66b3aa2f6fe26c5b744b156c740 (patch)
treec84f7bd21a45c54f406415bf727f894244224f4e /src/gsm
parentdb974f372b6039811737a8cbdcaec13f854a777e (diff)
lapd_core: Ensure we always have some tailroom
At some points, e.g. when allocating message buffers from the Tx history, we used to allocate them exactly as large as the defined headroom plus the user data. This means that the underlying PH layer (E1 mostly) had no tailroom to add anything to the end of the message. Especially for DAHDI this is a problem, as we need to make space for two more bytes of frame check sequence (FCS). So let's simply make sure we always have some extra space at the end of such buffers. Change-Id: Id362ce131157c7513d744b0248c7f78fb75c590c Related: OS#4644
Diffstat (limited to 'src/gsm')
-rw-r--r--src/gsm/lapd_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index c77b6632..cf25f3de 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -104,6 +104,7 @@
#define CR_NET2USER_RESP 0
#define LAPD_HEADROOM 56
+#define LAPD_TAILROOM 16
#define SBIT(a) (1 << a)
#define ALL_STATES 0xffffffff
@@ -120,7 +121,7 @@ struct msgb *lapd_msgb_alloc(int length, const char *name)
/* adding space for padding, FIXME: add as an option */
if (length < 21)
length = 21;
- return msgb_alloc_headroom(length + LAPD_HEADROOM, LAPD_HEADROOM, name);
+ return msgb_alloc_headroom(length + LAPD_HEADROOM + LAPD_TAILROOM, LAPD_HEADROOM, name);
}
static inline uint8_t do_mod(uint8_t x, uint8_t m)