diff --git a/lib/nas/nas_decoder.c b/lib/nas/nas_decoder.c index f5c77addf..cdfebba8e 100644 --- a/lib/nas/nas_decoder.c +++ b/lib/nas/nas_decoder.c @@ -26,7 +26,7 @@ /******************************************************************************* * This file had been created by gtpv2c_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2017-04-13 10:06:41.790125 by acetcom + * Created on: 2017-04-13 13:13:49.622584 by acetcom * from 24301-d80.docx ******************************************************************************/ diff --git a/lib/nas/nas_encoder.c b/lib/nas/nas_encoder.c index 115486031..d00a93992 100644 --- a/lib/nas/nas_encoder.c +++ b/lib/nas/nas_encoder.c @@ -26,7 +26,7 @@ /******************************************************************************* * This file had been created by gtpv2c_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2017-04-13 10:06:41.800426 by acetcom + * Created on: 2017-04-13 13:13:49.632842 by acetcom * from 24301-d80.docx ******************************************************************************/ diff --git a/lib/nas/nas_ies.c b/lib/nas/nas_ies.c index 7b8509f56..2d93ea64c 100644 --- a/lib/nas/nas_ies.c +++ b/lib/nas/nas_ies.c @@ -26,7 +26,7 @@ /******************************************************************************* * This file had been created by gtpv2c_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2017-04-13 10:06:41.772509 by acetcom + * Created on: 2017-04-13 13:13:49.598913 by acetcom * from 24301-d80.docx ******************************************************************************/ @@ -133,7 +133,7 @@ c_int16_t nas_decode_mobile_identity(nas_mobile_identity_t *mobile_identity, pkb d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); memcpy(mobile_identity, pkbuf->payload - size, size); - if (mobile_identity->tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI) + if (mobile_identity->tmsi.type == NAS_MOBILE_IDENTITY_TMSI) { if (mobile_identity->tmsi.spare != 0xf) d_warn("Spec warning : mobile_identity->tmsi.spare = 0x%x", mobile_identity->tmsi.spare); @@ -149,7 +149,7 @@ c_int16_t nas_encode_mobile_identity(pkbuf_t *pkbuf, nas_mobile_identity_t *mobi nas_mobile_identity_t target; memcpy(&target, mobile_identity, sizeof(nas_mobile_identity_t)); - if (mobile_identity->tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI) + if (mobile_identity->tmsi.type == NAS_MOBILE_IDENTITY_TMSI) { target.tmsi.tmsi = htonl(mobile_identity->tmsi.tmsi); target.tmsi.spare = 0xf; @@ -372,11 +372,11 @@ c_int16_t nas_decode_eps_mobile_identity(nas_eps_mobile_identity_t *eps_mobile_i d_assert(pkbuf_header(pkbuf, -size) == CORE_OK, return -1, "pkbuf_header error"); memcpy(eps_mobile_identity, pkbuf->payload - size, size); - if (eps_mobile_identity->guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI) + if (eps_mobile_identity->guti.type == NAS_EPS_MOBILE_IDENTITY_GUTI) { if (eps_mobile_identity->guti.spare != 0xf) d_warn("Spec warning : eps_mobile_identy->spare = 0x%x", eps_mobile_identity->guti.spare); - eps_mobile_identity->guti.mme_group_id = ntohs(eps_mobile_identity->guti.mme_group_id); + eps_mobile_identity->guti.mme_gid = ntohs(eps_mobile_identity->guti.mme_gid); eps_mobile_identity->guti.m_tmsi = ntohl(eps_mobile_identity->guti.m_tmsi); } @@ -389,10 +389,10 @@ c_int16_t nas_encode_eps_mobile_identity(pkbuf_t *pkbuf, nas_eps_mobile_identity nas_eps_mobile_identity_t target; memcpy(&target, eps_mobile_identity, sizeof(nas_eps_mobile_identity_t)); - if (target.guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI) + if (target.guti.type == NAS_EPS_MOBILE_IDENTITY_GUTI) { target.guti.spare = 0xf; - target.guti.mme_group_id = htons(eps_mobile_identity->guti.mme_group_id); + target.guti.mme_gid = htons(eps_mobile_identity->guti.mme_gid); target.guti.m_tmsi = htonl(eps_mobile_identity->guti.m_tmsi); } @@ -901,13 +901,13 @@ c_int16_t nas_decode_tracking_area_identity_list(nas_tracking_area_identity_list int i = 0; { - if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS) - for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) + if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS) + for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) tracking_area_identity_list->type0.tac[i] = ntohs(tracking_area_identity_list->type0.tac[i]); - else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) + else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) tracking_area_identity_list->type1.tac = ntohs(tracking_area_identity_list->type1.tac); - else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS) - for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) + else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS) + for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) tracking_area_identity_list->type2.tai[i].tac = ntohs(tracking_area_identity_list->type2.tai[i].tac); else return -1; @@ -924,13 +924,13 @@ c_int16_t nas_encode_tracking_area_identity_list(pkbuf_t *pkbuf, nas_tracking_ar memcpy(&target, tracking_area_identity_list, sizeof(nas_tracking_area_identity_list_t)); int i = 0; { - if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS) - for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) + if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS) + for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) target.type0.tac[i] = htons(tracking_area_identity_list->type0.tac[i]); - else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) + else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) target.type1.tac = htons(tracking_area_identity_list->type1.tac); - else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS) - for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) + else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS) + for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++) target.type2.tai[i].tac = htons(tracking_area_identity_list->type2.tai[i].tac); else return -1; diff --git a/lib/nas/nas_ies.h b/lib/nas/nas_ies.h index 1c307485e..45e7642e9 100644 --- a/lib/nas/nas_ies.h +++ b/lib/nas/nas_ies.h @@ -26,7 +26,7 @@ /******************************************************************************* * This file had been created by gtpv2c_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2017-04-13 10:06:41.768731 by acetcom + * Created on: 2017-04-13 13:13:49.594439 by acetcom * from 24301-d80.docx ******************************************************************************/ diff --git a/lib/nas/nas_message.h b/lib/nas/nas_message.h index 655059d77..1bc9ed7d3 100644 --- a/lib/nas/nas_message.h +++ b/lib/nas/nas_message.h @@ -26,7 +26,7 @@ /******************************************************************************* * This file had been created by gtpv2c_tlv.py script v0.1.0 * Please do not modify this file but regenerate it via script. - * Created on: 2017-04-13 10:06:41.782078 by acetcom + * Created on: 2017-04-13 13:13:49.611974 by acetcom * from 24301-d80.docx ******************************************************************************/ diff --git a/lib/nas/nas_types.h b/lib/nas/nas_types.h index 5258b708a..5b70c637d 100644 --- a/lib/nas/nas_types.h +++ b/lib/nas/nas_types.h @@ -37,7 +37,7 @@ typedef struct _nas_location_area_identification_t { typedef struct _nas_mobile_identity_imsi { ED3(c_uint8_t digit1:4;, c_uint8_t odd_even:1;, - c_uint8_t type_of_identity:3;) + c_uint8_t type:3;) ED2(c_uint8_t digit3:4;, c_uint8_t digit2:4;) ED2(c_uint8_t digit5:4;, @@ -57,7 +57,7 @@ ED2(c_uint8_t digit15:4;, typedef struct _nas_mobile_identity_tmsi { ED3(c_uint8_t spare:4;, c_uint8_t odd_even:1;, - c_uint8_t type_of_identity:3;) + c_uint8_t type:3;) c_uint32_t tmsi; } __attribute__ ((packed)) nas_mobile_identity_tmsi_t; @@ -66,7 +66,7 @@ ED5(c_uint8_t spare:2;, c_uint8_t mbms_session_id:1;, c_uint8_t mcc_mnc:1;, c_uint8_t odd_even:1;, - c_uint8_t type_of_identity:3;) + c_uint8_t type:3;) c_uint8_t mbms_servicec_id[3]; plmn_id_t plmn_id; c_uint8_t mbms_session_identity; @@ -312,9 +312,9 @@ ED4(c_uint8_t tsc:1;, typedef struct _nas_eps_mobile_identity_guti_t { ED3(c_uint8_t spare:4;, c_uint8_t odd_even:1;, - c_uint8_t type_of_identity:3;) + c_uint8_t type:3;) plmn_id_t plmn_id; - c_uint16_t mme_group_id; + c_uint16_t mme_gid; c_uint8_t mme_code; c_uint32_t m_tmsi; } __attribute__ ((packed)) nas_eps_mobile_identity_guti_t; @@ -365,7 +365,7 @@ typedef struct _nas_esm_message_container_t { #define NAS_GRPS_TIMER_UNIT_DEACTIVATED 7 typedef struct _nas_gprs_timer_t { ED2(c_uint8_t unit:3;, - c_uint8_t timer_value:5;) + c_uint8_t value:5;) } __attribute__ ((packed)) nas_gprs_timer_t; /* 9.9.3.16A GPRS timer 2 @@ -403,7 +403,7 @@ ED2(c_uint8_t unit:3;, #define NAS_IDENTITY_TYPE_2_TMSI 4 typedef struct _nas_identity_type_2_t { ED2(c_uint8_t spare:5;, - c_uint8_t type_of_identity:3;) + c_uint8_t type:3;) } __attribute__ ((packed)) nas_identity_type_2_t; /* 9.9.3.18 IMEISV request @@ -527,10 +527,7 @@ ED3(c_uint8_t type:4;, /* 9.9.3.32 Tracking area identity * O TV 6 */ -typedef struct _nas_tracking_area_identity_t { - plmn_id_t plmn_id; - c_uint16_t tac; -} __attribute__ ((packed)) nas_tracking_area_identity_t; +typedef tai_t nas_tracking_area_identity_t; /* 9.9.3.33 Tracking area identity list * M LV 7-97 */ @@ -552,8 +549,8 @@ typedef struct _nas_tracking_area_identity_type2 { typedef struct nas_tracking_area_identity_list_t { c_uint8_t length; ED3(c_uint8_t spare:1;, - c_uint8_t type_of_list:2;, - c_uint8_t number_of_elements:5;) + c_uint8_t type:2;, + c_uint8_t num:5;) union { nas_tracking_area_identity_type0 type0; nas_tracking_area_identity_type1 type1; diff --git a/lib/nas/support/type_list.py b/lib/nas/support/type_list.py index 903e72829..0a5ad6797 100644 --- a/lib/nas/support/type_list.py +++ b/lib/nas/support/type_list.py @@ -16,13 +16,13 @@ type_list["Tracking area identity"]["encode"] = \ type_list["Tracking area identity list"]["decode"] = \ " int i = 0;\n" \ " {\n" \ -" if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)\n" \ -" for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ +" if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)\n" \ +" for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ " tracking_area_identity_list->type0.tac[i] = ntohs(tracking_area_identity_list->type0.tac[i]);\n" \ -" else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)\n" \ +" else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)\n" \ " tracking_area_identity_list->type1.tac = ntohs(tracking_area_identity_list->type1.tac);\n" \ -" else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)\n" \ -" for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ +" else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)\n" \ +" for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ " tracking_area_identity_list->type2.tai[i].tac = ntohs(tracking_area_identity_list->type2.tai[i].tac);\n" \ " else\n" \ " return -1;\n" \ @@ -30,45 +30,45 @@ type_list["Tracking area identity list"]["decode"] = \ type_list["Tracking area identity list"]["encode"] = \ " int i = 0;\n" \ " {\n" \ -" if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)\n" \ -" for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ +" if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS)\n" \ +" for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ " target.type0.tac[i] = htons(tracking_area_identity_list->type0.tac[i]);\n" \ -" else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)\n" \ +" else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)\n" \ " target.type1.tac = htons(tracking_area_identity_list->type1.tac);\n" \ -" else if (tracking_area_identity_list->type_of_list == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)\n" \ -" for (i = 0; i < tracking_area_identity_list->number_of_elements + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ +" else if (tracking_area_identity_list->type == NAS_TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS)\n" \ +" for (i = 0; i < tracking_area_identity_list->num + 1 && i < NAS_MAX_TRACKING_AREA_IDENTITY; i++)\n" \ " target.type2.tai[i].tac = htons(tracking_area_identity_list->type2.tai[i].tac);\n" \ " else\n" \ " return -1;\n" \ " }\n\n" type_list["Mobile identity"]["decode"] = \ -" if (mobile_identity->tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI)\n" \ +" if (mobile_identity->tmsi.type == NAS_MOBILE_IDENTITY_TMSI)\n" \ " {\n" \ " if (mobile_identity->tmsi.spare != 0xf)\n" \ " d_warn(\"Spec warning : mobile_identity->tmsi.spare = 0x%x\", mobile_identity->tmsi.spare);\n" \ " mobile_identity->tmsi.tmsi = ntohl(mobile_identity->tmsi.tmsi);\n" \ " }\n\n" type_list["Mobile identity"]["encode"] = \ -" if (mobile_identity->tmsi.type_of_identity == NAS_MOBILE_IDENTITY_TMSI)\n" \ +" if (mobile_identity->tmsi.type == NAS_MOBILE_IDENTITY_TMSI)\n" \ " {\n" \ " target.tmsi.tmsi = htonl(mobile_identity->tmsi.tmsi);\n" \ " target.tmsi.spare = 0xf;\n" \ " }\n\n" type_list["EPS mobile identity"]["decode"] = \ -" if (eps_mobile_identity->guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)\n" \ +" if (eps_mobile_identity->guti.type == NAS_EPS_MOBILE_IDENTITY_GUTI)\n" \ " {\n" \ " if (eps_mobile_identity->guti.spare != 0xf)\n" \ " d_warn(\"Spec warning : eps_mobile_identy->spare = 0x%x\", eps_mobile_identity->guti.spare);\n" \ -" eps_mobile_identity->guti.mme_group_id = ntohs(eps_mobile_identity->guti.mme_group_id);\n" \ +" eps_mobile_identity->guti.mme_gid = ntohs(eps_mobile_identity->guti.mme_gid);\n" \ " eps_mobile_identity->guti.m_tmsi = ntohl(eps_mobile_identity->guti.m_tmsi);\n" \ " }\n\n" type_list["EPS mobile identity"]["encode"] = \ -" if (target.guti.type_of_identity == NAS_EPS_MOBILE_IDENTITY_GUTI)\n" \ +" if (target.guti.type == NAS_EPS_MOBILE_IDENTITY_GUTI)\n" \ " {\n" \ " target.guti.spare = 0xf;\n" \ -" target.guti.mme_group_id = htons(eps_mobile_identity->guti.mme_group_id);\n" \ +" target.guti.mme_gid = htons(eps_mobile_identity->guti.mme_gid);\n" \ " target.guti.m_tmsi = htonl(eps_mobile_identity->guti.m_tmsi);\n" \ " }\n\n" diff --git a/src/mme/emm_build.c b/src/mme/emm_build.c index 3a601fd45..e354e7e03 100644 --- a/src/mme/emm_build.c +++ b/src/mme/emm_build.c @@ -12,6 +12,19 @@ status_t emm_build_attach_accept( { nas_message_t message; nas_attach_accept_t *attach_accept = &message.emm.attach_accept; + nas_eps_attach_result_t *eps_attach_result = + &attach_accept->eps_attach_result; + nas_gprs_timer_t *t3412_value = &attach_accept->t3412_value; + nas_tracking_area_identity_list_t *tai_list = &attach_accept->tai_list; +#if 0 + nas_eps_mobile_identity_t *guti = &attach_accept->guti; +#endif + nas_gprs_timer_t *t3402_value = &attach_accept->t3402_value; +#if 0 + nas_gprs_timer_t *t3423_value = &attach_accept->t3423_value; + nas_eps_network_feature_support_t *eps_network_feature_support = + &attach_accept->eps_network_feature_support; +#endif d_assert(ue, return CORE_ERROR, "Null param"); @@ -23,9 +36,46 @@ status_t emm_build_attach_accept( message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM; message.emm.h.message_type = NAS_ATTACH_ACCEPT; + eps_attach_result->result = NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH; + t3412_value->unit = NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; + t3412_value->value = 9; + + tai_list->length = 6; + tai_list->type = 2; + tai_list->num = 0; /* +1 = 1 elements */ + memcpy(&tai_list->type2.tai[0], &ue->tai, sizeof(tai_t)); + attach_accept->esm_message_container.data = esmbuf->payload; attach_accept->esm_message_container.len = esmbuf->len; +#if 0 + attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT; + guti->length = 11; + guti->guti.odd_even = NAS_EPS_MOBILE_IDENTITY_EVEN; + guti->guti.type = NAS_EPS_MOBILE_IDENTITY_GUTI; + memcpy(&guti->guti.plmn_id, &ue->visited_plmn_id, PLMN_ID_LEN); + guti->guti.mme_gid = 2; + guti->guti.mme_code = 1; + guti->guti.m_tmsi = 0x040001fb; +#endif + + attach_accept->presencemask |= NAS_ATTACH_ACCEPT_EMM_CAUSE_PRESENT; + attach_accept->emm_cause = EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE; + attach_accept->presencemask |= NAS_ATTACH_ACCEPT_T3402_VALUE_PRESENT; + t3402_value->unit = NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM; + t3402_value->value = 12; +#if 0 + attach_accept->presencemask |= NAS_ATTACH_ACCEPT_T3423_VALUE_PRESENT; + t3423_value->unit = NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH; + t3423_value->value = 9; + attach_accept->presencemask |= + NAS_ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; + eps_network_feature_support->length = 1; + eps_network_feature_support->esr_ps = 1; + eps_network_feature_support->epc_lcs = 1; + eps_network_feature_support->ims_vops = 1; +#endif + d_assert(nas_security_encode(emmbuf, ue, &message) == CORE_OK && *emmbuf,,); return CORE_OK; diff --git a/src/mme/emm_handler.c b/src/mme/emm_handler.c index 19bf62e6c..57a1186a1 100644 --- a/src/mme/emm_handler.c +++ b/src/mme/emm_handler.c @@ -63,7 +63,7 @@ void emm_handle_attach_request( emm_handle_esm_message_container( ue, &attach_request->esm_message_container); - switch(eps_mobile_identity->imsi.type_of_identity) + switch(eps_mobile_identity->imsi.type) { case NAS_EPS_MOBILE_IDENTITY_IMSI: { @@ -99,7 +99,7 @@ void emm_handle_attach_request( default: { d_warn("Not implemented(type:%d)", - eps_mobile_identity->imsi.type_of_identity); + eps_mobile_identity->imsi.type); return; } @@ -219,10 +219,12 @@ void emm_handle_lo_create_session(mme_esm_t *esm) rv = emm_build_attach_accept(&emmbuf, ue, esmbuf); d_assert(rv == CORE_OK, return, "emm build error"); + d_print_hex(emmbuf->payload, emmbuf->len); pkbuf_free(esmbuf); rv = s1ap_build_initial_context_setup_request(&s1apbuf, esm, emmbuf); d_assert(rv == CORE_OK, return, "emm build error"); + d_print_hex(s1apbuf->payload, s1apbuf->len); pkbuf_free(emmbuf); d_assert(s1ap_send_to_enb(enb, s1apbuf) == CORE_OK,,); diff --git a/src/mme/s1ap_build.c b/src/mme/s1ap_build.c index 7e933c03a..42432c1b9 100644 --- a/src/mme/s1ap_build.c +++ b/src/mme/s1ap_build.c @@ -128,6 +128,7 @@ status_t s1ap_build_initial_context_setup_request( nasPdu->size = emmbuf->len; nasPdu->buf = core_calloc(nasPdu->size, sizeof(c_uint8_t)); memcpy(nasPdu->buf, emmbuf->payload, nasPdu->size); + d_print_hex(nasPdu->buf, nasPdu->size); message.procedureCode = S1ap_ProcedureCode_id_downlinkNASTransport; message.direction = S1AP_PDU_PR_initiatingMessage; diff --git a/test/nas_message_test.c b/test/nas_message_test.c index ed19f8027..c136fd2ab 100644 --- a/test/nas_message_test.c +++ b/test/nas_message_test.c @@ -65,7 +65,7 @@ static void nas_message_test2(abts_case *tc, void *data) NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH; attach_accept->t3412_value.unit = NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM; - attach_accept->t3412_value.timer_value = 3; + attach_accept->t3412_value.value = 3; attach_accept->tai_list.length = 6; plmn_id_build(&attach_accept->tai_list.type0.plmn_id, 417, 99, 2); attach_accept->tai_list.type0.tac[0] = 12345; @@ -75,9 +75,9 @@ static void nas_message_test2(abts_case *tc, void *data) attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT; attach_accept->guti.length = 11; - attach_accept->guti.guti.type_of_identity = NAS_EPS_MOBILE_IDENTITY_GUTI; + attach_accept->guti.guti.type = NAS_EPS_MOBILE_IDENTITY_GUTI; plmn_id_build(&attach_accept->guti.guti.plmn_id, 417, 99, 2); - attach_accept->guti.guti.mme_group_id = 9029; + attach_accept->guti.guti.mme_gid = 9029; attach_accept->guti.guti.mme_code = 225; attach_accept->guti.guti.m_tmsi = 0x00000456; @@ -89,7 +89,7 @@ static void nas_message_test2(abts_case *tc, void *data) attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT; attach_accept->ms_identity.length = 5; - attach_accept->ms_identity.tmsi.type_of_identity = + attach_accept->ms_identity.tmsi.type = NAS_MOBILE_IDENTITY_TMSI; attach_accept->ms_identity.tmsi.tmsi = 0x00e102d4; @@ -194,7 +194,7 @@ static void nas_message_test6(abts_case *tc, void *data) message.emm.h.protocol_discriminator); ABTS_INT_EQUAL(tc, NAS_IDENTITY_REQUEST, message.emm.h.message_type); ABTS_INT_EQUAL(tc, NAS_IDENTITY_TYPE_2_IMSI, - identity_request->identity_type.type_of_identity); + identity_request->identity_type.type); pkbuf_free(pkbuf); } @@ -217,7 +217,7 @@ static void nas_message_test7(abts_case *tc, void *data) identity_response->mobile_identity.length = 8; identity_response->mobile_identity.imsi.digit1 = 0; - identity_response->mobile_identity.imsi.type_of_identity = + identity_response->mobile_identity.imsi.type = NAS_IDENTITY_TYPE_2_IMSI; identity_response->mobile_identity.imsi.odd_even = 1; identity_response->mobile_identity.imsi.digit2 = 0; diff --git a/test/nas_sm_test.c b/test/nas_sm_test.c index a458eb0bf..ef0358112 100644 --- a/test/nas_sm_test.c +++ b/test/nas_sm_test.c @@ -29,6 +29,11 @@ static void nas_sm_test1(abts_case *tc, void *data) "000b402000000300 000005c00100009d 000800020001001a 000a092779012320" "010221d9"; + extern int _s1ap_recv; + d_trace_level(&_s1ap_recv, 100); + extern int _s1ap_send; + d_trace_level(&_s1ap_send, 100); + /* eNB connects to MME */ sock = tests1ap_enb_connect(); ABTS_PTR_NOTNULL(tc, sock);