[PATCH nf-next] netfilter: fix compilation with !CONFIG_NF_CONNTRACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With no conntrack support, struct nf_conntrack becomes undefined in
linux/skbuff.h.

Wrap around #include <net/netfilter/nf_conntrack.h> in ifdefs as we do
already in other spots in this code.

All errors (new ones prefixed by >>):

   In file included from net/ipv4/netfilter/nf_socket_ipv4.c:19:0:
>> include/net/netfilter/nf_conntrack.h:83:22: error: field 'ct_general' has incomplete type
     struct nf_conntrack ct_general;
                         ^~~~~~~~~~
   include/net/netfilter/nf_conntrack.h: In function 'nf_ct_get':
>> include/net/netfilter/nf_conntrack.h:170:30: error: 'const struct sk_buff' has no member named 'nfct'; did you mean 'next'?
     return (struct nf_conn *)skb->nfct;
                                 ^~
   include/net/netfilter/nf_conntrack.h: In function 'nf_ct_put':
>> include/net/netfilter/nf_conntrack.h:177:2: error: implicit declaration of function 'nf_conntrack_put' [-Werror=implicit-function-declaration]
     nf_conntrack_put(&ct->ct_general);
     ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 net/ipv4/netfilter/nf_socket_ipv4.c | 2 ++
 net/ipv6/netfilter/nf_socket_ipv6.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/ipv4/netfilter/nf_socket_ipv4.c b/net/ipv4/netfilter/nf_socket_ipv4.c
index 5f3741ba4654..a83d558e1aae 100644
--- a/net/ipv4/netfilter/nf_socket_ipv4.c
+++ b/net/ipv4/netfilter/nf_socket_ipv4.c
@@ -16,7 +16,9 @@
 #include <net/sock.h>
 #include <net/inet_sock.h>
 #include <net/netfilter/nf_socket.h>
+#if IS_ENABLED(CONFIG_NF_CONNTRACK)
 #include <net/netfilter/nf_conntrack.h>
+#endif
 
 static int
 extract_icmp4_fields(const struct sk_buff *skb, u8 *protocol,
diff --git a/net/ipv6/netfilter/nf_socket_ipv6.c b/net/ipv6/netfilter/nf_socket_ipv6.c
index 95cb0b82ff9a..ebb2bf84232a 100644
--- a/net/ipv6/netfilter/nf_socket_ipv6.c
+++ b/net/ipv6/netfilter/nf_socket_ipv6.c
@@ -18,7 +18,9 @@
 #include <net/inet6_hashtables.h>
 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
 #include <net/netfilter/nf_socket.h>
+#if IS_ENABLED(CONFIG_NF_CONNTRACK)
 #include <net/netfilter/nf_conntrack.h>
+#endif
 
 static int
 extract_icmp6_fields(const struct sk_buff *skb,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux