From bce2061b43c1e38b766cc3738b4ad669211dc6a4 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 5 Jan 2015 18:57:32 +0100 Subject: 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 --- openbsc/tests/sgsn/sgsn_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'openbsc/tests') diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index ef8661b12..6980a9015 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -438,7 +439,7 @@ static void test_subscriber_gsup(void) /* Inject SendAuthInfoErr GSUP message */ rc = rx_gsup_message(send_auth_info_err, sizeof(send_auth_info_err)); - OSMO_ASSERT(rc >= 0); + OSMO_ASSERT(rc == -GMM_CAUSE_GPRS_NOTALLOWED); OSMO_ASSERT(last_updated_subscr == s1); /* Check triplets */ @@ -456,7 +457,7 @@ static void test_subscriber_gsup(void) /* Inject UpdateLocErr GSUP message */ rc = rx_gsup_message(update_location_err, sizeof(update_location_err)); - OSMO_ASSERT(rc >= 0); + OSMO_ASSERT(rc == -GMM_CAUSE_GPRS_NOTALLOWED); OSMO_ASSERT(last_updated_subscr == s1); /* Check authorization */ -- cgit v1.2.3