[PATCH] abis_nm: Fix ACTIVATE SW parameters

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

Sylvain Munaut 246tnt at gmail.com
Sat Oct 3 12:02:48 UTC 2009


From: Sylvain Munaut <tnt at 246tNt.com>

The previous code only sent the FILE_ID tag data part,
but according to the GSM 12.21 spec, section 8.3.6, the
full SW Description 'object' must be sent so that includes
the NM_ATT_SW_DESCR tag, the whole FILE_ID and the whole
FILE_VERSION (including tags & length fields).

Note that functionnaly on a nanoBTS 139 I couldn't see any
difference ... whatever I send in there it works ...

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
---
 openbsc/src/abis_nm.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 35ed8db..a450452 100755
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -857,6 +857,7 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
 	const u_int8_t *sw_config;
 	int sw_config_len;
 	int file_id_len;
+	int file_ver_len;
 	int nack = 0;
 	int ret;
 
@@ -889,18 +890,24 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb)
 
 	if (sw_config[0] != NM_ATT_SW_DESCR)
 		DEBUGP(DNM, "SW_DESCR attribute identifier not found!\n");
+
 	if (sw_config[1] != NM_ATT_FILE_ID)
 		DEBUGP(DNM, "FILE_ID attribute identifier not found!\n");
 	file_id_len = sw_config[2] * 256 + sw_config[3];
 
+	if (sw_config[4+file_id_len] != NM_ATT_FILE_VERSION)
+		DEBUGP(DNM, "FILE_VERSION attribute identifier not found!\n");
+	file_ver_len = sw_config[5+file_id_len] * 256 + sw_config[6+file_id_len];
+
 	/* Assumes first SW file in list is the one to be activated */
-	/* sw_config + 4 to skip over 2 attribute ID bytes and 16-bit length field */
+	/* The +7 in length is to account for the 3 tags and 2 length fields */
+	/* (see GSM 12.21 - 9.4.{62,18,19} for details */
 	return ipacc_sw_activate(mb->trx->bts, foh->obj_class,
 				 foh->obj_inst.bts_nr,
 				 foh->obj_inst.trx_nr,
 				 foh->obj_inst.ts_nr,
-				 sw_config + 4,
-				 file_id_len);
+				 sw_config,
+				 7 + file_id_len + file_ver_len);
 }
 
 /* Receive a CHANGE_ADM_STATE_ACK, parse the TLV and update local state */
-- 
1.6.4





More information about the OpenBSC mailing list