diff options
authorHarald Welte <laforge@gnumonks.org>2017-12-10 14:13:33 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-10 14:16:16 +0100
commit9af7028ebe72bb5bf47713f11b4e111ed83c0693 (patch)
parent081ac9c0292298f7992916d8f1b64faf764d4174 (diff)
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
1 files changed, 4 insertions, 1 deletions
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
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)