LTE Initial Attach 的过程以及相关消息的具体解析 (一)

来源:互联网 发布:linux反向解析域名 编辑:程序博客网 时间:2024/06/08 17:48

具体的消息流过程还是按照3GPP 23.401。针对attach过程的某些流程和具体消息展开解释。并给出相对应的规范出处。

     



1. 首先第一条initial Attach 消息: 从具体的wireshark的包来看, 这个intial attach包含了两个事件, attach Req+PDN connectivity Req

    一个是EMM 层面的消息,一个是ESM 层面的消息。

    Attach Req 无需多讲,这是终端登陆网络侧所必须的过程。而PDN Conncetivity Req的出现是为了建立default Bearer。

   在NAS 规范24.301 6.5.1.1 中就是很明确的提出在attach req中所包含的PDN Con Req 是为了最初的default bearer建立所发(这个独立于可能还会和其他APN 所建立的default bearer),在这个PDN Connect Req里UE 侧不需要提交APN的地址,换句话讲, 这个initial default bearer所连向的APN 应该由网络侧来决定。终端只提供了UE 所支持的IP地址类型。 

   (但是也有例外,虽然规范里要求是这样,但是也有观点认为,UE提供了APN 更有利于UE 对业务需求,例如UE想直接连入企业网,那得需要UE 提供APN,但是这个APN的提供得在鉴权和NAS安全关联建立之后,因为default APN的提供应该估计应该根据实际运营商的业务实现或者客户需求来做)


      When the PDN CONNECTIVITY REQUEST message is sent together with an ATTACH REQUEST message, the UE
shall not include the APN.


    而把PDN Connectivity Req和Attach Req绑定的考虑出自于 3GPP2 24.301, 4.2节,LTE 中实现了the ip of UE alwanys online的想法。

  

a. 具体来看这个消息体。 在这条消息中,在S1AP 层面上,暂时还只有eNB-UE-S1AP-ID的value,网络侧的S1AP 的 ID 需要等MME 来回复。

     


b. 在NAS 层(如图2所示):其中 EPS mobility message 的地方出现了两次。 ESM PDN Connet Req的消息被包含在EMM 消息中,通过ESM Message Container这个IE ,EMM 包含了ESM的内容。


  

   EPS Mobility Message 出现两次的原因是: 这条消息采取了24.301中 9.1 节 所列出的消息编码格式----- a security protected NAS message. 如图3 所示:

  随后具体到每条NAS 的Message, NAS message 本身又有Protocol discriminator 和 Security header type 的IEI. 所以造成 EPS Mobility managerment message 这个header出现了两次的情况。 (但是为什么要出现两次呢? NAS 具体的Message 的Security header不够么? 为什么还要再加一层Security header上去呢?)

  

  那么如果UE 侧已经有一个valid NAS security context  存在了,那么UE 需要在attach Req 中置上intergrity protect。 对应于3GPP 24301:

1) Except for the case described in item 3 below, the UE shall transmit the initial NAS message integrity protected with the current EPS security context, but unciphered. The UE shall include the eKSI indicating the current EPS security context value in the initial NAS message. The MME shall check whether the eKSI included in the initial

NAS message belongs to an EPS security context available in the MME, and shall verify the MAC of the NAS message. If the verification is successful, the MME may re-establish the secure exchange of NAS messages:


- by replying with a NAS message that is integrity protected and ciphered using the current EPS security context. From this time onward, all NAS messages exchanged between the UE and the MME are sent integrity protected and except for the messages specified in subclause 4.4.5, all NAS messages exchanged between the UE and the MME are sent ciphered; or


- by initiating a security mode control procedure. This can be used by the MME to take a non-current EPS security context into use or to modify the current EPS security context by selecting new NAS security algorithms;


而一个Scurity Context 是通过NAS COUNT 来标示的。 NAS Count对应于NAS Header呢,就是Sequence Number。 MME 通过Sequence Number来找到相对应的Security Context (如果存在的话), 然后再使用 Message Authentication Code来完成检查.

   

                                   图3


c. 随后再打开 ESM Message Container 这个IEI。

   可以看到:


在这段消息体内,值得注意的是这几个header: EPS bearer identity , Procedure transaction id。 

copy from 24.007:

The EPS bearer identity is used to identify a message flow。 这个 NAS 中的EPS bearer id 和随后在GTP-C 上建立的Bearer Context ID 相互对应。

Procedure transaction:  A L3 protocol may define that the second octet of a standard L3 message of the protocol contains the proceduretransaction identity (PTI). The PTI allows distinguishing up to 254 different bi-directional messages flows for a given PD and a given SAP. Such a message flow is called a transaction. The procedure transaction identity is released when the procedure is completed.

对于这两个heder在LTE 中的运用,24.301 又给出了详细的描述。 参看 6.3.2.

并且通过24.007 中的routing model来看, PTI+PD 是EMM 用来routing消息给ESM 的。 而一旦bearer context 建立完,ESM 能够分配出context id后,后续的消息就不需要PTI了。

例如: PDN Context Req (from UE to MME)  中需要有PTI, EPS default Bearer req (from MME to UE) 需要有(PTI,EBI) , 随后的 EPS default bearer Resp (from UE to MME)只需要有EBI了,就不需要PTI了。

  在这个过程中,EMM层需要为ESM 提供一个routing服务,EMM 通过PTI来区分向ESM 建立不同的transcription, MME 收到req之后,回出的 Default Bearer Req 中,也需要PTI,是因为它需要向UE 标明 它是为了之前那条ESM transaction分配了EBI, UE 收到之后,双方在ESM 上达成了统一,就不需要PTI的配合了,因为Bearer ID 的唯一性就足够EMM 在随后的过程中,将ESM的消息路由给相对应的EMS layer来处理。

   这个default Beraer的的建立在MME 被pending在那边,因为要完成EMM的过程之后, MME 才会去处理ESM 的状态机。NAS 的PTI,EBI的再次出现要等到MME-SGW-PGW之间的bearer context 建立完成后。

2) 随后New MME 向 UE 要求获取IMSI, MME 可以根据IMSI 向 HSS 要求鉴权数据以及随后的用户数据。但这个时候因为security mode还未建立,所以NAS 层面的消息是

Plain NAS message, not security protected, 应该也算危险的地方。


3) MME 收到IMSI 之后,和HSS 通过diameter 的AIR/AIA 完成鉴权五元组的交互。

4) MME 向UE 发送 RAND ,AUTN value, 要求UE上报鉴权数据。

5) MME 收到 NAS Authentication Resp,鉴权通过之后, 开始security mode 的建立。

      按照 24.301 中4.4.2.4 的规定,

      The SECURITY MODE COMMAND message sent by the MME includes the eKSI of the new EPS security context to be used. The MME shall send the SECURITY MODE COMMAND message integrity protected with the new EPS security context, but unciphered. When the UE responds with a SECURITY MODE COMPLETE, it shall send the message integrity protected and ciphered with the new EPS security context.

     MME 下发的Security Command 只是integrity protected and unciphered. 但是UE 随后的Security Complete 消息应该是被cipher过的。

      但是如果MME 对于cipher的规则选择的是“ null ciphering alogrithm“ EEA0, 虽然随后UE 和MME 之间的NAS 没有经过cipher,但是在security header也必须置上ciphered。

     (参见24.301 - 4.4.5, ” If the "null ciphering algorithm" EEA0 has been selected as a ciphering algorithm, the NAS messages with the security header indicating ciphering are regarded as ciphered”)

      具体见图:(还是不理解为啥要插两层EMM 的 Security header 进去, 第一层的Security header 可以理解, 但是第二层对于具体的EMM ,为啥还需要一个security header呢,直接被包含在第一层不行么?)


6)  接下来就是MME 得去HSS 取数据了。使用DIAMETER ULR/ULA..   

     再分个子节吧。。。感觉这部分用户很重要。没有完全看过这部分的用户数据。

阅读全文
0 0
原创粉丝点击