travelping / upg-vpp

User Plane Gateway (UPG) based on VPP
Apache License 2.0
149 stars 51 forks source link

UPG crash when an UE pings another UE in the same UPF. #320

Open Salhi-K opened 1 year ago

Salhi-K commented 1 year ago

Hello,

I'm using UPG-VPP 1.6 as UPF with free5gc core. All features are running well until I try to ping an UE from another UE: UPF crashes showing this error message:

_/home/dp-15/upg-vpp-stable-1.6/vpp/src/plugins/upf/upf_session_dpo.c:426 (upf_ip4_session_dpo_node_fn_hsw) assertion `!((b)->flags & UPF_BUFFER_F_GTPU_INITIALIZED)' fails Abandon_

A .pcap file of the session establishment call flow and gtpu packets is attached. upg-vpp-crash-ping-2-ue.tar.gz

The crash disappears when I comment/remove this bloc (file upf.h lines from 81 to 101 + line 112):

#if CLIB_DEBUG > 0

/*
 * For debug builds, we add a flag to each buffer when we initialize
 * GTPU metadata when the buffer is processed by one of the UPF
 * entry nodes (upf-gtpu[46]-input, upf-ip[46]-session-dpo,
 * upf-ip[46]-proxy-server-output)
 */
#define UPF_BUFFER_F_GTPU_INITIALIZED VNET_BUFFER_F_AVAIL1
#define UPF_ENTER_SUBGRAPH(b)                   \
do {                                \
    ASSERT (!(b->flags & UPF_BUFFER_F_GTPU_INITIALIZED));   \
    b->flags |= UPF_BUFFER_F_GTPU_INITIALIZED;          \
    upf_buffer_opaque (b)->gtpu.hdr_flags = 0;          \
  } while (0)
#define UPF_CHECK_INNER_NODE(b) ASSERT (b->flags & UPF_BUFFER_F_GTPU_INITIALIZED)

#else

It seems that initializing gtpu metadata in the debug place is causing the problem.

Could you tell me please if disabling this part could be a good fix for this crash ?

Best regards. Salhi K.

sergeymatov commented 1 year ago

Hello @Salhi-K It seems you are running debug version of UPG build with assertion included. To avoid the crash you can use release UPG build. If there is a need to use debug build we would recommend either to remove this assertion or change #if CLIB_DEBUG > 0 to #if CLIB_DEBUG > 2 this prevent code for being executed. Just a note here - 3GPP specs are not strict to UE-UE accessibility. If same UPG is serving both UE sessions, traffic will be routed from one UE to another within SGi FIB table and counted correctly. But it won't leave SGi interface.

Salhi-K commented 1 year ago

Hello @sergeymatov , Thanks for your detailed reply.