From patchwork Tue Sep 23 11:28:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Erlbeck X-Patchwork-Id: 392432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8730B1400AF for ; Tue, 23 Sep 2014 21:36:56 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1XWOOk-0007ox-3w; Tue, 23 Sep 2014 13:36:46 +0200 Received: from mail.sysmocom.de ([2a01:4f8:191:444c::2:4]) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1XWOGh-0006jf-JO for openbsc@lists.osmocom.org; Tue, 23 Sep 2014 13:28:31 +0200 Received: from sysmocom-tmp.am93.sysmocom.de (unknown [91.65.194.134]) by mail.sysmocom.de (Postfix) with ESMTPSA id 8A68571E3E for ; Tue, 23 Sep 2014 11:28:26 +0000 (UTC) From: Jacob Erlbeck To: openbsc@lists.osmocom.org Subject: [PATCH 4/4] gprs: Set bssgph field in bssgp_msgb_alloc() Date: Tue, 23 Sep 2014 13:28:24 +0200 Message-Id: <1411471704-13911-4-git-send-email-jerlbeck@sysmocom.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411471704-13911-1-git-send-email-jerlbeck@sysmocom.de> References: <1411471704-13911-1-git-send-email-jerlbeck@sysmocom.de> X-Spam-Score: 0.0 (/) X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org 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 */