From e1cb358eeb5c744264b47e408818a467cd7bd7d1 Mon Sep 17 00:00:00 2001 From: Alexandre Cassen Date: Sun, 23 Jun 2024 10:58:19 +0200 Subject: [PATCH] switch: fix dummy_teid handling when using GTP-C ingress/egress split configuration, echo-request messages MUST not be forwarded and rather handled directly by receiving peer. --- VERSION | 2 +- lib/config.h | 2 +- src/gtp_switch.c | 4 ++-- src/include/gtp_teid.h | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index af0b7dd..86a1ef1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.6 +1.0.7pre0 diff --git a/lib/config.h b/lib/config.h index c751400..db103ef 100644 --- a/lib/config.h +++ b/lib/config.h @@ -25,7 +25,7 @@ #define LOG_FACILITY_MAX 7 #define PROG "gtp-guard" #define PROG_PID_FILE "/var/run/gtp-guard.pid" -#define VERSION_STRING PROG " v1.0.6 (2024/06/23)" +#define VERSION_STRING PROG " v1.0.7pre0 (2024/06/23)" #define COPYRIGHT_STRING "Copyright (C) 2023-2024 Alexandre Cassen, " diff --git a/src/gtp_switch.c b/src/gtp_switch.c index edb378f..7db0b3c 100644 --- a/src/gtp_switch.c +++ b/src/gtp_switch.c @@ -137,8 +137,8 @@ gtp_switch_ingress_process(gtp_server_worker_t *w, struct sockaddr_storage *addr /* Set destination address */ gtp_switch_fwd_addr_get(teid, addr_from, &addr_to); - gtp_server_send(w, fd - , (teid->type == 0xff) ? (struct sockaddr_in *) addr_from : &addr_to); + gtp_server_send(w, TEID_IS_DUMMY(teid) ? w->fd : fd + , TEID_IS_DUMMY(teid) ? (struct sockaddr_in *) addr_from : &addr_to); gtpc_switch_handle_post(w, teid); return 0; diff --git a/src/include/gtp_teid.h b/src/include/gtp_teid.h index 601476b..2009897 100644 --- a/src/include/gtp_teid.h +++ b/src/include/gtp_teid.h @@ -42,6 +42,9 @@ enum gtp_teid_flags { GTP_TEID_FL_XDP_SET, }; +/* Defines */ +#define TEID_IS_DUMMY(X) ((X)->type == 0xff) + /* GTP Connection tracking */ typedef struct _gtp_teid { uint8_t version; /* GTPv1 or GTPv2 */