Git Product home page Git Product logo

packetrusher's Introduction

PacketRusher

PacketRusher Logo


Description

PacketRusher is a tool, based upon my5G-RANTester, dedicated to the performance testing and automatic validation of 5G Core Networks using simulated UE (user equipment) and gNodeB (5G base station).

If you have questions or comments, feel free to open an issue.

PacketRusher borrows libraries and data structures from the free5gc project.

Features

  • Simulate multiple UEs and gNodeB from a single tool
    • We tested up to 10k UEs!
  • Supports both N2 (NGAP) and N1 (NAS) interfaces for stress testing
  • --pcap parameter to capture pcap of N1/N2 traffic
  • Implements main control plane procedures:
    • UE attach/detach (registration/identity request/authentification/security mode) procedures
    • Create/Delete PDU Sessions, up to 15 PDU Sessions per UE
    • Xn handover: UE handover between simulated gNodeB (PathSwitchRequest)
    • N2 handover: UE handover between simulated gNodeB (HandoverRequired)
    • UE Enter/Exit CM-IDLE procedures (Service Request)
    • GUTI Re-registration
    • Supports 5G roaming: Tested with new open5gs/open5gs#2194 Roaming feature
  • Implements high-performant N3 (GTP-U) interface
    • Generic tunnel supporting all kind of traffic (TCP, UDP, Video…)
      • We tested iperf3 traffic, and Youtube traffic through PacketRusher
      • We roughly reach 5 GB/s per UE, which is more than what a real UE can achieve.
  • Integrated all-in-one mocked 5GC/AMF for PacketRusher's integration testing

Installation

Quick start guide

The following is a quick start guide, for more details on the installation, configuration or usage, you may refer to the wiki.

Requirements

  • Ubuntu 20.04-23.04, Debian 12 Bookworm
    • All Linux distibutions with kernel >= 5.4 should work, but untested.
    • There might be issues with frankenstein kernel from RHEL/CentOS/Rocky, feel free to open a bug if you encounter one!
  • Windows is not supported (Windows does not support SCTP)
  • Go 1.21.0 or more recent
  • Root privilege
  • Secure boot disabled (for custom kernel module)

PacketRusher is not yet supported on Docker.

Dependencies

$ sudo apt install build-essential linux-headers-generic make git wget tar linux-modules-extra-$(uname -r)
# Warning this command will remove your existing local Go installation if you have one:
$ wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz && sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
# Add go binary to the executable PATH variable:
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> $HOME/.profile

Download PacketRusher source code

$ git clone https://github.com/HewlettPackard/PacketRusher # or download the ZIP from https://github.com/HewlettPackard/PacketRusher/archive/refs/heads/master.zip and upload it to your Linux server
$ cd PacketRusher && echo "export PACKETRUSHER=$PWD" >> $HOME/.profile
$ source $HOME/.profile

Build free5gc's gtp5g kernel module

$ cd $PACKETRUSHER/lib/gtp5g
$ make clean && make && sudo make install
# Make sure you have Secure boot disabled if you are unable to install the custom Kernel module

Build PacketRusher CLI

$ cd $PACKETRUSHER
$ go mod download
$ go build cmd/packetrusher.go
$ ./packetrusher --help

You can edit the configuration in $PACKETRUSHER/config/config.yml as specified here, and then run a basic scenario using sudo ./packetrusher ue while in the $PACKETRUSHER folder.
More complex scenarios are possible using sudo ./packetrusher multi-ue, see ./packetrusher multi-ue --help for more details.
For more details on the installation, configuration or usage, you may refer to the wiki.

Contributing

We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great!
You can review our contributing guide.

Developer's Certificate of Origin

All contributions must include acceptance of the DCO.

Sign your work

To accept the DCO, simply add this line to each commit message with your name and email address (git commit -s will do this for you):

Signed-off-by: Jane Example <[email protected]>

For legal reasons, no anonymous or pseudonymous contributions are accepted.

Citation

If you use this software, you may cite it as below:

@software{PacketRusher,
  author = {D'Emmanuele, Valentin and Raguideau, Akiya},
  doi = {10.5281/zenodo.10446651},
  month = nov,
  title = {{PacketRusher: High performance 5G UE/gNB Simulator and CP/UP load tester}},
  url = {https://github.com/HewlettPackard/PacketRusher},
  version = {1.0.0},
  year = {2023}
}

License

© Copyright 2023 Hewlett Packard Enterprise Development LP

© Copyright 2024 Valentin D'Emmanuele

This project is under the Apache 2.0 License license.

By contributing here, you agree to license your contribution under the terms of the Apache 2.0 License. All files are released with the Apache License 2.0.

PacketRusher borrows libraries and data structures from the free5gc project, and is originally based upon my5G-RANTester.

packetrusher's People

Contributors

abousselmi avatar baleeiro17 avatar brianchennn avatar cbboth avatar hccresende avatar klebercardoso avatar linouxis9 avatar orion-belt avatar raguideau avatar yoursunny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packetrusher's Issues

[BUG] Authentication failure with MAC failure

Describe the bug
MAC verification failure using Free5GC and packetrusher.

I've tried to comment out the MAC verification step here

if !reflect.DeepEqual(mac_a, mac_aHn) {

to find out that RES in UE's Authentication response is different from the AV's RES*

Also, do you know why the UE is sending a key set id = 1 in the initial registration message ? shouldn't it be 7 ?

Thanks !

To Reproduce
Steps to reproduce the behavior:

  1. Run free5gc using free5gc-compose
  2. Execute packetrusher using the provided config file

Expected behavior
UE registration OK

Architecture (please complete the following information):

  • OS: Debian
  • Platform x86_64
  • Version 11
  • Kernel 5.10.0-16-amd64

Log:

./packetrusher --config /config/config.yml ue
INFO[0000] Loaded config at: /config/config.yml
INFO[0000] PacketRusher version 1.0.1
INFO[0000] ---------------------------------------
INFO[0000] [TESTER] Starting test function: Testing an ue attached with configuration
INFO[0000] [TESTER][UE] Number of UEs: 1
INFO[0000] [TESTER][UE] disableTunnel is false
INFO[0000] [TESTER][GNB] Control interface IP/Port: 10.100.200.200/9487
INFO[0000] [TESTER][GNB] Data interface IP/Port: 10.100.200.200/2152
INFO[0000] [TESTER][AMF] AMF IP/Port: amf.free5gc.org/38412
INFO[0000] ---------------------------------------
INFO[0000] [GNB] SCTP/NGAP service is running
INFO[0000] [GNB] Initiating NG Setup Request
INFO[0000] [GNB][SCTP] Receive message in 0 stream
INFO[0000] [GNB][NGAP] Receive NG Setup Response
INFO[0000] [GNB][AMF] AMF Name: AMF
INFO[0000] [GNB][AMF] State of AMF: Active
INFO[0000] [GNB][AMF] Capacity of AMF: 255
INFO[0000] [GNB][AMF] PLMNs Identities Supported by AMF -- mcc: 208 mnc:93
INFO[0000] [GNB][AMF] List of AMF slices Supported by AMF -- sst:01 sd:010203
INFO[0000] [GNB][AMF] List of AMF slices Supported by AMF -- sst:01 sd:112233
INFO[0001] [TESTER] TESTING REGISTRATION USING IMSI 0000000003 UE
INFO[0001] [GNB] Received incoming connection from new UE
INFO[0001] [UE] Initiating Registration
INFO[0001] [UE] Switched from state 0 to state 1
INFO[0001] [GNB][SCTP] Receive message in 0 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message without security header
INFO[0001] [UE][NAS] Receive Authentication Request
INFO[0001] [UE][NAS][MAC] Authenticity of the authentication request message: FAILED
INFO[0001] [UE][NAS] Send authentication failure with MAC failure
INFO[0001] [GNB][SCTP] Receive message in 0 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message without security header
INFO[0001] [UE][NAS] Receive Authentication Reject
INFO[0001] [UE][NAS] Authentication of UE 1 failed
INFO[0001] [UE] Switched from state 1 to state 1
INFO[0001] [GNB][SCTP] Receive message in 0 stream
INFO[0001] [GNB][NGAP] Receive UE Context Release Command
INFO[0001] [GNB] Initiating UE Context Complete
WARN[0001] [UE][0000000003] Stopping UE as communication with gNB was closed
INFO[0001] [GNB][NGAP] Releasing UE Context, cause: nas: Authentication failure
^CINFO[0006] [UE] Terminating UE as requested
INFO[0006] [UE] UE Terminated
INFO[0006] [UE] Switched from state 1 to state 0

PR config:

gnodeb:
  controlif:
    ip: "10.100.200.200"
    port: 9487
  dataif:
    ip: "10.100.200.200"
    port: 2152
  plmnlist:
    mcc: "208"
    mnc: "93"
    tac: "000001"
    gnbid: "000001"
  slicesupportlist:
    sst: "01"
    sd: "010203"

ue:
  msin: "0000000003"
  key: "8e27b6af0e692e750f32667a3b14605d"
  opc: "8baf473f2f8fd09487cccbd7097c6862"
  amf: "8000"
  sqn: "000000000000"
  dnn: "internet"
  #routingindicator: "1"
  hplmn:
    mcc: "208"
    mnc: "93"
  snssai:
    sst: 01
    sd: "010203"
  integrity:
    nia0: true
    nia1: true
    nia2: true
    nia3: true
  ciphering:
    nea0: true
    nea1: true
    nea2: true
    nea3: true

amfif:
  ip: "amf.free5gc.org"
  port: 38412

logs:
  level: 4

Pcap:
mac-failure.zip

Additional context
Add any other context about the problem here.

How to trigger XN handover

I want to know how to create two gnb

corenet@corenet-virtual-machine:~/PacketRusher$ sudo ./packetrusher multi-ue -n 1 --xnh 1000
INFO[0000] Loaded config at: /home/corenet/PacketRusher/config/config.yml
INFO[0000] PacketRusher version 1.0.1
INFO[0000] ---------------------------------------
INFO[0000] [TESTER] Starting test function: Testing registration of multiple UEs
INFO[0000] [TESTER][UE] Number of UEs: 1
INFO[0000] [TESTER][GNB] gNodeB control interface IP/Port: 10.103.238.161/38412
INFO[0000] [TESTER][GNB] gNodeB data interface IP/Port: 10.103.238.161/2152
INFO[0000] [TESTER][AMF] AMF IP/Port: 10.103.239.31/38412
INFO[0000] ---------------------------------------
WARN[0000] [TESTER] We are increasing the number of gNodeB to two for handover test cases. Make you sure you fill the requirements for having two gNodeBs.
INFO[0000] [GNB] SCTP/NGAP service is running
INFO[0000] [GNB] Initiating NG Setup Request
FATA[0000] Error incannot assign requested address
image

[BUG] Three-digit MNCs are encoded incorrectly

When configuring a 3-digit MNC in the config.yml, PacketRusher does not encode it correctly.

configuration in config.yml

gnodeb:
controlif:
ip: "xx.yy.zz.ww"
port: 9487
dataif:
ip: "xx.yy.zz.uu"
port: 2152
plmnlist:
mcc: "789"
mnc: "123"
...

encoding in the NGSetupRequest message

> NG Application Protocol (NGSetupRequest)
>     NGAP-PDU: initiatingMessage (0)
>         initiatingMessage
>             procedureCode: id-NGSetup (21)
>             criticality: reject (0)
>             value
>                 NGSetupRequest
>                     protocolIEs: 4 items
>                         Item 0: id-GlobalRANNodeID
>                             ProtocolIE-Field
>                                 id: id-GlobalRANNodeID (27)
>                                 criticality: reject (0)
>                                 value
>                                     GlobalRANNodeID: globalGNB-ID (0)
>                                         globalGNB-ID
>                                             pLMNIdentity: 873921
>                                                 Mobile Country Code (MCC): Unassigned (789)
>                                                 Mobile Network Code (MNC): Unknown (312)
>                                             gNB-ID: gNB-ID (0)
>                                                 gNB-ID: 0f423d [bit length 24, 0000 1111  0100 0010  0011 1101 decimal value 999997]
>                         Item 1: id-RANNodeName
>                             ProtocolIE-Field
>                                 id: id-RANNodeName (82)
>                                 criticality: ignore (1)
>                                 value
>                                     RANNodeName: PacketRusher

You can see in the NGSetupRequest message that the MNC incorrectly becomes "312" instead of "123".

[FEATURE] UEs and gNB attached & Xnh targeting a gNB

Hi, here I list some features that could be interesting to have:

  • Have a way to check which users are attached to a certain gNB and vice versa.
  • The possibility of targeting a specific gNB while performing a Xn or NG handover.
  • The possibility of running an UE and a gNB in different VMs

Thank you for your work,

Ignacio

[FEATURE] Access to gNB and UE (like in UERANSIM repo)

Hello everyone!

I think that it could be interesting to have a way to connect to the users and gNBs deployed, where you could access their information and trigger some other useful commands like handovers.

I know about a repository called UERANSIM which also implements a RAN access for 5G and it offers this type of command interface with their nodes. They haven't implemented all the same 5G features as you tho.

Thank you for sharing your work,

Ignacio

[BUG] Unable to create tunnel for UE with multi-ue option

Describe the bug
I'm trying to use the multi-ue option with only 2 UEs for testing. Only with multi-ue -n 2, I have the log message telling "Interface for UE X has not been created. Tunnel has been disabled" but, if I exec multi-ue -n 2 --tunnel-vrf, I have exactly the same message, like if it's ignoring the vrf option.

I don't know if I'm missing something in terms of configuration.

To Reproduce
Steps to reproduce the behavior:
Deploy PacketRusher with ./packetrusher --config config.yml multi-ue -n 1 --tunnel-vrf true

Expected behavior
VRF tunnel interfaces have to be created.

Screenshots
If applicable, add screenshots to help explain your problem.

Architecture (please complete the following information):

  • OS: Ubuntu 20.04
  • Platform: x86_64
  • Kernel: 5.4.0-100-lowlatency

Log:

Pcap:

Additional context

[FEATURE] 5G Roaming Support

Is your feature request related to a problem? Please describe.
Currently Open5gs supports 5G roaming, it will great if this can be supported in PacketRusher

Describe the solution you'd like
Support roaming scenario whereby the UE PLMN is different from the gNB

Describe alternatives you've considered
None, I don't think this is supported by any opensource 5G RAN simulator

Additional context
Reference to the Open5gs roaming feature: https://open5gs.org/open5gs/docs/tutorial/05-roaming/

[FEATURE] Add mocked UPF to aio5gc to test PacketRusher's GTP-U stack

Is your feature request related to a problem? Please describe.
Our All-in-One 5G Core that is used for integration testing of PacketRusher in the CI already supports the creation and establishment of PDU Sessions.
The next step is to be able to also use this PDU Session with data traffic in integration tests, by adding a GTP-U stack inside aio5gc.

  • Goal: Validate that user traffic can flow between the UE and Data Network in CI.
  • Non-goal: The goal is not to do performance regression testing for now.
    • We might add an high performance open source UPF in CI for that

Describe the solution you'd like
Use https://github.com/wmnsk/go-gtp

Describe alternatives you've considered
Use the eBPF stack used by PacketRusher. I would advise against it as we may have conflicts between the PacketRusher's eBPF and aio5gc's eBPF.

Additional context
N/A

Issue setting up multi-ue

Hello, I have tested the multi-ue feature for setting 2 different UEs with packetRusher and Open5gs core. When setting up the./packetrusher ue, there is no any issue, the attach is performed succesfully, but when setting up the multi-UE for either 1 or 2 UEs the last step of binding the valxxx interface to the assigned IP is not properly being generated for any UE. Both UEs has been configured on the open5gs database.

The configuraration config/config.yml

gnodeb:
  controlif:
    ip: "192.168.100.50"
    port: 9487
  dataif:
    ip: "192.168.100.50"
    port: 2152
  plmnlist:
    mcc: "208"
    mnc: "93"
    tac: "000001"
    gnbid: "000008"
  slicesupportlist:
    sst: "01"
    #sd: "000001" # optional, can be removed if not used

ue:
  msin: "0000000002"
  key: "8baf473f2f8fd09487cccbd7097c6862"
  opc: "8e27b6af0e692e750f32667a3b14605d"
  amf: "8000"
  sqn: "00000000"
  dnn: "internet"
  routingindicator: "0000"
  hplmn:
    mcc: "208"
    mnc: "93"
  snssai:
    sst: 01
    #sd: "000001" # optional, can be removed if not used
  integrity:
    nia0: false
    nia1: false
    nia2: true
    nia3: false
  ciphering:
    nea0: true
    nea1: false
    nea2: true
    nea3: false
amfif:
  ip: "192.168.100.109"
  port: 38412
logs:
    level: 4

~
/

I attach the logs

ubuntu@ubuntu-desktop:~/PacketRusher$ sudo ./packetrusher multi-ue -n 2
[sudo] password for ubuntu: 
INFO[0000] Loaded config at: /home/ubuntu/PacketRusher/config/config.yml 
INFO[0000] PacketRusher version 1.0.1                   
INFO[0000] ---------------------------------------      
INFO[0000] [TESTER] Starting test function: Testing registration of multiple UEs 
INFO[0000] [TESTER][UE] Number of UEs: 2                
INFO[0000] [TESTER][GNB] gNodeB control interface IP/Port: 192.168.100.50/9487 
INFO[0000] [TESTER][GNB] gNodeB data interface IP/Port: 192.168.100.50/2152 
INFO[0000] [TESTER][AMF] AMF IP/Port: 192.168.100.109/38412 
INFO[0000] ---------------------------------------      
INFO[0000] [GNB] SCTP/NGAP service is running           
INFO[0000] [GNB] Initiating NG Setup Request            
INFO[0000] [GNB][SCTP] Receive message in 0 stream      
INFO[0000] [GNB][NGAP] Receive NG Setup Response        
INFO[0000] [GNB][AMF] AMF Name: open5gs-amf0            
INFO[0000] [GNB][AMF] State of AMF: Active              
INFO[0000] [GNB][AMF] Capacity of AMF: 255              
INFO[0000] [GNB][AMF] PLMNs Identities Supported by AMF -- mcc: 208 mnc:93 
INFO[0000] [GNB][AMF] List of AMF slices Supported by AMF -- sst:01 sd:was not informed 
INFO[0001] [TESTER] TESTING REGISTRATION USING IMSI 0000000002 UE 
INFO[0001] [GNB] Received incoming connection from new UE 
INFO[0001] [UE] Initiating Registration                 
INFO[0001] [UE] Switched from state 0 to state 1        
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport   
INFO[0001] [UE][NAS] Message without security header    
INFO[0001] [UE][NAS] Receive Authentication Request     
INFO[0001] [UE][NAS][MAC] Authenticity of the authentication request message: OK 
INFO[0001] [UE][NAS][SQN] SQN of the authentication request message: VALID 
INFO[0001] [UE][NAS] Send authentication response       
INFO[0001] [UE] Switched from state 1 to state 2        
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport   
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and with NEW 5G NAS SECURITY CONTEXT 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] Receive Security Mode Command      
INFO[0001] [UE][NAS] Type of ciphering algorithm is 5G-EA0 
INFO[0001] [UE][NAS] Type of integrity protection algorithm is 128-5G-IA2 
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Initial Context Setup Request 
INFO[0001] [GNB][UE] UE Context was created with successful 
INFO[0001] [GNB][UE] UE RAN ID 1                        
INFO[0001] [GNB][UE] UE AMF ID 81                       
INFO[0001] [GNB][UE] UE Mobility Restrict --Plmn-- Mcc: not informed Mnc: not informed 
INFO[0001] [GNB][UE] UE Masked Imeisv: 1110000000ffff00 
INFO[0001] [GNB][UE] Allowed Nssai-- Sst: [01 01] Sd: [not informed not informed] 
INFO[0001] [GNB][NGAP][AMF] Send Initial Context Setup Response. 
INFO[0001] [GNB] Initiating Initial Context Setup Response 
INFO[0001] [GNB][NGAP] No PDU Session to set up in InitialContextSetupResponse. 
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and ciphered 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] successful NAS CIPHERING           
INFO[0001] [UE][NAS] Receive Registration Accept        
INFO[0001] [UE][NAS] UE 5G GUTI: &{119 11 [242 2 248 57 2 0 64 192 0 6 82]} 
INFO[0001] [UE] Switched from state 2 to state 3        
INFO[0001] [UE] Initiating New PDU Session              
INFO[0001] [UE] Initiating New PDU Session              
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport   
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and ciphered 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] successful NAS CIPHERING           
INFO[0001] [UE][NAS] Receive Configuration Update Command 
INFO[0001] [UE] Initiating Configuration Update Complete 
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive PDU Session Resource Setup Request 
INFO[0001] [GNB][NGAP][UE] PDU Session was created with successful. 
INFO[0001] [GNB][NGAP][UE] PDU Session Id: 1            
INFO[0001] [GNB][NGAP][UE] NSSAI Selected --- sst: NSSAI was not selected sd: NSSAI was not selected 
INFO[0001] [GNB][NGAP][UE] PDU Session Type: ipv4       
INFO[0001] [GNB][NGAP][UE] QOS Flow Identifier: 1       
INFO[0001] [GNB][NGAP][UE] Uplink Teid: 27768           
INFO[0001] [GNB][NGAP][UE] Downlink Teid: 1             
INFO[0001] [GNB][NGAP][UE] Non-Dynamic-5QI: 9           
INFO[0001] [GNB][NGAP][UE] Priority Level ARP: 8        
INFO[0001] [GNB][NGAP][UE] UPF Address: 192.168.100.111 :2152 
INFO[0001] [GNB] Initiating PDU Session Resource Setup Response 
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and ciphered 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] successful NAS CIPHERING           
INFO[0001] [UE][NAS] Receive DL NAS Transport           
INFO[0001] [UE][NAS] Receiving PDU Session Establishment Accept 
INFO[0001] [UE][NAS] PDU session QoS RULES: [1 0 6 49 49 1 1 255 1] 
INFO[0001] [UE][NAS] PDU session DNN: internet          
INFO[0001] [UE][NAS] PDU session NSSAI -- sst: 1 sd: 000 
INFO[0001] [UE][NAS] PDU address received: 10.45.0.63   
INFO[0001] [UE][GTP] Interface for UE 0000000002 has not been created. Tunnel has been disabled. 
INFO[0001] [TESTER] TESTING REGISTRATION USING IMSI 0000000003 UE 
INFO[0001] [GNB] Received incoming connection from new UE 
INFO[0001] [UE] Initiating Registration                 
INFO[0001] [UE] Switched from state 0 to state 1        
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport   
INFO[0001] [UE][NAS] Message without security header    
INFO[0001] [UE][NAS] Receive Authentication Request     
INFO[0001] [UE][NAS][MAC] Authenticity of the authentication request message: OK 
INFO[0001] [UE][NAS][SQN] SQN of the authentication request message: VALID 
INFO[0001] [UE][NAS] Send authentication response       
INFO[0001] [UE] Switched from state 1 to state 2        
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport   
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and with NEW 5G NAS SECURITY CONTEXT 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] Receive Security Mode Command      
INFO[0001] [UE][NAS] Type of ciphering algorithm is 5G-EA0 
INFO[0001] [UE][NAS] Type of integrity protection algorithm is 128-5G-IA2 
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Initial Context Setup Request 
INFO[0001] [GNB][UE] UE Context was created with successful 
INFO[0001] [GNB][UE] UE RAN ID 2                        
INFO[0001] [GNB][UE] UE AMF ID 82                       
INFO[0001] [GNB][UE] UE Mobility Restrict --Plmn-- Mcc: not informed Mnc: not informed 
INFO[0001] [GNB][UE] UE Masked Imeisv: 1110000000ffff00 
INFO[0001] [GNB][UE] Allowed Nssai-- Sst: [01] Sd: [not informed] 
INFO[0001] [GNB][NGAP][AMF] Send Initial Context Setup Response. 
INFO[0001] [GNB] Initiating Initial Context Setup Response 
INFO[0001] [GNB][NGAP] No PDU Session to set up in InitialContextSetupResponse. 
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and ciphered 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] successful NAS CIPHERING           
INFO[0001] [UE][NAS] Receive Registration Accept        
INFO[0001] [UE][NAS] UE 5G GUTI: &{119 11 [242 2 248 57 2 0 64 192 0 7 93]} 
INFO[0001] [UE] Switched from state 2 to state 3        
INFO[0001] [UE] Initiating New PDU Session              
INFO[0001] [UE] Initiating New PDU Session              
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport   
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and ciphered 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] successful NAS CIPHERING           
INFO[0001] [UE][NAS] Receive Configuration Update Command 
INFO[0001] [UE] Initiating Configuration Update Complete 
INFO[0001] [GNB][SCTP] Receive message in 1 stream      
INFO[0001] [GNB][NGAP] Receive PDU Session Resource Setup Request 
INFO[0001] [GNB][NGAP][UE] PDU Session was created with successful. 
INFO[0001] [GNB][NGAP][UE] PDU Session Id: 1            
INFO[0001] [GNB][NGAP][UE] NSSAI Selected --- sst: NSSAI was not selected sd: NSSAI was not selected 
INFO[0001] [GNB][NGAP][UE] PDU Session Type: ipv4       
INFO[0001] [GNB][NGAP][UE] QOS Flow Identifier: 1       
INFO[0001] [GNB][NGAP][UE] Uplink Teid: 289             
INFO[0001] [GNB][NGAP][UE] Downlink Teid: 2             
INFO[0001] [GNB][NGAP][UE] Non-Dynamic-5QI: 9           
INFO[0001] [GNB][NGAP][UE] Priority Level ARP: 8        
INFO[0001] [GNB][NGAP][UE] UPF Address: 192.168.100.111 :2152 
INFO[0001] [GNB] Initiating PDU Session Resource Setup Response 
INFO[0001] [UE][NAS] Message with security header       
INFO[0001] [UE][NAS] Message with integrity and ciphered 
INFO[0001] [UE][NAS] successful NAS MAC verification    
INFO[0001] [UE][NAS] successful NAS CIPHERING           
INFO[0001] [UE][NAS] Receive DL NAS Transport           
INFO[0001] [UE][NAS] Receiving PDU Session Establishment Accept 
INFO[0001] [UE][NAS] PDU session QoS RULES: [1 0 6 49 49 1 1 255 1] 
INFO[0001] [UE][NAS] PDU session DNN: internet          
INFO[0001] [UE][NAS] PDU session NSSAI -- sst: 1 sd: 000 
INFO[0001] [UE][NAS] PDU address received: 10.45.0.64   
INFO[0001] [UE][GTP] Interface for UE 0000000003 has not been created. Tunnel has been disabled. 

The missing step compared from a sucessful attach when launching /packetrusher ue:


INFO[0002] [UE][GTP] Interface val0000000002 has successfully been configured for UE 10.45.0.65 
INFO[0002] [UE][GTP] You can do traffic for this UE using VRF vrf0000000002, eg: 
INFO[0002] [UE][GTP] sudo ip vrf exec vrf0000000002 iperf3 -c IPERF_SERVER -p PORT -t 9000 

[BUG] Xn and Ng Handover command

Hi,

I attach the bug I had while executing: sudo ./packetrusher multi-ue -n 1 -xnh 3000 -idl 13000 -ngh 23000 --tunnel --dedicatedGnb

In the following picture you can observe the free5gc on the left and, the output of the PacketRusher.

image

I attach the pcap file.

pcap.zip

Thank you for the support.

Ignacio

[FEATURE] Add PacketRusher version as tags

As the project continues to grow and more features are added, it would be useful to have the possibility to clone specific versions of this software. Adding tags to specific versions could facilitate users to clone this versions.

Also this tags can be setup along with the Releases.

DNS configuration

Hi @linouxis9

I am starting to use PacketRusher, and I believe it's incredible. Thank you for this tool!

I have a doubt regarding DNS configuration. Do you know if it's possible to config 5GC dns servers in VRF? I'm using Open5GS, and connectivity through IP works well, but when I try to ping a name (google.es e.g.), it is not working.

Thanks in advance,
Álvaro

[FEATURE] Using FQDN/device name for the interface configuration

I think it could be useful having the possibility to specify the gnodeb controlif (gNB N2), gnodeb dataif (gNB N3) and amfif ip (AMF N2) as FQDN/device name. Instead of using IP addresses, having a way to define a DNS name or a device name to automatically resolve the IP address.

This feature could be useful in a Docker Compose/kubernetes context where the IP addresses get automatically assigned.

# From IP address
gnodeb:
  controlif:
    ip: "192.168.11.13"

# To FQDN
gnodeb:
  controlif:
    ip: "gnb.controlif.internal"

# To device
gnodeb:
  controlif:
    ip: "eth0"

Open5GS implements this approach for their configuration files.

[BUG] Error sending NG Setup Request

Describe the bug
I trying to run some test using PR and Free5GC, but I encountered some errors.

To Reproduce
Steps to reproduce the behavior:

  1. Run free5gc using free5gc-compose
  2. Execute packetrusher using the provided config file

Expected behavior
Ngap assoc OK

Architecture (please complete the following information):

  • OS: Debian GNU/Linux
  • Platform x86_64
  • Version 11
  • Kernel 5.10.0-16-amd64

I'm using the following configuration:

gnodeb:
  controlif:
    ip: "10.100.200.2"
    port: 9487
  dataif:
    ip: "10.100.200.2"
    port: 2152
  plmnlist:
    mcc: "208"
    mnc: "93"
    tac: "1"
    gnbid: "000001"
  slicesupportlist:
    sst: "1"
    sd: "010203"

ue:
  msin: "0000000003"
  key: "8e27b6af0e692e750f32667a3b14605d"
  opc: "8baf473f2f8fd09487cccbd7097c6862"
  amf: "8000"
  sqn: "000000000023"
  dnn: "internet"
  routingindicator: "0000"
  hplmn:
    mcc: "208"
    mnc: "93"
  snssai:
    sst: 1
    sd: "010203"
  integrity:
    nia0: false
    nia1: false
    nia2: true
    nia3: false
  ciphering:
    nea0: false
    nea1: false
    nea2: true
    nea3: false

amfif:
  ip: "10.100.200.11"
  port: 38412

logs:
  level: 5

Log:

./app --config config/packetrusher/config.yml gnb
INFO[0000] Loaded config at: config/packetrusher/config.yml
INFO[0000] PacketRusher version 1.0.1
INFO[0000] ---------------------------------------
INFO[0000] [TESTER] Starting test function: Testing an gnb attached with configuration
INFO[0000] [TESTER][GNB] Number of GNBs: 1
INFO[0000] [TESTER][GNB] Control interface IP/Port: 10.192.122.15/9487
INFO[0000] [TESTER][GNB] Data interface IP/Port: 10.192.122.15/2152
INFO[0000] [TESTER][AMF] AMF IP/Port: 10.100.200.11/38412
INFO[0000] ---------------------------------------
INFO[0000] [GNB] SCTP/NGAP service is running
INFO[0000] [GNB] Initiating NG Setup Request
encoding/hex: odd length hex string
encoding/hex: odd length hex string
INFO[0000] [GNB][NGAP] Error sending NG Setup Request: OctetString Length(0) is not match fix-sized : 3

On the AMF side, I can see the following:

2024-02-07T13:38:41.428766817Z [INFO][AMF][Ngap] [AMF] SCTP Accept from: 10.100.200.2:9487
2024-02-07T13:38:41.429762874Z [INFO][AMF][Ngap] Create a new NG connection for: 10.100.200.2:9487
2024-02-07T13:38:41.429868081Z [ERRO][AMF][Ngap][ran_addr:10.100.200.2:9487] NGAP decode error : Get bits overflow, requireBits: 8, leftBits: 0
2024-02-07T13:38:44.639177704Z [INFO][AMF][Ngap] Handle SCTP Notification[addr: <nil>]
2024-02-07T13:38:44.639261521Z [INFO][AMF][Ngap][ran_addr:10.100.200.2:9487] SCTP_SHUTDOWN_EVENT notification, close the connection
2024-02-07T13:38:44.639284044Z [INFO][AMF][Ngap][ran_addr:10.100.200.2:9487] Remove RAN Context[ID: ]
2024-02-07T13:38:44.639560681Z [INFO][AMF][Ngap] Handle SCTP Notification[addr: <nil>]
2024-02-07T13:38:44.639588015Z [WARN][AMF][Ngap] RAN context has been removed[addr: <nil>]
2024-02-07T13:38:44.639839401Z [INFO][AMF][Ngap] Handle SCTP Connection Error[addr: <nil>] - remove RAN
2024-02-07T13:38:44.639862125Z [WARN][AMF][Ngap] RAN context has been removed[addr: <nil>]

Pcap:
malformed-packet.zip

[BUG] wrong gNB ID

Describe the bug
packetrusher ue command does not follow the .gnodeb.plmnlist.gnbid configuration option in its NGSetupRequest packet.
Instead, it always sends gNB ID starting with "000001".

To Reproduce

  1. Create config.yml as below.
  2. Capture traffic on N2 interface.
  3. Invoke sudo ./packetrusher ue command.
  4. Analyze traffic by Wireshark.
gnodeb:
  controlif:
    ip: 172.25.200.12
    port: 9487
  dataif:
    ip: 172.25.195.12
    port: 2152
  plmnlist:
    mcc: "001"
    mnc: "01"
    tac: "000005"
    gnbid: "000008"
  slicesupportlist:
    sst: "04"
    sd: "000000" # optional, can be removed if not used
ue:
  msin: "7005554000"
  key: ad5f6ba8aaafa72e9b7132dc0ef2819e
  opc: 17e524ea73ab1877b3af891c459cf58b
  amf: "8000"
  sqn: "00000000"
  dnn: vcam
  routingindicator: "0000"
  hplmn:
    mcc: "001"
    mnc: "01"
  snssai:
    sst: 4
    sd: "000000" # optional, can be removed if not used
  integrity:
    nia0: false
    nia1: false
    nia2: true
    nia3: false
  ciphering:
    nea0: true
    nea1: false
    nea2: true
    nea3: false
amfif:
  ip: 172.25.200.10
  port: 38412
logs:
  level: 4

Expected behavior
The traffic capture should have an NGSetupRequest message sent from PacketRusher gNB to the AMF.
In id-GlobalRANNodeID IE of this message, the gNB should indicate itself to have gNB ID 000008.

Screenshots
None.

Architecture (please complete the following information):

  • OS: Ubuntu 22.04 (despite the notice in README, latest version of gtp5g does work on Ubuntu 22.04)
  • Platform: amd64
  • Version: PacketRusher commit c105608
  • Kernel: 5.15.0-91

Log:

time="2023-12-21T16:59:06Z" level=info msg="Loaded config at: /config.yml"
time="2023-12-21T16:59:06Z" level=info msg="PacketRusher version 1.0.1"
time="2023-12-21T16:59:06Z" level=info msg=---------------------------------------
time="2023-12-21T16:59:06Z" level=info msg="[TESTER] Starting test function: Testing an ue attached with configuration"
time="2023-12-21T16:59:06Z" level=info msg="[TESTER][UE] Number of UEs: 1"
time="2023-12-21T16:59:06Z" level=info msg="[TESTER][UE] disableTunnel is false"
time="2023-12-21T16:59:06Z" level=info msg="[TESTER][GNB] Control interface IP/Port: 172.25.200.12/9487"
time="2023-12-21T16:59:06Z" level=info msg="[TESTER][GNB] Data interface IP/Port: 172.25.195.12/2152"
time="2023-12-21T16:59:06Z" level=info msg="[TESTER][AMF] AMF IP/Port: 172.25.200.10/38412"
time="2023-12-21T16:59:06Z" level=info msg=---------------------------------------
time="2023-12-21T16:59:06Z" level=info msg="[GNB] SCTP/NGAP service is running"
time="2023-12-21T16:59:06Z" level=info msg="[GNB] Initiating NG Setup Request"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][SCTP] Receive message in 0 stream\n"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][NGAP] Receive NG Setup Response"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][AMF] AMF Name: amf.amf.5gc.mnc001.mcc001.3gppnetwork.org"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][AMF] State of AMF: Active"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][AMF] Capacity of AMF: 5"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][AMF] PLMNs Identities Supported by AMF -- mcc: 001 mnc:01"
time="2023-12-21T16:59:06Z" level=info msg="[GNB][AMF] List of AMF slices Supported by AMF -- sst:04 sd:000000"
time="2023-12-21T16:59:07Z" level=info msg="[TESTER] TESTING REGISTRATION USING IMSI 7005554000 UE"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Initiating Registration"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Switched from state 0 to state 1"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][SCTP] Receive message in 1 stream\n"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP] Receive Downlink NAS Transport"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message without security header"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Receive Authentication Request"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS][MAC] Authenticity of the authentication request message: OK"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS][SQN] SQN of the authentication request message: VALID"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Send authentication response"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Switched from state 1 to state 2"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][SCTP] Receive message in 1 stream\n"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP] Receive Downlink NAS Transport"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with security header"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with integrity and with NEW 5G NAS SECURITY CONTEXT"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS MAC verification"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Receive Security Mode Command"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Type of ciphering algorithm is 5G-EA0"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Type of integrity protection algorithm is 128-5G-IA2"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][SCTP] Receive message in 1 stream\n"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP] Receive Initial Context Setup Request"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][UE] UE Context was created with successful"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][UE] UE RAN ID 1"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][UE] UE AMF ID 1"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][UE] UE Mobility Restrict --Plmn-- Mcc: not informed Mnc: not informed"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][UE] UE Masked Imeisv: "
time="2023-12-21T16:59:07Z" level=info msg="[GNB][UE] Allowed Nssai-- Sst: [04] Sd: [000000]"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NAS][UE] Send Registration Accept."
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][AMF] Send Initial Context Setup Response."
time="2023-12-21T16:59:07Z" level=info msg="[GNB] Initiating Initial Context Setup Response"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with security header"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with integrity and ciphered"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS MAC verification"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS CIPHERING"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Receive Registration Accept"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] UE 5G GUTI: [210 0 0 1]"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Switched from state 2 to state 3"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Initiating New PDU Session"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Initiating New PDU Session"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][SCTP] Receive message in 1 stream\n"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP] Receive Downlink NAS Transport"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with security header"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with integrity and ciphered"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS MAC verification"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS CIPHERING"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Receive Configuration Update Command"
time="2023-12-21T16:59:07Z" level=info msg="[UE] Initiating Configuration Update Complete"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][SCTP] Receive message in 1 stream\n"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP] Receive PDU Session Resource Setup Request"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] PDU Session was created with successful."
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] PDU Session Id: 1"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] NSSAI Selected --- sst: NSSAI was not selected sd: NSSAI was not selected"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] PDU Session Type: ipv4"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] QOS Flow Identifier: 1"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] Uplink Teid: 268435457"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] Downlink Teid: 1"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] Non-Dynamic-5QI: 9"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] Priority Level ARP: 2"
time="2023-12-21T16:59:07Z" level=info msg="[GNB][NGAP][UE] UPF Address: 172.25.195.5 :2152"
time="2023-12-21T16:59:07Z" level=info msg="[GNB] Initiating PDU Session Resource Setup Response"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with security header"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Message with integrity and ciphered"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS MAC verification"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] successful NAS CIPHERING"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Receive DL NAS Transport"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] Receiving PDU Session Establishment Accept"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] PDU session QoS RULES: [1 0 6 49 49 1 1 255 1]"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] PDU session DNN: vcam.mnc001.mcc001.gprs"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] PDU session NSSAI -- sst: 4 sd: 000"
time="2023-12-21T16:59:07Z" level=info msg="[UE][NAS] PDU address received: 10.140.0.1"
time="2023-12-21T16:59:08Z" level=info msg="[UE][GTP] Interface val7005554000 has successfully been configured for UE 10.140.0.1"
time="2023-12-21T16:59:08Z" level=info msg="[UE][GTP] You can do traffic for this UE using VRF vrf7005554000, eg:"
time="2023-12-21T16:59:08Z" level=info msg="[UE][GTP] sudo ip vrf exec vrf7005554000 iperf3 -c IPERF_SERVER -p PORT -t 9000"

Pcap:
1.pcapng.gz
The relevant packet is frame 16.
The relevant section is decoded as:

Item 0: id-GlobalRANNodeID
    ProtocolIE-Field
        id: id-GlobalRANNodeID (27)
        criticality: reject (0)
        value
            GlobalRANNodeID: globalGNB-ID (0)
                globalGNB-ID
                    pLMNIdentity: 00f110
                        Mobile Country Code (MCC): Unknown (001)
                        Mobile Network Code (MNC): Unknown (01)
                    gNB-ID: gNB-ID (0)
                        gNB-ID: 000001 [bit length 24, 0000 0000  0000 0000  0000 0001 decimal value 1]

Additional context
This bug is caused by this line:

cfg.GNodeB.PlmnList.GnbId = gnbIdGenerator(i)

It overwrites the configured gNB ID with numbers starting with 1.

To solve this issue, I'd recommend this logic:

  1. Use the configured gNB ID for the first gNB.
  2. Increment the gNB ID from there for subsequent gNBs.

[BUG] PDU Session Establishment Reject for PDU Session ID 1, 5GSM Cause: Service option temporarily out of order

Describe the bug
UE is not able to create successful PDU session

To Reproduce
Using Open5gs as the core, create a roaming scenario, configs can found in #32

Expected behavior
Successful PDU session creation

Screenshots
Packet Rusher logs:

ubuntu@packetRusher:~/rusher-raoming-1$ sudo ./packetrusher ue
INFO[0000] PacketRusher version 1.0.1
INFO[0000] ---------------------------------------
INFO[0000] [TESTER] Starting test function: Testing an ue attached with configuration
INFO[0000] [TESTER][UE] Number of UEs: 1
INFO[0000] [TESTER][UE] disableTunnel is false
INFO[0000] [TESTER][GNB] Control interface IP/Port: 192.168.200.2/9487
INFO[0000] [TESTER][GNB] Data interface IP/Port: 192.168.200.2/2152
INFO[0000] [TESTER][AMF] AMF IP/Port: 192.168.200.1/38412
INFO[0000] ---------------------------------------
INFO[0000] [GNB] SCTP/NGAP service is running
INFO[0000] [GNB] Initiating NG Setup Request
INFO[0000] [GNB][SCTP] Receive message in 0 stream
INFO[0000] [GNB][NGAP] Receive NG Setup Response
INFO[0000] [GNB][AMF] AMF Name: open5gs-amf0
INFO[0000] [GNB][AMF] State of AMF: Active
INFO[0000] [GNB][AMF] Capacity of AMF: 255
INFO[0000] [GNB][AMF] PLMNs Identities Supported by AMF -- mcc: 001 mnc:01
INFO[0000] [GNB][AMF] List of AMF slices Supported by AMF -- sst:01 sd:000001
INFO[0001] [TESTER] TESTING REGISTRATION USING IMSI 0000000001 UE
INFO[0001] [UE] Initiating Registration
INFO[0001] [UE] Switched from state 0 to state 1
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message without security header
INFO[0001] [UE][NAS] Receive Authentication Request
INFO[0001] [UE][NAS][MAC] Authenticity of the authentication request message: OK
INFO[0001] [UE][NAS][SQN] SQN of the authentication request message: VALID
INFO[0001] [UE][NAS] Send authentication response
INFO[0001] [UE] Switched from state 1 to state 2
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and with NEW 5G NAS SECURITY CONTEXT
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] Receive Security Mode Command
INFO[0001] [UE][NAS] Type of ciphering algorithm is 5G-EA0
INFO[0001] [UE][NAS] Type of integrity protection algorithm is 128-5G-IA2
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Initial Context Setup Request
INFO[0001] [GNB][UE] UE Context was created with successful
INFO[0001] [GNB][UE] UE RAN ID 1
INFO[0001] [GNB][UE] UE AMF ID 6
INFO[0001] [GNB][UE] UE Mobility Restrict --Plmn-- Mcc: not informed Mnc: not informed
INFO[0001] [GNB][UE] UE Masked Imeisv: 1110000000ffff00
INFO[0001] [GNB][UE] Allowed Nssai-- Sst: [01] Sd: [000001]
INFO[0001] [GNB][NAS][UE] Send Registration Accept.
INFO[0001] [GNB][NGAP][AMF] Send Initial Context Setup Response.
INFO[0001] [GNB] Initiating Initial Context Setup Response
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and ciphered
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] successful NAS CIPHERING
INFO[0001] [UE][NAS] Receive Registration Accept
INFO[0001] [UE][NAS] UE 5G GUTI: [192 0 6 79]
INFO[0001] [UE] Switched from state 2 to state 3
INFO[0001] [UE] Initiating New PDU Session
INFO[0001] [UE] Initiating New PDU Session
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and ciphered
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] successful NAS CIPHERING
INFO[0001] [UE][NAS] Receive Configuration Update Command
INFO[0001] [UE][NAS] imsi-999700000000001 was succesfully registered
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and ciphered
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] successful NAS CIPHERING
INFO[0001] [UE][NAS] Receive DL NAS Transport
ERRO[0001] [UE][NAS] Receiving PDU Session Establishment Reject
ERRO[0001] [UE][NAS] PDU Session Establishment Reject for PDU Session ID 1, 5GSM Cause: Service option temporarily out of order. Please share pcap with [email protected].
INFO[0001] [UE] Initiating New PDU Session
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and ciphered
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] successful NAS CIPHERING
INFO[0001] [UE][NAS] Receive DL NAS Transport
ERRO[0001] [UE][NAS] Receiving PDU Session Establishment Reject
ERRO[0001] [UE][NAS] PDU Session Establishment Reject for PDU Session ID 1, 5GSM Cause: Service option temporarily out of order. Please share pcap with [email protected].
INFO[0001] [UE] Initiating New PDU Session
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and ciphered
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] successful NAS CIPHERING
INFO[0001] [UE][NAS] Receive DL NAS Transport
ERRO[0001] [UE][NAS] Receiving PDU Session Establishment Reject
ERRO[0001] [UE][NAS] PDU Session Establishment Reject for PDU Session ID 1, 5GSM Cause: Service option temporarily out of order. Please share pcap with [email protected].
INFO[0001] [UE] Initiating New PDU Session
INFO[0001] [GNB][SCTP] Receive message in 1 stream
INFO[0001] [GNB][NGAP] Receive Downlink NAS Transport
INFO[0001] [UE][NAS] Message with security header
INFO[0001] [UE][NAS] Message with integrity and ciphered
INFO[0001] [UE][NAS] successful NAS MAC verification
INFO[0001] [UE][NAS] successful NAS CIPHERING
INFO[0001] [UE][NAS] Receive DL NAS Transport
ERRO[0001] [UE][NAS] Receiving PDU Session Establishment Reject

AMF logs:

12/04 15:00:59.043: [amf] INFO: gNB-N2 accepted[192.168.200.2]:9487 in ng-path module (../src/amf/ngap-sctp.c:113)
12/04 15:00:59.043: [amf] INFO: gNB-N2 accepted[192.168.200.2] in master_sm module (../src/amf/amf-sm.c:741)
12/04 15:00:59.043: [amf] INFO: [Added] Number of gNBs is now 1 (../src/amf/context.c:1227)
12/04 15:00:59.043: [amf] INFO: gNB-N2[192.168.200.2] max_num_of_ostreams : 2 (../src/amf/amf-sm.c:780)
12/04 15:01:00.046: [amf] INFO: InitialUEMessage (../src/amf/ngap-handler.c:401)
12/04 15:01:00.046: [amf] INFO: [Added] Number of gNB-UEs is now 1 (../src/amf/context.c:2546)
12/04 15:01:00.046: [amf] INFO:     RAN_UE_NGAP_ID[1] AMF_UE_NGAP_ID[6] TAC[1] CellID[0x1] (../src/amf/ngap-handler.c:562)
12/04 15:01:00.046: [amf] INFO: [suci-0-999-70-4567-0-0-0000000001] known UE by SUCI (../src/amf/context.c:1829)
12/04 15:01:00.046: [gmm] INFO: Registration request (../src/amf/gmm-sm.c:1165)
12/04 15:01:00.046: [gmm] INFO: [suci-0-999-70-4567-0-0-0000000001]    SUCI (../src/amf/gmm-handler.c:166)
12/04 15:01:00.096: [nas] WARNING: Spec warning : bcd[16] = 0x0, 0x30 (../lib/nas/common/conv.c:48)
12/04 15:01:00.316: [gmm] INFO: [imsi-999700000000001] Registration complete (../src/amf/gmm-sm.c:2146)
12/04 15:01:00.316: [amf] INFO: [imsi-999700000000001] Configuration update command (../src/amf/nas-path.c:612)
12/04 15:01:00.316: [gmm] INFO:     UTC [2023-12-04T15:01:00] Timezone[0]/DST[0] (../src/amf/gmm-build.c:559)
12/04 15:01:00.316: [gmm] INFO:     LOCAL [2023-12-04T15:01:00] Timezone[0]/DST[0] (../src/amf/gmm-build.c:564)
12/04 15:01:00.316: [gmm] INFO: UE SUPI[imsi-999700000000001] DNN[internet] S_NSSAI[SST:1 SD:0x1] smContextRef [NULL] (../src/amf/gmm-handler.c:1241)
12/04 15:01:00.316: [gmm] INFO: SMF Instance [bdeea232-92b5-41ee-b7ef-e14c5210b7e0] (../src/amf/gmm-handler.c:1280)
12/04 15:01:00.319: [smf] INFO: [Added] Number of SMF-UEs is now 1 (../src/smf/context.c:1019)
12/04 15:01:00.319: [smf] INFO: [Added] Number of SMF-Sessions is now 1 (../src/smf/context.c:3068)
12/04 15:01:00.325: [sbi] INFO: [UDM] (SCP-discover) NF registered [97942e20-91f4-41ee-9d87-d7f7e88b520f:1] (../lib/sbi/path.c:211)
12/04 15:01:00.330: [sbi] INFO: [PCF] (SCP-discover) NF registered [81e36fa4-91ff-41ee-8698-0bf418efb12f:1] (../lib/sbi/path.c:211)
12/04 15:01:00.330: [smf] ERROR: [imsi-999700000000001:1] HTTP response error [404] (../src/smf/gsm-sm.c:519)
12/04 15:01:00.331: [amf] ERROR: [1:0] PDU session establishment reject (../src/amf/namf-handler.c:466)
12/04 15:01:00.331: [amf] WARNING: [suci-0-999-70-4567-0-0-0000000001] DL NAS transport (../src/amf/nas-path.c:1014)
12/04 15:01:00.331: [amf] INFO: [Removed] Number of AMF-Sessions is now 0 (../src/amf/context.c:2574)

Architecture (please complete the following information):

  • OS: [Linux]
  • Platform [x86_64[
  • Version [20.04]
  • Kernel [5.4.0-167-generic]

Pcap:
packet-rusher-o5gs-roaming-1.zip

Additional context
Also the number of retries from pack-rusher seems to be too much, it practically flooded the logs of the Open5gs core components when it encountered this issue, I think this should be reduced to a few seconds retry mechanism.

Also I think the Discussion feature of your github repo should be enable so as to deal with other issues that are not related to bugs or feature (this is just a suggestion)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.