Skip to contentSkip to conversation

netfilter: bridge: define INT_MIN & INT_MAX in userspace

PATCH Applied Jiri Slaby 3 participants 3 messages Oct 24, 2018 – Oct 25, 2018 netfilter

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 netfilter: bridge: define INT_MIN & INT_MAX in userspace

With 4.19, programs like ebtables fail to build when they include "linux/netfilter_bridge.h". It is caused by commit 94276fa8a2a4 which
added a use of INT_MIN and INT_MAX to the header:
: In file included from /usr/include/linux/netfilter_bridge/ebtables.h:18,
: from include/ebtables_u.h:28,
: from communication.c:23:
: /usr/include/linux/netfilter_bridge.h:30:20: error: 'INT_MIN' undeclared here (not in a function)
: NF_BR_PRI_FIRST = INT_MIN,
: ^~~~~~~

Define these constants by including "limits.h" when !__KERNEL__ (the same way as for other netfilter_* headers).

Fixes 94276fa8a2a4 ("netfilter: bridge: Expose nf_tables bridge hook priorities through uapi")
Cc Máté Eckl <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
---
 include/uapi/linux/netfilter_bridge.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/netfilter_bridge.h +4 -0
index 156ccd089df1..1610fdbab98d 100644
@@ -11,6 +11,10 @@
 #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
Signature · 1 line
2.19.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jiri Slaby

With 4.19, programs like ebtables fail to build when they include "linux/netfilter_bridge.h". It is caused by commit 94276fa8a2a4 which
added a use of INT_MIN and INT_MAX to the header:
: In file included from /usr/include/linux/netfilter_bridge/ebtables.h:18,
: from include/ebtables_u.h:28,
: from communication.c:23:
: /usr/include/linux/netfilter_bridge.h:30:20: error: 'INT_MIN' undeclared here (not in a function)
: NF_BR_PRI_FIRST = INT_MIN,
: ^~~~~~~

Quoted 2 lines

Define these constants by including "limits.h" when !__KERNEL__ (the same way as for other netfilter_* headers).

Indeed I didn't think of this solution.

Thanks for the fix Jiri!

Quoted 5 lines
Fixes 94276fa8a2a4 ("netfilter: bridge: Expose nf_tables bridge hook priorities through uapi")
Cc Máté Eckl <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
Quoted 22 lines
---
 include/uapi/linux/netfilter_bridge.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/netfilter_bridge.h +4 -0
index 156ccd089df1..1610fdbab98d 100644
@@ -11,6 +11,10 @@
 #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
Signature · 1 line
2.19.1
maintainer Applied
#2 lore raw
In reply to Jiri Slaby
Quoted 10 lines · Jiri Slaby

With 4.19, programs like ebtables fail to build when they include "linux/netfilter_bridge.h". It is caused by commit 94276fa8a2a4 which
added a use of INT_MIN and INT_MAX to the header:
: In file included from /usr/include/linux/netfilter_bridge/ebtables.h:18,
: from include/ebtables_u.h:28,
: from communication.c:23:
: /usr/include/linux/netfilter_bridge.h:30:20: error: 'INT_MIN' undeclared here (not in a function)
: NF_BR_PRI_FIRST = INT_MIN,
: ^~~~~~~

Quoted 2 lines

Define these constants by including "limits.h" when !__KERNEL__ (the same way as for other netfilter_* headers).

Applied, thanks.