Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TNGF #121

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion internal/context/amf_ran.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions internal/context/amf_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand All @@ -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
}
Expand Down
26 changes: 26 additions & 0 deletions internal/context/ran_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,32 @@
}
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

Check failure on line 258 in internal/context/ran_ue.go

View workflow job for this annotation

GitHub Actions / lint (1.18)

userLocationInformation.ChoiceExtensions.UserLocationInformationExtIEs undefined (type *ngapType.ProtocolIESingleContainerUserLocationInformationExtIEs has no field or method UserLocationInformationExtIEs) (typecheck)

Check failure on line 258 in internal/context/ran_ue.go

View workflow job for this annotation

GitHub Actions / Go 1.18 sample

userLocationInformation.ChoiceExtensions.UserLocationInformationExtIEs undefined (type *ngapType.ProtocolIESingleContainerUserLocationInformationExtIEs has no field or method UserLocationInformationExtIEs)
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
Expand Down
2 changes: 1 addition & 1 deletion internal/ngap/message/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading