AUC: Differentiate between actual error and unknown IMSI
When responding to a SendAuthInfo.req, we need to differentiate
an error case caused by an unknown IMSI, or an error caused by
an error regarding accessing the database or data integrity.
diff --git a/src/hlr.c b/src/hlr.c
index 504c8d2..4fc072f 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -53,8 +53,12 @@
rc = db_get_auc(g_dbc, gsup->imsi, gsup_out.auth_vectors,
ARRAY_SIZE(gsup_out.auth_vectors),
NULL /* gsup->rand_auts */, gsup->auts);
- if (rc <= 0) {
+ if (rc < 0) {
gsup_out.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR;
+ gsup_out.cause = GMM_CAUSE_NET_FAIL;
+ } else if (rc == 0) {
+ gsup_out.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR;
+ gsup_out.cause = GMM_CAUSE_IMSI_UNKNOWN;
}
msg_out = msgb_alloc_headroom(1024+16, 16, "GSUP AUC response");