diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-04-19 18:02:05 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-04-23 08:59:42 +0000 |
commit | 4ad781412efe79596a7e2694daff0ba06d63e901 (patch) | |
tree | 28eacce45a3176a2de4973fa020e1fce21c8ad97 /src | |
parent | 5a8c0b2b5df42b21e6094be5815acd17a86a9f48 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/common/oml.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/common/oml.c b/src/common/oml.c index 0958220c..a1e7fdaa 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -211,7 +211,7 @@ static inline int handle_attrs_trx(uint8_t *out, struct gsm_bts_trx *trx, const 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 @@ static inline int handle_attrs_bts(uint8_t *out, const struct gsm_bts *bts, cons 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 @@ static int oml_tx_attr_resp(struct gsm_bts *bts, const struct abis_om_fom_hdr *f 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 @@ static int oml_tx_attr_resp(struct gsm_bts *bts, const struct abis_om_fom_hdr *f 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 @@ static int oml_tx_attr_resp(struct gsm_bts *bts, const struct abis_om_fom_hdr *f /* ยง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 @@ static int oml_rx_get_attr(struct gsm_bts *bts, struct msgb *msg) 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; |