v1.5 branch refresh based upon upstream master @ c8677ca89e53e3be7988d54280fce166cc894a7e
[librecmc/librecmc.git] / target / linux / generic / backport-4.14 / 329-v4.16-netfilter-improve-flow-table-Kconfig-dependencies.patch
1 From: Arnd Bergmann <arnd@arndb.de>
2 Date: Wed, 10 Jan 2018 18:10:59 +0100
3 Subject: [PATCH] netfilter: improve flow table Kconfig dependencies
4
5 The newly added NF_FLOW_TABLE options cause some build failures in
6 randconfig kernels:
7
8 - when CONFIG_NF_CONNTRACK is disabled, or is a loadable module but
9   NF_FLOW_TABLE is built-in:
10
11   In file included from net/netfilter/nf_flow_table.c:8:0:
12   include/net/netfilter/nf_conntrack.h:59:22: error: field 'ct_general' has incomplete type
13     struct nf_conntrack ct_general;
14   include/net/netfilter/nf_conntrack.h: In function 'nf_ct_get':
15   include/net/netfilter/nf_conntrack.h:148:15: error: 'const struct sk_buff' has no member named '_nfct'
16   include/net/netfilter/nf_conntrack.h: In function 'nf_ct_put':
17   include/net/netfilter/nf_conntrack.h:157:2: error: implicit declaration of function 'nf_conntrack_put'; did you mean 'nf_ct_put'? [-Werror=implicit-function-declaration]
18
19   net/netfilter/nf_flow_table.o: In function `nf_flow_offload_work_gc':
20   (.text+0x1540): undefined reference to `nf_ct_delete'
21
22 - when CONFIG_NF_TABLES is disabled:
23
24   In file included from net/ipv6/netfilter/nf_flow_table_ipv6.c:13:0:
25   include/net/netfilter/nf_tables.h: In function 'nft_gencursor_next':
26   include/net/netfilter/nf_tables.h:1189:14: error: 'const struct net' has no member named 'nft'; did you mean 'nf'?
27
28  - when CONFIG_NF_FLOW_TABLE_INET is enabled, but NF_FLOW_TABLE_IPV4
29   or NF_FLOW_TABLE_IPV6 are not, or are loadable modules
30
31   net/netfilter/nf_flow_table_inet.o: In function `nf_flow_offload_inet_hook':
32   nf_flow_table_inet.c:(.text+0x94): undefined reference to `nf_flow_offload_ipv6_hook'
33   nf_flow_table_inet.c:(.text+0x40): undefined reference to `nf_flow_offload_ip_hook'
34
35 - when CONFIG_NF_FLOW_TABLES is disabled, but the other options are
36   enabled:
37
38   net/netfilter/nf_flow_table_inet.o: In function `nf_flow_offload_inet_hook':
39   nf_flow_table_inet.c:(.text+0x6c): undefined reference to `nf_flow_offload_ipv6_hook'
40   net/netfilter/nf_flow_table_inet.o: In function `nf_flow_inet_module_exit':
41   nf_flow_table_inet.c:(.exit.text+0x8): undefined reference to `nft_unregister_flowtable_type'
42   net/netfilter/nf_flow_table_inet.o: In function `nf_flow_inet_module_init':
43   nf_flow_table_inet.c:(.init.text+0x8): undefined reference to `nft_register_flowtable_type'
44   net/ipv4/netfilter/nf_flow_table_ipv4.o: In function `nf_flow_ipv4_module_exit':
45   nf_flow_table_ipv4.c:(.exit.text+0x8): undefined reference to `nft_unregister_flowtable_type'
46   net/ipv4/netfilter/nf_flow_table_ipv4.o: In function `nf_flow_ipv4_module_init':
47   nf_flow_table_ipv4.c:(.init.text+0x8): undefined reference to `nft_register_flowtable_type'
48
49 This adds additional Kconfig dependencies to ensure that NF_CONNTRACK and NF_TABLES
50 are always visible from NF_FLOW_TABLE, and that the internal dependencies between
51 the four new modules are met.
52
53 Fixes: 7c23b629a808 ("netfilter: flow table support for the mixed IPv4/IPv6 family")
54 Fixes: 0995210753a2 ("netfilter: flow table support for IPv6")
55 Fixes: 97add9f0d66d ("netfilter: flow table support for IPv4")
56 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
57 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
58 ---
59
60 --- a/net/ipv4/netfilter/Kconfig
61 +++ b/net/ipv4/netfilter/Kconfig
62 @@ -78,8 +78,9 @@ config NF_TABLES_ARP
63  endif # NF_TABLES
64  
65  config NF_FLOW_TABLE_IPV4
66 -       select NF_FLOW_TABLE
67         tristate "Netfilter flow table IPv4 module"
68 +       depends on NF_CONNTRACK && NF_TABLES
69 +       select NF_FLOW_TABLE
70         help
71           This option adds the flow table IPv4 support.
72  
73 --- a/net/ipv6/netfilter/Kconfig
74 +++ b/net/ipv6/netfilter/Kconfig
75 @@ -72,8 +72,9 @@ endif # NF_TABLES_IPV6
76  endif # NF_TABLES
77  
78  config NF_FLOW_TABLE_IPV6
79 -       select NF_FLOW_TABLE
80         tristate "Netfilter flow table IPv6 module"
81 +       depends on NF_CONNTRACK && NF_TABLES
82 +       select NF_FLOW_TABLE
83         help
84           This option adds the flow table IPv6 support.
85  
86 --- a/net/netfilter/Kconfig
87 +++ b/net/netfilter/Kconfig
88 @@ -669,8 +669,9 @@ endif # NF_TABLES_NETDEV
89  endif # NF_TABLES
90  
91  config NF_FLOW_TABLE_INET
92 -       select NF_FLOW_TABLE
93         tristate "Netfilter flow table mixed IPv4/IPv6 module"
94 +       depends on NF_FLOW_TABLE_IPV4 && NF_FLOW_TABLE_IPV6
95 +       select NF_FLOW_TABLE
96         help
97            This option adds the flow table mixed IPv4/IPv6 support.
98  
99 @@ -678,6 +679,7 @@ config NF_FLOW_TABLE_INET
100  
101  config NF_FLOW_TABLE
102         tristate "Netfilter flow table module"
103 +       depends on NF_CONNTRACK && NF_TABLES
104         help
105           This option adds the flow table core infrastructure.
106