HewlettPackard / PacketRusher

High performance 5G UE/gNB Simulator and CP/UP load tester.
Apache License 2.0
109 stars 25 forks source link

[BUG] Error sending NG Setup Request #72

Closed abousselmi closed 8 months ago

abousselmi commented 8 months ago

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):

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

linouxis9 commented 8 months ago

Hi @abousselmi, There is an issue in your configuration, tac should be 6 digits: eg. 000001. That's why you are seeing the error "encoding/hex: odd length hex string". We are going to improve the code so PacketRusher does not run further if the configuration is malformed. Thanks a lot for the report!

abousselmi commented 8 months ago

Hi @linouxis9, Thank you for your feedback. That fixed my issue. SST should also be two digits. This configuration might be used as a reference for free5gc: https://free5gc.org/blog/20240110/20240110/?h=pack#packetrusher-gnbue-config And yes it would be great to fail fast and to be a little bit more explicit in the error message.

Thanks again !