Revert "gprs: Block other GSUP procedures during PURGE_MS"
This reverts commit f81cacc681
.
Since the PURGE MS retry mechanism had been removed, this feature
is not used anymore. It just makes the code more complex.
Conflicts:
openbsc/include/openbsc/gprs_sgsn.h
openbsc/src/gprs/gprs_subscriber.c
openbsc/tests/sgsn/sgsn_test.c
This commit is contained in:
parent
277b71e0d8
commit
ca69b0f68d
|
@ -296,20 +296,12 @@ struct sgsn_subscriber_pdp_data {
|
|||
char apn_str[GSM_APN_LENGTH];
|
||||
};
|
||||
|
||||
enum sgsn_subscriber_proc {
|
||||
SGSN_SUBSCR_PROC_NONE = 0,
|
||||
SGSN_SUBSCR_PROC_PURGE,
|
||||
SGSN_SUBSCR_PROC_UPD_LOC,
|
||||
SGSN_SUBSCR_PROC_UPD_AUTH,
|
||||
};
|
||||
|
||||
struct sgsn_subscriber_data {
|
||||
struct sgsn_mm_ctx *mm;
|
||||
struct gsm_auth_tuple auth_triplets[5];
|
||||
int auth_triplets_updated;
|
||||
struct llist_head pdp_list;
|
||||
int error_cause;
|
||||
enum sgsn_subscriber_proc blocked_by;
|
||||
};
|
||||
|
||||
#define SGSN_ERROR_CAUSE_NONE (-1)
|
||||
|
@ -359,10 +351,6 @@ void gprs_subscr_update(struct gsm_subscriber *subscr);
|
|||
void gprs_subscr_update_auth_info(struct gsm_subscriber *subscr);
|
||||
int gprs_subscr_rx_gsup_message(struct msgb *msg);
|
||||
|
||||
int gprs_subscr_purge(struct gsm_subscriber *subscr);
|
||||
int gprs_subscr_query_auth_info(struct gsm_subscriber *subscr);
|
||||
int gprs_subscr_location_update(struct gsm_subscriber *subscr);
|
||||
|
||||
/* Called on subscriber data updates */
|
||||
void sgsn_update_subscriber_data(struct sgsn_mm_ctx *mmctx);
|
||||
|
||||
|
|
|
@ -82,22 +82,6 @@ static int gsup_read_cb(struct gprs_gsup_client *gsupc, struct msgb *msg)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int check_blocking(
|
||||
struct gsm_subscriber *subscr,
|
||||
enum sgsn_subscriber_proc what)
|
||||
{
|
||||
if (subscr->sgsn_data->blocked_by == SGSN_SUBSCR_PROC_NONE ||
|
||||
subscr->sgsn_data->blocked_by == what)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void abort_blocking_procedure(struct gsm_subscriber *subscr)
|
||||
{
|
||||
/* reset something */
|
||||
}
|
||||
|
||||
int gprs_subscr_purge(struct gsm_subscriber *subscr);
|
||||
|
||||
static struct sgsn_subscriber_data *sgsn_subscriber_data_alloc(void *ctx)
|
||||
|
@ -659,42 +643,17 @@ int gprs_subscr_rx_gsup_message(struct msgb *msg)
|
|||
int gprs_subscr_purge(struct gsm_subscriber *subscr)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
int rc;
|
||||
|
||||
if (!check_blocking(subscr, SGSN_SUBSCR_PROC_PURGE)) {
|
||||
LOGGSUBSCRP(
|
||||
LOGL_NOTICE, subscr,
|
||||
"Cannot purge MS subscriber, blocked\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
/* GSM 09.02, 19.4.1.4 requires other MAP requests to be blocked until
|
||||
* this procedure is completed
|
||||
*/
|
||||
subscr->sgsn_data->blocked_by = SGSN_SUBSCR_PROC_PURGE;
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr, "purging MS subscriber\n");
|
||||
|
||||
gsup_msg.message_type = GPRS_GSUP_MSGT_PURGE_MS_REQUEST;
|
||||
rc = gprs_subscr_tx_gsup_message(subscr, &gsup_msg);
|
||||
if (rc < 0)
|
||||
subscr->sgsn_data->blocked_by = SGSN_SUBSCR_PROC_NONE;
|
||||
|
||||
return rc;
|
||||
return gprs_subscr_tx_gsup_message(subscr, &gsup_msg);
|
||||
}
|
||||
|
||||
int gprs_subscr_query_auth_info(struct gsm_subscriber *subscr)
|
||||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
|
||||
if (!check_blocking(subscr, SGSN_SUBSCR_PROC_UPD_AUTH)) {
|
||||
LOGGSUBSCRP(
|
||||
LOGL_NOTICE, subscr,
|
||||
"Cannot start update auth info request procedure, blocked\n");
|
||||
abort_blocking_procedure(subscr);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr,
|
||||
"subscriber auth info is not available\n");
|
||||
|
||||
|
@ -706,14 +665,6 @@ int gprs_subscr_location_update(struct gsm_subscriber *subscr)
|
|||
{
|
||||
struct gprs_gsup_message gsup_msg = {0};
|
||||
|
||||
if (!check_blocking(subscr, SGSN_SUBSCR_PROC_UPD_LOC)) {
|
||||
LOGGSUBSCRP(
|
||||
LOGL_NOTICE, subscr,
|
||||
"Cannot start update location procedure, blocked\n");
|
||||
abort_blocking_procedure(subscr);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
LOGGSUBSCRP(LOGL_INFO, subscr,
|
||||
"subscriber data is not available\n");
|
||||
|
||||
|
|
|
@ -636,88 +636,6 @@ int my_gprs_gsup_client_send_dummy(struct gprs_gsup_client *gsupc, struct msgb *
|
|||
return 0;
|
||||
};
|
||||
|
||||
|
||||
static void test_subscriber_blocking(void)
|
||||
{
|
||||
struct gsm_subscriber *s1;
|
||||
const char *imsi1 = "1234567890";
|
||||
struct sgsn_mm_ctx *ctx;
|
||||
struct gprs_ra_id raid = { 0, };
|
||||
uint32_t local_tlli = 0xffeeddcc;
|
||||
int rc;
|
||||
|
||||
printf("Testing subcriber procedure blocking\n");
|
||||
|
||||
gprs_gsup_client_send_cb = my_gprs_gsup_client_send_dummy;
|
||||
sgsn->gsup_client = talloc_zero(tall_bsc_ctx, struct gprs_gsup_client);
|
||||
|
||||
/* Check for emptiness */
|
||||
OSMO_ASSERT(gprs_subscr_get_by_imsi(imsi1) == NULL);
|
||||
|
||||
/* Create a context */
|
||||
OSMO_ASSERT(count(gprs_llme_list()) == 0);
|
||||
ctx = alloc_mm_ctx(local_tlli, &raid);
|
||||
strncpy(ctx->imsi, imsi1, sizeof(ctx->imsi) - 1);
|
||||
|
||||
/* Allocate and attach a subscriber */
|
||||
s1 = gprs_subscr_get_or_create_by_mmctx(ctx);
|
||||
assert_subscr(s1, imsi1);
|
||||
|
||||
/* Start SendAuthInfoRequest procedure */
|
||||
rc = gprs_subscr_query_auth_info(s1);
|
||||
/* Not blocking */
|
||||
OSMO_ASSERT(rc == 0);
|
||||
|
||||
/* Start UpdateLocation procedure */
|
||||
rc = gprs_subscr_location_update(s1);
|
||||
/* Blocking */
|
||||
OSMO_ASSERT(rc == 0);
|
||||
|
||||
/* Start PurgeMS procedure */
|
||||
rc = gprs_subscr_purge(s1);
|
||||
/* Not blocking */
|
||||
OSMO_ASSERT(rc == 0);
|
||||
OSMO_ASSERT(s1->sgsn_data->blocked_by == SGSN_SUBSCR_PROC_PURGE);
|
||||
|
||||
/* Start PurgeMS procedure (retry) */
|
||||
rc = gprs_subscr_purge(s1);
|
||||
/* Not blocking */
|
||||
OSMO_ASSERT(rc == 0);
|
||||
|
||||
/* Start SendAuthInfoRequest procedure */
|
||||
rc = gprs_subscr_query_auth_info(s1);
|
||||
/* Blocking */
|
||||
OSMO_ASSERT(rc == -EAGAIN);
|
||||
|
||||
/* Start UpdateLocation procedure */
|
||||
rc = gprs_subscr_location_update(s1);
|
||||
/* Blocking */
|
||||
OSMO_ASSERT(rc == -EAGAIN);
|
||||
|
||||
/* Unblock manually (normally done by the caller of gprs_subscr_purge) */
|
||||
s1->sgsn_data->blocked_by = SGSN_SUBSCR_PROC_NONE;
|
||||
|
||||
/* Start SendAuthInfoRequest procedure */
|
||||
rc = gprs_subscr_query_auth_info(s1);
|
||||
/* Not blocking */
|
||||
OSMO_ASSERT(rc == 0);
|
||||
|
||||
/* Start UpdateLocation procedure */
|
||||
rc = gprs_subscr_location_update(s1);
|
||||
/* Blocking */
|
||||
OSMO_ASSERT(rc == 0);
|
||||
|
||||
subscr_put(s1);
|
||||
sgsn_mm_ctx_cleanup_free(ctx);
|
||||
|
||||
assert_no_subscrs();
|
||||
|
||||
gprs_gsup_client_send_cb = __real_gprs_gsup_client_send;
|
||||
talloc_free(sgsn->gsup_client);
|
||||
sgsn->gsup_client = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Test that a GMM Detach will remove the MMCTX and the
|
||||
* associated LLME.
|
||||
|
@ -2081,7 +1999,6 @@ int main(int argc, char **argv)
|
|||
test_subscriber();
|
||||
test_auth_triplets();
|
||||
test_subscriber_gsup();
|
||||
test_subscriber_blocking();
|
||||
test_gmm_detach();
|
||||
test_gmm_detach_power_off();
|
||||
test_gmm_detach_no_mmctx();
|
||||
|
|
|
@ -2,7 +2,6 @@ Testing LLME allocations
|
|||
Testing core subscriber data API
|
||||
Testing authentication triplet handling
|
||||
Testing subcriber GSUP handling
|
||||
Testing subcriber procedure blocking
|
||||
Testing GMM detach
|
||||
Testing GMM detach (power off)
|
||||
Testing GMM detach (no MMCTX)
|
||||
|
|
Loading…
Reference in New Issue