[MERGED] libosmo-sccp[master]: initialize msg->l2h in sccp_msgb_alloc()

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
Sat Nov 11 19:52:28 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: initialize msg->l2h in sccp_msgb_alloc()
......................................................................


initialize msg->l2h in sccp_msgb_alloc()

Change-Id: I5fb11075593696b110bfd3e0541e3aa790029903
---
M src/sua.c
M tests/xua/xua_test.ok
2 files changed, 18 insertions(+), 13 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/sua.c b/src/sua.c
index fb7545e..7575021 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -60,10 +60,15 @@
 
 struct msgb *sccp_msgb_alloc(const char *name)
 {
+	struct msgb *msg;
 	if (!name)
 		name = "SCCP";
-	return msgb_alloc_headroom(SCCP_MSG_SIZE+SCCP_MSG_HEADROOM,
-				   SCCP_MSG_HEADROOM, name);
+	msg = msgb_alloc_headroom(SCCP_MSG_SIZE+SCCP_MSG_HEADROOM,
+				  SCCP_MSG_HEADROOM, name);
+	if (!msg)
+		return NULL;
+	msg->l2h = msg->tail;
+	return msg;
 }
 
 /***********************************************************************
diff --git a/tests/xua/xua_test.ok b/tests/xua/xua_test.ok
index 6b0cb33..472c02b 100644
--- a/tests/xua/xua_test.ok
+++ b/tests/xua/xua_test.ok
@@ -24,7 +24,7 @@
 	PART(T=Source Address,L=12,D=0002000180030008000000fe),
 	PART(T=Data,L=6,D=000430040120)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 09 00 03 05 07 02 42 fe 02 42 fe 06 00 04 30 04 01 20 
+SCCP Output: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 06 00 04 30 04 01 20 
 
 => BSSMAP-RESET-ACK
 SCCP Input: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 03 00 01 31 
@@ -35,7 +35,7 @@
 	PART(T=Source Address,L=20,D=00020003800200080000005c80030008000000fe),
 	PART(T=Data,L=3,D=000131)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 03 00 01 31 
+SCCP Output: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 03 00 01 31 
 
 => BSSMAP-PAGING
 SCCP Input: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 
@@ -46,7 +46,7 @@
 	PART(T=Source Address,L=20,D=00020003800200080000005c80030008000000fe),
 	PART(T=Data,L=16,D=000e52080829471002013197611a0106)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 
+SCCP Output: [L2]> 09 00 03 07 0b 04 43 01 00 fe 04 43 5c 00 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 
 
 => BSSMAP-UDT
 SCCP Input: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 
@@ -57,7 +57,7 @@
 	PART(T=Source Address,L=12,D=0002000180030008000000fe),
 	PART(T=Data,L=16,D=000e52080829471002013197611a0106)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 09 00 03 05 07 02 42 fe 02 42 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 
+SCCP Output: [L2]> 09 00 03 05 07 02 42 fe 02 42 fe 10 00 0e 52 08 08 29 47 10 02 01 31 97 61 1a 01 06 
 
 => BSSMAP-CR
 SCCP Input: [L2]> 01 01 02 03 02 02 04 02 42 fe 0f 1f 00 1d 57 05 08 00 72 f4 80 20 12 c3 50 17 10 05 24 11 03 33 19 a2 08 29 47 10 02 01 31 97 61 00 
@@ -68,7 +68,7 @@
 	PART(T=Destination Address,L=12,D=0002000180030008000000fe),
 	PART(T=Data,L=31,D=001d5705080072f4802012c3501710052411033319a2082947100201319761)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 01 01 02 03 02 02 04 02 42 fe 0f 1f 00 1d 57 05 08 00 72 f4 80 20 12 c3 50 17 10 05 24 11 03 33 19 a2 08 29 47 10 02 01 31 97 61 00 
+SCCP Output: [L2]> 01 01 02 03 02 02 04 02 42 fe 0f 1f 00 1d 57 05 08 00 72 f4 80 20 12 c3 50 17 10 05 24 11 03 33 19 a2 08 29 47 10 02 01 31 97 61 00 
 
 => BSSMAP-CC
 SCCP Input: [L2]> 02 01 02 03 00 00 03 02 01 00 
@@ -78,7 +78,7 @@
 	PART(T=Destination Reference,L=4,D=00010203),
 	PART(T=Source Reference,L=4,D=00000003)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 02 01 02 03 00 00 03 02 01 00 
+SCCP Output: [L2]> 02 01 02 03 00 00 03 02 01 00 
 
 => BSSMAP-DTAP
 SCCP Input: [L2]> 06 00 00 03 00 01 0f 01 00 0c 03 05 5c 08 11 81 33 66 02 13 45 f4 
@@ -88,7 +88,7 @@
 	PART(T=Segmentation,L=4,D=00000000),
 	PART(T=Data,L=15,D=01000c03055c0811813366021345f4)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 06 00 00 03 00 01 0f 01 00 0c 03 05 5c 08 11 81 33 66 02 13 45 f4 
+SCCP Output: [L2]> 06 00 00 03 00 01 0f 01 00 0c 03 05 5c 08 11 81 33 66 02 13 45 f4 
 
 => BSSMAP-CLEAR
 SCCP Input: [L2]> 06 00 00 03 00 01 06 00 04 20 04 01 09 
@@ -98,7 +98,7 @@
 	PART(T=Segmentation,L=4,D=00000000),
 	PART(T=Data,L=6,D=000420040109)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 06 00 00 03 00 01 06 00 04 20 04 01 09 
+SCCP Output: [L2]> 06 00 00 03 00 01 06 00 04 20 04 01 09 
 
 => BSSMAP-RELEASED
 SCCP Input: [L2]> 04 00 00 03 01 02 03 00 01 0f 02 23 42 00 
@@ -109,7 +109,7 @@
 	PART(T=Cause,L=4,D=00000300),
 	PART(T=Data,L=2,D=2342)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 04 00 00 03 01 02 03 00 01 0f 02 23 42 00 
+SCCP Output: [L2]> 04 00 00 03 01 02 03 00 01 0f 02 23 42 00 
 
 => BSSMAP-RELEASE_COMPLETE
 SCCP Input: [L2]> 05 01 02 03 00 00 03 
@@ -118,7 +118,7 @@
 	PART(T=Destination Reference,L=4,D=00010203),
 	PART(T=Source Reference,L=4,D=00000003)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 05 01 02 03 00 00 03 
+SCCP Output: [L2]> 05 01 02 03 00 00 03 
 
 => TCAP
 SCCP Input: [L2]> 09 81 03 0d 18 0a 12 07 00 12 04 53 84 09 00 17 0b 12 06 00 12 04 44 87 20 00 20 65 9a 65 81 97 48 04 26 00 01 98 49 04 51 01 03 df 6c 81 88 a1 81 85 02 01 44 02 01 07 30 80 a7 80 a0 80 04 01 2b 30 80 30 12 83 01 10 84 01 07 85 07 91 44 57 76 67 16 97 86 01 20 30 06 82 01 18 84 01 04 00 00 00 00 a3 06 04 01 42 84 01 05 a3 06 04 01 51 84 01 05 a3 06 04 01 31 84 01 05 a3 09 04 01 12 84 01 05 82 01 02 a3 09 04 01 11 84 01 05 81 01 01 a3 06 04 01 14 84 01 00 a3 0b 04 01 41 84 01 04 30 03 83 01 10 a3 0b 04 01 41 84 01 04 30 03 82 01 18 00 00 00 00 
@@ -129,7 +129,7 @@
 	PART(T=Source Address,L=32,D=0001000580010014000000040c00010444872000206500008003000800000006),
 	PART(T=Data,L=154,D=6581974804260001984904510103df6c8188a181850201440201073080a780a08004012b30803012830110840107850791445776671697860120300682011884010400000000a306040142840105a306040151840105a306040131840105a309040112840105820102a309040111840105810101a306040114840100a30b0401418401043003830110a30b040141840104300382011800000000)
 Re-Encoding decoded SUA to SCCP
-SCCP Output: 09 81 03 0d 18 0a 12 07 00 12 04 53 84 09 00 17 0b 12 06 00 12 04 44 87 20 00 20 65 9a 65 81 97 48 04 26 00 01 98 49 04 51 01 03 df 6c 81 88 a1 81 85 02 01 44 02 01 07 30 80 a7 80 a0 80 04 01 2b 30 80 30 12 83 01 10 84 01 07 85 07 91 44 57 76 67 16 97 86 01 20 30 06 82 01 18 84 01 04 00 00 00 00 a3 06 04 01 42 84 01 05 a3 06 04 01 51 84 01 05 a3 06 04 01 31 84 01 05 a3 09 04 01 12 84 01 05 82 01 02 a3 09 04 01 11 84 01 05 81 01 01 a3 06 04 01 14 84 01 00 a3 0b 04 01 41 84 01 04 30 03 83 01 10 a3 0b 04 01 41 84 01 04 30 03 82 01 18 00 00 00 00 
+SCCP Output: [L2]> 09 81 03 0d 18 0a 12 07 00 12 04 53 84 09 00 17 0b 12 06 00 12 04 44 87 20 00 20 65 9a 65 81 97 48 04 26 00 01 98 49 04 51 01 03 df 6c 81 88 a1 81 85 02 01 44 02 01 07 30 80 a7 80 a0 80 04 01 2b 30 80 30 12 83 01 10 84 01 07 85 07 91 44 57 76 67 16 97 86 01 20 30 06 82 01 18 84 01 04 00 00 00 00 a3 06 04 01 42 84 01 05 a3 06 04 01 51 84 01 05 a3 06 04 01 31 84 01 05 a3 09 04 01 12 84 01 05 82 01 02 a3 09 04 01 11 84 01 05 81 01 01 a3 06 04 01 14 84 01 00 a3 0b 04 01 41 84 01 04 30 03 83 01 10 a3 0b 04 01 41 84 01 04 30 03 82 01 18 00 00 00 00 
 Parsing M3UA Message
 Parsing Nested M3UA Routing Key IE
 Testing SCCP Address Encode/Decode

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5fb11075593696b110bfd3e0541e3aa790029903
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list