[PATCH] libosmo-sccp[master]: sccp_helpers: don't return msgb with l2h set

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Dec 10 13:17:09 UTC 2017


Review at  https://gerrit.osmocom.org/5263

sccp_helpers: don't return msgb with l2h set

It's a bad idea to use sccp_msgb_alloc() for SCCP User Primitive msgbs.

The rationale is quite simple: The SCU msgb's are used for wrapping
osmo_prim.  The user payload data (e.g. BSSAP) in such primitives is
found at msgb->l2h.  However, user payload data is optional.  So in a
SCU primitive without user data, we must have msgb->l2h == NULL.

The old behavior resulted in bogus data (actually the sccp_user_prim)
to be contained in the DATA section of SCCP messages such as RLSD/RLC.

Also, the old implementation of scu_msgb_alloc() discarded the 'name'
argument and replaced it with a static "SCU" which was of course another
bug.

Change-Id: I19cb83302aaa404ab1a2d92e6f2aec43d0380426
Related: OS#2732
---
M src/sccp_helpers.c
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/63/5263/1

diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index 078ca2b..1a67488 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -33,9 +33,12 @@
 
 #include "sccp_internal.h"
 
+#define SCU_MSG_SIZE		2048
+#define SCU_MSG_HEADROOM	0
+
 static struct msgb *scu_msgb_alloc(const char *name)
 {
-	return sccp_msgb_alloc("SCU");
+	return msgb_alloc_headroom(SCU_MSG_SIZE+SCU_MSG_HEADROOM, SCU_MSG_HEADROOM, name);
 }
 
 void osmo_sccp_make_addr_pc_ssn(struct osmo_sccp_addr *addr, uint32_t pc, uint32_t ssn)

-- 
To view, visit https://gerrit.osmocom.org/5263
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19cb83302aaa404ab1a2d92e6f2aec43d0380426
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list