From ac2c773b90bbb3652b19cd51476d37304672498d Mon Sep 17 00:00:00 2001 From: ianchen0119 Date: Wed, 25 Sep 2024 08:45:14 +0000 Subject: [PATCH 1/3] chore: update GetSNN() --- pkg/factory/config.go | 5 +++++ 1 file changed, 5 insertions(+) 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 } From ea0ec7f31d0d5b38ea4cfbe7f85e631730d95a2b Mon Sep 17 00:00:00 2001 From: ianchen0119 Date: Wed, 25 Sep 2024 08:46:14 +0000 Subject: [PATCH 2/3] chore: update config example --- config/n3ue.yaml | 3 +++ 1 file changed, 3 insertions(+) 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) From e9aa98c9ac53f1d675802b7cb1c987d679f2e966 Mon Sep 17 00:00:00 2001 From: ianchen0119 Date: Wed, 25 Sep 2024 08:59:03 +0000 Subject: [PATCH 3/3] fix: guti check in SendDeregistration --- internal/nwucp/handler/send.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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) + } }