diff --git a/config/n3ue.yaml b/config/n3ue.yaml index 2abe8ca..26f2780 100644 --- a/config/n3ue.yaml +++ b/config/n3ue.yaml @@ -6,6 +6,9 @@ configuration: IPSecIfaceAddr: 10.0.1.1 # IP address of Nwu interface (IKE) on N3IWF IPsecInnerAddr: 10.0.0.1 # IP address of IPsec tunnel enpoint on N3IWF N3UEInformation: + VisitedPLMN: # Optional + MCC: 208 # Mobile Country Code (3 digits string, digit: 0~9) + MNC: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9) IMSI: PLMNID: # Public Land Mobile Network ID MCC: 208 # Mobile Country Code (3 digits string, digit: 0~9) diff --git a/internal/nwucp/handler/send.go b/internal/nwucp/handler/send.go index 09064e4..da23e7a 100644 --- a/internal/nwucp/handler/send.go +++ b/internal/nwucp/handler/send.go @@ -65,11 +65,13 @@ func SendPduSessionEstablishmentRequest(ue *security.RanUeContext, func SendDeregistration() { n3ueContext := context.N3UESelf() - mobileIdentity5GS := nasType.MobileIdentity5GS{ - Len: n3ueContext.GUTI.Len, - Buffer: n3ueContext.GUTI.Octet[:], - } - deregistrationRequest := nasPacket.GetDeregistrationRequest(0x02, 0x01, 0x00, mobileIdentity5GS) + if n3ueContext.GUTI != nil { + mobileIdentity5GS := nasType.MobileIdentity5GS{ + Len: n3ueContext.GUTI.Len, + Buffer: n3ueContext.GUTI.Octet[:], + } + deregistrationRequest := nasPacket.GetDeregistrationRequest(0x02, 0x01, 0x00, mobileIdentity5GS) - SendNasMsg(n3ueContext.RanUeContext, n3ueContext.N3IWFRanUe.TCPConnection, deregistrationRequest) + SendNasMsg(n3ueContext.RanUeContext, n3ueContext.N3IWFRanUe.TCPConnection, deregistrationRequest) + } } diff --git a/pkg/factory/config.go b/pkg/factory/config.go index 6ac6362..564cb77 100644 --- a/pkg/factory/config.go +++ b/pkg/factory/config.go @@ -131,6 +131,7 @@ type N3UEInfo struct { IPSecSaCpSPI uint32 `yaml:"IPSecSA3gppControlPlaneSPI" valid:"hexadecimal,required"` SmPolicy []PolicyItem `yaml:"SmPolicy" valid:"required"` Security Security `yaml:"Security" valid:"required"` + VisitedPlmn *PLMN `yaml:"VisitedPLMN" valid:"optional"` } func (i *N3UEInfo) validate() (bool, error) { @@ -200,6 +201,10 @@ func (n *N3UEInfo) GetAMFID() ([]byte, error) { func (n *N3UEInfo) GetSNN() string { mcc := n.IMSI.PLMN.MCC mnc := n.IMSI.PLMN.MNC + if n.VisitedPlmn != nil { + mcc = n.VisitedPlmn.MCC + mnc = n.VisitedPlmn.MNC + } if len(n.IMSI.PLMN.MNC) == 2 { mnc = "0" + mnc }