[PATCH] osmo-bts[master]: return NACK codes instead of errno values from oml_tx_attr_r...

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

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Thu Apr 19 16:23:49 UTC 2018


Review at  https://gerrit.osmocom.org/7884

return NACK codes instead of errno values from oml_tx_attr_resp()

The caller translates errno values back into NACK codes anyway,
so lets's return NACK codes directly.

Change-Id: I2b1f79e66c778139d64101c89dd6377921807e2d
Related: OS#2295
---
M src/common/oml.c
1 file changed, 8 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/84/7884/1

diff --git a/src/common/oml.c b/src/common/oml.c
index 5c9885e..cb735b4 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -211,7 +211,7 @@
 	struct msgb *attr_buf = oml_msgb_alloc();
 
 	if (!attr_buf)
-		return -ENOMEM;
+		return -NM_NACK_CANT_PERFORM;
 
 	for (i = 0; i < attr_len; i++) {
 		bool processed = false;
@@ -244,7 +244,7 @@
 	struct msgb *attr_buf = oml_msgb_alloc();
 
 	if (!attr_buf)
-		return -ENOMEM;
+		return -NM_NACK_CANT_PERFORM;
 
 	for (i = 0; i < attr_len; i++) {
 		switch (attr[i]) {
@@ -277,7 +277,7 @@
 	     get_value_string(abis_nm_obj_class_names, foh->obj_class));
 
 	if (!nmsg)
-		return -ENOMEM;
+		return -NM_NACK_CANT_PERFORM;
 
 	switch (foh->obj_class) {
 	case NM_OC_BTS:
@@ -289,7 +289,7 @@
 	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));
-		len = -EINVAL;
+		len = -NM_NACK_RES_NOTIMPL;
 	}
 
 	if (len < 0) {
@@ -301,7 +301,8 @@
 	/* §9.4.64 Get Attribute Response Info */
 	msgb_tl16v_put(nmsg, NM_ATT_GET_ARI, len, resp);
 
-	return oml_mo_send_msg(&bts->mo, nmsg, NM_MT_GET_ATTR_RESP);
+	len = oml_mo_send_msg(&bts->mo, nmsg, NM_MT_GET_ATTR_RESP);
+	return (len < 0) ? -NM_NACK_CANT_PERFORM : len;
 }
 
 /* 8.8.1 sending State Changed Event Report */
@@ -552,15 +553,8 @@
 
 	rc = oml_tx_attr_resp(bts, foh, TLVP_VAL(&tp, NM_ATT_LIST_REQ_ATTR), TLVP_LEN(&tp, NM_ATT_LIST_REQ_ATTR));
 	if (rc < 0) {
-		LOGP(DOML, LOGL_ERROR, "Failed to respond to O&M Get Attributes message: %s\n", strerror(-rc));
-		switch (-rc) {
-		case ENOMEM:
-			return oml_fom_ack_nack(msg, NM_NACK_CANT_PERFORM);
-		case ENOTSUP:
-			return oml_fom_ack_nack(msg, NM_NACK_OBJCLASS_NOTSUPP);
-		default:
-			return oml_fom_ack_nack(msg, NM_NACK_RES_NOTIMPL);
-		}
+		LOGP(DOML, LOGL_ERROR, "responding to O&M Get Attributes message with NACK 0%x\n", -rc);
+		return oml_fom_ack_nack(msg, -rc);
 	}
 
 	return 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b1f79e66c778139d64101c89dd6377921807e2d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>



More information about the gerrit-log mailing list