From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew@lunn.ch>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: [PATCH RFC net-next 3/3] netfilter: uapi: Use UAPI definition of INT_MAX and INT_MIN
Date: Mon, 05 Jan 2026 09:26:49 +0100 [thread overview]
Message-ID: <20260105-uapi-limits-v1-3-023bc7a13037@linutronix.de> (raw)
In-Reply-To: <20260105-uapi-limits-v1-0-023bc7a13037@linutronix.de>
Using <limits.h> to gain access to INT_MAX and INT_MIN introduces a
dependency on a libc, which UAPI headers should not do.
Use the equivalent UAPI constants.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
include/uapi/linux/netfilter_bridge.h | 9 +++------
include/uapi/linux/netfilter_ipv4.h | 9 ++++-----
include/uapi/linux/netfilter_ipv6.h | 7 +++----
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/include/uapi/linux/netfilter_bridge.h b/include/uapi/linux/netfilter_bridge.h
index 1610fdbab98d..6ace6c8b211b 100644
--- a/include/uapi/linux/netfilter_bridge.h
+++ b/include/uapi/linux/netfilter_bridge.h
@@ -6,15 +6,12 @@
*/
#include <linux/in.h>
+#include <linux/limits.h>
#include <linux/netfilter.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <linux/if_pppox.h>
-#ifndef __KERNEL__
-#include <limits.h> /* for INT_MIN, INT_MAX */
-#endif
-
/* Bridge Hooks */
/* After promisc drops, checksum checks. */
#define NF_BR_PRE_ROUTING 0
@@ -31,14 +28,14 @@
#define NF_BR_NUMHOOKS 6
enum nf_br_hook_priorities {
- NF_BR_PRI_FIRST = INT_MIN,
+ NF_BR_PRI_FIRST = __KERNEL_INT_MIN,
NF_BR_PRI_NAT_DST_BRIDGED = -300,
NF_BR_PRI_FILTER_BRIDGED = -200,
NF_BR_PRI_BRNF = 0,
NF_BR_PRI_NAT_DST_OTHER = 100,
NF_BR_PRI_FILTER_OTHER = 200,
NF_BR_PRI_NAT_SRC = 300,
- NF_BR_PRI_LAST = INT_MAX,
+ NF_BR_PRI_LAST = __KERNEL_INT_MAX,
};
#endif /* _UAPI__LINUX_BRIDGE_NETFILTER_H */
diff --git a/include/uapi/linux/netfilter_ipv4.h b/include/uapi/linux/netfilter_ipv4.h
index 155e77d6a42d..e675534b2128 100644
--- a/include/uapi/linux/netfilter_ipv4.h
+++ b/include/uapi/linux/netfilter_ipv4.h
@@ -6,13 +6,12 @@
#define _UAPI__LINUX_IP_NETFILTER_H
+#include <linux/limits.h>
#include <linux/netfilter.h>
/* only for userspace compatibility */
#ifndef __KERNEL__
-#include <limits.h> /* for INT_MIN, INT_MAX */
-
/* IP Hooks */
/* After promisc drops, checksum checks. */
#define NF_IP_PRE_ROUTING 0
@@ -28,7 +27,7 @@
#endif /* ! __KERNEL__ */
enum nf_ip_hook_priorities {
- NF_IP_PRI_FIRST = INT_MIN,
+ NF_IP_PRI_FIRST = __KERNEL_INT_MIN,
NF_IP_PRI_RAW_BEFORE_DEFRAG = -450,
NF_IP_PRI_CONNTRACK_DEFRAG = -400,
NF_IP_PRI_RAW = -300,
@@ -41,8 +40,8 @@ enum nf_ip_hook_priorities {
NF_IP_PRI_NAT_SRC = 100,
NF_IP_PRI_SELINUX_LAST = 225,
NF_IP_PRI_CONNTRACK_HELPER = 300,
- NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
- NF_IP_PRI_LAST = INT_MAX,
+ NF_IP_PRI_CONNTRACK_CONFIRM = __KERNEL_INT_MAX,
+ NF_IP_PRI_LAST = __KERNEL_INT_MAX,
};
/* Arguments for setsockopt SOL_IP: */
diff --git a/include/uapi/linux/netfilter_ipv6.h b/include/uapi/linux/netfilter_ipv6.h
index 80aa9b0799af..6be21833f696 100644
--- a/include/uapi/linux/netfilter_ipv6.h
+++ b/include/uapi/linux/netfilter_ipv6.h
@@ -9,13 +9,12 @@
#define _UAPI__LINUX_IP6_NETFILTER_H
+#include <linux/limits.h>
#include <linux/netfilter.h>
/* only for userspace compatibility */
#ifndef __KERNEL__
-#include <limits.h> /* for INT_MIN, INT_MAX */
-
/* IP6 Hooks */
/* After promisc drops, checksum checks. */
#define NF_IP6_PRE_ROUTING 0
@@ -32,7 +31,7 @@
enum nf_ip6_hook_priorities {
- NF_IP6_PRI_FIRST = INT_MIN,
+ NF_IP6_PRI_FIRST = __KERNEL_INT_MIN,
NF_IP6_PRI_RAW_BEFORE_DEFRAG = -450,
NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
NF_IP6_PRI_RAW = -300,
@@ -45,7 +44,7 @@ enum nf_ip6_hook_priorities {
NF_IP6_PRI_NAT_SRC = 100,
NF_IP6_PRI_SELINUX_LAST = 225,
NF_IP6_PRI_CONNTRACK_HELPER = 300,
- NF_IP6_PRI_LAST = INT_MAX,
+ NF_IP6_PRI_LAST = __KERNEL_INT_MAX,
};
--
2.52.0
next prev parent reply other threads:[~2026-01-05 8:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 8:26 [PATCH RFC net-next 0/3] uapi: Use UAPI definitions " Thomas Weißschuh
2026-01-05 8:26 ` [PATCH RFC net-next 1/3] uapi: add INT_MAX and INT_MIN constants Thomas Weißschuh
2026-01-05 14:37 ` Andrew Lunn
2026-01-05 14:48 ` Thomas Weißschuh
2026-01-05 8:26 ` [PATCH RFC net-next 2/3] ethtool: uapi: Use UAPI definition of INT_MAX Thomas Weißschuh
2026-01-05 8:26 ` Thomas Weißschuh [this message]
2026-01-05 13:02 ` [PATCH RFC net-next 3/3] netfilter: uapi: Use UAPI definition of INT_MAX and INT_MIN Arnd Bergmann
2026-01-09 10:20 ` Thomas Weißschuh
2026-01-12 8:06 ` Thomas Weißschuh
2026-01-12 9:23 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260105-uapi-limits-v1-3-023bc7a13037@linutronix.de \
--to=thomas.weissschuh@linutronix.de \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®