• Robert Schmidt's avatar
    Handle repeated NGAP Initial Context Setup Request · d71104da
    Robert Schmidt authored
    Prior to this commit, if we receive an Initial Context Setup Request for
    a UE that has AS security set up, the gNB asserts with
    
        Assertion (!ue_p->as_security_active) failed!
        In rrc_gNB_generate_SecurityModeCommand() openairinterface5g/openair2/RRC/NR/rrc_gNB.c:2590
        logic error: security already activ
    
    However, TS 38.413 says:
    
    > The AMF may initiate the Initial Context Setup procedure if a
    > UE-associated logical NG-connection exists for the UE
    
    (I interpret this as "it might happen anytime")
    
    > store the received Security Key in the UE context and, if the NG-RAN
    > node is required to activate security for the UE, take this security key
    > into use.
    
    (I interpret this as "do not set up AS security again")
    
    In this commit, handle if we receive an Initial Context Setup Request
    for an existing UE context. As said in the spec, we store the keys. If
    security is not active, we trigger RRC Security Mode Command. If it is
    active, we skip Security, and directly set up a PDU session. If there is
    also no PDU session, we simply forward the NAS message, and acknowledge.
    
    If there was no AS security, after security, the gNB would trigger the
    setup of PDU sessions (if any), and then forward any NAS PDUs, which is
    stated in the if block if AS security is already active.
    d71104da
rrc_gNB_NGAP.c 60.9 KB