Change in osmo-bts[master]: common/oml.c: use proper OML object for Get Attribute Response

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
Sun Apr 21 08:06:37 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13701 )

Change subject: common/oml.c: use proper OML object for Get Attribute Response
......................................................................

common/oml.c: use proper OML object for Get Attribute Response

It was noticed that the Get Attribute Response message always
indicates BTS(00,ff,ff) as the addressed OML entity, even if
e.g. Baseband Transceiver(00,00,ff) was requested by the BSC.

Despite neither OsmoBSC nor OpenBSC does complain about this,
such behaviour violates 3GPP TS 52.021. Let's fix this.

Change-Id: Icb1ee75d4bf680deb6365288d8c2053816a12217
Related: OS#3938
---
M src/common/oml.c
1 file changed, 20 insertions(+), 11 deletions(-)

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



diff --git a/src/common/oml.c b/src/common/oml.c
index 568d406..307e8d9 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -252,29 +252,29 @@
 }
 
 /* send 3GPP TS 52.021 §8.11.2 Get Attribute Response */
-static int oml_tx_attr_resp(struct gsm_bts *bts, const struct abis_om_fom_hdr *foh, const uint8_t *attr,
-			    uint16_t attr_len)
+static int oml_tx_attr_resp(const struct gsm_abis_mo *mo,
+			    const uint8_t *attr, uint16_t attr_len)
 {
 	struct msgb *nmsg = oml_msgb_alloc();
 	uint8_t resp[MAX_VERSION_LENGTH * attr_len * 2]; /* heuristic for Attribute Response Info space requirements */
 	int len;
 
 	LOGP(DOML, LOGL_INFO, "%s Tx Get Attribute Response\n",
-	     get_value_string(abis_nm_obj_class_names, foh->obj_class));
+	     get_value_string(abis_nm_obj_class_names, mo->obj_class));
 
 	if (!nmsg)
 		return -NM_NACK_CANT_PERFORM;
 
-	switch (foh->obj_class) {
+	switch (mo->obj_class) {
 	case NM_OC_BTS:
-		len = handle_attrs_bts(resp, bts, attr, attr_len);
+		len = handle_attrs_bts(resp, mo->bts, attr, attr_len);
 		break;
 	case NM_OC_BASEB_TRANSC:
-		len = handle_attrs_trx(resp, gsm_bts_trx_num(bts, foh->obj_inst.trx_nr), attr, attr_len);
+		len = handle_attrs_trx(resp, gsm_bts_trx_num(mo->bts, mo->obj_inst.trx_nr), attr, attr_len);
 		break;
 	default:
 		LOGP(DOML, LOGL_ERROR, "Unsupported MO class %s in Get Attribute Response\n",
-		     get_value_string(abis_nm_obj_class_names, foh->obj_class));
+		     get_value_string(abis_nm_obj_class_names, mo->obj_class));
 		len = -NM_NACK_OBJCLASS_NOTSUPP;
 	}
 
@@ -287,7 +287,7 @@
 	/* §9.4.64 Get Attribute Response Info */
 	msgb_tl16v_put(nmsg, NM_ATT_GET_ARI, len, resp);
 
-	len = oml_mo_send_msg(&bts->mo, nmsg, NM_MT_GET_ATTR_RESP);
+	len = oml_mo_send_msg(mo, nmsg, NM_MT_GET_ATTR_RESP);
 	return (len < 0) ? -NM_NACK_CANT_PERFORM : len;
 }
 
@@ -527,6 +527,7 @@
 static int oml_rx_get_attr(struct gsm_bts *bts, struct msgb *msg)
 {
 	struct abis_om_fom_hdr *foh = msgb_l3(msg);
+	const struct gsm_abis_mo *mo;
 	struct tlv_parsed tp;
 	int rc;
 
@@ -536,18 +537,26 @@
 	abis_nm_debugp_foh(DOML, foh);
 	DEBUGPC(DOML, "Rx GET ATTR\n");
 
+	/* Determine which OML object is addressed */
+	mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst);
+	if (!mo) {
+		LOGP(DOML, LOGL_ERROR, "%s Get Attributes for unknown Object Instance\n",
+		     abis_nm_dump_foh(foh));
+		return oml_fom_ack_nack(msg, NM_NACK_OBJINST_UNKN);
+	}
+
 	rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
 	if (rc < 0) {
-		oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UNSUP_ATTR, "Get Attribute parsing failure");
+		oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UNSUP_ATTR, "Get Attribute parsing failure");
 		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
 	}
 
 	if (!TLVP_PRES_LEN(&tp, NM_ATT_LIST_REQ_ATTR, 1)) {
-		oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UNSUP_ATTR, "Get Attribute without Attribute List");
+		oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UNSUP_ATTR, "Get Attribute without Attribute List");
 		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
 	}
 
-	rc = oml_tx_attr_resp(bts, foh, TLVP_VAL(&tp, NM_ATT_LIST_REQ_ATTR), TLVP_LEN(&tp, NM_ATT_LIST_REQ_ATTR));
+	rc = oml_tx_attr_resp(mo, TLVP_VAL(&tp, NM_ATT_LIST_REQ_ATTR), TLVP_LEN(&tp, NM_ATT_LIST_REQ_ATTR));
 	if (rc < 0) {
 		LOGP(DOML, LOGL_ERROR, "responding to O&M Get Attributes message with NACK 0%x\n", -rc);
 		return oml_fom_ack_nack(msg, -rc);

-- 
To view, visit https://gerrit.osmocom.org/13701
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icb1ee75d4bf680deb6365288d8c2053816a12217
Gerrit-Change-Number: 13701
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190421/df61811b/attachment.htm>


More information about the gerrit-log mailing list