[NAS] Protection for malformed NAS message (#959)

Add the protection code to avoid AMF/MME crash due to malformed NAS
message
This commit is contained in:
Sukchan Lee 2021-05-07 23:04:48 +09:00
parent 018b352985
commit b0e8dbb31a
14 changed files with 990 additions and 856 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2021-02-22 09:29:55.346343 by acetcom
* Created on: 2021-05-07 23:02:37.448758 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2021-02-22 09:29:55.319953 by acetcom
* Created on: 2021-05-07 23:02:37.421878 by acetcom
* from 24501-g41.docx
******************************************************************************/
@ -53,7 +53,8 @@ int ogs_nas_5gs_decode_additional_information(ogs_nas_additional_information_t *
additional_information->length = source->length;
size = additional_information->length + sizeof(additional_information->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*additional_information) < size) return -1;
memcpy(additional_information, pkbuf->data - size, size);
ogs_trace(" ADDITIONAL_INFORMATION - ");
@ -83,7 +84,7 @@ int ogs_nas_5gs_decode_access_type(ogs_nas_access_type_t *access_type, ogs_pkbuf
{
uint16_t size = sizeof(ogs_nas_access_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(access_type, pkbuf->data - size, size);
ogs_trace(" ACCESS_TYPE - ");
@ -117,7 +118,8 @@ int ogs_nas_5gs_decode_dnn(ogs_nas_dnn_t *dnn, ogs_pkbuf_t *pkbuf)
dnn->length = source->length;
size = dnn->length + sizeof(dnn->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*dnn) < size) return -1;
memcpy(dnn, pkbuf->data - size, size);
{
@ -160,7 +162,7 @@ int ogs_nas_5gs_decode_eap_message(ogs_nas_eap_message_t *eap_message, ogs_pkbuf
eap_message->length = be16toh(source->length);
size = eap_message->length + sizeof(eap_message->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
eap_message->buffer = pkbuf->data - size + sizeof(eap_message->length);
ogs_trace(" EAP_MESSAGE - ");
@ -198,7 +200,7 @@ int ogs_nas_5gs_decode_gprs_timer(ogs_nas_gprs_timer_t *gprs_timer, ogs_pkbuf_t
{
uint16_t size = sizeof(ogs_nas_gprs_timer_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(gprs_timer, pkbuf->data - size, size);
ogs_trace(" GPRS_TIMER - ");
@ -232,7 +234,8 @@ int ogs_nas_5gs_decode_gprs_timer_2(ogs_nas_gprs_timer_2_t *gprs_timer_2, ogs_pk
gprs_timer_2->length = source->length;
size = gprs_timer_2->length + sizeof(gprs_timer_2->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gprs_timer_2) < size) return -1;
memcpy(gprs_timer_2, pkbuf->data - size, size);
ogs_trace(" GPRS_TIMER_2 - ");
@ -266,7 +269,8 @@ int ogs_nas_5gs_decode_gprs_timer_3(ogs_nas_gprs_timer_3_t *gprs_timer_3, ogs_pk
gprs_timer_3->length = source->length;
size = gprs_timer_3->length + sizeof(gprs_timer_3->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gprs_timer_3) < size) return -1;
memcpy(gprs_timer_3, pkbuf->data - size, size);
ogs_trace(" GPRS_TIMER_3 - ");
@ -300,7 +304,8 @@ int ogs_nas_5gs_decode_s_nssai(ogs_nas_s_nssai_t *s_nssai, ogs_pkbuf_t *pkbuf)
s_nssai->length = source->length;
size = s_nssai->length + sizeof(s_nssai->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*s_nssai) < size) return -1;
memcpy(s_nssai, pkbuf->data - size, size);
ogs_trace(" S_NSSAI - ");
@ -334,7 +339,8 @@ int ogs_nas_5gs_decode_5gmm_capability(ogs_nas_5gmm_capability_t *gmm_capability
gmm_capability->length = source->length;
size = gmm_capability->length + sizeof(gmm_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gmm_capability) < size) return -1;
memcpy(gmm_capability, pkbuf->data - size, size);
ogs_trace(" 5GMM_CAPABILITY - ");
@ -368,7 +374,8 @@ int ogs_nas_5gs_decode_abba(ogs_nas_abba_t *abba, ogs_pkbuf_t *pkbuf)
abba->length = source->length;
size = abba->length + sizeof(abba->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*abba) < size) return -1;
memcpy(abba, pkbuf->data - size, size);
ogs_trace(" ABBA - ");
@ -402,7 +409,8 @@ int ogs_nas_5gs_decode_additional_5g_security_information(ogs_nas_additional_5g_
additional_security_information->length = source->length;
size = additional_security_information->length + sizeof(additional_security_information->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*additional_security_information) < size) return -1;
memcpy(additional_security_information, pkbuf->data - size, size);
ogs_trace(" ADDITIONAL_5G_SECURITY_INFORMATION - ");
@ -436,7 +444,8 @@ int ogs_nas_5gs_decode_additional_information_requested(ogs_nas_additional_infor
additional_information_requested->length = source->length;
size = additional_information_requested->length + sizeof(additional_information_requested->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*additional_information_requested) < size) return -1;
memcpy(additional_information_requested, pkbuf->data - size, size);
ogs_trace(" ADDITIONAL_INFORMATION_REQUESTED - ");
@ -470,7 +479,8 @@ int ogs_nas_5gs_decode_allowed_pdu_session_status(ogs_nas_allowed_pdu_session_st
allowed_pdu_session_status->length = source->length;
size = allowed_pdu_session_status->length + sizeof(allowed_pdu_session_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*allowed_pdu_session_status) < size) return -1;
memcpy(allowed_pdu_session_status, pkbuf->data - size, size);
allowed_pdu_session_status->psi = be16toh(allowed_pdu_session_status->psi);
@ -508,7 +518,8 @@ int ogs_nas_5gs_decode_authentication_failure_parameter(ogs_nas_authentication_f
authentication_failure_parameter->length = source->length;
size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*authentication_failure_parameter) < size) return -1;
memcpy(authentication_failure_parameter, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_FAILURE_PARAMETER - ");
@ -542,7 +553,8 @@ int ogs_nas_5gs_decode_authentication_parameter_autn(ogs_nas_authentication_para
authentication_parameter_autn->length = source->length;
size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*authentication_parameter_autn) < size) return -1;
memcpy(authentication_parameter_autn, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_PARAMETER_AUTN - ");
@ -572,7 +584,7 @@ int ogs_nas_5gs_decode_authentication_parameter_rand(ogs_nas_authentication_para
{
uint16_t size = sizeof(ogs_nas_authentication_parameter_rand_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(authentication_parameter_rand, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_PARAMETER_RAND - ");
@ -606,7 +618,8 @@ int ogs_nas_5gs_decode_authentication_response_parameter(ogs_nas_authentication_
authentication_response_parameter->length = source->length;
size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*authentication_response_parameter) < size) return -1;
memcpy(authentication_response_parameter, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_RESPONSE_PARAMETER - ");
@ -668,7 +681,7 @@ int ogs_nas_5gs_decode_cag_information_list(ogs_nas_cag_information_list_t *cag_
cag_information_list->length = be16toh(source->length);
size = cag_information_list->length + sizeof(cag_information_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
cag_information_list->buffer = pkbuf->data - size + sizeof(cag_information_list->length);
ogs_trace(" CAG_INFORMATION_LIST - ");
@ -710,7 +723,7 @@ int ogs_nas_5gs_decode_ciphering_key_data(ogs_nas_ciphering_key_data_t *cipherin
ciphering_key_data->length = be16toh(source->length);
size = ciphering_key_data->length + sizeof(ciphering_key_data->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
ciphering_key_data->buffer = pkbuf->data - size + sizeof(ciphering_key_data->length);
ogs_trace(" CIPHERING_KEY_DATA - ");
@ -752,7 +765,8 @@ int ogs_nas_5gs_decode_daylight_saving_time(ogs_nas_daylight_saving_time_t *dayl
daylight_saving_time->length = source->length;
size = daylight_saving_time->length + sizeof(daylight_saving_time->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*daylight_saving_time) < size) return -1;
memcpy(daylight_saving_time, pkbuf->data - size, size);
ogs_trace(" DAYLIGHT_SAVING_TIME - ");
@ -782,7 +796,7 @@ int ogs_nas_5gs_decode_5gmm_cause(ogs_nas_5gmm_cause_t *gmm_cause, ogs_pkbuf_t *
{
uint16_t size = sizeof(ogs_nas_5gmm_cause_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(gmm_cause, pkbuf->data - size, size);
ogs_trace(" 5GMM_CAUSE - ");
@ -812,7 +826,7 @@ int ogs_nas_5gs_decode_de_registration_type(ogs_nas_de_registration_type_t *de_r
{
uint16_t size = sizeof(ogs_nas_de_registration_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(de_registration_type, pkbuf->data - size, size);
ogs_trace(" DE_REGISTRATION_TYPE - ");
@ -846,7 +860,8 @@ int ogs_nas_5gs_decode_emergency_number_list(ogs_nas_emergency_number_list_t *em
emergency_number_list->length = source->length;
size = emergency_number_list->length + sizeof(emergency_number_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*emergency_number_list) < size) return -1;
memcpy(emergency_number_list, pkbuf->data - size, size);
ogs_trace(" EMERGENCY_NUMBER_LIST - ");
@ -880,7 +895,8 @@ int ogs_nas_5gs_decode_eps_bearer_context_status(ogs_nas_eps_bearer_context_stat
eps_bearer_context_status->length = source->length;
size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*eps_bearer_context_status) < size) return -1;
memcpy(eps_bearer_context_status, pkbuf->data - size, size);
ogs_trace(" EPS_BEARER_CONTEXT_STATUS - ");
@ -914,7 +930,7 @@ int ogs_nas_5gs_decode_eps_nas_message_container(ogs_nas_eps_nas_message_contain
eps_nas_message_container->length = be16toh(source->length);
size = eps_nas_message_container->length + sizeof(eps_nas_message_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
eps_nas_message_container->buffer = pkbuf->data - size + sizeof(eps_nas_message_container->length);
ogs_trace(" EPS_NAS_MESSAGE_CONTAINER - ");
@ -952,7 +968,7 @@ int ogs_nas_5gs_decode_eps_nas_security_algorithms(ogs_nas_eps_nas_security_algo
{
uint16_t size = sizeof(ogs_nas_eps_nas_security_algorithms_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(eps_nas_security_algorithms, pkbuf->data - size, size);
ogs_trace(" EPS_NAS_SECURITY_ALGORITHMS - ");
@ -986,7 +1002,7 @@ int ogs_nas_5gs_decode_extended_emergency_number_list(ogs_nas_extended_emergency
extended_emergency_number_list->length = be16toh(source->length);
size = extended_emergency_number_list->length + sizeof(extended_emergency_number_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
extended_emergency_number_list->buffer = pkbuf->data - size + sizeof(extended_emergency_number_list->length);
ogs_trace(" EXTENDED_EMERGENCY_NUMBER_LIST - ");
@ -1028,7 +1044,8 @@ int ogs_nas_5gs_decode_extended_drx_parameters(ogs_nas_extended_drx_parameters_t
extended_drx_parameters->length = source->length;
size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*extended_drx_parameters) < size) return -1;
memcpy(extended_drx_parameters, pkbuf->data - size, size);
ogs_trace(" EXTENDED_DRX_PARAMETERS - ");
@ -1090,7 +1107,7 @@ int ogs_nas_5gs_decode_ladn_indication(ogs_nas_ladn_indication_t *ladn_indicatio
ladn_indication->length = be16toh(source->length);
size = ladn_indication->length + sizeof(ladn_indication->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
ladn_indication->buffer = pkbuf->data - size + sizeof(ladn_indication->length);
ogs_trace(" LADN_INDICATION - ");
@ -1132,7 +1149,8 @@ int ogs_nas_5gs_decode_5gs_drx_parameters(ogs_nas_5gs_drx_parameters_t *drx_para
drx_parameters->length = source->length;
size = drx_parameters->length + sizeof(drx_parameters->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*drx_parameters) < size) return -1;
memcpy(drx_parameters, pkbuf->data - size, size);
ogs_trace(" 5GS_DRX_PARAMETERS - ");
@ -1162,7 +1180,7 @@ int ogs_nas_5gs_decode_5gs_identity_type(ogs_nas_5gs_identity_type_t *identity_t
{
uint16_t size = sizeof(ogs_nas_5gs_identity_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(identity_type, pkbuf->data - size, size);
ogs_trace(" 5GS_IDENTITY_TYPE - ");
@ -1196,7 +1214,7 @@ int ogs_nas_5gs_decode_ladn_information(ogs_nas_ladn_information_t *ladn_informa
ladn_information->length = be16toh(source->length);
size = ladn_information->length + sizeof(ladn_information->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
ladn_information->buffer = pkbuf->data - size + sizeof(ladn_information->length);
ogs_trace(" LADN_INFORMATION - ");
@ -1294,7 +1312,8 @@ int ogs_nas_5gs_decode_mapped_nssai(ogs_nas_mapped_nssai_t *mapped_nssai, ogs_pk
mapped_nssai->length = source->length;
size = mapped_nssai->length + sizeof(mapped_nssai->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*mapped_nssai) < size) return -1;
memcpy(mapped_nssai, pkbuf->data - size, size);
ogs_trace(" MAPPED_NSSAI - ");
@ -1328,7 +1347,8 @@ int ogs_nas_5gs_decode_mobile_station_classmark_2(ogs_nas_mobile_station_classma
mobile_station_classmark_2->length = source->length;
size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*mobile_station_classmark_2) < size) return -1;
memcpy(mobile_station_classmark_2, pkbuf->data - size, size);
ogs_trace(" MOBILE_STATION_CLASSMARK_2 - ");
@ -1390,7 +1410,7 @@ int ogs_nas_5gs_decode_message_container(ogs_nas_message_container_t *message_co
message_container->length = be16toh(source->length);
size = message_container->length + sizeof(message_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
message_container->buffer = pkbuf->data - size + sizeof(message_container->length);
ogs_trace(" MESSAGE_CONTAINER - ");
@ -1428,7 +1448,7 @@ int ogs_nas_5gs_decode_security_algorithms(ogs_nas_security_algorithms_t *securi
{
uint16_t size = sizeof(ogs_nas_security_algorithms_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(security_algorithms, pkbuf->data - size, size);
ogs_trace(" SECURITY_ALGORITHMS - ");
@ -1462,7 +1482,8 @@ int ogs_nas_5gs_decode_network_name(ogs_nas_network_name_t *network_name, ogs_pk
network_name->length = source->length;
size = network_name->length + sizeof(network_name->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*network_name) < size) return -1;
memcpy(network_name, pkbuf->data - size, size);
ogs_trace(" NETWORK_NAME - ");
@ -1552,7 +1573,8 @@ int ogs_nas_5gs_decode_nssai(ogs_nas_nssai_t *nssai, ogs_pkbuf_t *pkbuf)
nssai->length = source->length;
size = nssai->length + sizeof(nssai->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*nssai) < size) return -1;
memcpy(nssai, pkbuf->data - size, size);
ogs_trace(" NSSAI - ");
@ -1614,7 +1636,7 @@ int ogs_nas_5gs_decode_operator_defined_access_category_definitions(ogs_nas_oper
operator_defined_access_category_definitions->length = be16toh(source->length);
size = operator_defined_access_category_definitions->length + sizeof(operator_defined_access_category_definitions->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
operator_defined_access_category_definitions->buffer = pkbuf->data - size + sizeof(operator_defined_access_category_definitions->length);
ogs_trace(" OPERATOR_DEFINED_ACCESS_CATEGORY_DEFINITIONS - ");
@ -1656,7 +1678,7 @@ int ogs_nas_5gs_decode_payload_container(ogs_nas_payload_container_t *payload_co
payload_container->length = be16toh(source->length);
size = payload_container->length + sizeof(payload_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
payload_container->buffer = pkbuf->data - size + sizeof(payload_container->length);
ogs_trace(" PAYLOAD_CONTAINER - ");
@ -1698,7 +1720,7 @@ int ogs_nas_5gs_decode_5gs_mobile_identity(ogs_nas_5gs_mobile_identity_t *mobile
mobile_identity->length = be16toh(source->length);
size = mobile_identity->length + sizeof(mobile_identity->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
mobile_identity->buffer = pkbuf->data - size + sizeof(mobile_identity->length);
ogs_trace(" 5GS_MOBILE_IDENTITY - ");
@ -1764,7 +1786,7 @@ int ogs_nas_5gs_decode_pdu_session_identity_2(ogs_nas_pdu_session_identity_2_t *
{
uint16_t size = sizeof(ogs_nas_pdu_session_identity_2_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(pdu_session_identity_2, pkbuf->data - size, size);
ogs_trace(" PDU_SESSION_IDENTITY_2 - ");
@ -1798,7 +1820,8 @@ int ogs_nas_5gs_decode_pdu_session_reactivation_result(ogs_nas_pdu_session_react
pdu_session_reactivation_result->length = source->length;
size = pdu_session_reactivation_result->length + sizeof(pdu_session_reactivation_result->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*pdu_session_reactivation_result) < size) return -1;
memcpy(pdu_session_reactivation_result, pkbuf->data - size, size);
pdu_session_reactivation_result->psi = be16toh(pdu_session_reactivation_result->psi);
@ -1836,7 +1859,7 @@ int ogs_nas_5gs_decode_pdu_session_reactivation_result_error_cause(ogs_nas_pdu_s
pdu_session_reactivation_result_error_cause->length = be16toh(source->length);
size = pdu_session_reactivation_result_error_cause->length + sizeof(pdu_session_reactivation_result_error_cause->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
pdu_session_reactivation_result_error_cause->buffer = pkbuf->data - size + sizeof(pdu_session_reactivation_result_error_cause->length);
ogs_trace(" PDU_SESSION_REACTIVATION_RESULT_ERROR_CAUSE - ");
@ -1878,7 +1901,8 @@ int ogs_nas_5gs_decode_pdu_session_status(ogs_nas_pdu_session_status_t *pdu_sess
pdu_session_status->length = source->length;
size = pdu_session_status->length + sizeof(pdu_session_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*pdu_session_status) < size) return -1;
memcpy(pdu_session_status, pkbuf->data - size, size);
pdu_session_status->psi = be16toh(pdu_session_status->psi);
@ -1916,7 +1940,8 @@ int ogs_nas_5gs_decode_plmn_list(ogs_nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pk
plmn_list->length = source->length;
size = plmn_list->length + sizeof(plmn_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*plmn_list) < size) return -1;
memcpy(plmn_list, pkbuf->data - size, size);
ogs_trace(" PLMN_LIST - ");
@ -1950,7 +1975,8 @@ int ogs_nas_5gs_decode_rejected_nssai(ogs_nas_rejected_nssai_t *rejected_nssai,
rejected_nssai->length = source->length;
size = rejected_nssai->length + sizeof(rejected_nssai->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*rejected_nssai) < size) return -1;
memcpy(rejected_nssai, pkbuf->data - size, size);
ogs_trace(" REJECTED_NSSAI - ");
@ -2040,7 +2066,8 @@ int ogs_nas_5gs_decode_s1_ue_network_capability(ogs_nas_s1_ue_network_capability
s1_ue_network_capability->length = source->length;
size = s1_ue_network_capability->length + sizeof(s1_ue_network_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*s1_ue_network_capability) < size) return -1;
memcpy(s1_ue_network_capability, pkbuf->data - size, size);
ogs_trace(" S1_UE_NETWORK_CAPABILITY - ");
@ -2074,7 +2101,8 @@ int ogs_nas_5gs_decode_s1_ue_security_capability(ogs_nas_s1_ue_security_capabili
s1_ue_security_capability->length = source->length;
size = s1_ue_security_capability->length + sizeof(s1_ue_security_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*s1_ue_security_capability) < size) return -1;
memcpy(s1_ue_security_capability, pkbuf->data - size, size);
ogs_trace(" S1_UE_SECURITY_CAPABILITY - ");
@ -2108,7 +2136,8 @@ int ogs_nas_5gs_decode_service_area_list(ogs_nas_service_area_list_t *service_ar
service_area_list->length = source->length;
size = service_area_list->length + sizeof(service_area_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*service_area_list) < size) return -1;
memcpy(service_area_list, pkbuf->data - size, size);
ogs_trace(" SERVICE_AREA_LIST - ");
@ -2142,7 +2171,8 @@ int ogs_nas_5gs_decode_5gs_network_feature_support(ogs_nas_5gs_network_feature_s
network_feature_support->length = source->length;
size = network_feature_support->length + sizeof(network_feature_support->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*network_feature_support) < size) return -1;
memcpy(network_feature_support, pkbuf->data - size, size);
ogs_trace(" 5GS_NETWORK_FEATURE_SUPPORT - ");
@ -2204,7 +2234,7 @@ int ogs_nas_5gs_decode_sor_transparent_container(ogs_nas_sor_transparent_contain
sor_transparent_container->length = be16toh(source->length);
size = sor_transparent_container->length + sizeof(sor_transparent_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
sor_transparent_container->buffer = pkbuf->data - size + sizeof(sor_transparent_container->length);
ogs_trace(" SOR_TRANSPARENT_CONTAINER - ");
@ -2246,7 +2276,8 @@ int ogs_nas_5gs_decode_supported_codec_list(ogs_nas_supported_codec_list_t *supp
supported_codec_list->length = source->length;
size = supported_codec_list->length + sizeof(supported_codec_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*supported_codec_list) < size) return -1;
memcpy(supported_codec_list, pkbuf->data - size, size);
ogs_trace(" SUPPORTED_CODEC_LIST - ");
@ -2276,7 +2307,7 @@ int ogs_nas_5gs_decode_time_zone(ogs_nas_time_zone_t *time_zone, ogs_pkbuf_t *pk
{
uint16_t size = sizeof(ogs_nas_time_zone_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(time_zone, pkbuf->data - size, size);
ogs_trace(" TIME_ZONE - ");
@ -2306,7 +2337,7 @@ int ogs_nas_5gs_decode_time_zone_and_time(ogs_nas_time_zone_and_time_t *time_zon
{
uint16_t size = sizeof(ogs_nas_time_zone_and_time_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(time_zone_and_time, pkbuf->data - size, size);
ogs_trace(" TIME_ZONE_AND_TIME - ");
@ -2340,7 +2371,8 @@ int ogs_nas_5gs_decode_ue_security_capability(ogs_nas_ue_security_capability_t *
ue_security_capability->length = source->length;
size = ue_security_capability->length + sizeof(ue_security_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_security_capability) < size) return -1;
memcpy(ue_security_capability, pkbuf->data - size, size);
ogs_trace(" UE_SECURITY_CAPABILITY - ");
@ -2374,7 +2406,8 @@ int ogs_nas_5gs_decode_ue_usage_setting(ogs_nas_ue_usage_setting_t *ue_usage_set
ue_usage_setting->length = source->length;
size = ue_usage_setting->length + sizeof(ue_usage_setting->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_usage_setting) < size) return -1;
memcpy(ue_usage_setting, pkbuf->data - size, size);
ogs_trace(" UE_USAGE_SETTING - ");
@ -2408,7 +2441,8 @@ int ogs_nas_5gs_decode_ue_status(ogs_nas_ue_status_t *ue_status, ogs_pkbuf_t *pk
ue_status->length = source->length;
size = ue_status->length + sizeof(ue_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_status) < size) return -1;
memcpy(ue_status, pkbuf->data - size, size);
ogs_trace(" UE_STATUS - ");
@ -2442,7 +2476,8 @@ int ogs_nas_5gs_decode_uplink_data_status(ogs_nas_uplink_data_status_t *uplink_d
uplink_data_status->length = source->length;
size = uplink_data_status->length + sizeof(uplink_data_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*uplink_data_status) < size) return -1;
memcpy(uplink_data_status, pkbuf->data - size, size);
uplink_data_status->psi = be16toh(uplink_data_status->psi);
@ -2480,7 +2515,8 @@ int ogs_nas_5gs_decode_5gs_registration_result(ogs_nas_5gs_registration_result_t
registration_result->length = source->length;
size = registration_result->length + sizeof(registration_result->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*registration_result) < size) return -1;
memcpy(registration_result, pkbuf->data - size, size);
ogs_trace(" 5GS_REGISTRATION_RESULT - ");
@ -2514,7 +2550,8 @@ int ogs_nas_5gs_decode_ue_radio_capability_id(ogs_nas_ue_radio_capability_id_t *
ue_radio_capability_id->length = source->length;
size = ue_radio_capability_id->length + sizeof(ue_radio_capability_id->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_radio_capability_id) < size) return -1;
memcpy(ue_radio_capability_id, pkbuf->data - size, size);
ogs_trace(" UE_RADIO_CAPABILITY_ID - ");
@ -2572,7 +2609,7 @@ int ogs_nas_5gs_decode_5gs_registration_type(ogs_nas_5gs_registration_type_t *re
{
uint16_t size = sizeof(ogs_nas_5gs_registration_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(registration_type, pkbuf->data - size, size);
ogs_trace(" 5GS_REGISTRATION_TYPE - ");
@ -2606,7 +2643,8 @@ int ogs_nas_5gs_decode_truncated_5g_s_tmsi_configuration(ogs_nas_truncated_5g_s_
truncated_s_tmsi_configuration->length = source->length;
size = truncated_s_tmsi_configuration->length + sizeof(truncated_s_tmsi_configuration->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*truncated_s_tmsi_configuration) < size) return -1;
memcpy(truncated_s_tmsi_configuration, pkbuf->data - size, size);
ogs_trace(" TRUNCATED_5G_S_TMSI_CONFIGURATION - ");
@ -2640,7 +2678,8 @@ int ogs_nas_5gs_decode_wus_assistance_information(ogs_nas_wus_assistance_informa
wus_assistance_information->length = source->length;
size = wus_assistance_information->length + sizeof(wus_assistance_information->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*wus_assistance_information) < size) return -1;
memcpy(wus_assistance_information, pkbuf->data - size, size);
ogs_trace(" WUS_ASSISTANCE_INFORMATION - ");
@ -2698,7 +2737,7 @@ int ogs_nas_5gs_decode_5gs_tracking_area_identity(ogs_nas_5gs_tracking_area_iden
{
uint16_t size = sizeof(ogs_nas_5gs_tracking_area_identity_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(tracking_area_identity, pkbuf->data - size, size);
tracking_area_identity->tac = ogs_be24toh(tracking_area_identity->tac);
@ -2736,7 +2775,8 @@ int ogs_nas_5gs_decode_5gs_tracking_area_identity_list(ogs_nas_5gs_tracking_area
tracking_area_identity_list->length = source->length;
size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*tracking_area_identity_list) < size) return -1;
memcpy(tracking_area_identity_list, pkbuf->data - size, size);
ogs_trace(" 5GS_TRACKING_AREA_IDENTITY_LIST - ");
@ -2770,7 +2810,8 @@ int ogs_nas_5gs_decode_5gs_update_type(ogs_nas_5gs_update_type_t *update_type, o
update_type->length = source->length;
size = update_type->length + sizeof(update_type->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*update_type) < size) return -1;
memcpy(update_type, pkbuf->data - size, size);
ogs_trace(" 5GS_UPDATE_TYPE - ");
@ -2804,7 +2845,8 @@ int ogs_nas_5gs_decode_5gsm_capability(ogs_nas_5gsm_capability_t *gsm_capability
gsm_capability->length = source->length;
size = gsm_capability->length + sizeof(gsm_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gsm_capability) < size) return -1;
memcpy(gsm_capability, pkbuf->data - size, size);
ogs_trace(" 5GSM_CAPABILITY - ");
@ -2838,7 +2880,8 @@ int ogs_nas_5gs_decode_pdu_address(ogs_nas_pdu_address_t *pdu_address, ogs_pkbuf
pdu_address->length = source->length;
size = pdu_address->length + sizeof(pdu_address->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*pdu_address) < size) return -1;
memcpy(pdu_address, pkbuf->data - size, size);
ogs_trace(" PDU_ADDRESS - ");
@ -2900,7 +2943,7 @@ int ogs_nas_5gs_decode_qos_flow_descriptions(ogs_nas_qos_flow_descriptions_t *qo
qos_flow_descriptions->length = be16toh(source->length);
size = qos_flow_descriptions->length + sizeof(qos_flow_descriptions->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
qos_flow_descriptions->buffer = pkbuf->data - size + sizeof(qos_flow_descriptions->length);
ogs_trace(" QOS_FLOW_DESCRIPTIONS - ");
@ -2942,7 +2985,7 @@ int ogs_nas_5gs_decode_qos_rules(ogs_nas_qos_rules_t *qos_rules, ogs_pkbuf_t *pk
qos_rules->length = be16toh(source->length);
size = qos_rules->length + sizeof(qos_rules->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
qos_rules->buffer = pkbuf->data - size + sizeof(qos_rules->length);
ogs_trace(" QOS_RULES - ");
@ -2984,7 +3027,8 @@ int ogs_nas_5gs_decode_session_ambr(ogs_nas_session_ambr_t *session_ambr, ogs_pk
session_ambr->length = source->length;
size = session_ambr->length + sizeof(session_ambr->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*session_ambr) < size) return -1;
memcpy(session_ambr, pkbuf->data - size, size);
session_ambr->downlink.value = be16toh(source->downlink.value);
@ -3024,7 +3068,8 @@ int ogs_nas_5gs_decode_sm_pdu_dn_request_container(ogs_nas_sm_pdu_dn_request_con
sm_pdu_dn_request_container->length = source->length;
size = sm_pdu_dn_request_container->length + sizeof(sm_pdu_dn_request_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*sm_pdu_dn_request_container) < size) return -1;
memcpy(sm_pdu_dn_request_container, pkbuf->data - size, size);
ogs_trace(" SM_PDU_DN_REQUEST_CONTAINER - ");
@ -3086,7 +3131,8 @@ int ogs_nas_5gs_decode_re_attempt_indicator(ogs_nas_re_attempt_indicator_t *re_a
re_attempt_indicator->length = source->length;
size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*re_attempt_indicator) < size) return -1;
memcpy(re_attempt_indicator, pkbuf->data - size, size);
ogs_trace(" RE_ATTEMPT_INDICATOR - ");
@ -3120,7 +3166,8 @@ int ogs_nas_5gs_decode_5gsm_network_feature_support(ogs_nas_5gsm_network_feature
gsm_network_feature_support->length = source->length;
size = gsm_network_feature_support->length + sizeof(gsm_network_feature_support->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gsm_network_feature_support) < size) return -1;
memcpy(gsm_network_feature_support, pkbuf->data - size, size);
ogs_trace(" 5GSM_NETWORK_FEATURE_SUPPORT - ");
@ -3150,7 +3197,7 @@ int ogs_nas_5gs_decode_5gsm_cause(ogs_nas_5gsm_cause_t *gsm_cause, ogs_pkbuf_t *
{
uint16_t size = sizeof(ogs_nas_5gsm_cause_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(gsm_cause, pkbuf->data - size, size);
ogs_trace(" 5GSM_CAUSE - ");
@ -3184,7 +3231,8 @@ int ogs_nas_5gs_decode_serving_plmn_rate_control(ogs_nas_serving_plmn_rate_contr
serving_plmn_rate_control->length = source->length;
size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*serving_plmn_rate_control) < size) return -1;
memcpy(serving_plmn_rate_control, pkbuf->data - size, size);
ogs_trace(" SERVING_PLMN_RATE_CONTROL - ");
@ -3218,7 +3266,8 @@ int ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(ogs_nas_5gsm_congest
gsm_congestion_re_attempt_indicator->length = source->length;
size = gsm_congestion_re_attempt_indicator->length + sizeof(gsm_congestion_re_attempt_indicator->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gsm_congestion_re_attempt_indicator) < size) return -1;
memcpy(gsm_congestion_re_attempt_indicator, pkbuf->data - size, size);
ogs_trace(" 5GSM_CONGESTION_RE_ATTEMPT_INDICATOR - ");
@ -3252,7 +3301,7 @@ int ogs_nas_5gs_decode_atsss_container(ogs_nas_atsss_container_t *atsss_containe
atsss_container->length = be16toh(source->length);
size = atsss_container->length + sizeof(atsss_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
atsss_container->buffer = pkbuf->data - size + sizeof(atsss_container->length);
ogs_trace(" ATSSS_CONTAINER - ");
@ -3322,7 +3371,8 @@ int ogs_nas_5gs_decode_header_compression_configuration(ogs_nas_header_compressi
header_compression_configuration->length = source->length;
size = header_compression_configuration->length + sizeof(header_compression_configuration->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*header_compression_configuration) < size) return -1;
memcpy(header_compression_configuration, pkbuf->data - size, size);
header_compression_configuration->max_cid = be16toh(header_compression_configuration->max_cid);
@ -3360,7 +3410,8 @@ int ogs_nas_5gs_decode_ds_tt_ethernet_port_mac_address(ogs_nas_ds_tt_ethernet_po
ds_tt_ethernet_port_mac_address->length = source->length;
size = ds_tt_ethernet_port_mac_address->length + sizeof(ds_tt_ethernet_port_mac_address->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ds_tt_ethernet_port_mac_address) < size) return -1;
memcpy(ds_tt_ethernet_port_mac_address, pkbuf->data - size, size);
ogs_trace(" DS_TT_ETHERNET_PORT_MAC_ADDRESS - ");
@ -3394,7 +3445,8 @@ int ogs_nas_5gs_decode_ue_ds_tt_residence_time(ogs_nas_ue_ds_tt_residence_time_t
ue_ds_tt_residence_time->length = source->length;
size = ue_ds_tt_residence_time->length + sizeof(ue_ds_tt_residence_time->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_ds_tt_residence_time) < size) return -1;
memcpy(ue_ds_tt_residence_time, pkbuf->data - size, size);
ogs_trace(" UE_DS_TT_RESIDENCE_TIME - ");
@ -3428,7 +3480,7 @@ int ogs_nas_5gs_decode_port_management_information_container(ogs_nas_port_manage
port_management_information_container->length = be16toh(source->length);
size = port_management_information_container->length + sizeof(port_management_information_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
port_management_information_container->buffer = pkbuf->data - size + sizeof(port_management_information_container->length);
ogs_trace(" PORT_MANAGEMENT_INFORMATION_CONTAINER - ");
@ -3554,7 +3606,7 @@ int ogs_nas_5gs_decode_extended_protocol_configuration_options(ogs_nas_extended_
extended_protocol_configuration_options->length = be16toh(source->length);
size = extended_protocol_configuration_options->length + sizeof(extended_protocol_configuration_options->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
extended_protocol_configuration_options->buffer = pkbuf->data - size + sizeof(extended_protocol_configuration_options->length);
ogs_trace(" EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS - ");
@ -3592,7 +3644,7 @@ int ogs_nas_5gs_decode_integrity_protection_maximum_data_rate(ogs_nas_integrity_
{
uint16_t size = sizeof(ogs_nas_integrity_protection_maximum_data_rate_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(integrity_protection_maximum_data_rate, pkbuf->data - size, size);
ogs_trace(" INTEGRITY_PROTECTION_MAXIMUM_DATA_RATE - ");
@ -3626,7 +3678,7 @@ int ogs_nas_5gs_decode_mapped_eps_bearer_contexts(ogs_nas_mapped_eps_bearer_cont
mapped_eps_bearer_contexts->length = be16toh(source->length);
size = mapped_eps_bearer_contexts->length + sizeof(mapped_eps_bearer_contexts->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
mapped_eps_bearer_contexts->buffer = pkbuf->data - size + sizeof(mapped_eps_bearer_contexts->length);
ogs_trace(" MAPPED_EPS_BEARER_CONTEXTS - ");
@ -3664,7 +3716,7 @@ int ogs_nas_5gs_decode_maximum_number_of_supported_packet_filters(ogs_nas_maximu
{
uint16_t size = sizeof(ogs_nas_maximum_number_of_supported_packet_filters_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(maximum_number_of_supported_packet_filters, pkbuf->data - size, size);
ogs_trace(" MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS - ");

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2021-02-22 09:29:55.317282 by acetcom
* Created on: 2021-05-07 23:02:37.419237 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2021-02-22 09:29:55.328800 by acetcom
* Created on: 2021-05-07 23:02:37.431012 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -412,7 +412,7 @@ for (k, v) in sorted_type_list:
f.write(" uint16_t size = 3;\n\n")
else:
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;\n")
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
@ -443,7 +443,7 @@ for (k, v) in sorted_type_list:
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = be16toh(source->length);\n" % get_value(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;\n")
f.write(" %s->buffer = pkbuf->data - size + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, (void*)%s->buffer, %s->length);\n\n" % (get_value(k), get_value(k)));
@ -473,7 +473,8 @@ for (k, v) in sorted_type_list:
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = source->length;\n" % get_value(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;\n")
f.write(" if (sizeof(*%s) < size) return -1;\n" % get_value(k))
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
@ -662,7 +663,7 @@ for (k, v) in sorted_msg_list:
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]:
f.write(" size = ogs_nas_5gs_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return size;\n")
f.write(" decoded += size;\n\n")
optional_fields = False;
@ -685,7 +686,7 @@ for (k, v) in sorted_msg_list:
f.write(" decoded--;\n")
f.write(" ogs_assert(ogs_pkbuf_push(pkbuf, 1));\n")
f.write(" size = ogs_nas_5gs_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return size;\n")
f.write(" %s->presencemask |= OGS_NAS_5GS_%s_%s_PRESENT;\n" % (get_value(k), v_upper(k), v_upper(ie["value"])))
f.write(" decoded += size;\n")
f.write(" break;\n")
@ -715,7 +716,7 @@ f.write("""int ogs_nas_5gmm_decode(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *
memset(message, 0, sizeof(ogs_nas_5gs_message_t));
size = sizeof(ogs_nas_5gmm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return OGS_ERROR;
memcpy(&message->gmm.h, pkbuf->data - size, size);
decoded += size;
@ -728,7 +729,7 @@ for (k, v) in sorted_msg_list:
f.write(" case OGS_NAS_5GS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_5gs_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return OGS_ERROR;\n")
f.write(" decoded += size;\n")
f.write(" break;\n")
@ -756,7 +757,7 @@ f.write("""int ogs_nas_5gsm_decode(ogs_nas_5gs_message_t *message, ogs_pkbuf_t *
memset(message, 0, sizeof(ogs_nas_5gs_message_t));
size = sizeof(ogs_nas_5gsm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return OGS_ERROR;
memcpy(&message->gsm.h, pkbuf->data - size, size);
decoded += size;
@ -769,7 +770,7 @@ for (k, v) in sorted_msg_list:
f.write(" case OGS_NAS_5GS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_5gs_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return OGS_ERROR;\n")
f.write(" decoded += size;\n")
f.write(" break;\n")

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-08-16 17:47:29.440664 by acetcom
* Created on: 2021-05-07 23:02:21.691492 by acetcom
* from 24301-g40.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-08-16 17:47:29.412678 by acetcom
* Created on: 2021-05-07 23:02:21.664083 by acetcom
* from 24301-g40.docx
******************************************************************************/
@ -53,7 +53,8 @@ int ogs_nas_eps_decode_additional_information(ogs_nas_additional_information_t *
additional_information->length = source->length;
size = additional_information->length + sizeof(additional_information->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*additional_information) < size) return -1;
memcpy(additional_information, pkbuf->data - size, size);
ogs_trace(" ADDITIONAL_INFORMATION - ");
@ -115,7 +116,8 @@ int ogs_nas_eps_decode_eps_bearer_context_status(ogs_nas_eps_bearer_context_stat
eps_bearer_context_status->length = source->length;
size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*eps_bearer_context_status) < size) return -1;
memcpy(eps_bearer_context_status, pkbuf->data - size, size);
ogs_trace(" EPS_BEARER_CONTEXT_STATUS - ");
@ -149,7 +151,8 @@ int ogs_nas_eps_decode_supported_codec_list(ogs_nas_supported_codec_list_t *supp
supported_codec_list->length = source->length;
size = supported_codec_list->length + sizeof(supported_codec_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*supported_codec_list) < size) return -1;
memcpy(supported_codec_list, pkbuf->data - size, size);
ogs_trace(" SUPPORTED_CODEC_LIST - ");
@ -179,7 +182,7 @@ int ogs_nas_eps_decode_location_area_identification(ogs_nas_location_area_identi
{
uint16_t size = sizeof(ogs_nas_location_area_identification_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(location_area_identification, pkbuf->data - size, size);
location_area_identification->lac = be16toh(location_area_identification->lac);
@ -217,7 +220,8 @@ int ogs_nas_eps_decode_mobile_identity(ogs_nas_mobile_identity_t *mobile_identit
mobile_identity->length = source->length;
size = mobile_identity->length + sizeof(mobile_identity->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*mobile_identity) < size) return -1;
memcpy(mobile_identity, pkbuf->data - size, size);
if (mobile_identity->tmsi.type == OGS_NAS_MOBILE_IDENTITY_TMSI) {
@ -260,7 +264,8 @@ int ogs_nas_eps_decode_mobile_station_classmark_2(ogs_nas_mobile_station_classma
mobile_station_classmark_2->length = source->length;
size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*mobile_station_classmark_2) < size) return -1;
memcpy(mobile_station_classmark_2, pkbuf->data - size, size);
ogs_trace(" MOBILE_STATION_CLASSMARK_2 - ");
@ -294,7 +299,8 @@ int ogs_nas_eps_decode_mobile_station_classmark_3(ogs_nas_mobile_station_classma
mobile_station_classmark_3->length = source->length;
size = mobile_station_classmark_3->length + sizeof(mobile_station_classmark_3->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*mobile_station_classmark_3) < size) return -1;
memcpy(mobile_station_classmark_3, pkbuf->data - size, size);
ogs_trace(" MOBILE_STATION_CLASSMARK_3 - ");
@ -328,7 +334,8 @@ int ogs_nas_eps_decode_plmn_list(ogs_nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pk
plmn_list->length = source->length;
size = plmn_list->length + sizeof(plmn_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*plmn_list) < size) return -1;
memcpy(plmn_list, pkbuf->data - size, size);
ogs_trace(" PLMN_LIST - ");
@ -418,7 +425,8 @@ int ogs_nas_eps_decode_authentication_failure_parameter(ogs_nas_authentication_f
authentication_failure_parameter->length = source->length;
size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*authentication_failure_parameter) < size) return -1;
memcpy(authentication_failure_parameter, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_FAILURE_PARAMETER - ");
@ -448,7 +456,7 @@ int ogs_nas_eps_decode_eps_attach_result(ogs_nas_eps_attach_result_t *eps_attach
{
uint16_t size = sizeof(ogs_nas_eps_attach_result_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(eps_attach_result, pkbuf->data - size, size);
ogs_trace(" EPS_ATTACH_RESULT - ");
@ -478,7 +486,7 @@ int ogs_nas_eps_decode_eps_attach_type(ogs_nas_eps_attach_type_t *eps_attach_typ
{
uint16_t size = sizeof(ogs_nas_eps_attach_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(eps_attach_type, pkbuf->data - size, size);
ogs_trace(" EPS_ATTACH_TYPE - ");
@ -512,7 +520,8 @@ int ogs_nas_eps_decode_eps_mobile_identity(ogs_nas_eps_mobile_identity_t *eps_mo
eps_mobile_identity->length = source->length;
size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*eps_mobile_identity) < size) return -1;
memcpy(eps_mobile_identity, pkbuf->data - size, size);
if (eps_mobile_identity->guti.type == OGS_NAS_EPS_MOBILE_IDENTITY_GUTI) {
@ -557,7 +566,8 @@ int ogs_nas_eps_decode_eps_network_feature_support(ogs_nas_eps_network_feature_s
eps_network_feature_support->length = source->length;
size = eps_network_feature_support->length + sizeof(eps_network_feature_support->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*eps_network_feature_support) < size) return -1;
memcpy(eps_network_feature_support, pkbuf->data - size, size);
ogs_trace(" EPS_NETWORK_FEATURE_SUPPORT - ");
@ -587,7 +597,7 @@ int ogs_nas_eps_decode_eps_update_result(ogs_nas_eps_update_result_t *eps_update
{
uint16_t size = sizeof(ogs_nas_eps_update_result_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(eps_update_result, pkbuf->data - size, size);
ogs_trace(" EPS_UPDATE_RESULT - ");
@ -617,7 +627,7 @@ int ogs_nas_eps_decode_eps_update_type(ogs_nas_eps_update_type_t *eps_update_typ
{
uint16_t size = sizeof(ogs_nas_eps_update_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(eps_update_type, pkbuf->data - size, size);
ogs_trace(" EPS_UPDATE_TYPE - ");
@ -651,7 +661,7 @@ int ogs_nas_eps_decode_esm_message_container(ogs_nas_esm_message_container_t *es
esm_message_container->length = be16toh(source->length);
size = esm_message_container->length + sizeof(esm_message_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
esm_message_container->buffer = pkbuf->data - size + sizeof(esm_message_container->length);
ogs_trace(" ESM_MESSAGE_CONTAINER - ");
@ -689,7 +699,7 @@ int ogs_nas_eps_decode_gprs_timer(ogs_nas_gprs_timer_t *gprs_timer, ogs_pkbuf_t
{
uint16_t size = sizeof(ogs_nas_gprs_timer_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(gprs_timer, pkbuf->data - size, size);
ogs_trace(" GPRS_TIMER - ");
@ -723,7 +733,8 @@ int ogs_nas_eps_decode_gprs_timer_2(ogs_nas_gprs_timer_2_t *gprs_timer_2, ogs_pk
gprs_timer_2->length = source->length;
size = gprs_timer_2->length + sizeof(gprs_timer_2->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gprs_timer_2) < size) return -1;
memcpy(gprs_timer_2, pkbuf->data - size, size);
ogs_trace(" GPRS_TIMER_2 - ");
@ -757,7 +768,8 @@ int ogs_nas_eps_decode_gprs_timer_3(ogs_nas_gprs_timer_3_t *gprs_timer_3, ogs_pk
gprs_timer_3->length = source->length;
size = gprs_timer_3->length + sizeof(gprs_timer_3->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*gprs_timer_3) < size) return -1;
memcpy(gprs_timer_3, pkbuf->data - size, size);
ogs_trace(" GPRS_TIMER_3 - ");
@ -787,7 +799,7 @@ int ogs_nas_eps_decode_identity_type_2(ogs_nas_identity_type_2_t *identity_type_
{
uint16_t size = sizeof(ogs_nas_identity_type_2_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(identity_type_2, pkbuf->data - size, size);
ogs_trace(" IDENTITY_TYPE_2 - ");
@ -845,7 +857,7 @@ int ogs_nas_eps_decode_ksi_and_sequence_number(ogs_nas_ksi_and_sequence_number_t
{
uint16_t size = sizeof(ogs_nas_ksi_and_sequence_number_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(ksi_and_sequence_number, pkbuf->data - size, size);
ogs_trace(" KSI_AND_SEQUENCE_NUMBER - ");
@ -879,7 +891,8 @@ int ogs_nas_eps_decode_authentication_parameter_autn(ogs_nas_authentication_para
authentication_parameter_autn->length = source->length;
size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*authentication_parameter_autn) < size) return -1;
memcpy(authentication_parameter_autn, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_PARAMETER_AUTN - ");
@ -913,7 +926,8 @@ int ogs_nas_eps_decode_ms_network_capability(ogs_nas_ms_network_capability_t *ms
ms_network_capability->length = source->length;
size = ms_network_capability->length + sizeof(ms_network_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ms_network_capability) < size) return -1;
memcpy(ms_network_capability, pkbuf->data - size, size);
ogs_trace(" MS_NETWORK_CAPABILITY - ");
@ -1003,7 +1017,8 @@ int ogs_nas_eps_decode_eps_message_container(ogs_nas_eps_message_container_t *ep
eps_message_container->length = source->length;
size = eps_message_container->length + sizeof(eps_message_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*eps_message_container) < size) return -1;
memcpy(eps_message_container, pkbuf->data - size, size);
ogs_trace(" EPS_MESSAGE_CONTAINER - ");
@ -1033,7 +1048,7 @@ int ogs_nas_eps_decode_security_algorithms(ogs_nas_security_algorithms_t *securi
{
uint16_t size = sizeof(ogs_nas_security_algorithms_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(security_algorithms, pkbuf->data - size, size);
ogs_trace(" SECURITY_ALGORITHMS - ");
@ -1067,7 +1082,8 @@ int ogs_nas_eps_decode_network_name(ogs_nas_network_name_t *network_name, ogs_pk
network_name->length = source->length;
size = network_name->length + sizeof(network_name->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*network_name) < size) return -1;
memcpy(network_name, pkbuf->data - size, size);
ogs_trace(" NETWORK_NAME - ");
@ -1101,7 +1117,8 @@ int ogs_nas_eps_decode_network_resource_identifier_container(ogs_nas_network_res
network_resource_identifier_container->length = source->length;
size = network_resource_identifier_container->length + sizeof(network_resource_identifier_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*network_resource_identifier_container) < size) return -1;
memcpy(network_resource_identifier_container, pkbuf->data - size, size);
ogs_trace(" NETWORK_RESOURCE_IDENTIFIER_CONTAINER - ");
@ -1131,7 +1148,7 @@ int ogs_nas_eps_decode_nonce(ogs_nas_nonce_t *nonce, ogs_pkbuf_t *pkbuf)
{
uint16_t size = sizeof(ogs_nas_nonce_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(nonce, pkbuf->data - size, size);
*nonce = be32toh(*nonce);
@ -1165,7 +1182,7 @@ int ogs_nas_eps_decode_paging_identity(ogs_nas_paging_identity_t *paging_identit
{
uint16_t size = sizeof(ogs_nas_paging_identity_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(paging_identity, pkbuf->data - size, size);
ogs_trace(" PAGING_IDENTITY - ");
@ -1195,7 +1212,7 @@ int ogs_nas_eps_decode_p_tmsi_signature(ogs_nas_p_tmsi_signature_t *p_tmsi_signa
{
uint16_t size = 3;
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(p_tmsi_signature, pkbuf->data - size, size);
*p_tmsi_signature = htobe32(*p_tmsi_signature);
@ -1257,7 +1274,7 @@ int ogs_nas_eps_decode_service_type(ogs_nas_service_type_t *service_type, ogs_pk
{
uint16_t size = sizeof(ogs_nas_service_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(service_type, pkbuf->data - size, size);
ogs_trace(" SERVICE_TYPE - ");
@ -1287,7 +1304,7 @@ int ogs_nas_eps_decode_short_mac(ogs_nas_short_mac_t *short_mac, ogs_pkbuf_t *pk
{
uint16_t size = sizeof(ogs_nas_short_mac_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(short_mac, pkbuf->data - size, size);
*short_mac = be16toh(*short_mac);
@ -1321,7 +1338,7 @@ int ogs_nas_eps_decode_time_zone(ogs_nas_time_zone_t *time_zone, ogs_pkbuf_t *pk
{
uint16_t size = sizeof(ogs_nas_time_zone_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(time_zone, pkbuf->data - size, size);
ogs_trace(" TIME_ZONE - ");
@ -1351,7 +1368,7 @@ int ogs_nas_eps_decode_authentication_parameter_rand(ogs_nas_authentication_para
{
uint16_t size = sizeof(ogs_nas_authentication_parameter_rand_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(authentication_parameter_rand, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_PARAMETER_RAND - ");
@ -1381,7 +1398,7 @@ int ogs_nas_eps_decode_time_zone_and_time(ogs_nas_time_zone_and_time_t *time_zon
{
uint16_t size = sizeof(ogs_nas_time_zone_and_time_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(time_zone_and_time, pkbuf->data - size, size);
ogs_trace(" TIME_ZONE_AND_TIME - ");
@ -1439,7 +1456,7 @@ int ogs_nas_eps_decode_tracking_area_identity(ogs_nas_tracking_area_identity_t *
{
uint16_t size = sizeof(ogs_nas_tracking_area_identity_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(tracking_area_identity, pkbuf->data - size, size);
tracking_area_identity->tac = be16toh(tracking_area_identity->tac);
@ -1477,7 +1494,8 @@ int ogs_nas_eps_decode_tracking_area_identity_list(ogs_nas_tracking_area_identit
tracking_area_identity_list->length = source->length;
size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*tracking_area_identity_list) < size) return -1;
memcpy(tracking_area_identity_list, pkbuf->data - size, size);
ogs_trace(" TRACKING_AREA_IDENTITY_LIST - ");
@ -1511,7 +1529,8 @@ int ogs_nas_eps_decode_ue_network_capability(ogs_nas_ue_network_capability_t *ue
ue_network_capability->length = source->length;
size = ue_network_capability->length + sizeof(ue_network_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_network_capability) < size) return -1;
memcpy(ue_network_capability, pkbuf->data - size, size);
ogs_trace(" UE_NETWORK_CAPABILITY - ");
@ -1573,7 +1592,8 @@ int ogs_nas_eps_decode_ue_security_capability(ogs_nas_ue_security_capability_t *
ue_security_capability->length = source->length;
size = ue_security_capability->length + sizeof(ue_security_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_security_capability) < size) return -1;
memcpy(ue_security_capability, pkbuf->data - size, size);
ogs_trace(" UE_SECURITY_CAPABILITY - ");
@ -1607,7 +1627,8 @@ int ogs_nas_eps_decode_emergency_number_list(ogs_nas_emergency_number_list_t *em
emergency_number_list->length = source->length;
size = emergency_number_list->length + sizeof(emergency_number_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*emergency_number_list) < size) return -1;
memcpy(emergency_number_list, pkbuf->data - size, size);
ogs_trace(" EMERGENCY_NUMBER_LIST - ");
@ -1641,7 +1662,7 @@ int ogs_nas_eps_decode_extended_emergency_number_list(ogs_nas_extended_emergency
extended_emergency_number_list->length = be16toh(source->length);
size = extended_emergency_number_list->length + sizeof(extended_emergency_number_list->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
extended_emergency_number_list->buffer = pkbuf->data - size + sizeof(extended_emergency_number_list->length);
ogs_trace(" EXTENDED_EMERGENCY_NUMBER_LIST - ");
@ -1683,7 +1704,8 @@ int ogs_nas_eps_decode_cli(ogs_nas_cli_t *cli, ogs_pkbuf_t *pkbuf)
cli->length = source->length;
size = cli->length + sizeof(cli->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*cli) < size) return -1;
memcpy(cli, pkbuf->data - size, size);
ogs_trace(" CLI - ");
@ -1713,7 +1735,7 @@ int ogs_nas_eps_decode_ss_code(ogs_nas_ss_code_t *ss_code, ogs_pkbuf_t *pkbuf)
{
uint16_t size = sizeof(ogs_nas_ss_code_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(ss_code, pkbuf->data - size, size);
ogs_trace(" SS_CODE - ");
@ -1747,7 +1769,8 @@ int ogs_nas_eps_decode_authentication_response_parameter(ogs_nas_authentication_
authentication_response_parameter->length = source->length;
size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*authentication_response_parameter) < size) return -1;
memcpy(authentication_response_parameter, pkbuf->data - size, size);
ogs_trace(" AUTHENTICATION_RESPONSE_PARAMETER - ");
@ -1777,7 +1800,7 @@ int ogs_nas_eps_decode_lcs_indicator(ogs_nas_lcs_indicator_t *lcs_indicator, ogs
{
uint16_t size = sizeof(ogs_nas_lcs_indicator_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(lcs_indicator, pkbuf->data - size, size);
ogs_trace(" LCS_INDICATOR - ");
@ -1811,7 +1834,8 @@ int ogs_nas_eps_decode_lcs_client_identity(ogs_nas_lcs_client_identity_t *lcs_cl
lcs_client_identity->length = source->length;
size = lcs_client_identity->length + sizeof(lcs_client_identity->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*lcs_client_identity) < size) return -1;
memcpy(lcs_client_identity, pkbuf->data - size, size);
ogs_trace(" LCS_CLIENT_IDENTITY - ");
@ -1841,7 +1865,7 @@ int ogs_nas_eps_decode_generic_message_container_type(ogs_nas_generic_message_co
{
uint16_t size = sizeof(ogs_nas_generic_message_container_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(generic_message_container_type, pkbuf->data - size, size);
ogs_trace(" GENERIC_MESSAGE_CONTAINER_TYPE - ");
@ -1875,7 +1899,7 @@ int ogs_nas_eps_decode_generic_message_container(ogs_nas_generic_message_contain
generic_message_container->length = be16toh(source->length);
size = generic_message_container->length + sizeof(generic_message_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
generic_message_container->buffer = pkbuf->data - size + sizeof(generic_message_container->length);
ogs_trace(" GENERIC_MESSAGE_CONTAINER - ");
@ -1917,7 +1941,8 @@ int ogs_nas_eps_decode_voice_domain_preference_and_ue_usage_setting(ogs_nas_voic
voice_domain_preference_and_ue_usage_setting->length = source->length;
size = voice_domain_preference_and_ue_usage_setting->length + sizeof(voice_domain_preference_and_ue_usage_setting->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*voice_domain_preference_and_ue_usage_setting) < size) return -1;
memcpy(voice_domain_preference_and_ue_usage_setting, pkbuf->data - size, size);
ogs_trace(" VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING - ");
@ -1979,7 +2004,8 @@ int ogs_nas_eps_decode_extended_drx_parameters(ogs_nas_extended_drx_parameters_t
extended_drx_parameters->length = source->length;
size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*extended_drx_parameters) < size) return -1;
memcpy(extended_drx_parameters, pkbuf->data - size, size);
ogs_trace(" EXTENDED_DRX_PARAMETERS - ");
@ -2013,7 +2039,8 @@ int ogs_nas_eps_decode_dcn_id(ogs_nas_dcn_id_t *dcn_id, ogs_pkbuf_t *pkbuf)
dcn_id->length = source->length;
size = dcn_id->length + sizeof(dcn_id->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*dcn_id) < size) return -1;
memcpy(dcn_id, pkbuf->data - size, size);
ogs_trace(" DCN_ID - ");
@ -2159,7 +2186,8 @@ int ogs_nas_eps_decode_hashmme(ogs_nas_hashmme_t *hashmme, ogs_pkbuf_t *pkbuf)
hashmme->length = source->length;
size = hashmme->length + sizeof(hashmme->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*hashmme) < size) return -1;
memcpy(hashmme, pkbuf->data - size, size);
ogs_trace(" HASHMME - ");
@ -2193,7 +2221,7 @@ int ogs_nas_eps_decode_replayed_nas_message_container(ogs_nas_replayed_nas_messa
replayed_nas_message_container->length = be16toh(source->length);
size = replayed_nas_message_container->length + sizeof(replayed_nas_message_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
replayed_nas_message_container->buffer = pkbuf->data - size + sizeof(replayed_nas_message_container->length);
ogs_trace(" REPLAYED_NAS_MESSAGE_CONTAINER - ");
@ -2263,7 +2291,8 @@ int ogs_nas_eps_decode_ue_additional_security_capability(ogs_nas_ue_additional_s
ue_additional_security_capability->length = source->length;
size = ue_additional_security_capability->length + sizeof(ue_additional_security_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_additional_security_capability) < size) return -1;
memcpy(ue_additional_security_capability, pkbuf->data - size, size);
ogs_trace(" UE_ADDITIONAL_SECURITY_CAPABILITY - ");
@ -2297,7 +2326,8 @@ int ogs_nas_eps_decode_ue_status(ogs_nas_ue_status_t *ue_status, ogs_pkbuf_t *pk
ue_status->length = source->length;
size = ue_status->length + sizeof(ue_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_status) < size) return -1;
memcpy(ue_status, pkbuf->data - size, size);
ogs_trace(" UE_STATUS - ");
@ -2327,7 +2357,7 @@ int ogs_nas_eps_decode_additional_information_requested(ogs_nas_additional_infor
{
uint16_t size = sizeof(ogs_nas_additional_information_requested_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(additional_information_requested, pkbuf->data - size, size);
ogs_trace(" ADDITIONAL_INFORMATION_REQUESTED - ");
@ -2361,7 +2391,7 @@ int ogs_nas_eps_decode_ciphering_key_data(ogs_nas_ciphering_key_data_t *cipherin
ciphering_key_data->length = be16toh(source->length);
size = ciphering_key_data->length + sizeof(ciphering_key_data->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
ciphering_key_data->buffer = pkbuf->data - size + sizeof(ciphering_key_data->length);
ogs_trace(" CIPHERING_KEY_DATA - ");
@ -2403,7 +2433,8 @@ int ogs_nas_eps_decode_n1_ue_network_capability(ogs_nas_n1_ue_network_capability
n1_ue_network_capability->length = source->length;
size = n1_ue_network_capability->length + sizeof(n1_ue_network_capability->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*n1_ue_network_capability) < size) return -1;
memcpy(n1_ue_network_capability, pkbuf->data - size, size);
ogs_trace(" N1_UE_NETWORK_CAPABILITY - ");
@ -2465,7 +2496,8 @@ int ogs_nas_eps_decode_daylight_saving_time(ogs_nas_daylight_saving_time_t *dayl
daylight_saving_time->length = source->length;
size = daylight_saving_time->length + sizeof(daylight_saving_time->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*daylight_saving_time) < size) return -1;
memcpy(daylight_saving_time, pkbuf->data - size, size);
ogs_trace(" DAYLIGHT_SAVING_TIME - ");
@ -2499,7 +2531,8 @@ int ogs_nas_eps_decode_ue_radio_capability_id(ogs_nas_ue_radio_capability_id_t *
ue_radio_capability_id->length = source->length;
size = ue_radio_capability_id->length + sizeof(ue_radio_capability_id->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*ue_radio_capability_id) < size) return -1;
memcpy(ue_radio_capability_id, pkbuf->data - size, size);
ogs_trace(" UE_RADIO_CAPABILITY_ID - ");
@ -2557,7 +2590,7 @@ int ogs_nas_eps_decode_detach_type(ogs_nas_detach_type_t *detach_type, ogs_pkbuf
{
uint16_t size = sizeof(ogs_nas_detach_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(detach_type, pkbuf->data - size, size);
ogs_trace(" DETACH_TYPE - ");
@ -2587,7 +2620,7 @@ int ogs_nas_eps_decode_drx_parameter(ogs_nas_drx_parameter_t *drx_parameter, ogs
{
uint16_t size = sizeof(ogs_nas_drx_parameter_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(drx_parameter, pkbuf->data - size, size);
ogs_trace(" DRX_PARAMETER - ");
@ -2617,7 +2650,7 @@ int ogs_nas_eps_decode_emm_cause(ogs_nas_emm_cause_t *emm_cause, ogs_pkbuf_t *pk
{
uint16_t size = sizeof(ogs_nas_emm_cause_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(emm_cause, pkbuf->data - size, size);
ogs_trace(" EMM_CAUSE - ");
@ -2651,7 +2684,8 @@ int ogs_nas_eps_decode_access_point_name(ogs_nas_access_point_name_t *access_poi
access_point_name->length = source->length;
size = access_point_name->length + sizeof(access_point_name->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*access_point_name) < size) return -1;
memcpy(access_point_name, pkbuf->data - size, size);
{
@ -2694,7 +2728,8 @@ int ogs_nas_eps_decode_protocol_configuration_options(ogs_nas_protocol_configura
protocol_configuration_options->length = source->length;
size = protocol_configuration_options->length + sizeof(protocol_configuration_options->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*protocol_configuration_options) < size) return -1;
memcpy(protocol_configuration_options, pkbuf->data - size, size);
ogs_trace(" PROTOCOL_CONFIGURATION_OPTIONS - ");
@ -2728,7 +2763,8 @@ int ogs_nas_eps_decode_quality_of_service(ogs_nas_quality_of_service_t *quality_
quality_of_service->length = source->length;
size = quality_of_service->length + sizeof(quality_of_service->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*quality_of_service) < size) return -1;
memcpy(quality_of_service, pkbuf->data - size, size);
ogs_trace(" QUALITY_OF_SERVICE - ");
@ -2790,7 +2826,8 @@ int ogs_nas_eps_decode_re_attempt_indicator(ogs_nas_re_attempt_indicator_t *re_a
re_attempt_indicator->length = source->length;
size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*re_attempt_indicator) < size) return -1;
memcpy(re_attempt_indicator, pkbuf->data - size, size);
ogs_trace(" RE_ATTEMPT_INDICATOR - ");
@ -2820,7 +2857,7 @@ int ogs_nas_eps_decode_request_type(ogs_nas_request_type_t *request_type, ogs_pk
{
uint16_t size = sizeof(ogs_nas_request_type_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(request_type, pkbuf->data - size, size);
ogs_trace(" REQUEST_TYPE - ");
@ -2854,7 +2891,8 @@ int ogs_nas_eps_decode_traffic_flow_aggregate_description(ogs_nas_traffic_flow_a
traffic_flow_aggregate_description->length = source->length;
size = traffic_flow_aggregate_description->length + sizeof(traffic_flow_aggregate_description->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*traffic_flow_aggregate_description) < size) return -1;
memcpy(traffic_flow_aggregate_description, pkbuf->data - size, size);
ogs_trace(" TRAFFIC_FLOW_AGGREGATE_DESCRIPTION - ");
@ -2888,7 +2926,8 @@ int ogs_nas_eps_decode_traffic_flow_template(ogs_nas_traffic_flow_template_t *tr
traffic_flow_template->length = source->length;
size = traffic_flow_template->length + sizeof(traffic_flow_template->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*traffic_flow_template) < size) return -1;
memcpy(traffic_flow_template, pkbuf->data - size, size);
ogs_trace(" TRAFFIC_FLOW_TEMPLATE - ");
@ -2922,7 +2961,8 @@ int ogs_nas_eps_decode_transaction_identifier(ogs_nas_transaction_identifier_t *
transaction_identifier->length = source->length;
size = transaction_identifier->length + sizeof(transaction_identifier->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*transaction_identifier) < size) return -1;
memcpy(transaction_identifier, pkbuf->data - size, size);
ogs_trace(" TRANSACTION_IDENTIFIER - ");
@ -2984,7 +3024,8 @@ int ogs_nas_eps_decode_nbifom_container(ogs_nas_nbifom_container_t *nbifom_conta
nbifom_container->length = source->length;
size = nbifom_container->length + sizeof(nbifom_container->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*nbifom_container) < size) return -1;
memcpy(nbifom_container, pkbuf->data - size, size);
ogs_trace(" NBIFOM_CONTAINER - ");
@ -3018,7 +3059,8 @@ int ogs_nas_eps_decode_apn_aggregate_maximum_bit_rate(ogs_nas_apn_aggregate_maxi
apn_aggregate_maximum_bit_rate->length = source->length;
size = apn_aggregate_maximum_bit_rate->length + sizeof(apn_aggregate_maximum_bit_rate->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*apn_aggregate_maximum_bit_rate) < size) return -1;
memcpy(apn_aggregate_maximum_bit_rate, pkbuf->data - size, size);
ogs_trace(" APN_AGGREGATE_MAXIMUM_BIT_RATE - ");
@ -3052,7 +3094,8 @@ int ogs_nas_eps_decode_header_compression_configuration(ogs_nas_header_compressi
header_compression_configuration->length = source->length;
size = header_compression_configuration->length + sizeof(header_compression_configuration->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*header_compression_configuration) < size) return -1;
memcpy(header_compression_configuration, pkbuf->data - size, size);
header_compression_configuration->max_cid = be16toh(header_compression_configuration->max_cid);
@ -3118,7 +3161,7 @@ int ogs_nas_eps_decode_extended_protocol_configuration_options(ogs_nas_extended_
extended_protocol_configuration_options->length = be16toh(source->length);
size = extended_protocol_configuration_options->length + sizeof(extended_protocol_configuration_options->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
extended_protocol_configuration_options->buffer = pkbuf->data - size + sizeof(extended_protocol_configuration_options->length);
ogs_trace(" EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS - ");
@ -3160,7 +3203,8 @@ int ogs_nas_eps_decode_header_compression_configuration_status(ogs_nas_header_co
header_compression_configuration_status->length = source->length;
size = header_compression_configuration_status->length + sizeof(header_compression_configuration_status->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*header_compression_configuration_status) < size) return -1;
memcpy(header_compression_configuration_status, pkbuf->data - size, size);
ogs_trace(" HEADER_COMPRESSION_CONFIGURATION_STATUS - ");
@ -3194,7 +3238,8 @@ int ogs_nas_eps_decode_serving_plmn_rate_control(ogs_nas_serving_plmn_rate_contr
serving_plmn_rate_control->length = source->length;
size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*serving_plmn_rate_control) < size) return -1;
memcpy(serving_plmn_rate_control, pkbuf->data - size, size);
ogs_trace(" SERVING_PLMN_RATE_CONTROL - ");
@ -3228,7 +3273,8 @@ int ogs_nas_eps_decode_extended_apn_aggregate_maximum_bit_rate(ogs_nas_extended_
extended_apn_aggregate_maximum_bit_rate->length = source->length;
size = extended_apn_aggregate_maximum_bit_rate->length + sizeof(extended_apn_aggregate_maximum_bit_rate->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*extended_apn_aggregate_maximum_bit_rate) < size) return -1;
memcpy(extended_apn_aggregate_maximum_bit_rate, pkbuf->data - size, size);
ogs_trace(" EXTENDED_APN_AGGREGATE_MAXIMUM_BIT_RATE - ");
@ -3290,7 +3336,8 @@ int ogs_nas_eps_decode_eps_quality_of_service(ogs_nas_eps_quality_of_service_t *
eps_quality_of_service->length = source->length;
size = eps_quality_of_service->length + sizeof(eps_quality_of_service->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*eps_quality_of_service) < size) return -1;
memcpy(eps_quality_of_service, pkbuf->data - size, size);
ogs_trace(" EPS_QUALITY_OF_SERVICE - ");
@ -3324,7 +3371,8 @@ int ogs_nas_eps_decode_extended_quality_of_service(ogs_nas_extended_quality_of_s
extended_quality_of_service->length = source->length;
size = extended_quality_of_service->length + sizeof(extended_quality_of_service->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*extended_quality_of_service) < size) return -1;
memcpy(extended_quality_of_service, pkbuf->data - size, size);
ogs_trace(" EXTENDED_QUALITY_OF_SERVICE - ");
@ -3354,7 +3402,7 @@ int ogs_nas_eps_decode_esm_cause(ogs_nas_esm_cause_t *esm_cause, ogs_pkbuf_t *pk
{
uint16_t size = sizeof(ogs_nas_esm_cause_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(esm_cause, pkbuf->data - size, size);
ogs_trace(" ESM_CAUSE - ");
@ -3412,7 +3460,7 @@ int ogs_nas_eps_decode_linked_eps_bearer_identity(ogs_nas_linked_eps_bearer_iden
{
uint16_t size = sizeof(ogs_nas_linked_eps_bearer_identity_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(linked_eps_bearer_identity, pkbuf->data - size, size);
ogs_trace(" LINKED_EPS_BEARER_IDENTITY - ");
@ -3442,7 +3490,7 @@ int ogs_nas_eps_decode_llc_service_access_point_identifier(ogs_nas_llc_service_a
{
uint16_t size = sizeof(ogs_nas_llc_service_access_point_identifier_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
memcpy(llc_service_access_point_identifier, pkbuf->data - size, size);
ogs_trace(" LLC_SERVICE_ACCESS_POINT_IDENTIFIER - ");
@ -3476,7 +3524,8 @@ int ogs_nas_eps_decode_packet_flow_identifier(ogs_nas_packet_flow_identifier_t *
packet_flow_identifier->length = source->length;
size = packet_flow_identifier->length + sizeof(packet_flow_identifier->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*packet_flow_identifier) < size) return -1;
memcpy(packet_flow_identifier, pkbuf->data - size, size);
ogs_trace(" PACKET_FLOW_IDENTIFIER - ");
@ -3510,7 +3559,8 @@ int ogs_nas_eps_decode_pdn_address(ogs_nas_pdn_address_t *pdn_address, ogs_pkbuf
pdn_address->length = source->length;
size = pdn_address->length + sizeof(pdn_address->length);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;
if (sizeof(*pdn_address) < size) return -1;
memcpy(pdn_address, pkbuf->data - size, size);
ogs_trace(" PDN_ADDRESS - ");

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-08-16 17:47:29.410200 by acetcom
* Created on: 2021-05-07 23:02:21.661736 by acetcom
* from 24301-g40.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-08-16 17:47:29.419910 by acetcom
* Created on: 2021-05-07 23:02:21.671298 by acetcom
* from 24301-g40.docx
******************************************************************************/

View File

@ -426,7 +426,7 @@ for (k, v) in sorted_type_list:
f.write(" uint16_t size = 3;\n\n")
else:
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;\n")
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % v_lower(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
@ -457,7 +457,7 @@ for (k, v) in sorted_type_list:
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = be16toh(source->length);\n" % v_lower(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;\n")
f.write(" %s->buffer = pkbuf->data - size + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, (void*)%s->buffer, %s->length);\n\n" % (v_lower(k), v_lower(k)));
@ -487,7 +487,8 @@ for (k, v) in sorted_type_list:
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = source->length;\n" % v_lower(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) return -1;\n")
f.write(" if (sizeof(*%s) < size) return -1;\n" % v_lower(k))
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % v_lower(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
@ -676,7 +677,7 @@ for (k, v) in sorted_msg_list:
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]:
f.write(" size = ogs_nas_eps_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), v_lower(k), v_lower(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return size;\n")
f.write(" decoded += size;\n\n")
optional_fields = False;
@ -699,7 +700,7 @@ for (k, v) in sorted_msg_list:
f.write(" decoded--;\n")
f.write(" ogs_assert(ogs_pkbuf_push(pkbuf, 1));\n")
f.write(" size = ogs_nas_eps_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), v_lower(k), v_lower(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return size;\n")
f.write(" %s->presencemask |= OGS_NAS_EPS_%s_%s_PRESENT;\n" % (v_lower(k), v_upper(k), v_upper(ie["value"])))
f.write(" decoded += size;\n")
f.write(" break;\n")
@ -729,7 +730,7 @@ f.write("""int ogs_nas_emm_decode(ogs_nas_eps_message_t *message, ogs_pkbuf_t *p
memset(message, 0, sizeof(ogs_nas_eps_message_t));
size = sizeof(ogs_nas_emm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return OGS_ERROR;
memcpy(&message->emm.h, pkbuf->data - size, size);
decoded += size;
@ -753,7 +754,7 @@ for (k, v) in sorted_msg_list:
f.write(" case OGS_NAS_EPS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_eps_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return OGS_ERROR;\n")
f.write(" decoded += size;\n")
f.write(" break;\n")
@ -782,7 +783,7 @@ f.write("""int ogs_nas_esm_decode(ogs_nas_eps_message_t *message, ogs_pkbuf_t *p
memset(message, 0, sizeof(ogs_nas_eps_message_t));
size = sizeof(ogs_nas_esm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
if (ogs_pkbuf_pull(pkbuf, size) == NULL) return OGS_ERROR;
memcpy(&message->esm.h, pkbuf->data - size, size);
decoded += size;
@ -795,7 +796,7 @@ for (k, v) in sorted_msg_list:
f.write(" case OGS_NAS_EPS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_eps_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" if (size < 0) return OGS_ERROR;\n")
f.write(" decoded += size;\n")
f.write(" break;\n")

View File

@ -1290,6 +1290,7 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message)
ogs_nas_5gs_service_request_t *service_request = NULL;
ogs_nas_5gs_mobile_identity_t *mobile_identity = NULL;
ogs_nas_5gs_mobile_identity_header_t *mobile_identity_header = NULL;
ogs_nas_5gs_mobile_identity_suci_t *mobile_identity_suci = NULL;
ogs_nas_5gs_mobile_identity_guti_t *mobile_identity_guti = NULL;
ogs_nas_5gs_mobile_identity_s_tmsi_t *mobile_identity_s_tmsi = NULL;
ogs_nas_5gs_guti_t nas_guti;
@ -1316,6 +1317,15 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message)
switch (mobile_identity_header->type) {
case OGS_NAS_5GS_MOBILE_IDENTITY_SUCI:
mobile_identity_suci =
(ogs_nas_5gs_mobile_identity_suci_t *)mobile_identity->buffer;
if (mobile_identity_suci->protection_scheme_id !=
OGS_NAS_5GS_NULL_SCHEME) {
ogs_error("Not implemented ProtectionSchemeID(%d) in SUCI",
mobile_identity_suci->protection_scheme_id);
return NULL;
}
suci = ogs_nas_5gs_suci_from_mobile_identity(mobile_identity);
ogs_assert(suci);

View File

@ -47,6 +47,7 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue,
ogs_nas_5gs_registration_type_t *registration_type = NULL;
ogs_nas_5gs_mobile_identity_t *mobile_identity = NULL;
ogs_nas_5gs_mobile_identity_header_t *mobile_identity_header = NULL;
ogs_nas_5gs_mobile_identity_suci_t *mobile_identity_suci = NULL;
ogs_nas_5gs_mobile_identity_guti_t *mobile_identity_guti = NULL;
ogs_nas_ue_security_capability_t *ue_security_capability = NULL;
ogs_nas_5gs_guti_t nas_guti;
@ -134,6 +135,16 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue,
switch (mobile_identity_header->type) {
case OGS_NAS_5GS_MOBILE_IDENTITY_SUCI:
mobile_identity_suci =
(ogs_nas_5gs_mobile_identity_suci_t *)mobile_identity->buffer;
if (mobile_identity_suci->protection_scheme_id !=
OGS_NAS_5GS_NULL_SCHEME) {
ogs_error("Not implemented ProtectionSchemeID(%d) in SUCI",
mobile_identity_suci->protection_scheme_id);
nas_5gs_send_registration_reject(amf_ue,
OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED);
return OGS_ERROR;
}
amf_ue_set_suci(amf_ue, mobile_identity);
ogs_info("[%s] SUCI", amf_ue->suci);
break;
@ -644,6 +655,7 @@ int gmm_handle_identity_response(amf_ue_t *amf_ue,
ran_ue_t *ran_ue = NULL;
ogs_nas_5gs_mobile_identity_t *mobile_identity = NULL;
ogs_nas_5gs_mobile_identity_suci_t *mobile_identity_suci = NULL;
ogs_nas_5gs_mobile_identity_header_t *mobile_identity_header = NULL;
ogs_assert(identity_response);
@ -663,6 +675,14 @@ int gmm_handle_identity_response(amf_ue_t *amf_ue,
(ogs_nas_5gs_mobile_identity_header_t *)mobile_identity->buffer;
if (mobile_identity_header->type == OGS_NAS_5GS_MOBILE_IDENTITY_SUCI) {
mobile_identity_suci =
(ogs_nas_5gs_mobile_identity_suci_t *)mobile_identity->buffer;
if (mobile_identity_suci->protection_scheme_id !=
OGS_NAS_5GS_NULL_SCHEME) {
ogs_error("Not implemented ProtectionSchemeID(%d) in SUCI",
mobile_identity_suci->protection_scheme_id);
return OGS_ERROR;
}
amf_ue_set_suci(amf_ue, mobile_identity);
ogs_info("[%s] SUCI", amf_ue->suci);
} else {