[PATCH 4/4] gprs: Set bssgph field in bssgp_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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Tue Sep 23 11:28:24 UTC 2014


Currently the bssgph field is not set when using the bssgp_tx_*
functions. This hinders unit testing of generated messages.

This patch initializes the bssgph field directly after allocation a
new bssgp msgb in bssgp_msgb_alloc() so that it is set by default.

Sponsored-by: On-Waves ehf
---
 src/gb/gprs_bssgp_util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gb/gprs_bssgp_util.c b/src/gb/gprs_bssgp_util.c
index 261e0b0..604764c 100644
--- a/src/gb/gprs_bssgp_util.c
+++ b/src/gb/gprs_bssgp_util.c
@@ -70,7 +70,9 @@ const char *bssgp_cause_str(enum gprs_bssgp_cause cause)
 
 struct msgb *bssgp_msgb_alloc(void)
 {
-	return msgb_alloc_headroom(4096, 128, "BSSGP");
+	struct msgb *msg = msgb_alloc_headroom(4096, 128, "BSSGP");
+	msgb_bssgph(msg) = msg->data;
+	return msg;
 }
 
 /* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */
-- 
1.9.1





More information about the OpenBSC mailing list