From ccda6bcd423155062fd4fc8b652e05f3d4e4dc01 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 10 Sep 2019 20:30:01 +0200 Subject: sgsn_auth: Move UL check to a helper function This same code will be re-used in next commit. Change-Id: Iedb01d20a0ccb7fccd21a4fc1da4bcf7e504f1f2 --- include/osmocom/sgsn/gprs_sgsn.h | 1 + src/sgsn/sgsn_auth.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h index 0a52a7df5..0795bea09 100644 --- a/include/osmocom/sgsn/gprs_sgsn.h +++ b/include/osmocom/sgsn/gprs_sgsn.h @@ -480,6 +480,7 @@ int sgsn_acl_del(const char *imsi, struct sgsn_config *cfg); /* Request authorization */ int sgsn_auth_request(struct sgsn_mm_ctx *mm); enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mm); +bool sgsn_auth_needs_update_location(struct sgsn_mm_ctx *mm); void sgsn_auth_update(struct sgsn_mm_ctx *mm); struct gsm_auth_tuple *sgsn_auth_get_tuple(struct sgsn_mm_ctx *mmctx, unsigned key_seq); diff --git a/src/sgsn/sgsn_auth.c b/src/sgsn/sgsn_auth.c index b8d803590..56dc2830e 100644 --- a/src/sgsn/sgsn_auth.c +++ b/src/sgsn/sgsn_auth.c @@ -145,6 +145,13 @@ enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mmctx) return SGSN_AUTH_REJECTED; } +bool sgsn_auth_needs_update_location(struct sgsn_mm_ctx *mmctx) +{ + return sgsn->cfg.require_update_location && + (mmctx->subscr == NULL || + mmctx->pending_req == GSM48_MT_GMM_ATTACH_REQ); +} + /* * This function is directly called by e.g. the GMM layer. It returns either * after calling sgsn_auth_update directly or after triggering an asynchronous @@ -164,9 +171,7 @@ int sgsn_auth_request(struct sgsn_mm_ctx *mmctx) return 0; } - need_update_location = sgsn->cfg.require_update_location && - (mmctx->subscr == NULL || - mmctx->pending_req == GSM48_MT_GMM_ATTACH_REQ); + need_update_location = sgsn_auth_needs_update_location(mmctx); /* This has the side effect of registering the subscr with the mmctx */ subscr = gprs_subscr_get_or_create_by_mmctx(mmctx); -- cgit v1.2.3