gprs: Handle PURGE MS ERR/RES without subscr

Currently the subscr entry is no longer present, when PURGE MS
ERROR/RESULT arrives. In this case, an unspecific notice is logged
('unknown IMSI'). This clutters up the logfile with notices even in
perfectly normal operation.

This commit changes the code path that is used when a subscr cannot
be found for an incoming GSUP message. A check for PURGE MS RESULT
and ERROR is added and gprs_subscr_handle_gsup_purge_no_subscr is
called for these messages instead of gprs_subscr_handle_unknown_imsi.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2015-01-27 13:47:24 +01:00 committed by Holger Hans Peter Freyther
parent e988ae471d
commit 929acdf6bf
1 changed files with 29 additions and 2 deletions

View File

@ -35,6 +35,11 @@
#define SGSN_SUBSCR_MAX_RETRIES 3
#define SGSN_SUBSCR_RETRY_INTERVAL 10
#define LOGGSUPP(level, gsup, fmt, args...) \
LOGP(DGPRS, level, "GSUP(%s) " fmt, \
(gsup)->imsi, \
## args)
extern void *tall_bsc_ctx;
static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg);
@ -370,6 +375,21 @@ static int gprs_subscr_handle_gsup_upd_loc_err(struct gsm_subscriber *subscr,
return -gsup_msg->cause;
}
static int gprs_subscr_handle_gsup_purge_no_subscr(
struct gprs_gsup_message *gsup_msg)
{
if (GPRS_GSUP_IS_MSGT_ERROR(gsup_msg->message_type)) {
LOGGSUPP(LOGL_NOTICE, gsup_msg,
"Purge MS has failed with cause '%s' (%d)\n",
get_value_string(gsm48_gmm_cause_names, gsup_msg->cause),
gsup_msg->cause);
return -gsup_msg->cause;
}
LOGGSUPP(LOGL_INFO, gsup_msg, "Completing purge MS\n");
return 0;
}
static int gprs_subscr_handle_gsup_purge_res(struct gsm_subscriber *subscr,
struct gprs_gsup_message *gsup_msg)
{
@ -479,8 +499,15 @@ int gprs_subscr_rx_gsup_message(struct msgb *msg)
subscr = gprs_subscr_get_by_imsi(gsup_msg.imsi);
if (!subscr)
return gprs_subscr_handle_unknown_imsi(&gsup_msg);
if (!subscr) {
switch (gsup_msg.message_type) {
case GPRS_GSUP_MSGT_PURGE_MS_RESULT:
case GPRS_GSUP_MSGT_PURGE_MS_ERROR:
return gprs_subscr_handle_gsup_purge_no_subscr(&gsup_msg);
default:
return gprs_subscr_handle_unknown_imsi(&gsup_msg);
}
}
LOGGSUBSCRP(LOGL_INFO, subscr,
"Received GSUP message of type 0x%02x\n", gsup_msg.message_type);