Change in libosmocore[master]: lapd_core: Ensure we always have some tailroom

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Jul 3 17:31:00 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19128 )


Change subject: lapd_core: Ensure we always have some tailroom
......................................................................

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
---
M src/gsm/lapd_core.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/28/19128/1

diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index c77b663..cf25f3d 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 @@
 	/* 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)

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19128
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id362ce131157c7513d744b0248c7f78fb75c590c
Gerrit-Change-Number: 19128
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200703/125e8f79/attachment.htm>


More information about the gerrit-log mailing list