Openair UE workaround for HashMME #651, #584

This commit is contained in:
Sukchan Lee 2020-11-10 10:04:09 -05:00
parent 23e8e6577c
commit 9a1824f6aa
3 changed files with 29 additions and 4 deletions

View File

@ -321,6 +321,9 @@ int ogs_app_context_parse_config(void)
} else if (!strcmp(parameter_key, "no_slaac")) {
self.parameter.no_slaac =
ogs_yaml_iter_bool(&parameter_iter);
} else if (!strcmp(parameter_key, "use_openair")) {
self.parameter.use_openair =
ogs_yaml_iter_bool(&parameter_iter);
} else
ogs_warn("unknown key `%s`", parameter_key);
}

View File

@ -69,6 +69,8 @@ typedef struct ogs_app_context_s {
int prefer_ipv4;
int multicast;
int no_slaac;
int use_openair;
} parameter;
ogs_sockopt_t sockopt;

View File

@ -301,10 +301,30 @@ ogs_pkbuf_t *emm_build_security_mode_command(mme_ue_t *mme_ue)
imeisv_request->type = OGS_NAS_IMEISV_TYPE;
imeisv_request->value = OGS_NAS_IMEISV_REQUESTED;
security_mode_command->presencemask |=
OGS_NAS_EPS_SECURITY_MODE_COMMAND_HASHMME_PRESENT;
hashmme->length = OGS_HASH_MME_LEN;
memcpy(hashmme->value, mme_ue->hash_mme, hashmme->length);
/*
* TS24.301
* 5.4.3.2 NAS security mode control initiation by the network
*
* If, during an ongoing attach or tracking area updating procedure,
* the MME is initiating a SECURITY MODE COMMAND (i.e. after receiving
* the ATTACH REQUEST or TRACKING AREA UPDATE REQUEST message,
* but before sending a response to that message) and the ATTACH REQUEST
* or TRACKING AREA UPDATE REQUEST message is received without integrity
* protection or does not successfully pass the integrity check at the MME,
* the MME shall calculate the HASH MME of the entire plain ATTACH REQUEST
* or TRACKING AREA UPDATE REQUEST message as described
* in 3GPP TS 33.401 [19] and shall include the HASH MME
* in the SECURITY MODE COMMAND message
*
* However, Openair UE does not support HashMME. For user convenience,
* we added a way not to include HashMME through the configuration file.
*/
if (ogs_app()->parameter.use_openair == false) {
security_mode_command->presencemask |=
OGS_NAS_EPS_SECURITY_MODE_COMMAND_HASHMME_PRESENT;
hashmme->length = OGS_HASH_MME_LEN;
memcpy(hashmme->value, mme_ue->hash_mme, hashmme->length);
}
if (mme_ue->ue_additional_security_capability.length) {
security_mode_command->presencemask |=