[LTP] [PATCH v4 3/4] lapi: Add tc_pedit.h fallback
Andrea Cervesato
andrea.cervesato@suse.de
Mon Jul 13 14:37:09 CEST 2026
From: Andrea Cervesato <andrea.cervesato@suse.com>
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
configure.ac | 6 ++++++
include/lapi/tc_pedit.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/configure.ac b/configure.ac
index 3a1283ac3a30d85ca731ca54a281ed0c1d4bc06e..19fc5e1b8f5f5f94bd797ff2ba4275c29c20cb6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,6 +190,12 @@ AC_CHECK_MEMBERS([struct utsname.domainname],,,[
])
AC_CHECK_TYPES([enum kcmp_type],,,[#include <linux/kcmp.h>])
+AC_CHECK_TYPES([enum pedit_header_type],,,[#include <linux/tc_act/tc_pedit.h>])
+AC_CHECK_TYPES([enum pedit_cmd],,,[#include <linux/tc_act/tc_pedit.h>])
+AC_CHECK_DECLS([TCA_PEDIT_PARMS_EX, TCA_PEDIT_KEYS_EX, TCA_PEDIT_KEY_EX,
+ TCA_PEDIT_KEY_EX_HTYPE, TCA_PEDIT_KEY_EX_CMD],,,[
+#include <linux/tc_act/tc_pedit.h>
+])
AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
AC_CHECK_TYPES([struct af_alg_iv, struct sockaddr_alg],,,[# include <linux/if_alg.h>])
AC_CHECK_TYPES([struct clone_args],,,[#include <sched.h>])
diff --git a/include/lapi/tc_pedit.h b/include/lapi/tc_pedit.h
new file mode 100644
index 0000000000000000000000000000000000000000..057d96efd3fb0f2556886c9774b0bd5682b14398
--- /dev/null
+++ b/include/lapi/tc_pedit.h
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2026 SUSE LLC <andrea.cervesato@suse.com>
+ */
+
+#ifndef LAPI_TC_PEDIT_H__
+#define LAPI_TC_PEDIT_H__
+
+#include "config.h"
+#include <linux/tc_act/tc_pedit.h>
+
+#if !HAVE_DECL_TCA_PEDIT_PARMS_EX
+# define TCA_PEDIT_PARMS_EX 4
+#endif
+
+#if !HAVE_DECL_TCA_PEDIT_KEYS_EX
+# define TCA_PEDIT_KEYS_EX 5
+#endif
+
+#if !HAVE_DECL_TCA_PEDIT_KEY_EX
+# define TCA_PEDIT_KEY_EX 6
+#endif
+
+#if !HAVE_DECL_TCA_PEDIT_KEY_EX_HTYPE
+# define TCA_PEDIT_KEY_EX_HTYPE 1
+#endif
+
+#if !HAVE_DECL_TCA_PEDIT_KEY_EX_CMD
+# define TCA_PEDIT_KEY_EX_CMD 2
+#endif
+
+#ifndef HAVE_ENUM_PEDIT_HEADER_TYPE
+enum pedit_header_type {
+ TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0,
+ TCA_PEDIT_KEY_EX_HDR_TYPE_ETH,
+ TCA_PEDIT_KEY_EX_HDR_TYPE_IP4,
+ TCA_PEDIT_KEY_EX_HDR_TYPE_IP6,
+ TCA_PEDIT_KEY_EX_HDR_TYPE_TCP,
+ TCA_PEDIT_KEY_EX_HDR_TYPE_UDP,
+ __PEDIT_HDR_TYPE_MAX,
+};
+#endif
+
+#ifndef HAVE_ENUM_PEDIT_CMD
+enum pedit_cmd {
+ TCA_PEDIT_KEY_EX_CMD_SET = 0,
+ TCA_PEDIT_KEY_EX_CMD_ADD,
+ __PEDIT_CMD_MAX,
+};
+#endif
+
+#endif /* LAPI_TC_PEDIT_H__ */
--
2.51.0
More information about the ltp
mailing list