diff --git a/lib/nas/5gs/types.h b/lib/nas/5gs/types.h index dd8f5cb2a..a3fce972d 100644 --- a/lib/nas/5gs/types.h +++ b/lib/nas/5gs/types.h @@ -106,34 +106,53 @@ ED5(uint8_t spare4:4;, /* 9.11.3.2 5GMM cause * M V 1 */ + +/* REQUEST_ACCEPTED(16) cause is defined by Open5GS */ +#define OGS_5GMM_CAUSE_REQUEST_ACCEPTED 16 + +/* Annex A (informative): Cause values for 5GS mobility management + * A.1 Causes related to UE identification */ #define OGS_5GMM_CAUSE_ILLEGAL_UE 3 -#define OGS_5GMM_CAUSE_PEI_NOT_ACCEPTED 5 #define OGS_5GMM_CAUSE_ILLEGAL_ME 6 -#define OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED 7 #define OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 9 #define OGS_5GMM_CAUSE_IMPLICITLY_DE_REGISTERED 10 + +/* A.2 Cause related to subscription options */ +#define OGS_5GMM_CAUSE_PEI_NOT_ACCEPTED 5 +#define OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED 7 #define OGS_5GMM_CAUSE_PLMN_NOT_ALLOWED 11 #define OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED 12 #define OGS_5GMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 13 #define OGS_5GMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA 15 +#define OGS_5GMM_CAUSE_N1_MODE_NOT_ALLOWED 27 +#define OGS_5GMM_CAUSE_REDIRECTION_TO_EPC_REQUIRED 31 +#define OGS_5GMM_CAUSE_NON_3GPP_ACCESS_TO_5GCN_NOT_ALLOWED 72 +#define OGS_5GMM_CAUSE_TEMPORARILY_NOT_AUTHORIZED_FOR_THIS_SNPN 74 +#define OGS_5GMM_CAUSE_PERMANENTLY_NOT_AUTHORIZED_FOR_THIS_SNPN 75 +#define OGS_5GMM_CAUSE_NOT_AUTHORIZED_FOR_THIS_CAG_OR_AUITHORIZED_FOR_CAG_CELLS_ONLY 76 +#define WIRELESS_ACCESS_AREA_NOT_ALLOWED 76 + +/* A.3 Causes related to PLMN or SNPN specific network failures + * and congestion/authentication failures */ #define OGS_5GMM_CAUSE_MAC_FAILURE 20 #define OGS_5GMM_CAUSE_SYNCH_FAILURE 21 #define OGS_5GMM_CAUSE_CONGESTION 22 #define OGS_5GMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH 23 #define OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED 24 #define OGS_5GMM_CAUSE_NON_5G_AUTHENTICATION_UNACCEPTABLE 26 -#define OGS_5GMM_CAUSE_N1_MODE_NOT_ALLOWED 27 #define OGS_5GMM_CAUSE_RESTRICTED_SERVICE_AREA 28 #define OGS_5GMM_CAUSE_LADN_NOT_AVAILABLE 43 +#define OGS_5GMM_CAUSE_NO_NETWORK_SLICES_AVAILABLE 62 #define OGS_5GMM_CAUSE_MAXIMUM_NUMBER_OF_PDU_SESSIONS_REACHED 65 #define OGS_5GMM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67 #define OGS_5GMM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69 #define OGS_5GMM_CAUSE_NGKSI_ALREADY_IN_USE 71 -#define OGS_5GMM_CAUSE_NON_3GPP_ACCESS_TO_5GCN_NOT_ALLOWED 72 #define OGS_5GMM_CAUSE_SERVING_NETWORK_NOT_AUTHORIZED 73 #define OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED 90 #define OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE 91 #define OGS_5GMM_CAUSE_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION 92 + +/* A.4 Causes related to invalid messages */ #define OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95 #define OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION 96 #define OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 @@ -291,7 +310,7 @@ ED3(uint8_t spare:1;, /* * Do not change 'ogs_5gs_tai_t' to 'ogs_nas_tracking_area_identity_t'. * Use 'ogs_5gs_tai_t' for easy implementation. - * ogs_nas_tai_list_build() changes to NAS + * ogs_nas_tai_list_build() changes to NAS * format(ogs_nas_tracking_area_identity_t) * and is sent to the UE. */ @@ -639,6 +658,9 @@ ED3(uint8_t spare:6;, /* 9.11.4.2 5GSM cause * O TV 2 */ + +/* Annex B (informative): Cause values for 5GS session management + * B.1 Causes related to nature of request */ #define OGS_5GSM_CAUSE_OPERATOR_DETERMINED_BARRING 8 #define OGS_5GSM_CAUSE_INSUFFICIENT_RESOURCES 26 #define OGS_5GSM_CAUSE_MISSING_OR_UNKNOWN_DNN 27 @@ -647,11 +669,12 @@ ED3(uint8_t spare:6;, #define OGS_5GSM_CAUSE_REQUEST_REJECTED_UNSPECIFIED 31 #define OGS_5GSM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED 32 #define OGS_5GSM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33 -#define OGS_5GSM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34 #define OGS_5GSM_CAUSE_PTI_ALREADY_IN_USE 35 #define OGS_5GSM_CAUSE_REGULAR_DEACTIVATION 36 #define OGS_5GSM_CAUSE_NETWORK_FAILURE 38 #define OGS_5GSM_CAUSE_REACTIVATION_REQUESTED 39 +#define OGS_5GSM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION 41 +#define OGS_5GSM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION 42 #define OGS_5GSM_CAUSE_INVALID_PDU_SESSION_IDENTITY 43 #define OGS_5GSM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS 44 #define OGS_5GSM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS 45 @@ -660,6 +683,10 @@ ED3(uint8_t spare:6;, #define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED 50 #define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_IPV6_ONLY_ALLOWED 51 #define OGS_5GSM_CAUSE_PDU_SESSION_DOES_NOT_EXIST 54 +#define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_IPV4V6_ONLY_ALLOWED 57 +#define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_UNSTRUCTURED_ONLY_ALLOWED 58 +#define OGS_5GSM_CAUSE_UNSUPPORTED_5QI_VALUE 59 +#define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_ETHERNET_ONLY_ALLOWED 61 #define OGS_5GSM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67 #define OGS_5GSM_CAUSE_NOT_SUPPORTED_SSC_MODE 68 #define OGS_5GSM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69 @@ -669,6 +696,8 @@ ED3(uint8_t spare:6;, #define OGS_5GSM_CAUSE_SEMANTIC_ERROR_IN_THE_QOS_OPERATION 83 #define OGS_5GSM_CAUSE_SYNTACTICAL_ERROR_IN_THE_QOS_OPERATION 84 #define OGS_5GSM_CAUSE_INVALID_MAPPED_EPS_BEARER_IDENTITY 85 + +/* B.2 Protocol errors (e.g., unknown message) */ #define OGS_5GSM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95 #define OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION 96 #define OGS_5GSM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 diff --git a/lib/nas/eps/types.h b/lib/nas/eps/types.h index 67717cc83..c59664325 100644 --- a/lib/nas/eps/types.h +++ b/lib/nas/eps/types.h @@ -182,8 +182,8 @@ ED3(uint8_t type:4;, } __attribute__ ((packed)) ogs_nas_csfb_response_t; /* 9.9.3.7 Detach type - * M V 1/2 - * 9.9.3.21 NAS key set identifier + * M V 1/2 + * 9.9.3.21 NAS key set identifier * M V 1/2 */ #define OGS_NAS_DETACH_TYPE_FROM_UE_EPS_DETACH 1 #define OGS_NAS_DETACH_TYPE_FROM_UE_IMSI_DETACH 2 @@ -222,51 +222,55 @@ ED3(uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode:4 } __attribute__ ((packed)) ogs_nas_drx_parameter_t; /* 9.9.3.9 EMM cause - * O TV 2 - * Annex A (informative) Cause values for EPS mobility management + * O TV 2 */ + +/* REQUEST_ACCEPTED(16) cause is defined by Open5GS */ +#define EMM_CAUSE_REQUEST_ACCEPTED 16 + +/* Annex A (informative) Cause values for EPS mobility management * A.1 Causes related to UE identification */ -#define EMM_CAUSE_IMSI_UNKNOWN_IN_HSS 2 -#define EMM_CAUSE_ILLEGAL_UE 3 -#define EMM_CAUSE_IMSI_UNKNOWN_IN_VLR 4 -#define EMM_CAUSE_ILLEGAL_ME 6 -#define EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 9 -#define EMM_CAUSE_IMPLICITLY_DETACHED 10 +#define OGS_NAS_EMM_CAUSE_IMSI_UNKNOWN_IN_HSS 2 +#define OGS_NAS_EMM_CAUSE_ILLEGAL_UE 3 +#define OGS_NAS_EMM_CAUSE_IMSI_UNKNOWN_IN_VLR 4 +#define OGS_NAS_EMM_CAUSE_ILLEGAL_ME 6 +#define OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 9 +#define OGS_NAS_EMM_CAUSE_IMPLICITLY_DETACHED 10 /* A.2 Cause related to subscription options */ -#define EMM_CAUSE_IMEI_NOT_ACCEPTED 5 -#define EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED 7 -#define EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED 8 -#define EMM_CAUSE_PLMN_NOT_ALLOWED 11 -#define EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED 12 -#define EMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 13 -#define EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN 14 -#define EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA 15 -#define EMM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_AUTHORIZED_IN_THIS_PLMN 35 -#define EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED 40 -/* A.3 Causes related to PLMN specific network failures and +#define OGS_NAS_EMM_CAUSE_IMEI_NOT_ACCEPTED 5 +#define OGS_NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED 7 +#define OGS_NAS_EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED 8 +#define OGS_NAS_EMM_CAUSE_PLMN_NOT_ALLOWED 11 +#define OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED 12 +#define OGS_NAS_EMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 13 +#define OGS_NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN 14 +#define OGS_NAS_EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA 15 +#define OGS_NAS_EMM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_AUTHORIZED_IN_THIS_PLMN 35 +#define OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED 40 +/* A.3 Causes related to PLMN specific network failures and * congestion/authentication failures */ -#define EMM_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE 16 -#define EMM_CAUSE_NETWORK_FAILURE 17 -#define EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE 18 -#define EMM_CAUSE_ESM_FAILURE 19 -#define EMM_CAUSE_MAC_FAILURE 20 -#define EMM_CAUSE_SYNCH_FAILURE 21 -#define EMM_CAUSE_CONGESTION 22 -#define EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH 23 -#define EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED 24 -#define EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE 26 -#define EMM_CAUSE_CS_SERVICE_TEMPORARILY_NOT_AVAILABLE 39 -#define EMM_CAUSE_SEVERE_NETWORK_FAILURE 42 -/* A.4 Causes related to nature of request +#define OGS_NAS_EMM_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE 16 +#define OGS_NAS_EMM_CAUSE_NETWORK_FAILURE 17 +#define OGS_NAS_EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE 18 +#define OGS_NAS_EMM_CAUSE_ESM_FAILURE 19 +#define OGS_NAS_EMM_CAUSE_MAC_FAILURE 20 +#define OGS_NAS_EMM_CAUSE_SYNCH_FAILURE 21 +#define OGS_NAS_EMM_CAUSE_CONGESTION 22 +#define OGS_NAS_EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH 23 +#define OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED 24 +#define OGS_NAS_EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE 26 +#define OGS_NAS_EMM_CAUSE_CS_SERVICE_TEMPORARILY_NOT_AVAILABLE 39 +#define OGS_NAS_EMM_CAUSE_SEVERE_NETWORK_FAILURE 42 +/* A.4 Causes related to nature of request * NOTE: This subclause has no entries in this version of the specification * * A.5 Causes related to invalid messages */ -#define EMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95 -#define EMM_CAUSE_INVALID_MANDATORY_INFORMATION 96 -#define EMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 -#define EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 98 -#define EMM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99 -#define EMM_CAUSE_CONDITIONAL_IE_ERROR 100 -#define EMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 101 -#define EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 +#define OGS_NAS_EMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95 +#define OGS_NAS_EMM_CAUSE_INVALID_MANDATORY_INFORMATION 96 +#define OGS_NAS_EMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 +#define OGS_NAS_EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 98 +#define OGS_NAS_EMM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99 +#define OGS_NAS_EMM_CAUSE_CONDITIONAL_IE_ERROR 100 +#define OGS_NAS_EMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 101 +#define OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 typedef uint8_t ogs_nas_emm_cause_t; /* 9.9.3.10 * EPS attach result @@ -280,7 +284,7 @@ ED2(uint8_t spare:5;, /* 9.9.3.11 EPS attach type * M V 1/2 - * 9.9.3.21 NAS key set identifier + * 9.9.3.21 NAS key set identifier * M V 1/2 */ #define OGS_NAS_KEY_SET_IDENTIFIER_NATIVE 0 #define OGS_NAS_KEY_SET_IDENTIFIER_MAPPED 1 @@ -320,7 +324,7 @@ typedef struct ogs_nas_eps_mobile_identity_s { }; } __attribute__ ((packed)) ogs_nas_eps_mobile_identity_t; -/* 9.9.3.12A EPS network feature support +/* 9.9.3.12A EPS network feature support * O TLV 3 */ typedef struct ogs_nas_eps_network_feature_support_s { uint8_t length; @@ -353,8 +357,8 @@ ED2(uint8_t spare:5;, } __attribute__ ((packed)) ogs_nas_eps_update_result_t; /* 9.9.3.14 EPS update type - * M V 1/2 - * 9.9.3.21 NAS key set identifier + * M V 1/2 + * 9.9.3.21 NAS key set identifier * M V 1/2 */ #define OGS_NAS_EPS_UPDATE_TYPE_TA_UPDATING 0 #define OGS_NAS_EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING 1 @@ -430,7 +434,7 @@ ED6(uint8_t user_plane_integrity_protection_support:1;, uint8_t spare:3;) } __attribute__ ((packed)) ogs_nas_ms_network_capability_t; -/* 9.9.3.20A MS network feature support +/* 9.9.3.20A MS network feature support * See subclause 10.5.1.15 in 3GPP TS 24.008 [13]. * O TV 1 */ typedef struct ogs_nas_ms_network_feature_support_s { @@ -470,12 +474,12 @@ ED2(uint8_t spare:7;, uint8_t identity:1;) } ogs_nas_paging_identity_t; -/* 9.9.3.26 P-TMSI signature +/* 9.9.3.26 P-TMSI signature * See subclause 10.5.5.8 in 3GPP TS 24.008 * O TV 4 */ typedef uint32_t ogs_nas_p_tmsi_signature_t; /* TV : 4bytes */ -/* 9.9.3.26A Extended EMM cause +/* 9.9.3.26A Extended EMM cause * O TV 1 */ typedef struct ogs_nas_extended_emm_cause_s { ED4(uint8_t type:4;, @@ -485,8 +489,8 @@ ED4(uint8_t type:4;, } ogs_nas_extended_emm_cause_t; /* 9.9.3.27 Service type - * M V 1/2 - * 9.9.3.21 NAS key set identifier + * M V 1/2 + * 9.9.3.21 NAS key set identifier * M V 1/2 */ #define OGS_NAS_SERVICE_TYPE_CS_FALLBACK_FROM_UE 0 #define OGS_NAS_SERVICE_TYPE_CS_FALLBACK_TO_UE 1 @@ -540,7 +544,7 @@ ED3(uint8_t spare:1;, /* * Do not change 'ogs_eps_tai_t' to 'ogs_nas_tracking_area_identity_t'. * Use 'ogs_eps_tai_t' for easy implementation. - * ogs_nas_tai_list_build() changes to NAS + * ogs_nas_tai_list_build() changes to NAS * format(ogs_nas_tracking_area_identity_t) * and is sent to the UE. */ @@ -565,9 +569,9 @@ ED3(uint8_t type:4;, } __attribute__ ((packed)) ogs_nas_ue_radio_capability_information_update_needed_t; /* 9.9.3.38 CLI - * O TLV 3-14 - * The coding of the CLI value part is the same as for - * octets 3 to 14 of the Calling party BCD number information element + * O TLV 3-14 + * The coding of the CLI value part is the same as for + * octets 3 to 14 of the Calling party BCD number information element * defined in subclause 10.5.4.9 of 3GPP TS 24.008 [13]. */ #define NAX_MAX_CLI_LEN 12 typedef struct ogs_nas_cli_s { @@ -576,8 +580,8 @@ typedef struct ogs_nas_cli_s { } __attribute__ ((packed)) ogs_nas_cli_t; /* 9.9.3.39 SS Code - * O TV 2 - * The coding of the SS Code value is given in subclause 17.7.5 of + * O TV 2 + * The coding of the SS Code value is given in subclause 17.7.5 of * 3GPP TS 29.002 [15C] */ typedef uint8_t ogs_nas_ss_code_t; @@ -613,11 +617,11 @@ typedef struct ogs_nas_generic_message_container_s { typedef struct ogs_nas_voice_domain_preference_and_ue_usage_setting_s { uint8_t length; ED3(uint8_t spare:5;, - uint8_t ue_usage_setting:1;, + uint8_t ue_usage_setting:1;, uint8_t voice_domain_preference_for_e_utran:2;) } __attribute__ ((packed)) ogs_nas_voice_domain_preference_and_ue_usage_setting_t; -/* 9.9.3.45 GUTI type +/* 9.9.3.45 GUTI type * O TV 1 */ typedef struct ogs_nas_guti_type_s { ED3(uint8_t type:4;, @@ -767,56 +771,56 @@ ED3(uint8_t type:4;, } __attribute__ ((packed)) ogs_nas_connectivity_type_t; /* 9.9.4.4 ESM cause - * M V 1 - * Annex B (informative) Cause values for EPS session management + * M V 1 + * Annex B (informative) Cause values for EPS session management B.1 Causes related to nature of request */ -#define ESM_CAUSE_OPERATOR_DETERMINED_BARRING 8 -#define ESM_CAUSE_INSUFFICIENT_RESOURCES 26 -#define ESM_CAUSE_MISSING_OR_UNKNOWN_APN 27 -#define ESM_CAUSE_UNKNOWN_PDN_TYPE 28 -#define ESM_CAUSE_USER_AUTHENTICATION_FAILED 29 -#define ESM_CAUSE_REQUEST_REJECTED_BY_SERVING_GW_OR_PDN_GW 30 -#define ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED 31 -#define ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED 32 -#define ESM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33 -#define ESM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34 -#define ESM_CAUSE_PTI_ALREADY_IN_USE 35 -#define ESM_CAUSE_REGULAR_DEACTIVATION 36 -#define ESM_CAUSE_EPS_QOS_NOT_ACCEPTED 37 -#define ESM_CAUSE_NETWORK_FAILURE 38 -#define ESM_CAUSE_REACTIVATION_REQUESTED 39 -#define ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION 41 -#define ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION 42 -#define ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY 43 -#define ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS 44 -#define ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS 45 -#define ESM_CAUSE_PTI_MISMATCH 47 -#define ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED 49 -#define ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED 50 -#define ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED 51 -#define ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED 52 -#define ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED 53 -#define ESM_CAUSE_PDN_CONNECTION_DOES_NOT_EXIST 54 -#define ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED 55 -#define ESM_CAUSE_COLLISION_WITH_NETWORK_INITIATED_REQUEST 56 -#define ESM_CAUSE_PDN_TYPE_IPV4V6_ONLY_ALLOWED 57 -#define ESM_CAUSE_PDN_TYPE_NON_IP_ONLY_ALLOWED 58 -#define ESM_CAUSE_UNSUPPORTED_QCI_VALUE 59 -#define ESM_CAUSE_BEARER_HANDLING_NOT_SUPPORTED 60 -#define ESM_CAUSE_MAXIMUM_NUMBER_OF_EPS_BEARERS_REACHED 65 -#define ESM_CAUSE_REQUESTED_APN_NOT_SUPPORTED_IN_CURRENT_RAT_AND_PLMN_COMBINATION 66 -#define ESM_CAUSE_INVALID_PTI_VALUE 81 -#define ESM_CAUSE_APN_RESTRICTION_VALUE_INCOMPATIBLE_WITH_ACTIVE_EPS_BEARER_CONTEXT 112 -#define ESM_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED 113 +#define OGS_NAS_ESM_CAUSE_OPERATOR_DETERMINED_BARRING 8 +#define OGS_NAS_ESM_CAUSE_INSUFFICIENT_RESOURCES 26 +#define OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN 27 +#define OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE 28 +#define OGS_NAS_ESM_CAUSE_USER_AUTHENTICATION_FAILED 29 +#define OGS_NAS_ESM_CAUSE_REQUEST_REJECTED_BY_SERVING_GW_OR_PDN_GW 30 +#define OGS_NAS_ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED 31 +#define OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED 32 +#define OGS_NAS_ESM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33 +#define OGS_NAS_ESM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34 +#define OGS_NAS_ESM_CAUSE_PTI_ALREADY_IN_USE 35 +#define OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION 36 +#define OGS_NAS_ESM_CAUSE_EPS_QOS_NOT_ACCEPTED 37 +#define OGS_NAS_ESM_CAUSE_NETWORK_FAILURE 38 +#define OGS_NAS_ESM_CAUSE_REACTIVATION_REQUESTED 39 +#define OGS_NAS_ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION 41 +#define OGS_NAS_ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION 42 +#define OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY 43 +#define OGS_NAS_ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS 44 +#define OGS_NAS_ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS 45 +#define OGS_NAS_ESM_CAUSE_PTI_MISMATCH 47 +#define OGS_NAS_ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED 49 +#define OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED 50 +#define OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED 51 +#define OGS_NAS_ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED 52 +#define OGS_NAS_ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED 53 +#define OGS_NAS_ESM_CAUSE_PDN_CONNECTION_DOES_NOT_EXIST 54 +#define OGS_NAS_ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED 55 +#define OGS_NAS_ESM_CAUSE_COLLISION_WITH_NETWORK_INITIATED_REQUEST 56 +#define OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV4V6_ONLY_ALLOWED 57 +#define OGS_NAS_ESM_CAUSE_PDN_TYPE_NON_IP_ONLY_ALLOWED 58 +#define OGS_NAS_ESM_CAUSE_UNSUPPORTED_QCI_VALUE 59 +#define OGS_NAS_ESM_CAUSE_BEARER_HANDLING_NOT_SUPPORTED 60 +#define OGS_NAS_ESM_CAUSE_MAXIMUM_NUMBER_OF_EPS_BEARERS_REACHED 65 +#define OGS_NAS_ESM_CAUSE_REQUESTED_APN_NOT_SUPPORTED_IN_CURRENT_RAT_AND_PLMN_COMBINATION 66 +#define OGS_NAS_ESM_CAUSE_INVALID_PTI_VALUE 81 +#define OGS_NAS_ESM_CAUSE_APN_RESTRICTION_VALUE_INCOMPATIBLE_WITH_ACTIVE_EPS_BEARER_CONTEXT 112 +#define OGS_NAS_ESM_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED 113 /* B.2 Protocol errors (e.g., unknown message) class */ -#define ESM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95 -#define ESM_CAUSE_INVALID_MANDATORY_INFORMATION 96 -#define ESM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 -#define ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 98 -#define ESM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99 -#define ESM_CAUSE_CONDITIONAL_IE_ERROR 100 -#define ESM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 101 -#define ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 +#define OGS_NAS_ESM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95 +#define OGS_NAS_ESM_CAUSE_INVALID_MANDATORY_INFORMATION 96 +#define OGS_NAS_ESM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97 +#define OGS_NAS_ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 98 +#define OGS_NAS_ESM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99 +#define OGS_NAS_ESM_CAUSE_CONDITIONAL_IE_ERROR 100 +#define OGS_NAS_ESM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE 101 +#define OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111 typedef uint8_t ogs_nas_esm_cause_t; /* 9.9.4.5 ESM information transfer flag @@ -869,7 +873,7 @@ typedef ogs_nas_pdu_address_t ogs_nas_pdn_address_t; /* 9.9.4.11 Protocol configuration options * See subclause 10.5.6.3 in 3GPP TS 24.008 [13]. - * O TLV 3-253 */ + * O TLV 3-253 */ typedef struct ogs_nas_protocol_configuration_options_s { uint8_t length; uint8_t buffer[OGS_MAX_PCO_LEN]; diff --git a/src/amf/gmm-handler.c b/src/amf/gmm-handler.c index 39f2c9355..c9f93b22f 100644 --- a/src/amf/gmm-handler.c +++ b/src/amf/gmm-handler.c @@ -28,11 +28,11 @@ #undef OGS_LOG_DOMAIN #define OGS_LOG_DOMAIN __gmm_log_domain -static int gmm_handle_nas_message_container( +static ogs_nas_5gmm_cause_t gmm_handle_nas_message_container( amf_ue_t *amf_ue, uint8_t message_type, ogs_nas_message_container_t *nas_message_container); -int gmm_handle_registration_request(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_registration_request(amf_ue_t *amf_ue, ogs_nas_security_header_type_t h, NGAP_ProcedureCode_t ngap_code, ogs_nas_5gs_registration_request_t *registration_request) { @@ -112,28 +112,19 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, ~OGS_REGISTRATION_CLEARTEXT_PRESENT) { ogs_error("Non cleartext IEs is included [0x%llx]", (long long)registration_request->presencemask); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } if (!h.integrity_protected && (registration_request->presencemask & OGS_NAS_5GS_REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT)) { ogs_error("NAS container present without Integrity-protected"); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } if (!mobile_identity->length || !mobile_identity->buffer) { ogs_error("No Mobile Identity"); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } mobile_identity_header = @@ -152,11 +143,7 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, OGS_NAS_5GS_ECIES_SCHEME_PROFILE_B) { ogs_error("Invalid ProtectionSchemeID(%d) in SUCI", mobile_identity_suci->protection_scheme_id); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE) - ); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } amf_ue_set_suci(amf_ue, mobile_identity); ogs_info("[%s] SUCI", amf_ue->suci); @@ -166,7 +153,7 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, (ogs_nas_5gs_mobile_identity_guti_t *)mobile_identity->buffer; if (!mobile_identity_guti) { ogs_error("No mobile identity"); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } ogs_nas_5gs_mobile_identity_guti_to_nas_guti( @@ -262,13 +249,9 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, /* Check TAI */ served_tai_index = amf_find_served_tai(&amf_ue->nr_tai); if (served_tai_index < 0) { - /* Send Registration Reject */ - ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", + ogs_error("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED; } ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); @@ -285,18 +268,15 @@ int gmm_handle_registration_request(amf_ue_t *amf_ue, ogs_error("[UE:0x%x:0x%x], NEA0 can be used in Encrypt[0x%x], " "but Integrity[0x%x] cannot be bypassed with NIA0", ue_security_capability->nr_ea, ue_security_capability->nr_ia, - amf_selected_enc_algorithm(amf_ue), + amf_selected_enc_algorithm(amf_ue), amf_selected_int_algorithm(amf_ue)); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH; } - return OGS_OK; + return OGS_5GMM_CAUSE_REQUEST_ACCEPTED; } -int gmm_handle_registration_update(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_registration_update(amf_ue_t *amf_ue, ogs_nas_5gs_registration_request_t *registration_request) { amf_sess_t *sess = NULL; @@ -376,7 +356,7 @@ int gmm_handle_registration_update(amf_ue_t *amf_ue, amf_ue->requested_nssai.s_nssai[i].sst, amf_ue->requested_nssai.s_nssai[i].sd.v); } - return OGS_ERROR; + return OGS_5GMM_CAUSE_NO_NETWORK_SLICES_AVAILABLE; } } @@ -442,10 +422,10 @@ int gmm_handle_registration_update(amf_ue_t *amf_ue, } } - return OGS_OK; + return OGS_5GMM_CAUSE_REQUEST_ACCEPTED; } -int gmm_handle_service_request(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_service_request(amf_ue_t *amf_ue, ogs_nas_security_header_type_t h, NGAP_ProcedureCode_t ngap_code, ogs_nas_5gs_service_request_t *service_request) { @@ -483,20 +463,14 @@ int gmm_handle_service_request(amf_ue_t *amf_ue, service_request->presencemask & ~OGS_SERVICE_CLEARTEXT_PRESENT) { ogs_error("Non cleartext IEs is included [0x%llx]", (long long)service_request->presencemask); - ogs_assert(OGS_OK == - nas_5gs_send_service_reject(amf_ue, - OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } if (!h.integrity_protected && (service_request->presencemask & OGS_NAS_5GS_SERVICE_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT)) { ogs_error("NAS container present without Integrity-protected"); - ogs_assert(OGS_OK == - nas_5gs_send_service_reject(amf_ue, - OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } amf_ue->nas.message_type = OGS_NAS_5GS_SERVICE_REQUEST; @@ -550,13 +524,9 @@ int gmm_handle_service_request(amf_ue_t *amf_ue, /* Check TAI */ served_tai_index = amf_find_served_tai(&amf_ue->nr_tai); if (served_tai_index < 0) { - /* Send Registration Reject */ - ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", + ogs_error("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]", ogs_plmn_id_hexdump(&amf_ue->nr_tai.plmn_id), amf_ue->nr_tai.tac.v); - ogs_assert(OGS_OK == - nas_5gs_send_registration_reject(amf_ue, - OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED)); - return OGS_ERROR; + return OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED; } ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); @@ -565,10 +535,10 @@ int gmm_handle_service_request(amf_ue_t *amf_ue, ogs_amf_id_hexdump(&amf_ue->current.guti.amf_id), amf_ue->current.guti.m_tmsi); - return OGS_OK; + return OGS_5GMM_CAUSE_REQUEST_ACCEPTED; } -int gmm_handle_service_update(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_service_update(amf_ue_t *amf_ue, ogs_nas_5gs_service_request_t *service_request) { amf_sess_t *sess = NULL; @@ -663,7 +633,7 @@ int gmm_handle_service_update(amf_ue_t *amf_ue, ogs_assert(OGS_OK == nas_5gs_send_service_accept(amf_ue)); - return OGS_OK; + return OGS_5GMM_CAUSE_REQUEST_ACCEPTED; } int gmm_handle_deregistration_request(amf_ue_t *amf_ue, @@ -800,7 +770,7 @@ int gmm_handle_identity_response(amf_ue_t *amf_ue, return OGS_OK; } -int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_security_mode_complete(amf_ue_t *amf_ue, ogs_nas_5gs_security_mode_complete_t *security_mode_complete) { ogs_nas_5gs_mobile_identity_t *imeisv = NULL; @@ -829,7 +799,7 @@ int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, OGS_NAS_5GS_SECURITY_MODE_COMPLETE_NAS_MESSAGE_CONTAINER_PRESENT) == 0) { ogs_error("No NAS Message Container in Security mode complete message"); - return OGS_ERROR; + return OGS_5GMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE; } if (security_mode_complete->presencemask & @@ -886,7 +856,7 @@ int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, &security_mode_complete->nas_message_container); } - return OGS_OK; + return OGS_5GMM_CAUSE_REQUEST_ACCEPTED; } int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, @@ -1212,11 +1182,11 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, return OGS_OK; } -static int gmm_handle_nas_message_container( +static ogs_nas_5gmm_cause_t gmm_handle_nas_message_container( amf_ue_t *amf_ue, uint8_t message_type, ogs_nas_message_container_t *nas_message_container) { - int rv = OGS_ERROR; + int gmm_cause; ogs_pkbuf_t *nasbuf = NULL; ogs_nas_5gs_message_t nas_message; @@ -1227,7 +1197,7 @@ static int gmm_handle_nas_message_container( if (!nas_message_container->buffer || !nas_message_container->length) { ogs_error("No NAS message container [%p:%d]", nas_message_container->buffer,nas_message_container->length); - return OGS_ERROR; + return OGS_5GMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE; } nasbuf = ogs_pkbuf_alloc(NULL, nas_message_container->length); @@ -1269,25 +1239,26 @@ static int gmm_handle_nas_message_container( if (ogs_nas_5gmm_decode(&nas_message, nasbuf) != OGS_OK) { ogs_error("ogs_nas_5gmm_decode() failed"); ogs_pkbuf_free(nasbuf); - return OGS_ERROR; + return OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; } + gmm_cause = OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE; + switch (nas_message.gmm.h.message_type) { case OGS_NAS_5GS_REGISTRATION_REQUEST: ogs_debug("Registration request in NAS message container"); - rv = gmm_handle_registration_update( + gmm_cause = gmm_handle_registration_update( amf_ue, &nas_message.gmm.registration_request); break; case OGS_NAS_5GS_SERVICE_REQUEST: ogs_debug("Service request in NAS message container"); - rv = gmm_handle_service_update( + gmm_cause = gmm_handle_service_update( amf_ue, &nas_message.gmm.service_request); break; default: ogs_error("Unknown message [%d]", nas_message.gmm.h.message_type); - rv = OGS_ERROR; } ogs_pkbuf_free(nasbuf); - return rv; + return gmm_cause; } diff --git a/src/amf/gmm-handler.h b/src/amf/gmm-handler.h index 9cab5905d..56d93333d 100644 --- a/src/amf/gmm-handler.h +++ b/src/amf/gmm-handler.h @@ -26,16 +26,16 @@ extern "C" { #endif -int gmm_handle_registration_request(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_registration_request(amf_ue_t *amf_ue, ogs_nas_security_header_type_t h, NGAP_ProcedureCode_t ngap_code, ogs_nas_5gs_registration_request_t *registration_request); -int gmm_handle_registration_update(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_registration_update(amf_ue_t *amf_ue, ogs_nas_5gs_registration_request_t *registration_request); -int gmm_handle_service_request(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_service_request(amf_ue_t *amf_ue, ogs_nas_security_header_type_t h, NGAP_ProcedureCode_t ngap_code, ogs_nas_5gs_service_request_t *service_request); -int gmm_handle_service_update(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_service_update(amf_ue_t *amf_ue, ogs_nas_5gs_service_request_t *service_request); int gmm_handle_deregistration_request(amf_ue_t *amf_ue, @@ -47,7 +47,7 @@ int gmm_handle_authentication_response(amf_ue_t *amf_ue, int gmm_handle_identity_response(amf_ue_t *amf_ue, ogs_nas_5gs_identity_response_t *identity_response); -int gmm_handle_security_mode_complete(amf_ue_t *amf_ue, +ogs_nas_5gmm_cause_t gmm_handle_security_mode_complete(amf_ue_t *amf_ue, ogs_nas_5gs_security_mode_complete_t *security_mode_complete); int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue, diff --git a/src/amf/gmm-sm.c b/src/amf/gmm-sm.c index 20ab49284..da705bc1f 100644 --- a/src/amf/gmm-sm.c +++ b/src/amf/gmm-sm.c @@ -91,6 +91,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e) static void common_register_state(ogs_fsm_t *s, amf_event_t *e) { int rv, xact_count = 0; + ogs_nas_5gmm_cause_t gmm_cause; amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; @@ -102,7 +103,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) ogs_sbi_message_t *sbi_message = NULL; ogs_assert(e); - + if (e->sess) { sess = e->sess; amf_ue = sess->amf_ue; @@ -132,11 +133,14 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) switch (nas_message->gmm.h.message_type) { case OGS_NAS_5GS_REGISTRATION_REQUEST: ogs_info("Registration request"); - rv = gmm_handle_registration_request( + gmm_cause = gmm_handle_registration_request( amf_ue, h, e->ngap.code, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("gmm_handle_registration_request() failed"); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("gmm_handle_registration_request() failed [%d]", + gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -150,10 +154,13 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) if (h.integrity_protected && SECURITY_CONTEXT_IS_VALID(amf_ue)) { - rv = gmm_handle_registration_update( + gmm_cause = gmm_handle_registration_update( amf_ue, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("gmm_handle_registration_update() failed"); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_registration_update() " + "failed [%d]", amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -204,10 +211,13 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) case OGS_NAS_5GS_SERVICE_REQUEST: ogs_info("Service request"); - rv = gmm_handle_service_request( + gmm_cause = gmm_handle_service_request( amf_ue, h, e->ngap.code, &nas_message->gmm.service_request); - if (rv != OGS_OK) { - ogs_error("gmm_handle_service_request() failed"); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_service_request() failed [%d]", + amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_service_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -232,10 +242,13 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) break; } - rv = gmm_handle_service_update( + gmm_cause = gmm_handle_service_update( amf_ue, &nas_message->gmm.service_request); - if (rv != OGS_OK) { - ogs_error("gmm_handle_service_update() failed"); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_service_update() failed [%d]", + amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_service_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); } @@ -495,6 +508,8 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e) void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) { int rv; + ogs_nas_5gmm_cause_t gmm_cause; + amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; @@ -510,7 +525,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) ogs_assert(s); ogs_assert(e); - + amf_sm_debug(e); if (e->sess) { @@ -602,12 +617,14 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) break; case OGS_NAS_5GS_REGISTRATION_REQUEST: ogs_warn("Registration request"); - rv = gmm_handle_registration_request( + gmm_cause = gmm_handle_registration_request( amf_ue, h, e->ngap.code, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("[%s] gmm_handle_registration_request() failed", - amf_ue->suci); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_registration_request() failed [%d]", + amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -744,6 +761,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e) void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) { int rv; + ogs_nas_5gmm_cause_t gmm_cause; amf_ue_t *amf_ue = NULL; ogs_nas_5gs_message_t *nas_message = NULL; ogs_nas_security_header_type_t h; @@ -797,13 +815,14 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) break; } - rv = gmm_handle_security_mode_complete( + gmm_cause = gmm_handle_security_mode_complete( amf_ue, &nas_message->gmm.security_mode_complete); - if (rv != OGS_OK) { - ogs_error("[%s] Cannot handle NAS message", amf_ue->suci); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_security_mode_complete() " + "failed [%d] in type [%d]", + amf_ue->suci, gmm_cause, amf_ue->nas.message_type); ogs_assert(OGS_OK == - nas_5gs_send_gmm_reject(amf_ue, - OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED)); + nas_5gs_send_gmm_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -837,11 +856,14 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) break; case OGS_NAS_5GS_REGISTRATION_REQUEST: ogs_warn("Registration request"); - rv = gmm_handle_registration_request( + gmm_cause = gmm_handle_registration_request( amf_ue, h, e->ngap.code, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("[%s] Cannot handle NAS message", amf_ue->suci); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_registration_request() failed [%d]", + amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -916,6 +938,8 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e) void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) { int rv, xact_count = 0; + ogs_nas_5gmm_cause_t gmm_cause; + amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; ogs_nas_5gs_message_t *nas_message = NULL; @@ -1156,11 +1180,14 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) case OGS_NAS_5GS_REGISTRATION_REQUEST: ogs_warn("Registration request"); - rv = gmm_handle_registration_request( + gmm_cause = gmm_handle_registration_request( amf_ue, h, e->ngap.code, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("[%s] Cannot handle NAS message", amf_ue->suci); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_registration_request() failed [%d]", + amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -1236,7 +1263,8 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e) void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e) { - int rv, xact_count = 0; + int xact_count = 0; + ogs_nas_5gmm_cause_t gmm_cause; amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; @@ -1289,11 +1317,14 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e) switch (nas_message->gmm.h.message_type) { case OGS_NAS_5GS_REGISTRATION_REQUEST: ogs_info("Registration request"); - rv = gmm_handle_registration_request( + gmm_cause = gmm_handle_registration_request( amf_ue, h, e->ngap.code, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("gmm_handle_registration_request() failed"); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("gmm_handle_registration_request() failed [%d]", + gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } @@ -1309,10 +1340,13 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e) if (h.integrity_protected && SECURITY_CONTEXT_IS_VALID(amf_ue)) { - rv = gmm_handle_registration_update( + gmm_cause = gmm_handle_registration_update( amf_ue, &nas_message->gmm.registration_request); - if (rv != OGS_OK) { - ogs_error("gmm_handle_registration_update() failed"); + if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { + ogs_error("[%s] gmm_handle_registration_update() " + "failed [%d]", amf_ue->suci, gmm_cause); + ogs_assert(OGS_OK == + nas_5gs_send_registration_reject(amf_ue, gmm_cause)); OGS_FSM_TRAN(s, gmm_state_exception); break; } diff --git a/src/mme/emm-build.c b/src/mme/emm-build.c index c670015cd..6e85961aa 100644 --- a/src/mme/emm-build.c +++ b/src/mme/emm-build.c @@ -119,7 +119,8 @@ ogs_pkbuf_t *emm_build_attach_accept( (eps_attach_result->result == OGS_NAS_ATTACH_TYPE_EPS_ATTACH)) { attach_accept->presencemask |= OGS_NAS_EPS_ATTACH_ACCEPT_EMM_CAUSE_PRESENT; - attach_accept->emm_cause = EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE; + attach_accept->emm_cause = + OGS_NAS_EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE; } } else { switch (eps_attach_result->result) { diff --git a/src/mme/emm-handler.c b/src/mme/emm-handler.c index c320fc53b..a6d72bdbe 100644 --- a/src/mme/emm-handler.c +++ b/src/mme/emm-handler.c @@ -126,8 +126,8 @@ int emm_handle_attach_request(mme_ue_t *mme_ue, ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); return OGS_ERROR; } ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); @@ -169,8 +169,8 @@ int emm_handle_attach_request(mme_ue_t *mme_ue, mme_selected_int_algorithm(mme_ue)); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); return OGS_ERROR; } @@ -519,7 +519,7 @@ int emm_handle_tau_request(mme_ue_t *mme_ue, ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); ogs_assert(OGS_OK == nas_eps_send_tau_reject( - mme_ue, EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED)); + mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED)); return OGS_ERROR; } ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); @@ -637,7 +637,7 @@ int emm_handle_extended_service_request(mme_ue_t *mme_ue, ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac); ogs_assert(OGS_OK == nas_eps_send_tau_reject( - mme_ue, EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED)); + mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED)); return OGS_ERROR; } ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index); diff --git a/src/mme/emm-sm.c b/src/mme/emm-sm.c index c3d24323f..a1ecff282 100644 --- a/src/mme/emm-sm.c +++ b/src/mme/emm-sm.c @@ -133,7 +133,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_info("Service request : Unknown UE"); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -142,7 +142,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -151,7 +151,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No Session Context : IMSI[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -160,7 +160,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No active EPS bearers : IMSI[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED)); + OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -227,8 +227,8 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_error("nas_eps_send_emm_to_esm() failed"); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -259,7 +259,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_info("TAU request : Unknown UE"); ogs_assert(OGS_OK == nas_eps_send_tau_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -268,7 +268,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_tau_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, emm_state_exception); break; } @@ -277,7 +277,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No active EPS bearers : IMSI[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_tau_reject(mme_ue, - EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED)); + OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -400,7 +400,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("Extended Service request : Unknown UE"); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -409,7 +409,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, emm_state_exception); break; } @@ -418,7 +418,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -430,7 +430,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No P-TMSI : UE[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) ); mme_send_release_access_bearer_or_ue_context_release( enb_ue); @@ -457,7 +457,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) mme_ue->nas_eps.service.value); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) ); OGS_FSM_TRAN(s, &emm_state_exception); break; @@ -474,7 +474,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) ogs_warn("No P-TMSI : UE[%s]", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) ); break; } @@ -499,7 +499,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e) mme_ue->nas_eps.service.value); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK) ); OGS_FSM_TRAN(s, &emm_state_exception); break; @@ -704,26 +704,26 @@ void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e) authentication_failure_parameter; ogs_debug("Authentication failure"); - ogs_debug(" IMSI[%s] EMM_CAUSE[%d]", mme_ue->imsi_bcd, + ogs_debug(" IMSI[%s] OGS_NAS_EMM_CAUSE[%d]", mme_ue->imsi_bcd, authentication_failure->emm_cause); CLEAR_MME_UE_TIMER(mme_ue->t3460); switch (authentication_failure->emm_cause) { - case EMM_CAUSE_MAC_FAILURE: + case OGS_NAS_EMM_CAUSE_MAC_FAILURE: ogs_warn("Authentication failure(MAC failure)"); break; - case EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE: + case OGS_NAS_EMM_CAUSE_NON_EPS_AUTHENTICATION_UNACCEPTABLE: ogs_error("Authentication failure" "(Non-EPS authentication unacceptable)"); break; - case EMM_CAUSE_SYNCH_FAILURE: + case OGS_NAS_EMM_CAUSE_SYNCH_FAILURE: ogs_info("Authentication failure(Synch failure)"); mme_s6a_send_air(mme_ue, authentication_failure_parameter); return; default: - ogs_error("Unknown EMM_CAUSE{%d] in Authentication" + ogs_error("Unknown OGS_NAS_EMM_CAUSE{%d] in Authentication" " failure", authentication_failure->emm_cause); break; @@ -837,7 +837,7 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) ogs_debug("Service request"); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -856,8 +856,8 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -866,8 +866,8 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) ogs_warn("[%s] No Security Context", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -917,7 +917,7 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) ogs_debug("Tracking area update request"); ogs_assert(OGS_OK == nas_eps_send_tau_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; case OGS_NAS_EPS_EMM_STATUS: @@ -955,8 +955,8 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e) ogs_expect(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); } else { rv = nas_eps_send_security_mode_command(mme_ue); if (rv == OGS_OK) { @@ -1008,7 +1008,7 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) ogs_debug("Service request"); ogs_assert(OGS_OK == nas_eps_send_service_reject(mme_ue, - EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); + OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -1025,8 +1025,8 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -1035,8 +1035,8 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) ogs_warn("[%s] No Security Context", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -1072,8 +1072,8 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -1082,8 +1082,8 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e) ogs_warn("[%s] No Security Context", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } @@ -1242,8 +1242,8 @@ void emm_state_exception(ogs_fsm_t *s, mme_event_t *e) ogs_error("nas_eps_send_emm_to_esm() failed"); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); OGS_FSM_TRAN(s, &emm_state_exception); break; } diff --git a/src/mme/esm-build.c b/src/mme/esm-build.c index d21c32599..55edfef25 100644 --- a/src/mme/esm-build.c +++ b/src/mme/esm-build.c @@ -174,13 +174,13 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV4) { pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV4; activate_default_eps_bearer_context_request->esm_cause = - ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; + OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; } else if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV6) { pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV6; activate_default_eps_bearer_context_request->esm_cause = - ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; + OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; } @@ -188,7 +188,7 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV6) { pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV6; activate_default_eps_bearer_context_request->esm_cause = - ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; + OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; } @@ -196,7 +196,7 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request( if (session->paa.session_type == OGS_PDU_SESSION_TYPE_IPV4) { pdn_address->pdn_type = OGS_PDU_SESSION_TYPE_IPV4; activate_default_eps_bearer_context_request->esm_cause = - ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; + OGS_NAS_ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; activate_default_eps_bearer_context_request->presencemask |= OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; } diff --git a/src/mme/esm-handler.c b/src/mme/esm-handler.c index d7dc642bd..7f8cd46c2 100644 --- a/src/mme/esm-handler.c +++ b/src/mme/esm-handler.c @@ -67,7 +67,7 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, /* Invalid APN */ ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject( - sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action)); + sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action)); ogs_warn("Invalid APN[%s]", req->access_point_name.apn); return OGS_ERROR; } @@ -82,7 +82,7 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, sess->request_type.type, sess->session->session_type); ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject( - sess, ESM_CAUSE_UNKNOWN_PDN_TYPE, create_action)); + sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE, create_action)); return OGS_ERROR; } } else { @@ -139,7 +139,7 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, ogs_error("No APN"); ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject( - sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action)); + sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action)); return OGS_ERROR; } @@ -185,7 +185,7 @@ int esm_handle_information_response(mme_sess_t *sess, sess->request_type.type, sess->session->session_type); ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject( - sess, ESM_CAUSE_UNKNOWN_PDN_TYPE, + sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE, OGS_GTP_CREATE_IN_ATTACH_REQUEST)); return OGS_ERROR; } @@ -219,7 +219,7 @@ int esm_handle_information_response(mme_sess_t *sess, ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject( - sess, ESM_CAUSE_MISSING_OR_UNKNOWN_APN, + sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, OGS_GTP_CREATE_IN_ATTACH_REQUEST)); return OGS_ERROR; } @@ -241,7 +241,7 @@ int esm_handle_bearer_resource_allocation_request( ogs_assert(OGS_OK == nas_eps_send_bearer_resource_allocation_reject( - mme_ue, sess->pti, ESM_CAUSE_NETWORK_FAILURE)); + mme_ue, sess->pti, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE)); return OGS_OK; } diff --git a/src/mme/esm-sm.c b/src/mme/esm-sm.c index 0ec58b983..a9ccee7bf 100644 --- a/src/mme/esm-sm.c +++ b/src/mme/esm-sm.c @@ -35,13 +35,13 @@ static uint8_t gtp_cause_from_esm(uint8_t esm_cause) { switch (esm_cause) { - case ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION: + case OGS_NAS_ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION: return OGS_GTP2_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION; - case ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION: + case OGS_NAS_ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION: return OGS_GTP2_CAUSE_SYNTACTIC_ERROR_IN_THE_TFT_OPERATION; - case ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS: + case OGS_NAS_ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS: return OGS_GTP2_CAUSE_SYNTACTIC_ERRORS_IN_PACKET_FILTER; - case ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS: + case OGS_NAS_ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS: return OGS_GTP2_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER; default: break; @@ -139,8 +139,8 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e) ogs_error("[%s] No Integrity Protected", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); ogs_assert(mme_ue->enb_ue); ogs_assert(OGS_OK == s1ap_send_ue_context_release_command(mme_ue->enb_ue, @@ -154,8 +154,8 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e) ogs_warn("[%s] No Security Context", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); ogs_assert(mme_ue->enb_ue); ogs_assert(OGS_OK == s1ap_send_ue_context_release_command(mme_ue->enb_ue, @@ -232,7 +232,7 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e) ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject(sess, - ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED, + OGS_NAS_ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED, e->create_action)); } else { rv = nas_eps_send_esm_information_request(bearer); diff --git a/src/mme/mme-context.c b/src/mme/mme-context.c index aea4aeb94..9ed82d792 100644 --- a/src/mme/mme-context.c +++ b/src/mme/mme-context.c @@ -3113,8 +3113,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( ogs_error("No Bearer : EBI[%d]", ebi); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); return NULL; } @@ -3125,8 +3125,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( ogs_error("Both PTI[%d] and EBI[%d] are 0", pti, ebi); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); return NULL; } @@ -3143,8 +3143,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( linked_eps_bearer_identity->eps_bearer_identity); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); return NULL; } } else if (message->esm.h.message_type == @@ -3162,7 +3162,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( linked_eps_bearer_identity->eps_bearer_identity); ogs_assert(OGS_OK == nas_eps_send_bearer_resource_allocation_reject( - mme_ue, pti, ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY)); + mme_ue, pti, + OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY)); return NULL; } @@ -3181,7 +3182,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( linked_eps_bearer_identity->eps_bearer_identity); ogs_assert(OGS_OK == nas_eps_send_bearer_resource_modification_reject( - mme_ue, pti, ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY)); + mme_ue, pti, + OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY)); return NULL; } } @@ -3205,7 +3207,7 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( ogs_assert(OGS_OK == nas_eps_send_pdn_connectivity_reject( sess, - ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED, + OGS_NAS_ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED, create_action)); ogs_warn("APN duplicated [%s]", pdn_connectivity_request->access_point_name.apn); @@ -3228,8 +3230,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message( message->esm.h.message_type, pti); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); return NULL; } } diff --git a/src/mme/mme-s11-handler.c b/src/mme/mme-s11-handler.c index 4ed29b868..f6b70b4dd 100644 --- a/src/mme/mme-s11-handler.c +++ b/src/mme/mme-s11-handler.c @@ -36,17 +36,17 @@ static uint8_t esm_cause_from_gtp(uint8_t gtp_cause) { switch (gtp_cause) { case OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND: - return ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY; + return OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY; case OGS_GTP2_CAUSE_SERVICE_NOT_SUPPORTED: - return ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED; + return OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED; case OGS_GTP2_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION: - return ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION; + return OGS_NAS_ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION; case OGS_GTP2_CAUSE_SYNTACTIC_ERROR_IN_THE_TFT_OPERATION: - return ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION; + return OGS_NAS_ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION; case OGS_GTP2_CAUSE_SYNTACTIC_ERRORS_IN_PACKET_FILTER: - return ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS; + return OGS_NAS_ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS; case OGS_GTP2_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER: - return ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS; + return OGS_NAS_ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS; default: break; } @@ -56,7 +56,7 @@ static uint8_t esm_cause_from_gtp(uint8_t gtp_cause) * OGS_GTP2_CAUSE_MANDATORY_IE_MISSING * ... */ - return ESM_CAUSE_NETWORK_FAILURE; + return OGS_NAS_ESM_CAUSE_NETWORK_FAILURE; } void mme_s11_handle_echo_request( @@ -140,7 +140,7 @@ void mme_s11_handle_create_session_response( if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) { ogs_error("[%s] Attach reject", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_NETWORK_FAILURE, ESM_CAUSE_NETWORK_FAILURE)); + OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE)); } mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; @@ -200,7 +200,7 @@ void mme_s11_handle_create_session_response( if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) { ogs_error("[%s] Attach reject", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_NETWORK_FAILURE, ESM_CAUSE_NETWORK_FAILURE)); + OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE)); } mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; @@ -224,7 +224,7 @@ void mme_s11_handle_create_session_response( if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) { ogs_error("[%s] Attach reject", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_NETWORK_FAILURE, ESM_CAUSE_NETWORK_FAILURE)); + OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE)); } mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; @@ -244,7 +244,7 @@ void mme_s11_handle_create_session_response( if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) { ogs_error("[%s] Attach reject", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_NETWORK_FAILURE, ESM_CAUSE_NETWORK_FAILURE)); + OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE)); } mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; @@ -611,8 +611,8 @@ void mme_s11_handle_delete_session_response( ogs_error("nas_eps_send_emm_to_esm() failed"); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); } } @@ -951,7 +951,8 @@ void mme_s11_handle_update_bearer_request( /* MME received Bearer Resource Modification Request */ ogs_assert(OGS_OK == nas_eps_send_bearer_resource_modification_reject( - mme_ue, sess->pti, ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED)); + mme_ue, sess->pti, + OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED)); } ogs_assert(OGS_OK == diff --git a/src/mme/mme-sm.c b/src/mme/mme-sm.c index 33bf3f913..ac0cf69f0 100644 --- a/src/mme/mme-sm.c +++ b/src/mme/mme-sm.c @@ -45,18 +45,19 @@ static uint8_t emm_cause_from_diameter( switch (*dia_exp_err) { case OGS_DIAM_S6A_ERROR_USER_UNKNOWN: /* 5001 */ ogs_info("[%s] User Unknown in HSS DB", mme_ue->imsi_bcd); - return EMM_CAUSE_PLMN_NOT_ALLOWED; + return OGS_NAS_EMM_CAUSE_PLMN_NOT_ALLOWED; case OGS_DIAM_S6A_ERROR_UNKNOWN_EPS_SUBSCRIPTION: /* 5420 */ /* FIXME: Error diagnostic? */ - return EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA; + return OGS_NAS_EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA; case OGS_DIAM_S6A_ERROR_RAT_NOT_ALLOWED: /* 5421 */ - return EMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA; + return OGS_NAS_EMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA; case OGS_DIAM_S6A_ERROR_ROAMING_NOT_ALLOWED: /* 5004 */ - return EMM_CAUSE_PLMN_NOT_ALLOWED; - //return EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN; (ODB_HPLMN_APN) - //return EMM_CAUSE_ESM_FAILURE; (ODB_ALL_APN) + return OGS_NAS_EMM_CAUSE_PLMN_NOT_ALLOWED; + /* return OGS_NAS_EMM_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN; + * (ODB_HPLMN_APN) */ + /* return OGS_NAS_EMM_CAUSE_ESM_FAILURE; (ODB_ALL_APN) */ case OGS_DIAM_S6A_AUTHENTICATION_DATA_UNAVAILABLE: /* 4181 */ - return EMM_CAUSE_NETWORK_FAILURE; + return OGS_NAS_EMM_CAUSE_NETWORK_FAILURE; } } if (dia_err) { @@ -64,21 +65,21 @@ static uint8_t emm_cause_from_diameter( case ER_DIAMETER_AUTHORIZATION_REJECTED: /* 5003 */ case ER_DIAMETER_UNABLE_TO_DELIVER: /* 3002 */ case ER_DIAMETER_REALM_NOT_SERVED: /* 3003 */ - return EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA; + return OGS_NAS_EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA; case ER_DIAMETER_UNABLE_TO_COMPLY: /* 5012 */ case ER_DIAMETER_INVALID_AVP_VALUE: /* 5004 */ case ER_DIAMETER_AVP_UNSUPPORTED: /* 5001 */ case ER_DIAMETER_MISSING_AVP: /* 5005 */ case ER_DIAMETER_RESOURCES_EXCEEDED: /* 5006 */ case ER_DIAMETER_AVP_OCCURS_TOO_MANY_TIMES: /* 5009 */ - return EMM_CAUSE_NETWORK_FAILURE; + return OGS_NAS_EMM_CAUSE_NETWORK_FAILURE; } } ogs_error("Unexpected Diameter Result Code %d/%d, defaulting to severe " "network failure", dia_err ? *dia_err : -1, dia_exp_err ? *dia_exp_err : -1); - return EMM_CAUSE_SEVERE_NETWORK_FAILURE; + return OGS_NAS_EMM_CAUSE_SEVERE_NETWORK_FAILURE; } void mme_state_initial(ogs_fsm_t *s, mme_event_t *e) @@ -455,11 +456,11 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e) uint8_t emm_cause = emm_cause_from_diameter( mme_ue, s6a_message->err, s6a_message->exp_err); - ogs_info("[%s] Attach reject [EMM_CAUSE:%d]", + ogs_info("[%s] Attach reject [OGS_NAS_EMM_CAUSE:%d]", mme_ue->imsi_bcd, emm_cause); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - emm_cause, ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); ogs_assert(OGS_OK == s1ap_send_ue_context_release_command(enb_ue, @@ -486,8 +487,8 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e) ogs_error("nas_eps_send_emm_to_esm() failed"); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); } } else if (mme_ue->nas_eps.type == MME_EPS_TYPE_TAU_REQUEST) { ogs_assert(OGS_OK == diff --git a/src/mme/nas-path.c b/src/mme/nas-path.c index ee499c1aa..6ef8cf554 100644 --- a/src/mme/nas-path.c +++ b/src/mme/nas-path.c @@ -301,7 +301,7 @@ int nas_eps_send_pdn_connectivity_reject( /* During the UE-attach process, we'll send Attach-Reject * with pyggybacking PDN-connectivity-Reject */ rv = nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, esm_cause); + OGS_NAS_EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, esm_cause); ogs_expect(rv == OGS_OK); } else { esmbuf = esm_build_pdn_connectivity_reject( @@ -450,7 +450,7 @@ int nas_eps_send_deactivate_bearer_context_request(mme_bearer_t *bearer) ogs_assert(mme_ue); esmbuf = esm_build_deactivate_bearer_context_request( - bearer, ESM_CAUSE_REGULAR_DEACTIVATION); + bearer, OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ogs_expect_or_return_val(esmbuf, OGS_ERROR); s1apbuf = s1ap_build_e_rab_release_command(bearer, esmbuf, diff --git a/src/mme/sgsap-handler.c b/src/mme/sgsap-handler.c index f8d3686d9..41991973c 100644 --- a/src/mme/sgsap-handler.c +++ b/src/mme/sgsap-handler.c @@ -124,8 +124,8 @@ void sgsap_handle_location_update_accept(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf) error: ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + OGS_NAS_EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED, + OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); mme_send_delete_session_or_mme_ue_context_release(mme_ue); } @@ -205,7 +205,7 @@ void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf) ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, - emm_cause, ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); + emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED)); mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; diff --git a/tests/attach/auth-test.c b/tests/attach/auth-test.c index cbc172550..dafb014ad 100644 --- a/tests/attach/auth-test.c +++ b/tests/attach/auth-test.c @@ -315,7 +315,7 @@ static void test1_func(abts_case *tc, void *data) /* Send Authentication failure - SYNCH failure */ emmbuf = testemm_build_authentication_failure( - test_ue, EMM_CAUSE_SYNCH_FAILURE, 0x11223344); + test_ue, OGS_NAS_EMM_CAUSE_SYNCH_FAILURE, 0x11223344); ABTS_PTR_NOTNULL(tc, emmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, emmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -329,7 +329,7 @@ static void test1_func(abts_case *tc, void *data) /* Send Authentication failure - MAC failure */ emmbuf = testemm_build_authentication_failure( - test_ue, EMM_CAUSE_MAC_FAILURE, 0); + test_ue, OGS_NAS_EMM_CAUSE_MAC_FAILURE, 0); ABTS_PTR_NOTNULL(tc, emmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, emmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -388,7 +388,7 @@ static void test1_func(abts_case *tc, void *data) /* Send Authentication failure - MAC failure */ emmbuf = testemm_build_authentication_failure( - test_ue, EMM_CAUSE_MAC_FAILURE, 0); + test_ue, OGS_NAS_EMM_CAUSE_MAC_FAILURE, 0); ABTS_PTR_NOTNULL(tc, emmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, emmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); diff --git a/tests/attach/emm-status-test.c b/tests/attach/emm-status-test.c index 524f25680..cc9a09029 100644 --- a/tests/attach/emm-status-test.c +++ b/tests/attach/emm-status-test.c @@ -150,8 +150,8 @@ static void test1_func(abts_case *tc, void *data) tests1ap_recv(test_ue, recvbuf); /* Send EMM Status */ - emmbuf = testemm_build_emm_status( - test_ue, ESM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE); + emmbuf = testemm_build_emm_status(test_ue, + OGS_NAS_ESM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE); ABTS_PTR_NOTNULL(tc, emmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, emmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); diff --git a/tests/common/emm-build.c b/tests/common/emm-build.c index cbedced18..e28372704 100644 --- a/tests/common/emm-build.c +++ b/tests/common/emm-build.c @@ -342,7 +342,7 @@ ogs_pkbuf_t *testemm_build_authentication_failure( authentication_failure->emm_cause = emm_cause; - if (emm_cause == EMM_CAUSE_SYNCH_FAILURE) { + if (emm_cause == OGS_NAS_EMM_CAUSE_SYNCH_FAILURE) { authentication_failure->presencemask |= OGS_NAS_EPS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT; diff --git a/tests/unit/nas-message-test.c b/tests/unit/nas-message-test.c index 872bfbf31..38fc48897 100644 --- a/tests/unit/nas-message-test.c +++ b/tests/unit/nas-message-test.c @@ -175,7 +175,7 @@ static void ogs_nas_eps_message_test4(abts_case *tc, void *data) memset(&message, 0, sizeof(message)); message.emm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM; message.emm.h.message_type = OGS_NAS_EPS_ATTACH_REJECT; - attach_reject->emm_cause = EMM_CAUSE_NETWORK_FAILURE; + attach_reject->emm_cause = OGS_NAS_EMM_CAUSE_NETWORK_FAILURE; pkbuf = ogs_nas_eps_plain_encode(&message); ABTS_INT_EQUAL(tc, sizeof(buffer), pkbuf->len); diff --git a/tests/volte/rx-test.c b/tests/volte/rx-test.c index eb9c7583d..4fb12971f 100644 --- a/tests/volte/rx-test.c +++ b/tests/volte/rx-test.c @@ -430,7 +430,7 @@ static void test1_func(abts_case *tc, void *data) sess->pti = 10; esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); diff --git a/tests/volte/video-test.c b/tests/volte/video-test.c index 026f87a0c..333a9bfb5 100644 --- a/tests/volte/video-test.c +++ b/tests/volte/video-test.c @@ -347,7 +347,7 @@ static void test1_func(abts_case *tc, void *data) ogs_assert(bearer); esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -509,7 +509,7 @@ static void test1_func(abts_case *tc, void *data) ogs_assert(bearer); esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -671,7 +671,7 @@ static void test1_func(abts_case *tc, void *data) ogs_assert(bearer); esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -833,7 +833,7 @@ static void test1_func(abts_case *tc, void *data) ogs_assert(bearer); esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -995,7 +995,7 @@ static void test1_func(abts_case *tc, void *data) ogs_assert(bearer); esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf); @@ -1157,7 +1157,7 @@ static void test1_func(abts_case *tc, void *data) ogs_assert(bearer); esmbuf = testesm_build_bearer_resource_modification_request( bearer, OGS_GTP2_TFT_CODE_DELETE_PACKET_FILTERS_FROM_EXISTING, 0, - ESM_CAUSE_REGULAR_DEACTIVATION); + OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf); ABTS_PTR_NOTNULL(tc, sendbuf);