aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-01-05 18:57:32 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-01-18 18:22:47 +0100
commitbce2061b43c1e38b766cc3738b4ad669211dc6a4 (patch)
tree0df33aa2f88e57fd4a693f531180e31a909c780f /openbsc/src/gprs
parent9aa9991efe207f5c12bbcf655b0660e3466c02e0 (diff)
gprs: Let GSUP parser functions return GMM causes on errors
Currently the GSUP message handling function in gprs_subscriber.c and the functions in gprs_gsup_messages.c are not consistent with respect to the return codes if an error happens. Albeit all error return codes are negative, the semantics of the absolute value are not clearly defined. In addition, some return codes are not passed to the calling function. This path changes these functions to always return a negated GMM cause value in case of errors. Return values of called parser functions are not longer ignored. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs')
-rw-r--r--openbsc/src/gprs/gprs_gsup_messages.c4
-rw-r--r--openbsc/src/gprs/gprs_subscriber.c11
2 files changed, 8 insertions, 7 deletions
diff --git a/openbsc/src/gprs/gprs_gsup_messages.c b/openbsc/src/gprs/gprs_gsup_messages.c
index f47ad5545..1dad74ffe 100644
--- a/openbsc/src/gprs/gprs_gsup_messages.c
+++ b/openbsc/src/gprs/gprs_gsup_messages.c
@@ -74,7 +74,7 @@ static int decode_pdp_info(uint8_t *data, size_t data_len,
rc = gprs_shift_tlv(&data, &data_len, &tag, &value, &value_len);
if (rc < 0)
- return rc;
+ return -GMM_CAUSE_PROTO_ERR_UNSPEC;
iei = tag;
@@ -116,7 +116,7 @@ static int decode_auth_info(uint8_t *data, size_t data_len,
while (data_len > 0) {
rc = gprs_shift_tlv(&data, &data_len, &tag, &value, &value_len);
if (rc < 0)
- return rc;
+ return -GMM_CAUSE_PROTO_ERR_UNSPEC;
iei = tag;
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index fd16fa3ef..136ac28fb 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -339,7 +339,8 @@ int gprs_subscr_rx_gsup_message(struct msgb *msg)
rc = gprs_gsup_decode(data, data_len, &gsup_msg);
if (rc < 0) {
LOGP(DGPRS, LOGL_ERROR,
- "decoding GSUP message fails with error code %d\n", -rc);
+ "decoding GSUP message fails with error '%s' (%d)\n",
+ get_value_string(gsm48_gmm_cause_names, -rc), -rc);
return rc;
}
@@ -369,19 +370,19 @@ int gprs_subscr_rx_gsup_message(struct msgb *msg)
break;
case GPRS_GSUP_MSGT_SEND_AUTH_INFO_RESULT:
- gprs_subscr_handle_gsup_auth_res(subscr, &gsup_msg);
+ rc = gprs_subscr_handle_gsup_auth_res(subscr, &gsup_msg);
break;
case GPRS_GSUP_MSGT_SEND_AUTH_INFO_ERROR:
- gprs_subscr_handle_gsup_auth_err(subscr, &gsup_msg);
+ rc = gprs_subscr_handle_gsup_auth_err(subscr, &gsup_msg);
break;
case GPRS_GSUP_MSGT_UPDATE_LOCATION_RESULT:
- gprs_subscr_handle_gsup_upd_loc_res(subscr, &gsup_msg);
+ rc = gprs_subscr_handle_gsup_upd_loc_res(subscr, &gsup_msg);
break;
case GPRS_GSUP_MSGT_UPDATE_LOCATION_ERROR:
- gprs_subscr_handle_gsup_upd_loc_err(subscr, &gsup_msg);
+ rc = gprs_subscr_handle_gsup_upd_loc_err(subscr, &gsup_msg);
break;
case GPRS_GSUP_MSGT_PURGE_MS_ERROR: