Skip to contentSkip to conversation

netfilter: fix compilation with !CONFIG_NF_CONNTRACK

PATCH New Pablo Neira Ayuso 1 participant 1 message Oct 31, 2016

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: fix compilation with !CONFIG_NF_CONNTRACK

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:

Quoted 1 line
Quoted 1 line

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':

Quoted 1 line
Quoted 1 line

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':

Quoted 1 line
Quoted 1 line

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

---
 net/ipv4/netfilter/nf_socket_ipv4.c | 2 ++
 net/ipv6/netfilter/nf_socket_ipv6.c | 2 ++
 2 files changed, 4 insertions(+)
net/ipv4/netfilter/nf_socket_ipv4.c +2 -0
index 5f3741ba4654..a83d558e1aae 100644
@@ -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,
net/ipv6/netfilter/nf_socket_ipv6.c +2 -0
index 95cb0b82ff9a..ebb2bf84232a 100644
@@ -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,
Signature · 1 line
2.1.4