laforge submitted this change.
Refactor mmctx_is_r99 into mmctx.c
It is related to the mmctx and should be in mmctx.c instead
of the GMM message parsing or handling.
Change-Id: I198a3c9d49667c70e8995808b3fcb5ea26e8f17a
---
M include/osmocom/sgsn/mmctx.h
M src/sgsn/gprs_gmm.c
M src/sgsn/mmctx.c
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/include/osmocom/sgsn/mmctx.h b/include/osmocom/sgsn/mmctx.h
index 03bb845..9fa06dc 100644
--- a/include/osmocom/sgsn/mmctx.h
+++ b/include/osmocom/sgsn/mmctx.h
@@ -282,6 +282,8 @@
struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm,
uint8_t tid);
+bool sgsn_mm_ctx_is_r99(const struct sgsn_mm_ctx *mm);
+
uint32_t sgsn_alloc_ptmsi(void);
/* Called on subscriber data updates */
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 357b762..80c2148 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -479,16 +479,6 @@
return gsm48_gmm_sendmsg(msg, 1, mm, false);
}
-/* determine if the MS/UE supports R99 or later */
-static bool mmctx_is_r99(const struct sgsn_mm_ctx *mm)
-{
- if (mm->ms_network_capa.len < 1)
- return false;
- if (mm->ms_network_capa.buf[0] & 0x01)
- return true;
- return false;
-}
-
static enum gprs_ciph_algo gprs_ms_net_select_best_gea(uint8_t net_mask, uint8_t ms_mask) {
uint8_t common_mask = net_mask & ms_mask;
uint8_t r = 0;
@@ -514,8 +504,8 @@
LOGMMCTXP(LOGL_INFO, mm, "<- GMM AUTH AND CIPHERING REQ (rand = %s,"
" mmctx_is_r99=%d, vec->auth_types=0x%x",
osmo_hexdump(vec->rand, sizeof(vec->rand)),
- mmctx_is_r99(mm), vec->auth_types);
- if (mmctx_is_r99(mm) && vec
+ sgsn_mm_ctx_is_r99(mm), vec->auth_types);
+ if (sgsn_mm_ctx_is_r99(mm) && vec
&& (vec->auth_types & OSMO_AUTH_TYPE_UMTS)) {
LOGPC(DMM, LOGL_INFO, ", autn = %s)\n",
osmo_hexdump(vec->autn, sizeof(vec->autn)));
@@ -558,7 +548,7 @@
* the optional AUTN IE. If a classic GSM SIM is
* inserted, it will simply ignore AUTN and just use
* RAND */
- if (mmctx_is_r99(mm) &&
+ if (sgsn_mm_ctx_is_r99(mm) &&
(vec->auth_types & OSMO_AUTH_TYPE_UMTS)) {
msgb_tlv_put(msg, GSM48_IE_GMM_AUTN,
sizeof(vec->autn), vec->autn);
@@ -602,7 +592,7 @@
* However, on GERAN, even if we sent a UMTS AKA Authentication Request, the MS may decide to
* instead reply with a GSM AKA SRES response. */
if (is_utran
- || (mmctx_is_r99(ctx) && (vec->auth_types & OSMO_AUTH_TYPE_UMTS)
+ || (sgsn_mm_ctx_is_r99(ctx) && (vec->auth_types & OSMO_AUTH_TYPE_UMTS)
&& (res_len > sizeof(vec->sres)))) {
expect_type = OSMO_AUTH_TYPE_UMTS;
expect_str = "UMTS RES";
diff --git a/src/sgsn/mmctx.c b/src/sgsn/mmctx.c
index e0af4ed..ae73320 100644
--- a/src/sgsn/mmctx.c
+++ b/src/sgsn/mmctx.c
@@ -597,3 +597,14 @@
return ggsn;
}
+
+
+/* determine if the MS/UE supports R99 or later */
+bool sgsn_mm_ctx_is_r99(const struct sgsn_mm_ctx *mm)
+{
+ if (mm->ms_network_capa.len < 1)
+ return false;
+ if (mm->ms_network_capa.buf[0] & 0x01)
+ return true;
+ return false;
+}
To view, visit change 39242. To unsubscribe, or for help writing mail filters, visit settings.