kernel: Copy patches from kernel 4.14 to 4.19
[openwrt/staging/chunkeey.git] / target / linux / generic / backport-4.19 / 289-v4.16-netfilter-add-defines-for-arp-decnet-max-hooks.patch
1 From e58f33cc84bc089c430ac955f3cad6380ae98591 Mon Sep 17 00:00:00 2001
2 From: Florian Westphal <fw@strlen.de>
3 Date: Thu, 7 Dec 2017 16:28:23 +0100
4 Subject: [PATCH] netfilter: add defines for arp/decnet max hooks
5
6 The kernel already has defines for this, but they are in uapi exposed
7 headers.
8
9 Including these from netns.h causes build errors and also adds unneeded
10 dependencies on heads that we don't need.
11
12 So move these defines to netfilter_defs.h and place the uapi ones
13 in ifndef __KERNEL__ to keep them for userspace.
14
15 Signed-off-by: Florian Westphal <fw@strlen.de>
16 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
17 ---
18 include/linux/netfilter_defs.h | 6 ++++++
19 include/uapi/linux/netfilter_arp.h | 3 +++
20 include/uapi/linux/netfilter_decnet.h | 4 +++-
21 3 files changed, 12 insertions(+), 1 deletion(-)
22
23 --- a/include/linux/netfilter_defs.h
24 +++ b/include/linux/netfilter_defs.h
25 @@ -7,4 +7,10 @@
26 /* Largest hook number + 1, see uapi/linux/netfilter_decnet.h */
27 #define NF_MAX_HOOKS 8
28
29 +/* in/out/forward only */
30 +#define NF_ARP_NUMHOOKS 3
31 +
32 +/* max hook is NF_DN_ROUTE (6), also see uapi/linux/netfilter_decnet.h */
33 +#define NF_DN_NUMHOOKS 7
34 +
35 #endif
36 --- a/include/uapi/linux/netfilter_arp.h
37 +++ b/include/uapi/linux/netfilter_arp.h
38 @@ -15,6 +15,9 @@
39 #define NF_ARP_IN 0
40 #define NF_ARP_OUT 1
41 #define NF_ARP_FORWARD 2
42 +
43 +#ifndef __KERNEL__
44 #define NF_ARP_NUMHOOKS 3
45 +#endif
46
47 #endif /* __LINUX_ARP_NETFILTER_H */
48 --- a/include/uapi/linux/netfilter_decnet.h
49 +++ b/include/uapi/linux/netfilter_decnet.h
50 @@ -24,6 +24,9 @@
51 #define NFC_DN_IF_IN 0x0004
52 /* Output device. */
53 #define NFC_DN_IF_OUT 0x0008
54 +
55 +/* kernel define is in netfilter_defs.h */
56 +#define NF_DN_NUMHOOKS 7
57 #endif /* ! __KERNEL__ */
58
59 /* DECnet Hooks */
60 @@ -41,7 +44,6 @@
61 #define NF_DN_HELLO 5
62 /* Input Routing Packets */
63 #define NF_DN_ROUTE 6
64 -#define NF_DN_NUMHOOKS 7
65
66 enum nf_dn_hook_priorities {
67 NF_DN_PRI_FIRST = INT_MIN,