S1AP View of LTE Attach & EPS Bearer Setup (2018-0326)
S1AP View of LTE Attach & EPS Bearer Setup (2018-0326)
S1AP View of LTE Attach & EPS Bearer Setup (2018-0326)
html
http://www.eventhelix.com/lte/attach/s1ap-lte-attach-eps-bearer-setup.pdf
* @details This function is used to build and send the S1 Setup Request to the
* MME.
*
* Function: wrEmmMmeSetup
*
* Processing steps:
* - Build and send S1 Setup Request to the MME.
* - Move the MME control block state to WR_MME_IN_PROG.
* - Start the Setup response timer to retransmit the setup request
* incase of reponse is not received with in the time.
* - This function is invoked EMM module when EMM Module ges trigger
* from Management intrerface ie., during cell config/setup.
*
* @param[in] mmeId: MME Id.
* @return S16
* -# Success : ROK
* -# Failure : RFAILED
*/
PUBLIC S16 wrEmmMmeSetup
(
WrMmeId mmeId
)
{
SztUDatEvnt uDatEvnt;
WrMmeCb *mmeCb;
mmeCb->adminState = WR_MME_UNLOCKED;
if (wrEmmMmeBldSetupReq(&(uDatEvnt.pdu)) != ROK)
{
RLOG0(L_ERROR, "Building S1 SETUP Failed");
RETVALUE(RFAILED);
}
uDatEvnt.transId.pres = PRSNT_NODEF;
uDatEvnt.transId.val = 1;
uDatEvnt.peerId.pres = PRSNT_NODEF;
uDatEvnt.peerId.val = mmeCb->peerId;
RLOG1(L_INFO, "Sending S1 SETUP For Peer [%d]", mmeCb->peerId);
/* Send the pdu to the MME */
if((WrIfmS1apSndMgmtMsg(&uDatEvnt)) != ROK)
{
RLOG0(L_ERROR, "Sending S1 SETUP Failed");
RETVALUE(RFAILED);
}
/* update state of the s1 connection */
mmeCb->state = WR_MME_IN_PROG;
#if 0
#else
wrStartTmr((PTR)mmeCb, WR_TMR_MME_SETUP_RSP, wrEmmCb.tmrCfg.s1SetupTmr);
#endif
RETVALUE(ROK);
}
TRC2(wrEmmMmeSztBldSetupReq);
RLOG1(L_DEBUG,"TAC : [%d]",cellCb->sib1.tac);
#ifdef SS_DIAG
wrDiagPrntPlmnId(&(cellCb->sib1.plmns[0].plmnId),3);
#endif
RLOG_ARG3(L_DEBUG, DBG_CELLID,cellCb->cellId,"SIB1 configured Q-RxLevMin[%d]"
" Q-RxLevMin offset[%d] cellBarred[%d]", cellCb->sib1.qRxLevMin,
cellCb->sib1.qRxLevMinOffset, cellCb->sib1.cellBarred);
RLOG_ARG4(L_DEBUG, DBG_CELLID,cellCb->cellId,"SIB2 configured "
"defaultPagingCycle[%d] nB[%d] rootSequenceIndx[%d] prach-ConfigIndex[%d]",
cellCb->sib2.pcchCfg.defaultPagingCycle, cellCb->sib2.pcchCfg.nB,
cellCb->sib2.prachCfg.rootSeqIdx, cellCb->sib2.prachCfg.prachCfgIdx);
WR_SET_ZERO(&suppTAs, sizeof(WrEmmS1SetpSuppTAs));
wrEmmGetSuppTAs(&suppTAs);
wrFillTknU16(&(ie->value.u.sztSuppTAs.noComp), suppTAs.numTAs);
if ((cmGetMem(setupReqPdu, suppTAs.numTAs * sizeof(SztSuppTAs_Item),
(Ptr*)&(ie->value.u.sztSuppTAs.member))) !=ROK)
{
RLOG0(L_FATAL,"wrEmmMmeSztBldSetupReq: cmGetMem failed");
WR_FREE_EVNT(setupReqPdu);
RETVALUE(RFAILED);
}
for( taIdx = 0; taIdx < suppTAs.numTAs; taIdx++)
{
tACItem = &ie->value.u.sztSuppTAs.member[taIdx];
wrFillTknU8(&(tACItem->pres), PRSNT_NODEF);
wrEmmMmeSztFillTAC(suppTAs.taInfo[taIdx].tac, setupReqPdu, &tACItem->tAC);
numComp = suppTAs.taInfo[taIdx].numPlmnIds;
/* Allocate memory for broadcast PLMNs */
if((cmGetMem(setupReqPdu, numComp * sizeof(SztPLMNidentity),
(Ptr*)&(tACItem->broadcastPLMNs.member))) !=ROK)
{
RLOG0(L_FATAL, "Memory allocation failed for PLMN identity");
WR_FREE_EVNT(setupReqPdu);
RETVALUE(RFAILED);
}
wrFillTknU16(&(tACItem->broadcastPLMNs.noComp),numComp);
for(idx = 0; idx < numComp; idx++)
{
wrEmmMmeSztFillPLMNId(setupReqPdu, &(suppTAs.taInfo[taIdx].plmns[idx]),
&(tACItem->broadcastPLMNs.member[idx]));
RLOG2(L_EVENT, "[S1AP]:Sending S1 SETUP REQUEST [CGI:%d] [Supported TAI:%d]",
wrEmmCb.enbId, cellCb->sib1.tac);
}
}
ieIdx++;
ie = &initMsg->value.u.sztS1SetupRqst.protocolIEs.member[ieIdx];
wrFillTknU8(&(ie->pres), PRSNT_NODEF);
wrFillTknU32(&(ie->id), Sztid_DefaultPagDRX);
wrFillTknU32(&(ie->value.u.sztPagDRX), cellCb->sib2.pcchCfg.defaultPagingCycle);
wrFillTknU32(&(ie->criticality),SztCriticalityignoreEnum);
ieIdx++;
RETVALUE(ROK);
} /* wrEmmMmeSztBldSetupReq */
////Step 1 Initial UE Message (wireshark log)
s1ap S1 Application Protocol
per.extension_bit 0... .... Extension Bit: False
per.choice_index Choice Index: 0
s1ap.S1AP_PDU S1AP-PDU: initiatingMessage (0)
o s1ap.initiatingMessage_element initiatingMessage
s1ap.procedureCode procedureCode: id-initialUEMessage (12)
per.enum_index Enumerated Index: 1
s1ap.criticality criticality: ignore (1)
per.open_type_length Open Type Length: 159
s1ap.value_element value
s1ap.InitialUEMessage_element InitialUEMessage
per.extension_bit 0... .... Extension Bit: False
per.sequence_of_length Sequence-Of Length: 5
s1ap.protocolIEs protocolIEs: 5 items
s1ap Item 0: id-eNB-UE-S1AP-ID
s1ap.ProtocolIE_Field_element ProtocolIE-Field
s1ap.id id: id-eNB-UE-S1AP-ID (8)
per.enum_index Enumerated Index: 0
s1ap.criticality criticality: reject (0)
per.open_type_length Open Type Length: 2
s1ap.value_element value
s1ap.ENB_UE_S1AP_ID ENB-UE-S1AP-ID: 1
s1ap Item 1: id-NAS-PDU
s1ap.ProtocolIE_Field_element ProtocolIE-Field
s1ap.id id: id-NAS-PDU (26)
per.enum_index Enumerated Index: 0
s1ap.criticality criticality: reject (0)
per.open_type_length Open Type Length: 119
s1ap.value_element value
per.octet_string_length Octet String Length: 118
s1ap.NAS_PDU NAS-PDU: 17c0c8102d0b0741020bf61300148001010000000105e060...
nas-eps Non-Access-Stratum (NAS)PDU
// Radisys code
/**
* @brief This function builds the S1AP initial UE message
*
PUBLIC S16 wrUmmS1apBldInitUePdu
/* List of IEs
* 1. UE ENB S1AP ID
* 2. NAS PDU
* 3. TAI
* 4. EUTRAN CGI
* 5. Establishment Cause
* 6. S-TMSI
*7 Csg Id
* 8. Registered MME
* 9. Cell Access Mode
*10. GUMMEI Type
* */
////Step2 Downlink NAS Transport {AUTHENTICATION REQUEST}
s1ap S1 Application Protocol
nas_eps.security_header_type 0000 .... = Security header type: Plain NAS message, not security
protected (0)
gsm_a.L3_protocol_discriminator .... 0111 = Protocol discriminator: EPS mobility management
messages (0x07)
nas_eps.nas_msg_emm_type NAS EPS Mobility Management Message Type: Authentication
request (0x52)
nas_eps.emm.spare_half_octet 0000 .... = Spare half octet: 0
nas_eps.emm.tsc .... 0... = Type of security context flag (TSC): Native security context (for
KSIasme)
nas_eps.emm.nas_key_set_id .... .000 = NAS key set identifier: (0) ASME
gsm_a.dtap Authentication Parameter RAND - EPS challenge
o gsm_a.dtap.rand RAND value: e80526e22caab2fc9a4dda558c612e6a
gsm_a Authentication Parameter AUTN (UMTS and EPS authentication challenge) - EPS
challenge
o gsm_a.len Length: 16
o gsm_a.dtap.autn AUTN value: 9113c6e1085c9001df93421ca180ebe5
gsm_a.dtap.autn.sqn_xor_ak SQN xor AK: 9113c6e1085c
gsm_a.dtap.autn.amf AMF: 9001
gsm_a.dtap.autn.mac MAC: df93421ca180ebe5
/////
//////Step3 Uplink NAS Transport {AUTHENTICATION RESPONSE}
nas_eps.security_header_type 0011 .... = Security header type: Integrity protected with new
EPS security context (3)
gsm_a.L3_protocol_discriminator .... 0111 = Protocol discriminator: EPS mobility management
messages (0x07)
nas_eps.msg_auth_code Message authentication code: 0x7b99f3e3
nas_eps.seq_no Sequence number: 0
nas_eps.security_header_type 0000 .... = Security header type: Plain NAS message, not security
protected (0)
gsm_a.L3_protocol_discriminator .... 0111 = Protocol discriminator: EPS mobility management
messages (0x07)
nas_eps.nas_msg_emm_type NAS EPS Mobility Management Message Type: Security mode
command (0x5d)
nas_eps NAS security algorithms - Selected NAS security algorithms
o nas_eps.spare_bits 0... .... = Spare bit(s): 0x00
o nas_eps.emm.toc .000 .... = Type of ciphering algorithm: EPS encryption algorithm
EEA0 (null ciphering algorithm) (0)
o nas_eps.spare_bits .... 0... = Spare bit(s): 0x00
o nas_eps.emm.toi .... .001 = Type of integrity protection algorithm: EPS integrity
algorithm 128-EIA1 (1)
nas_eps.emm.spare_half_octet 0000 .... = Spare half octet: 0
nas_eps.emm.tsc .... 0... = Type of security context flag (TSC): Native security context (for
KSIasme)
nas_eps.emm.nas_key_set_id .... .000 = NAS key set identifier: (0) ASME
gsm_a UE security capability - Replayed UE security capabilities
o gsm_a.len Length: 5
o nas_eps.emm.eea0 1... .... = EEA0: Supported
o nas_eps.emm.128eea1 .1.. .... = 128-EEA1: Supported
o nas_eps.emm.128eea2 ..1. .... = 128-EEA2: Supported
o nas_eps.emm.eea3 ...0 .... = 128-EEA3: Not Supported
o nas_eps.emm.eea4 .... 0... = EEA4: Not Supported
o nas_eps.emm.eea5 .... .0.. = EEA5: Not Supported
o nas_eps.emm.eea6 .... ..0. = EEA6: Not Supported
o nas_eps.emm.eea7 .... ...0 = EEA7: Not Supported
o nas_eps.emm.eia0 0... .... = EIA0: Not Supported
o nas_eps.emm.128eia1 .1.. .... = 128-EIA1: Supported
o nas_eps.emm.128eia2 ..1. .... = 128-EIA2: Supported
o nas_eps.emm.eia3 ...0 .... = 128-EIA3: Not Supported
o nas_eps.emm.eia4 .... 0... = EIA4: Not Supported
o nas_eps.emm.eia5 .... .0.. = EIA5: Not Supported
o nas_eps.emm.eia6 .... ..0. = EIA6: Not Supported
o nas_eps.emm.eia7 .... ...0 = EIA7: Not Supported
o nas_eps.emm.uea0 1... .... = UEA0: Supported
o nas_eps.emm.uea1 .1.. .... = UEA1: Supported
o nas_eps.emm.uea2 ..0. .... = UEA2: Not Supported
o nas_eps.emm.uea3 ...0 .... = UEA3: Not Supported
o nas_eps.emm.uea4 .... 0... = UEA4: Not Supported
o nas_eps.emm.uea5 .... .0.. = UEA5: Not Supported
o nas_eps.emm.uea6 .... ..0. = UEA6: Not Supported
o nas_eps.emm.uea7 .... ...0 = UEA7: Not Supported
o nas_eps.spare_bits 0... .... = Spare bit(s): 0x00
o nas_eps.emm.uia1 .1.. .... = UMTS integrity algorithm UIA1: Supported
o nas_eps.emm.uia2 ..0. .... = UMTS integrity algorithm UIA2: Not Supported
o nas_eps.emm.uia3 ...0 .... = UMTS integrity algorithm UIA3: Not Supported
o nas_eps.emm.uia4 .... 0... = UMTS integrity algorithm UIA4: Not Supported
o nas_eps.emm.uia5 .... .0.. = UMTS integrity algorithm UIA5: Not Supported
o nas_eps.emm.uia6 .... ..0. = UMTS integrity algorithm UIA6: Not Supported
o nas_eps.emm.uia7 .... ...0 = UMTS integrity algorithm UIA7: Not Supported
o nas_eps.spare_bits 0... .... = Spare bit(s): 0x00
o nas_eps.emm.gea1 .1.. .... = GPRS encryption algorithm GEA1: Supported
o nas_eps.emm.gea2 ..1. .... = GPRS encryption algorithm GEA2: Supported
o nas_eps.emm.gea3 ...1 .... = GPRS encryption algorithm GEA3: Supported
o nas_eps.emm.gea4 .... 0... = GPRS encryption algorithm GEA4: Not Supported
o nas_eps.emm.gea5 .... .0.. = GPRS encryption algorithm GEA5: Not Supported
o nas_eps.emm.gea6 .... ..0. = GPRS encryption algorithm GEA6: Not Supported
o nas_eps.emm.gea7 .... ...0 = GPRS encryption algorithm GEA7: Not Supported
IMEISV request
o nas_eps 1100 .... = Element ID: 0xc-
o nas_eps.spare_bits .... 0... = Spare bit(s): 0x00
o nas_eps.emm.imeisv_req .... .001 = IMEISV request: IMEISV requested (1)
////////////////////////////////
//// Step 6 : Downlink NAS Transport {ESM INFORMATION REQUEST}
s1ap S1 Application Protocol
/////
//////Step 8: Initial Context Setup Request {ATTACH ACCEPT, ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST}
s1ap S1 Application Protocol
//////Step 9: UECapabilityInfoIndication
s1ap S1 Application Protocol
s1ap.ENB_UE_S1AP_ID ENB-UE-S1AP-ID: 1
///Step 10: Initial Context Setup Response [E-RAB Setup List Res]
s1ap S1 Application Protocol
///// Step 11: Uplink NAS Transport {ATTACH COMPLETE, ACTIVATE DEFAULT EPS BEARER CONTEXT ACCEPT}
s1ap S1 Application Protocol
//////Step 15: Uplink NAS Transport {ACTIVATE DEFAULT EPS BEARER CONTEXT ACCEPT}
s1ap.ENB_UE_S1AP_ID ENB-UE-S1AP-ID: 2
s1ap.TAI_element TAI
o per.extension_bit 0... .... Extension Bit: False
o per.optional_field_bit .0.. .... Optional Field Bit: False (iE-Extensions is NOT present)
o s1ap.pLMNidentity pLMNidentity: 134001
o e212.mcc Mobile Country Code (MCC): United States of America (310)
o e212.mnc Mobile Network Code (MNC): Cingular Wireless (410)
o s1ap.tAC tAC: 0001
s1ap.EUTRAN_CGI_element EUTRAN-CGI
o per.extension_bit 0... .... Extension Bit: False
o per.optional_field_bit .0.. .... Optional Field Bit: False (iE-Extensions is NOT present)
o s1ap.pLMNidentity pLMNidentity: 134001
o e212.mcc Mobile Country Code (MCC): United States of America (310)
o e212.mnc Mobile Network Code (MNC): Cingular Wireless (410)
o s1ap.cell_ID cell-ID: 1a2d0010 [bit length 28, 4 LSB pad bits, 0001 1010 0010 1101 0000
0000 0001 .... decimal value 27447297]
s1ap.S_TMSI_element S-TMSI
o per.extension_bit 0... .... Extension Bit: False
o per.optional_field_bit .0.. .... Optional Field Bit: False (iE-Extensions is NOT present)
o s1ap.mMEC mMEC: 01
o s1ap.m_TMSI m-TMSI: 00000001