Fix the 5GMM wrong sequence state after registration is complete
When the gNB was manually disconnected and immediately reconnected without touching the UE the UE remained attached but the AMF sets the UE to 5GMM-DEREGISTERED. That causes a state mismatch that is observed in the Wireshark capture when the UE sends Registration complete message but the AMF responds with Registration reject.
logs_15-05-26-09-50-56.tar.bz2
How to Reproduce:
- Start OAI CN5G
- Start gNB
- Start UE
- Stop gNB (without touching in the UE)
- Wait < 3 seconds
- Start gNB
- Wait for the UE to reconnect
- Confirm that AMF replies with Registration Reject but UE still connected
FIX:
A new function release_ngap_context_only() was introduced in amf_n2.cpp and applied to the handlers that are triggered when a gNB disconnects. It sets the UE to CM-IDLE, keeps the NAS context intact, and only removes the NGAP IDs. After testing with this MR the issue is not present anymore:
logs_15-05-26-11-14-00.tar.bz2
Registration_Reject_fix.pcapng
Fix based on the following 3GPP specifications:
-
3GPP TS 38.413 Section 8.7.4.2.2: "the AMF shall release all allocated resources on NG related to the UE association(s) indicated explicitly or implicitly in the NG RESET message and remove the NGAP ID for the indicated UE associations."
-
3GPP TS 23.501 Section 5.3.3.2.2: "When the UE states in the AMF are CM-IDLE and RM-REGISTERED, the AMF shall perform a network triggered Service Request procedure when it has signalling or mobile-terminated data to be sent to this UE, by sending a Paging Request to this UE."
-
3GPP TS 23.501 Section 5.4.1.1: "The AMF runs a Mobile Reachable timer for the UE. The timer is started with a value longer than the UE's periodic registration timer whenever the CM state for the UE in RM-REGISTERED state changes to CM-IDLE."
-
3GPP TS 24.501 Section 5.1.3.2.1.2.2: "In the state 5GMM-DEREGISTERED, no 5GMM context has been established and the UE location is unknown to the network and hence it is unreachable by a network. In order to establish a 5GMM context, the UE shall start the initial registration procedure."