diff --git a/go.sum b/go.sum index 0bf08c0a..c876410a 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,6 @@ github.com/free5gc/nas v1.1.2-0.20230828074825-175b09665828/go.mod h1:fjWwpyp7/w github.com/free5gc/ngap v1.0.7-0.20230614061954-9c128114ab1f h1:wgXjoknZ7JJoZ72J15g/f2/0DgdCpfcTg189lnhUPuY= github.com/free5gc/ngap v1.0.7-0.20230614061954-9c128114ab1f/go.mod h1:lKA1sLTYM3CGEBhZVxkGGJIkai5+Bvy2yHIMhb7Vx/k= github.com/free5gc/openapi v1.0.6/go.mod h1:iw/N0E+FlX44EEx24IBi2EdZW8v+bkj3ETWPGnlK9DI= -github.com/free5gc/openapi v1.0.7-0.20240117084712-52ad99299693 h1:gFyYBsErQAkx4OVHXYqjO0efO9gPWydQavQcjU0CkHY= -github.com/free5gc/openapi v1.0.7-0.20240117084712-52ad99299693/go.mod h1:qv9KqEucoZSeENPRFGxfTe+33ZWYyiYFx1Rj+H0DoWA= github.com/free5gc/openapi v1.0.7-0.20240206085156-20cdf964e9da h1:vr8v4Fere76nfj0SWpkUeIuUbS4bLPjRQsf3ly1K3fY= github.com/free5gc/openapi v1.0.7-0.20240206085156-20cdf964e9da/go.mod h1:qv9KqEucoZSeENPRFGxfTe+33ZWYyiYFx1Rj+H0DoWA= github.com/free5gc/sctp v0.0.0-20231121085449-400a702ea7f9 h1:L02UI8oODfXgH1fGzWWuWF4zyze4IScEFm20q3PKZdE= diff --git a/internal/context/amf_ran.go b/internal/context/amf_ran.go index 49ee47a5..89903b55 100644 --- a/internal/context/amf_ran.go +++ b/internal/context/amf_ran.go @@ -110,7 +110,7 @@ func (ran *AmfRan) SetRanId(ranNodeId *ngapType.GlobalRANNodeID) { ranId := ngapConvert.RanIdToModels(*ranNodeId) ran.RanPresent = ranNodeId.Present ran.RanId = &ranId - if ranNodeId.Present == ngapType.GlobalRANNodeIDPresentGlobalN3IWFID { + if ranNodeId.Present == ngapType.GlobalRANNodeIDPresentGlobalN3IWFID || ranNodeId.Present == ngapType.GlobalRANNodeIDPresentChoiceExtensions { ran.AnType = models.AccessType_NON_3_GPP_ACCESS } else { ran.AnType = models.AccessType__3_GPP_ACCESS diff --git a/internal/context/amf_ue.go b/internal/context/amf_ue.go index 52615fd5..7d30eb0d 100644 --- a/internal/context/amf_ue.go +++ b/internal/context/amf_ue.go @@ -153,7 +153,7 @@ type AmfUe struct { KnasInt [16]uint8 // 16 byte KnasEnc [16]uint8 // 16 byte Kgnb []uint8 // 32 byte - Kn3iwf []uint8 // 32 byte + Knon3gpp []uint8 // 32 byte NH []uint8 // 32 byte NCC uint8 // 0..7 ULCount security.Count @@ -535,7 +535,7 @@ func (ue *AmfUe) DerivateAnKey(anType models.AccessType) { case security.AccessType3GPP: ue.Kgnb = key case security.AccessTypeNon3GPP: - ue.Kn3iwf = key + ue.Knon3gpp = key } } @@ -562,7 +562,7 @@ func (ue *AmfUe) UpdateSecurityContext(anType models.AccessType) { case models.AccessType__3_GPP_ACCESS: ue.DerivateNH(ue.Kgnb) case models.AccessType_NON_3_GPP_ACCESS: - ue.DerivateNH(ue.Kn3iwf) + ue.DerivateNH(ue.Knon3gpp) } ue.NCC = 1 } diff --git a/internal/context/ran_ue.go b/internal/context/ran_ue.go index 437c3190..ac0ae155 100644 --- a/internal/context/ran_ue.go +++ b/internal/context/ran_ue.go @@ -250,6 +250,32 @@ func (ranUe *RanUe) UpdateLocation(userLocationInformation *ngapType.UserLocatio } ranUe.Tai = deepcopy.Copy(*ranUe.Location.N3gaLocation.N3gppTai).(models.Tai) + if ranUe.AmfUe != nil { + ranUe.AmfUe.Location = deepcopy.Copy(ranUe.Location).(models.UserLocation) + ranUe.AmfUe.Tai = *ranUe.Location.N3gaLocation.N3gppTai + } + case ngapType.UserLocationInformationPresentChoiceExtensions: + userLocationInformationExtIEsValue := userLocationInformation.ChoiceExtensions.UserLocationInformationExtIEs.Value.UserLocationInformationTNGF + if ranUe.Location.N3gaLocation == nil { + ranUe.Location.N3gaLocation = new(models.N3gaLocation) + } + + ip := userLocationInformationExtIEsValue.IPAddress + // port := userLocationInformationExtIEsValue.PortNumber + + ipv4Addr, ipv6Addr := ngapConvert.IPAddressToString(ip) + + ranUe.Location.N3gaLocation.UeIpv4Addr = ipv4Addr + ranUe.Location.N3gaLocation.UeIpv6Addr = ipv6Addr + // ranUe.Location.N3gaLocation.PortNumber = ngapConvert.PortNumberToInt(port) + // N3GPP TAI is operator-specific + // TODO: define N3GPP TAI + ranUe.Location.N3gaLocation.N3gppTai = &models.Tai{ + PlmnId: amfSelf.SupportTaiLists[0].PlmnId, + Tac: amfSelf.SupportTaiLists[0].Tac, + } + ranUe.Tai = deepcopy.Copy(*ranUe.Location.N3gaLocation.N3gppTai).(models.Tai) + if ranUe.AmfUe != nil { ranUe.AmfUe.Location = deepcopy.Copy(ranUe.Location).(models.UserLocation) ranUe.AmfUe.Tai = *ranUe.Location.N3gaLocation.N3gppTai diff --git a/internal/ngap/message/build.go b/internal/ngap/message/build.go index 3770497e..b546df92 100644 --- a/internal/ngap/message/build.go +++ b/internal/ngap/message/build.go @@ -1082,7 +1082,7 @@ func BuildInitialContextSetupRequest( case models.AccessType__3_GPP_ACCESS: securityKey.Value = ngapConvert.ByteToBitString(amfUe.Kgnb, 256) case models.AccessType_NON_3_GPP_ACCESS: - securityKey.Value = ngapConvert.ByteToBitString(amfUe.Kn3iwf, 256) + securityKey.Value = ngapConvert.ByteToBitString(amfUe.Knon3gpp, 256) } initialContextSetupRequestIEs.List = append(initialContextSetupRequestIEs.List, ie)