Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2800

to look at the new patch set (#2).

Request and parse BTS feature list via OML

Request features supported by BTS when getting attributes over OML.

Change-Id: Ic35b2865998bca3c2c0cb4b77e4e73d12e08bd7e
Related: OS#1614
---
M openbsc/src/libbsc/abis_nm.c
1 file changed, 40 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/00/2800/2

diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 83c8965..1a812b9 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -473,6 +473,45 @@
        return ari + num_unreported + 1; /* we have to account for 1st byte 
with number of unreported attributes */
 }
 
+/* Parse Attribute Response Info content for 3GPP TS 52.021 §9.4.30 
Manufacturer Id */
+static inline uint8_t *parse_attr_resp_info_manuf_id(struct gsm_bts *bts, 
uint8_t *data, uint16_t *data_len)
+{
+       struct tlv_parsed tp;
+       uint16_t m_id_len = 0;
+       uint8_t adjust = 0, i;
+
+       abis_nm_tlv_parse(&tp, bts, data, *data_len);
+       if (TLVP_PRES_LEN(&tp, NM_ATT_MANUF_ID, 2)) {
+               m_id_len = TLVP_LEN(&tp, NM_ATT_MANUF_ID);
+
+               if (m_id_len > MAX_BTS_FEATURES/8 + 1) {
+                       LOGP(DNM, LOGL_NOTICE, "Get Attributes Response: BTS%u 
feature vector is truncated to %u bytes\n",
+                            bts->nr, MAX_BTS_FEATURES/8);
+                       m_id_len = MAX_BTS_FEATURES/8;
+               }
+
+               if (m_id_len > _NUM_BTS_FEAT/8 + 1)
+                       LOGP(DNM, LOGL_NOTICE, "Get Attributes Response: BTS%u 
reported unexpectedly long (%u bytes) "
+                            "feature vector - most likely it was compiled 
against newer BSC headers. "
+                            "Consider upgrading your BSC to later version.\n",
+                            bts->nr, m_id_len);
+
+               memcpy(bts->_features_data, TLVP_VAL(&tp, NM_ATT_MANUF_ID), 
m_id_len);
+               adjust = m_id_len + 3; /* adjust for parsed TL16V struct */
+
+               for (i = 0; i < _NUM_BTS_FEAT; i++)
+                       if (gsm_bts_has_feature(bts, i) != 
gsm_btsmodel_has_feature(bts->model, i))
+                               LOGP(DNM, LOGL_NOTICE, "BTS%u feature '%s' 
reported via OML does not match statically "
+                                    "set feature: %u != %u. Please fix.\n", 
bts->nr,
+                                    get_value_string(gsm_bts_features_descs, 
i),
+                                    gsm_bts_has_feature(bts, i), 
gsm_btsmodel_has_feature(bts->model, i));
+       }
+
+       *data_len -= adjust;
+
+       return data + adjust;
+}
+
 /* Parse Attribute Response Info content for 3GPP TS 52.021 §9.4.28 
Manufacturer Dependent State */
 static inline uint8_t *parse_attr_resp_info_manuf_state(const struct gsm_bts 
*bts, uint8_t trx_nr,
                                                        uint8_t *data, uint16_t 
*data_len)
@@ -520,6 +559,7 @@
                                               &data_len);
 
        data = parse_attr_resp_info_manuf_state(bts, trx_nr, data, &data_len);
+       data = parse_attr_resp_info_manuf_id(bts, data, &data_len);
 
        /* after parsing manufacturer-specific attributes there's list of 
replies in form of sw-conf structure: */
        rc = abis_nm_get_sw_conf(data, data_len, &sw_descr[0], 
ARRAY_SIZE(sw_descr));

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic35b2865998bca3c2c0cb4b77e4e73d12e08bd7e
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to