ENOBUILD in nf_tables
Subsystems (4)
Hi Pablo!
I hit the following build breakage on net with the config attached.
GCC 9, doesn't seem like your just-posted series fixes this?
From a quick scan it doesn't seem like your just posted series fixes that, but I didn't actually test (the threading is broken and patchwork
CC include/net/netfilter/nf_tables_offload.h.s
In file included from ../include/net/netfilter/nf_tables.h:8,
from ./../include/net/netfilter/nf_tables_offload.h:5,
from <command-line>:../include/linux/netfilter/x_tables.h: In function ‘xt_net’:../include/linux/netfilter/x_tables.h:46:19: error: dereferencing pointer to incomplete type ‘const struct nf_hook_state’
46 | return par->state->net;
| ^~
In file included from ../include/net/netfilter/nf_tables.h:8,
from ./../include/net/netfilter/nf_tables_offload.h:5,
from <command-line>:../include/linux/netfilter/x_tables.h: At top level:../include/linux/netfilter/x_tables.h:449:64: error: unknown type name ‘nf_hookfn’
449 | struct nf_hook_ops *xt_hook_ops_alloc(const struct xt_table *, nf_hookfn *);
| ^~~~~~~~~
In file included from ../include/net/netfilter/nf_tables.h:12,
from ./../include/net/netfilter/nf_tables_offload.h:5,
from <command-line>:
../include/net/netfilter/nf_flow_table.h:19:2: error: unknown type name ‘nf_hookfn’
19 | nf_hookfn *hook;
| ^~~~~~~~~
In file included from ./../include/net/netfilter/nf_tables_offload.h:5,
from <command-line>:
../include/net/netfilter/nf_tables.h:929:2: error: unknown type name ‘nf_hookfn’
929 | nf_hookfn *hooks[NF_MAX_HOOKS];
| ^~~~~~~~~
../include/net/netfilter/nf_tables.h:957:22: error: field ‘ops’ has incomplete type
957 | struct nf_hook_ops ops;
| ^~~../include/net/netfilter/nf_tables.h: In function ‘nft_gencursor_next’:../include/net/netfilter/nf_tables.h:1223:12: error: ‘const struct net’ has no member named ‘nft’
1223 | return net->nft.gencursor + 1 == 1 ? 1 : 0;
| ^~
In file included from ../include/linux/kernel.h:11,
from ../include/net/flow_offload.h:4,
from ./../include/net/netfilter/nf_tables_offload.h:4,
from <command-line>:../include/net/netfilter/nf_tables.h: In function ‘nft_genmask_cur’:../include/net/netfilter/nf_tables.h:1234:27: error: ‘const struct net’ has no member named ‘nft’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~../include/linux/compiler.h:256:17: note: in definition of macro ‘__READ_ONCE’
256 | union { typeof(x) __val; char __c[1]; } __u; \
| ^../include/net/netfilter/nf_tables.h:1234:14: note: in expansion of macro ‘READ_ONCE’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~~~~~~~~../include/net/netfilter/nf_tables.h:1234:27: error: ‘const struct net’ has no member named ‘nft’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~../include/linux/compiler.h:258:22: note: in definition of macro ‘__READ_ONCE’
258 | __read_once_size(&(x), __u.__c, sizeof(x)); \
| ^../include/net/netfilter/nf_tables.h:1234:14: note: in expansion of macro ‘READ_ONCE’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~~~~~~~~../include/net/netfilter/nf_tables.h:1234:27: error: ‘const struct net’ has no member named ‘nft’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~../include/linux/compiler.h:258:42: note: in definition of macro ‘__READ_ONCE’
258 | __read_once_size(&(x), __u.__c, sizeof(x)); \
| ^../include/net/netfilter/nf_tables.h:1234:14: note: in expansion of macro ‘READ_ONCE’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~~~~~~~~../include/net/netfilter/nf_tables.h:1234:27: error: ‘const struct net’ has no member named ‘nft’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~../include/linux/compiler.h:260:30: note: in definition of macro ‘__READ_ONCE’
260 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
| ^../include/net/netfilter/nf_tables.h:1234:14: note: in expansion of macro ‘READ_ONCE’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~~~~~~~~../include/net/netfilter/nf_tables.h:1234:27: error: ‘const struct net’ has no member named ‘nft’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~../include/linux/compiler.h:260:50: note: in definition of macro ‘__READ_ONCE’
260 | __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \
| ^../include/net/netfilter/nf_tables.h:1234:14: note: in expansion of macro ‘READ_ONCE’
1234 | return 1 << READ_ONCE(net->nft.gencursor);
| ^~~~~~~~~../scripts/Makefile.build:304: recipe for target 'include/net/netfilter/nf_tables_offload.h.s' failed make[2]: *** [include/net/netfilter/nf_tables_offload.h.s] Error 1
make[2]: *** Waiting for unfinished jobs.... /home/jkicinski/devel/linux/Makefile:1077: recipe for target 'include' failed make[1]: *** [include] Error 2
make[1]: Leaving directory '/home/jkicinski/devel/linux/build_randconfig' Makefile:179: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
Pablo Neira Ayuso
maintainerHi Jakub,
Quoted 5 lines · Jakub Kicinski
Hi Pablo!
I hit the following build breakage on net with the config attached.
GCC 9, doesn't seem like your just-posted series fixes this?
$ gcc -v ... gcc version 9.1.0
$ make ... CC include/net/netfilter/nf_tables_offload.h.s ... $
Works for me here.
Quoted 9 lines · Pablo Neira Ayuso
Quoted 3 lines · Jakub Kicinski
I hit the following build breakage on net with the config attached.
GCC 9, doesn't seem like your just-posted series fixes this?
$ gcc -v ... gcc version 9.1.0
Quoted 7 lines
$ make ... CC include/net/netfilter/nf_tables_offload.h.s ... $Works for me here.
I think the compiler version is a red herring. I reproduced the failure with gcc-8 (Debian 8.3.0-6) and gcc-9 (Debian 9.1.0-4). The problem is that CONFIG_HEADER_TEST is defined and nf_tables_offload.h is not on the header-test blacklist, but includes nf_tables.h, which is.
J.
PATCH 1/1 kbuild: add net/netfilter/nf_tables_offload.h to header-test blacklist.
In reply to Jakub Kicinskinet/netfilter/nf_tables_offload.h includes net/netfilter/nf_tables.h which is itself on the blacklist.
--- include/Kbuild | 1 + 1 file changed, 1 insertion(+)
include/Kbuild +1 -0
@@ -909,6 +909,7 @@ header-test- += net/netfilter/nf_tables.h header-test- += net/netfilter/nf_tables_core.h header-test- += net/netfilter/nf_tables_ipv4.h header-test- += net/netfilter/nf_tables_ipv6.h +header-test- += net/netfilter/nf_tables_offload.h header-test- += net/netfilter/nft_fib.h header-test- += net/netfilter/nft_meta.h header-test- += net/netfilter/nft_reject.h
Signature · 1 line
2.20.1
Re: [PATCH net] kbuild: add net/netfilter/nf_tables_offload.h to header-test blacklist.
Quoted 5 lines · Jeremy Sowden
net/netfilter/nf_tables_offload.hincludesnet/netfilter/nf_tables.hwhich is itself on the blacklist.Reported-by Jakub Kicinski <[email protected]>Signed-off-by Jeremy Sowden <[email protected]>
Thanks, I think it would be good later on to review all of the netfilter headers and make them compile via this new CONFIG_HEADER_TEST Kconfig knob.
Re: [PATCH net] kbuild: add net/netfilter/nf_tables_offload.h to header-test blacklist.
In reply to Jeremy SowdenFrom: Jeremy Sowden <[email protected]>
Date: Sun, 21 Jul 2019 12:31:05 +0100
Quoted 5 lines
net/netfilter/nf_tables_offload.hincludesnet/netfilter/nf_tables.hwhich is itself on the blacklist.Reported-by Jakub Kicinski <[email protected]>Signed-off-by Jeremy Sowden <[email protected]>
Applied.
Re: [PATCH net] kbuild: add net/netfilter/nf_tables_offload.h to header-test blacklist.
In reply to Pablo Neira AyusoQuoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Jeremy Sowden
net/netfilter/nf_tables_offload.hincludesnet/netfilter/nf_tables.hwhich is itself on the blacklist.
Quoted 8 lines
Quoted 2 lines
Reported-by Jakub Kicinski <[email protected]>Signed-off-by Jeremy Sowden <[email protected]>Thanks, I think it would be good later on to review all of the netfilter headers and make them compile via this new
CONFIG_HEADER_TESTKconfigknob.
Definitely. The problem in this instance is that linux/netfilter.h wraps some struct definitions and inline functions in "#ifdef CONFIG_NETFILTER" / "#endif", but some of these are required by code defined in other header-files that are not so wrapped, so when CONFIG_NETFILTER is not defined, compilation of those header-files fails. I only took a cursory glance over the week-end and stopped once I found the blacklist. I'll take a more thorough look when I have some time, hopefully later this week.
J.
PATCH 4/8 netfilter: added missing IS_ENABLED(CONFIG_NF_TABLES) check to header-file.
In reply to Jeremy Sowdennf_tables.h defines an API comprising several inline functions and macros that depend on the nft member of struct net. However, this is only defined is CONFIG_NF_TABLES is enabled. Added preprocessor checks to ensure that nf_tables.h will compile if CONFIG_NF_TABLES is disabled.
--- include/net/netfilter/nf_tables.h | 4 ++++ 1 file changed, 4 insertions(+)
include/net/netfilter/nf_tables.h +4 -0
@@ -1207,6 +1207,8 @@ void nft_trace_notify(struct nft_traceinfo *info);#define MODULE_ALIAS_NFT_OBJ (type) \ MODULE_ALIAS("nft-obj-" __stringify(type)) +#if IS_ENABLED (CONFIG_NF_TABLES ) +/* * The gencursor defines two generations, the currently active and the * next one. Objects contain a bitmask of 2 bits specifying the generations
@@ -1280,6 +1282,8 @@ static inline void nft_set_elem_change_active(const struct net *net, ext->genmask ^= nft_genmask_next(net); } +#endif /* IS_ENABLED(CONFIG_NF_TABLES) */ +/* * We use a free bit in the genmask field to indicate the element * is busy, meaning it is currently being processed either by
Signature · 1 line
2.20.1
cover netfilter: header compilation fixes
In reply to Jeremy SowdenA number of netfilter header files are on the header-test blacklist
becuse they cannot be compiled stand-alone. There are two main reasons
for this: missing inclusions of other headers, and missing conditionals checking for CONFIG_* symbols.
The first six of these patches rectify these omissions, the seventh removes some unnecessary "#ifdef __KERNEL__" checks, and the last removes all the NF headers from the blacklist.
I've cc'ed Masahiro Yamada because the last patch removes 74 lines from include/Kbuild and may conflict with his kbuild tree.
Jeremy Sowden (8):
netfilter: inlined four headers files into another one.
netfilter: added missing includes to a number of header-files.
netfilter: added missing IS_ENABLED(CONFIG_BRIDGE_NETFILTER) checks to
header-file.
netfilter: added missing IS_ENABLED(CONFIG_NF_TABLES) check to
header-file.
netfilter: added missing IS_ENABLED(CONFIG_NF_CONNTRACK) checks to
some header-files.
netfilter: added missing IS_ENABLED(CONFIG_NETFILTER) checks to some
header-files.
netfilter: removed "#ifdef __KERNEL__" guards from some headers.
kbuild: removed all netfilter headers from header-test blacklist.
include/Kbuild | 74 ------ include/linux/netfilter/ipset/ip_set.h | 238 +++++++++++++++++- .../linux/netfilter/ipset/ip_set_comment.h | 73 ------ .../linux/netfilter/ipset/ip_set_counter.h | 84 ------- .../linux/netfilter/ipset/ip_set_getport.h | 4 + .../linux/netfilter/ipset/ip_set_skbinfo.h | 42 ---- .../linux/netfilter/ipset/ip_set_timeout.h | 77 ------ include/linux/netfilter/nf_conntrack_amanda.h | 4 + include/linux/netfilter/nf_conntrack_dccp.h | 3 - include/linux/netfilter/nf_conntrack_ftp.h | 8 +- include/linux/netfilter/nf_conntrack_h323.h | 11 +- .../linux/netfilter/nf_conntrack_h323_asn1.h | 2 + include/linux/netfilter/nf_conntrack_irc.h | 5 +- include/linux/netfilter/nf_conntrack_pptp.h | 12 +- .../linux/netfilter/nf_conntrack_proto_gre.h | 2 - include/linux/netfilter/nf_conntrack_sane.h | 4 - include/linux/netfilter/nf_conntrack_sip.h | 6 +- include/linux/netfilter/nf_conntrack_snmp.h | 3 + include/linux/netfilter/nf_conntrack_tftp.h | 5 + include/linux/netfilter/x_tables.h | 6 + include/linux/netfilter_arp/arp_tables.h | 2 + include/linux/netfilter_bridge/ebtables.h | 2 + include/linux/netfilter_ipv4/ip_tables.h | 4 + include/linux/netfilter_ipv6/ip6_tables.h | 2 + include/net/netfilter/br_netfilter.h | 12 + include/net/netfilter/ipv4/nf_dup_ipv4.h | 3 + include/net/netfilter/ipv6/nf_defrag_ipv6.h | 4 +- include/net/netfilter/ipv6/nf_dup_ipv6.h | 2 + include/net/netfilter/nf_conntrack.h | 10 + include/net/netfilter/nf_conntrack_acct.h | 13 + include/net/netfilter/nf_conntrack_bridge.h | 6 + include/net/netfilter/nf_conntrack_core.h | 3 + include/net/netfilter/nf_conntrack_count.h | 3 + include/net/netfilter/nf_conntrack_l4proto.h | 4 + .../net/netfilter/nf_conntrack_timestamp.h | 6 + include/net/netfilter/nf_conntrack_tuple.h | 2 + include/net/netfilter/nf_dup_netdev.h | 2 + include/net/netfilter/nf_flow_table.h | 5 + include/net/netfilter/nf_nat.h | 4 + include/net/netfilter/nf_nat_helper.h | 4 +- include/net/netfilter/nf_nat_redirect.h | 3 + include/net/netfilter/nf_queue.h | 7 + include/net/netfilter/nf_reject.h | 3 + include/net/netfilter/nf_synproxy.h | 4 + include/net/netfilter/nf_tables.h | 12 + include/net/netfilter/nf_tables_ipv6.h | 1 + include/net/netfilter/nft_fib.h | 2 + include/net/netfilter/nft_meta.h | 2 + include/net/netfilter/nft_reject.h | 5 + include/uapi/linux/netfilter/xt_policy.h | 1 + net/netfilter/ipset/ip_set_hash_gen.h | 2 +- net/netfilter/xt_set.c | 1 - 52 files changed, 409 insertions(+), 390 deletions(-) delete mode 100644 include/linux/netfilter/ipset/ip_set_comment.h delete mode 100644 include/linux/netfilter/ipset/ip_set_counter.h delete mode 100644 include/linux/netfilter/ipset/ip_set_skbinfo.h delete mode 100644 include/linux/netfilter/ipset/ip_set_timeout.h
Signature · 1 line
2.20.1
PATCH 1/8 netfilter: inlined four headers files into another one.
linux/netfilter/ipset/ip_set.h included four other header files:
include/linux/netfilter/ipset/ip_set_comment.h
include/linux/netfilter/ipset/ip_set_counter.h
include/linux/netfilter/ipset/ip_set_skbinfo.h
include/linux/netfilter/ipset/ip_set_timeout.h
Of these the first three were not included anywhere else. The last, ip_set_timeout.h, was included in a couple of other places, but defined inline functions which call other inline functions defined in ip_set.h, so ip_set.h had to be included before it.
Inlined all four into ip_set.h, and updated the other files that included ip_set_timeout.h.
--- include/linux/netfilter/ipset/ip_set.h | 238 +++++++++++++++++- .../linux/netfilter/ipset/ip_set_comment.h | 73 ------ .../linux/netfilter/ipset/ip_set_counter.h | 84 ------- .../linux/netfilter/ipset/ip_set_skbinfo.h | 42 ---- .../linux/netfilter/ipset/ip_set_timeout.h | 77 ------ net/netfilter/ipset/ip_set_hash_gen.h | 2 +- net/netfilter/xt_set.c | 1 - 7 files changed, 235 insertions(+), 282 deletions(-) delete mode 100644 include/linux/netfilter/ipset/ip_set_comment.h delete mode 100644 include/linux/netfilter/ipset/ip_set_counter.h delete mode 100644 include/linux/netfilter/ipset/ip_set_skbinfo.h delete mode 100644 include/linux/netfilter/ipset/ip_set_timeout.h
include/linux/netfilter/ipset/ip_set.h +234 -4
@@ -452,10 +452,240 @@ bitmap_bytes(u32 a, u32 b)return 4 * ((((b - a +8 ) /8 ) +3 ) /4 ); } -#include <linux/netfilter/ipset/ip_set_timeout.h> -#include <linux/netfilter/ipset/ip_set_comment.h> -#include <linux/netfilter/ipset/ip_set_counter.h> -#include <linux/netfilter/ipset/ip_set_skbinfo.h> +/* How often should the gc be run by default */ +#define IPSET_GC_TIME (3 * 60) + +/* Timeout period depending on the timeout value of the given set */ +#define IPSET_GC_PERIOD (timeout) \ + ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) + +/* Entry is set with no timeout value */ +#define IPSET_ELEM_PERMANENT 0 + +/* Set is defined with timeout support: timeout value may be 0 */ +#define IPSET_NO_TIMEOUT UINT_MAX + +/* Max timeout value, see msecs_to_jiffies() in jiffies.h */ +#define IPSET_MAX_TIMEOUT (UINT_MAX >> 1)/MSEC_PER_SEC + +#define ip_set_adt_opt_timeout (opt, set) \ +((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (set)->timeout) + +static inline unsigned int +ip_set_timeout_uget (struct nlattr *tb) +{ +unsigned int timeout =ip_set_get_h32 (tb); + +/* Normalize to fit into jiffies */ +if (timeout >IPSET_MAX_TIMEOUT ) + timeout =IPSET_MAX_TIMEOUT ; + +return timeout; +} + +static inline bool +ip_set_timeout_expired (const unsigned long *t) +{ +return *t !=IPSET_ELEM_PERMANENT &&time_is_before_jiffies (*t); +} + +static inline void +ip_set_timeout_set (unsigned long *timeout,u32 value) +{ +unsigned long t; + +if (!value) { + *timeout =IPSET_ELEM_PERMANENT ; +return ; + } + + t =msecs_to_jiffies (value *MSEC_PER_SEC ) + jiffies; +if (t ==IPSET_ELEM_PERMANENT ) +/* Bingo! :-) */ + t--; + *timeout = t; +} + +static inline u32 +ip_set_timeout_get (const unsigned long *timeout) +{ +u32 t; + +if (*timeout ==IPSET_ELEM_PERMANENT ) +return 0 ; + + t =jiffies_to_msecs (*timeout - jiffies)/MSEC_PER_SEC ; +/* Zero value in userspace means no timeout */ +return t ==0 ?1 : t; +} + +static inline char * +ip_set_comment_uget (struct nlattr *tb) +{ +return nla_data (tb); +} + +/* Called from uadd only, protected by the set spinlock. +* The kadt functions don't use the comment extensions in any way. +*/ +static inline void +ip_set_init_comment (struct ip_set *set,struct ip_set_comment *comment, +const struct ip_set_ext *ext) +{ +struct ip_set_comment_rcu *c =rcu_dereference_protected (comment->c,1 ); +size_t len = ext->comment ?strlen (ext->comment) :0 ; + +if (unlikely (c)) { + set->ext_size -=sizeof (*c) +strlen (c->str) +1 ; +kfree_rcu (c, rcu); +rcu_assign_pointer (comment->c,NULL ); + } +if (!len) +return ; +if (unlikely (len >IPSET_MAX_COMMENT_SIZE )) + len =IPSET_MAX_COMMENT_SIZE ; + c =kmalloc (sizeof (*c) + len +1 ,GFP_ATOMIC ); +if (unlikely (!c)) +return ; +strlcpy (c->str, ext->comment, len +1 ); + set->ext_size +=sizeof (*c) +strlen (c->str) +1 ; +rcu_assign_pointer (comment->c, c); +} + +/* Used only when dumping a set, protected by rcu_read_lock() */ +static inline int +ip_set_put_comment (struct sk_buff *skb,const struct ip_set_comment *comment) +{ +struct ip_set_comment_rcu *c =rcu_dereference (comment->c); + +if (!c) +return 0 ; +return nla_put_string (skb,IPSET_ATTR_COMMENT , c->str); +} + +/* Called from uadd/udel, flush or the garbage collectors protected +* by the set spinlock. +* Called when the set is destroyed and when there can't be any user +* of the set data anymore. +*/ +static inline void +ip_set_comment_free (struct ip_set *set,struct ip_set_comment *comment) +{ +struct ip_set_comment_rcu *c; + + c =rcu_dereference_protected (comment->c,1 ); +if (unlikely (!c)) +return ; + set->ext_size -=sizeof (*c) +strlen (c->str) +1 ; +kfree_rcu (c, rcu); +rcu_assign_pointer (comment->c,NULL ); +} + +static inline void +ip_set_add_bytes (u64 bytes,struct ip_set_counter *counter) +{ +atomic64_add ((long long )bytes, &(counter)->bytes); +} + +static inline void +ip_set_add_packets (u64 packets,struct ip_set_counter *counter) +{ +atomic64_add ((long long )packets, &(counter)->packets); +} + +static inline u64 +ip_set_get_bytes (const struct ip_set_counter *counter) +{ +return (u64 )atomic64_read (&(counter)->bytes); +} + +static inline u64 +ip_set_get_packets (const struct ip_set_counter *counter) +{ +return (u64 )atomic64_read (&(counter)->packets); +} + +static inline bool +ip_set_match_counter (u64 counter,u64 match,u8 op) +{ +switch (op) { +case IPSET_COUNTER_NONE : +return true; +case IPSET_COUNTER_EQ : +return counter == match; +case IPSET_COUNTER_NE : +return counter != match; +case IPSET_COUNTER_LT : +return counter < match; +case IPSET_COUNTER_GT : +return counter > match; + } +return false; +} + +static inline void +ip_set_update_counter (struct ip_set_counter *counter, +const struct ip_set_ext *ext,u32 flags) +{ +if (ext->packets !=ULLONG_MAX && + !(flags &IPSET_FLAG_SKIP_COUNTER_UPDATE )) { +ip_set_add_bytes (ext->bytes, counter); +ip_set_add_packets (ext->packets, counter); + } +} + +static inline bool +ip_set_put_counter (struct sk_buff *skb,const struct ip_set_counter *counter) +{ +return nla_put_net64 (skb,IPSET_ATTR_BYTES , +cpu_to_be64 (ip_set_get_bytes (counter)), +IPSET_ATTR_PAD ) || +nla_put_net64 (skb,IPSET_ATTR_PACKETS , +cpu_to_be64 (ip_set_get_packets (counter)), +IPSET_ATTR_PAD ); +} + +static inline void +ip_set_init_counter (struct ip_set_counter *counter, +const struct ip_set_ext *ext) +{ +if (ext->bytes !=ULLONG_MAX ) +atomic64_set (&(counter)->bytes, (long long )(ext->bytes)); +if (ext->packets !=ULLONG_MAX ) +atomic64_set (&(counter)->packets, (long long )(ext->packets)); +} + +static inline void +ip_set_get_skbinfo (struct ip_set_skbinfo *skbinfo, +const struct ip_set_ext *ext, +struct ip_set_ext *mext,u32 flags) +{ + mext->skbinfo = *skbinfo; +} + +static inline bool +ip_set_put_skbinfo (struct sk_buff *skb,const struct ip_set_skbinfo *skbinfo) +{ +/* Send nonzero parameters only */ +return ((skbinfo->skbmark || skbinfo->skbmarkmask) && +nla_put_net64 (skb,IPSET_ATTR_SKBMARK , +cpu_to_be64 ((u64 )skbinfo->skbmark <<32 | + skbinfo->skbmarkmask), +IPSET_ATTR_PAD )) || + (skbinfo->skbprio && +nla_put_net32 (skb,IPSET_ATTR_SKBPRIO , +cpu_to_be32 (skbinfo->skbprio))) || + (skbinfo->skbqueue && +nla_put_net16 (skb,IPSET_ATTR_SKBQUEUE , +cpu_to_be16 (skbinfo->skbqueue))); +} + +static inline void +ip_set_init_skbinfo (struct ip_set_skbinfo *skbinfo, +const struct ip_set_ext *ext) +{ + *skbinfo = ext->skbinfo; +}#define IP_SET_INIT_KEXT (skb, opt, set) \ { .bytes = (skb)->len, .packets = 1, \
include/linux/netfilter/ipset/ip_set_comment.h deleted +0 -73
73 lines not on this page · raw message
include/linux/netfilter/ipset/ip_set_counter.h deleted +0 -84
84 lines not on this page · raw message
include/linux/netfilter/ipset/ip_set_skbinfo.h deleted +0 -42
42 lines not on this page · raw message
include/linux/netfilter/ipset/ip_set_timeout.h deleted +0 -77
77 lines not on this page · raw message
net/netfilter/ipset/ip_set_hash_gen.h +1 -1
@@ -7,7 +7,7 @@#include <linux/rcupdate.h> #include <linux/jhash.h> #include <linux/types.h> -#include <linux/netfilter/ipset/ip_set_timeout.h> +#include <linux/netfilter/ipset/ip_set.h> #define __ipset_dereference_protected (p, c) rcu_dereference_protected(p, c)#define ipset_dereference_protected (p, set) \
net/netfilter/xt_set.c +0 -1
@@ -14,7 +14,6 @@#include <linux/netfilter/x_tables.h> #include <linux/netfilter/ipset/ip_set.h> -#include <linux/netfilter/ipset/ip_set_timeout.h> #include <uapi/linux/netfilter/xt_set.h> MODULE_LICENSE ("GPL" );
Signature · 1 line
2.20.1
PATCH 3/8 netfilter: added missing IS_ENABLED(CONFIG_BRIDGE_NETFILTER) checks to header-file.
In reply to Jeremy Sowdenbr_netfilter.h defines inline functions that use an enum constant and struct member that are only defined if CONFIG_BRIDGE_NETFILTER is enabled. Added preprocessor checks to ensure br_netfilter.h will compile if CONFIG_BRIDGE_NETFILTER is disabled.
--- include/net/netfilter/br_netfilter.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/net/netfilter/br_netfilter.h +8 -0
@@ -8,12 +8,16 @@static inline struct nf_bridge_info *nf_bridge_alloc (struct sk_buff *skb) { +#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER )struct nf_bridge_info *b =skb_ext_add (skb,SKB_EXT_BRIDGE_NF );if (b)memset (b,0 ,sizeof (*b));return b; +#else +return NULL ; +#endif }void nf_bridge_update_protocol (struct sk_buff *skb);
@@ -38,10 +42,14 @@ int br_nf_pre_routing_finish_bridge(struct net *net, struct sock *sk, struct sk_static inline struct rtable *bridge_parent_rtable (const struct net_device *dev) { +#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER )struct net_bridge_port *port; port =br_port_get_rcu (dev);return port ? &port->br->fake_rtable :NULL ; +#else +return NULL ; +#endif } struct net_device *setup_pre_routing(struct sk_buff *skb,
Signature · 1 line
2.20.1
PATCH 5/8 netfilter: added missing IS_ENABLED(CONFIG_NF_CONNTRACK) checks to some header-files.
In reply to Jeremy Sowdenstruct nf_conn contains a "struct nf_conntrack ct_general" member and struct net contains a "struct netns_ct ct" member which are both only defined in CONFIG_NF_CONNTRACK is enabled. These members are used in a number of inline functions defined in other header-files. Added preprocessor checks to make sure the headers will compile if CONFIG_NF_CONNTRACK is disabled.
--- include/net/netfilter/nf_conntrack.h | 10 ++++++++++ include/net/netfilter/nf_conntrack_acct.h | 13 +++++++++++++ include/net/netfilter/nf_conntrack_l4proto.h | 2 ++ include/net/netfilter/nf_conntrack_timestamp.h | 6 ++++++ 4 files changed, 31 insertions(+)
include/net/netfilter/nf_conntrack.h +10 -0
@@ -59,6 +59,7 @@ struct nf_conntrack_net {#include <net/netfilter/ipv6/nf_conntrack_ipv6.h> struct nf_conn { +#if IS_ENABLED (CONFIG_NF_CONNTRACK )/* Usage count in here is 1 for hash table, 1 per skb, * plus 1 for any connection(s) we are `master' for *
@@ -68,6 +69,7 @@ struct nf_conn {* beware nf_ct_get() is different and don't inc refcnt. */ struct nf_conntrack ct_general; +#endif spinlock_t lock;/* jiffies32 when this ct is considered dead */
@@ -148,6 +150,8 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,int nf_conntrack_tuple_taken (const struct nf_conntrack_tuple *tuple,const struct nf_conn *ignored_conntrack); +#if IS_ENABLED (CONFIG_NF_CONNTRACK ) +#define NFCT_INFOMASK 7UL#define NFCT_PTRMASK ~(NFCT_INFOMASK)
@@ -167,6 +171,8 @@ static inline void nf_ct_put(struct nf_conn *ct) nf_conntrack_put(&ct->ct_general); } +#endif +/* Protocol module loading */ int nf_ct_l3proto_try_module_get (unsigned short l3proto);void nf_ct_l3proto_module_put (unsigned short l3proto);
@@ -318,12 +324,16 @@ void nf_ct_tmpl_free(struct nf_conn *tmpl);u32 nf_ct_get_id (const struct nf_conn *ct); +#if IS_ENABLED (CONFIG_NF_CONNTRACK ) +static inline void nf_ct_set (struct sk_buff *skb,struct nf_conn *ct,enum ip_conntrack_info info) { skb->_nfct = (unsigned long )ct | info; } +#endif +#define NF_CT_STAT_INC (net, count) __this_cpu_inc((net)->ct.stat->count)#define NF_CT_STAT_INC_ATOMIC (net, count) this_cpu_inc((net)->ct.stat->count)#define NF_CT_STAT_ADD_ATOMIC (net, count, v) this_cpu_add((net)->ct.stat->count, (v))
include/net/netfilter/nf_conntrack_acct.h +13 -0
@@ -29,6 +29,7 @@ struct nf_conn_acct *nf_conn_acct_find(const struct nf_conn *ct)static inline struct nf_conn_acct *nf_ct_acct_ext_add (struct nf_conn *ct,gfp_t gfp) { +#if IS_ENABLED (CONFIG_NF_CONNTRACK )struct net *net =nf_ct_net (ct);struct nf_conn_acct *acct;
@@ -41,22 +42,34 @@ struct nf_conn_acct *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)return acct; +#else +return NULL ; +#endif };/* Check if connection tracking accounting is enabled */ static inline bool nf_ct_acct_enabled (struct net *net) { +#if IS_ENABLED (CONFIG_NF_CONNTRACK )return net->ct.sysctl_acct !=0 ; +#else +return false; +#endif }/* Enable/disable connection tracking accounting */ static inline void nf_ct_set_acct (struct net *net,bool enable) { +#if IS_ENABLED (CONFIG_NF_CONNTRACK ) net->ct.sysctl_acct = enable; +#endif } +#if IS_ENABLED (CONFIG_NF_CONNTRACK )void nf_conntrack_acct_pernet_init (struct net *net);int nf_conntrack_acct_init (void );void nf_conntrack_acct_fini (void ); +#endif /* IS_ENABLED(CONFIG_NF_CONNTRACK) */ +#endif /* _NF_CONNTRACK_ACCT_H */
include/net/netfilter/nf_conntrack_l4proto.h +2 -0
@@ -176,6 +176,7 @@ void nf_ct_l4proto_log_invalid(const struct sk_buff *skb, const char *fmt, ...) { }#endif /* CONFIG_SYSCTL */ +#if IS_ENABLED (CONFIG_NF_CONNTRACK )static inline struct nf_generic_net *nf_generic_pernet (struct net *net) {return &net->ct.nf_ct_proto.generic;
@@ -200,6 +201,7 @@ static inline struct nf_icmp_net *nf_icmpv6_pernet(struct net *net) {return &net->ct.nf_ct_proto.icmpv6; } +#endif #ifdef CONFIG_NF_CT_PROTO_DCCP static inline struct nf_dccp_net *nf_dccp_pernet (struct net *net)
include/net/netfilter/nf_conntrack_timestamp.h +6 -0
@@ -40,12 +40,18 @@ struct nf_conn_tstamp *nf_ct_tstamp_ext_add(struct nf_conn *ct, gfp_t gfp)static inline bool nf_ct_tstamp_enabled (struct net *net) { +#if IS_ENABLED (CONFIG_NF_CONNTRACK )return net->ct.sysctl_tstamp !=0 ; +#else +return false; +#endif }static inline void nf_ct_set_tstamp (struct net *net,bool enable) { +#if IS_ENABLED (CONFIG_NF_CONNTRACK ) net->ct.sysctl_tstamp = enable; +#endif }#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
Signature · 1 line
2.20.1
PATCH 2/8 netfilter: added missing includes to a number of header-files.
In reply to Jeremy SowdenA number of netfilter header-files used declarations and definitions from other headers without including them. Added include directives to make those declarations and definitions available.
--- include/linux/netfilter/ipset/ip_set_getport.h | 4 ++++ include/linux/netfilter/nf_conntrack_amanda.h | 4 ++++ include/linux/netfilter/nf_conntrack_ftp.h | 8 +++++--- include/linux/netfilter/nf_conntrack_h323.h | 7 +++++-- include/linux/netfilter/nf_conntrack_h323_asn1.h | 2 ++ include/linux/netfilter/nf_conntrack_irc.h | 4 ++++ include/linux/netfilter/nf_conntrack_pptp.h | 9 +++++---- include/linux/netfilter/nf_conntrack_sip.h | 4 ++-- include/linux/netfilter/nf_conntrack_snmp.h | 3 +++ include/linux/netfilter/nf_conntrack_tftp.h | 5 +++++ include/net/netfilter/br_netfilter.h | 2 ++ include/net/netfilter/ipv4/nf_dup_ipv4.h | 3 +++ include/net/netfilter/ipv6/nf_defrag_ipv6.h | 4 +++- include/net/netfilter/ipv6/nf_dup_ipv6.h | 2 ++ include/net/netfilter/nf_conntrack_bridge.h | 4 ++++ include/net/netfilter/nf_conntrack_count.h | 3 +++ include/net/netfilter/nf_dup_netdev.h | 2 ++ include/net/netfilter/nf_flow_table.h | 1 + include/net/netfilter/nf_nat_helper.h | 4 ++-- include/net/netfilter/nf_nat_redirect.h | 3 +++ include/net/netfilter/nf_queue.h | 2 ++ include/net/netfilter/nf_reject.h | 3 +++ include/net/netfilter/nf_tables_ipv6.h | 1 + include/net/netfilter/nft_fib.h | 2 ++ include/net/netfilter/nft_meta.h | 2 ++ include/net/netfilter/nft_reject.h | 5 +++++ include/uapi/linux/netfilter/xt_policy.h | 1 + 27 files changed, 80 insertions(+), 14 deletions(-)
include/linux/netfilter/ipset/ip_set_getport.h +4 -0
@@ -2,6 +2,10 @@#ifndef _IP_SET_GETPORT_H#define _IP_SET_GETPORT_H +#include <linux/skbuff.h> +#include <linux/types.h> +#include <uapi/linux/in.h> +extern bool ip_set_get_ip4_port (const struct sk_buff *skb,bool src,__be16 *port,u8 *proto);
include/linux/netfilter/nf_conntrack_amanda.h +4 -0
@@ -3,6 +3,10 @@#define _NF_CONNTRACK_AMANDA_H/* AMANDA tracking. */ +#include <linux/netfilter.h> +#include <linux/skbuff.h> +#include <net/netfilter/nf_conntrack_expect.h> + extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff,
include/linux/netfilter/nf_conntrack_ftp.h +5 -3
@@ -2,8 +2,12 @@#ifndef _NF_CONNTRACK_FTP_H#define _NF_CONNTRACK_FTP_H +#include <linux/netfilter.h> +#include <linux/skbuff.h> +#include <linux/types.h> +#include <net/netfilter/nf_conntrack_expect.h> #include <uapi/linux/netfilter/nf_conntrack_ftp.h> - +#include <uapi/linux/netfilter/nf_conntrack_tuple_common.h> #define FTP_PORT 21
@@ -20,8 +24,6 @@ struct nf_ct_ftp_master {u_int16_t flags[IP_CT_DIR_MAX ]; }; -struct nf_conntrack_expect ; -/* For NAT to hook in when we find a packet which describes what other * connection we should expect. */ extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
include/linux/netfilter/nf_conntrack_h323.h +5 -2
@@ -4,7 +4,12 @@#ifdef __KERNEL__ +#include <linux/netfilter.h> +#include <linux/skbuff.h> +#include <linux/types.h> #include <linux/netfilter/nf_conntrack_h323_asn1.h> +#include <net/netfilter/nf_conntrack_expect.h> +#include <uapi/linux/netfilter/nf_conntrack_tuple_common.h> #define RAS_PORT 1719#define Q931_PORT 1720
@@ -28,8 +33,6 @@ struct nf_ct_h323_master { }; }; -struct nf_conn ; -int get_h225_addr (struct nf_conn *ct,unsigned char *data,TransportAddress *taddr,union nf_inet_addr *addr,__be16 *port);
include/linux/netfilter/nf_conntrack_h323_asn1.h +2 -0
@@ -37,6 +37,8 @@/***************************************************************************** * H.323 Types ****************************************************************************/ + +#include <linux/types.h> #include <linux/netfilter/nf_conntrack_h323_types.h> typedef struct {
include/linux/netfilter/nf_conntrack_irc.h +4 -0
@@ -4,6 +4,10 @@#ifdef __KERNEL__ +#include <linux/netfilter.h> +#include <linux/skbuff.h> +#include <net/netfilter/nf_conntrack_expect.h> +#define IRC_PORT 6667 extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,
include/linux/netfilter/nf_conntrack_pptp.h +5 -4
@@ -3,7 +3,12 @@#ifndef _NF_CONNTRACK_PPTP_H#define _NF_CONNTRACK_PPTP_H +#include <linux/netfilter.h> +#include <linux/skbuff.h> +#include <linux/types.h> #include <linux/netfilter/nf_conntrack_common.h> +#include <net/netfilter/nf_conntrack_expect.h> +#include <uapi/linux/netfilter/nf_conntrack_tuple_common.h> extern const char *const pptp_msg_name[];
@@ -297,10 +302,6 @@ union pptp_ctrl_union {struct PptpSetLinkInfo setlink; }; -/* crap needed for nf_conntrack_compat.h */ -struct nf_conn ; -struct nf_conntrack_expect ; - extern int (*nf_nat_pptp_hook_outbound)(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info ctinfo,
include/linux/netfilter/nf_conntrack_sip.h +2 -2
@@ -3,9 +3,9 @@#define __NF_CONNTRACK_SIP_H__#ifdef __KERNEL__ -#include <net/netfilter/nf_conntrack_expect.h> - +#include <linux/skbuff.h> #include <linux/types.h> +#include <net/netfilter/nf_conntrack_expect.h> #define SIP_PORT 5060#define SIP_TIMEOUT 3600
include/linux/netfilter/nf_conntrack_snmp.h +3 -0
@@ -2,6 +2,9 @@#ifndef _NF_CONNTRACK_SNMP_H#define _NF_CONNTRACK_SNMP_H +#include <linux/netfilter.h> +#include <linux/skbuff.h> + extern int (*nf_nat_snmp_hook)(struct sk_buff *skb, unsigned int protoff, struct nf_conn *ct,
include/linux/netfilter/nf_conntrack_tftp.h +5 -0
@@ -4,6 +4,11 @@#define TFTP_PORT 69 +#include <linux/netfilter.h> +#include <linux/skbuff.h> +#include <linux/types.h> +#include <net/netfilter/nf_conntrack_expect.h> +struct tftphdr {__be16 opcode; };
include/net/netfilter/br_netfilter.h +2 -0
@@ -2,6 +2,8 @@#ifndef _BR_NETFILTER_H_#define _BR_NETFILTER_H_ +#include <linux/netfilter.h> +#include "../../../net/bridge/br_private.h" static inline struct nf_bridge_info *nf_bridge_alloc (struct sk_buff *skb)
include/net/netfilter/ipv4/nf_dup_ipv4.h +3 -0
@@ -2,6 +2,9 @@#ifndef _NF_DUP_IPV4_H_#define _NF_DUP_IPV4_H_ +#include <linux/skbuff.h> +#include <uapi/linux/in.h> +void nf_dup_ipv4 (struct net *net,struct sk_buff *skb,unsigned int hooknum,const struct in_addr *gw,int oif);
include/net/netfilter/ipv6/nf_defrag_ipv6.h +3 -1
@@ -2,7 +2,9 @@#ifndef _NF_DEFRAG_IPV6_H#define _NF_DEFRAG_IPV6_H -struct net ; +#include <linux/skbuff.h> +#include <linux/types.h> +int nf_defrag_ipv6_enable (struct net *);int nf_ct_frag6_init (void );
include/net/netfilter/ipv6/nf_dup_ipv6.h +2 -0
@@ -2,6 +2,8 @@#ifndef _NF_DUP_IPV6_H_#define _NF_DUP_IPV6_H_ +#include <linux/skbuff.h> +void nf_dup_ipv6 (struct net *net,struct sk_buff *skb,unsigned int hooknum,const struct in6_addr *gw,int oif);
include/net/netfilter/nf_conntrack_bridge.h +4 -0
@@ -1,6 +1,10 @@ #ifndef NF_CONNTRACK_BRIDGE_ #define NF_CONNTRACK_BRIDGE_ +#include <linux/module.h> +#include <linux/types.h> +#include <uapi/linux/if_ether.h> + struct nf_ct_bridge_info { struct nf_hook_ops *ops; unsigned int ops_size;
include/net/netfilter/nf_conntrack_count.h +3 -0
@@ -2,6 +2,9 @@#define _NF_CONNTRACK_COUNT_H#include <linux/list.h> +#include <linux/spinlock.h> +#include <net/netfilter/nf_conntrack_tuple.h> +#include <net/netfilter/nf_conntrack_zones.h> struct nf_conncount_data ;
include/net/netfilter/nf_dup_netdev.h +2 -0
@@ -2,6 +2,8 @@#ifndef _NF_DUP_NETDEV_H_#define _NF_DUP_NETDEV_H_ +#include <net/netfilter/nf_tables.h> +void nf_dup_netdev_egress (const struct nft_pktinfo *pkt,int oif);void nf_fwd_netdev_egress (const struct nft_pktinfo *pkt,int oif);
include/net/netfilter/nf_flow_table.h +1 -0
@@ -6,6 +6,7 @@#include <linux/netdevice.h> #include <linux/rhashtable-types.h> #include <linux/rcupdate.h> +#include <linux/netfilter.h> #include <linux/netfilter/nf_conntrack_tuple_common.h> #include <net/dst.h>
include/net/netfilter/nf_nat_helper.h +2 -2
@@ -3,9 +3,9 @@#define _NF_NAT_HELPER_H/* NAT protocol helper routines. */ +#include <linux/skbuff.h> #include <net/netfilter/nf_conntrack.h> - -struct sk_buff ; +#include <net/netfilter/nf_conntrack_expect.h> /* These return true or false. */ bool __nf_nat_mangle_tcp_packet(struct sk_buff *skb, struct nf_conn *ct,
include/net/netfilter/nf_nat_redirect.h +3 -0
@@ -2,6 +2,9 @@#ifndef _NF_NAT_REDIRECT_H_#define _NF_NAT_REDIRECT_H_ +#include <linux/skbuff.h> +#include <uapi/linux/netfilter/nf_nat.h> + unsigned int nf_nat_redirect_ipv4(struct sk_buff *skb, const struct nf_nat_ipv4_multi_range_compat *mr,
include/net/netfilter/nf_queue.h +2 -0
@@ -5,6 +5,8 @@#include <linux/ip.h> #include <linux/ipv6.h> #include <linux/jhash.h> +#include <linux/netfilter.h> +#include <linux/skbuff.h> /* Each queued (to userspace) skbuff has one of these. */ struct nf_queue_entry {
include/net/netfilter/nf_reject.h +3 -0
@@ -2,6 +2,9 @@#ifndef _NF_REJECT_H#define _NF_REJECT_H +#include <linux/types.h> +#include <uapi/linux/in.h> +static inline bool nf_reject_verify_csum (__u8 proto) {/* Skip protocols that don't use 16-bit one's complement checksum
include/net/netfilter/nf_tables_ipv6.h +1 -0
@@ -4,6 +4,7 @@#include <linux/netfilter_ipv6/ip6_tables.h> #include <net/ipv6.h> +#include <net/netfilter/nf_tables.h> static inline void nft_set_pktinfo_ipv6 (struct nft_pktinfo *pkt,struct sk_buff *skb)
include/net/netfilter/nft_fib.h +2 -0
@@ -2,6 +2,8 @@ #ifndef _NFT_FIB_H_ #define _NFT_FIB_H_ +#include <net/netfilter/nf_tables.h> + struct nft_fib { enum nft_registers dreg:8; u8 result;
include/net/netfilter/nft_meta.h +2 -0
@@ -2,6 +2,8 @@ #ifndef _NFT_META_H_ #define _NFT_META_H_ +#include <net/netfilter/nf_tables.h> + struct nft_meta { enum nft_meta_keys key:8; union {
include/net/netfilter/nft_reject.h +5 -0
@@ -2,6 +2,11 @@ #ifndef _NFT_REJECT_H_ #define _NFT_REJECT_H_ +#include <linux/types.h> +#include <net/netlink.h> +#include <net/netfilter/nf_tables.h> +#include <uapi/linux/netfilter/nf_tables.h> + struct nft_reject { enum nft_reject_types type:8; u8 icmp_code;
include/uapi/linux/netfilter/xt_policy.h +1 -0
@@ -2,6 +2,7 @@#ifndef _XT_POLICY_H#define _XT_POLICY_H +#include <linux/netfilter.h> #include <linux/types.h> #include <linux/in.h> #include <linux/in6.h>
Signature · 1 line
2.20.1
PATCH 8/8 kbuild: removed all netfilter headers from header-test blacklist.
In reply to Jeremy SowdenAll the blacklisted NF headers can now be compiled stand-alone, so removed them from the blacklist.
--- include/Kbuild | 74 -------------------------------------------------- 1 file changed, 74 deletions(-)
include/Kbuild +0 -74
@@ -386,31 +386,6 @@ header-test- += linux/mvebu-pmsu.h header-test- += linux/mxm-wmi.h header-test- += linux/n_r3964.h header-test- += linux/ndctl.h -header-test- += linux/netfilter/ipset/ip_set.h -header-test- += linux/netfilter/ipset/ip_set_bitmap.h -header-test- += linux/netfilter/ipset/ip_set_comment.h -header-test- += linux/netfilter/ipset/ip_set_counter.h -header-test- += linux/netfilter/ipset/ip_set_getport.h -header-test- += linux/netfilter/ipset/ip_set_hash.h -header-test- += linux/netfilter/ipset/ip_set_list.h -header-test- += linux/netfilter/ipset/ip_set_skbinfo.h -header-test- += linux/netfilter/ipset/ip_set_timeout.h -header-test- += linux/netfilter/nf_conntrack_amanda.h -header-test- += linux/netfilter/nf_conntrack_ftp.h -header-test- += linux/netfilter/nf_conntrack_h323.h -header-test- += linux/netfilter/nf_conntrack_h323_asn1.h -header-test- += linux/netfilter/nf_conntrack_irc.h -header-test- += linux/netfilter/nf_conntrack_pptp.h -header-test- += linux/netfilter/nf_conntrack_proto_gre.h -header-test- += linux/netfilter/nf_conntrack_sip.h -header-test- += linux/netfilter/nf_conntrack_snmp.h -header-test- += linux/netfilter/nf_conntrack_tftp.h -header-test- += linux/netfilter/x_tables.h -header-test- += linux/netfilter_arp/arp_tables.h -header-test- += linux/netfilter_bridge/ebtables.h -header-test- += linux/netfilter_ipv4/ip4_tables.h -header-test- += linux/netfilter_ipv4/ip_tables.h -header-test- += linux/netfilter_ipv6/ip6_tables.h header-test- += linux/nfs.h header-test- += linux/nfs_fs_i.h header-test- += linux/nfs_fs_sb.h
@@ -874,43 +849,6 @@ header-test- += net/mpls_iptunnel.h header-test- += net/mrp.h header-test- += net/ncsi.h header-test- += net/netevent.h -header-test- += net/netfilter/br_netfilter.h -header-test- += net/netfilter/ipv4/nf_dup_ipv4.h -header-test- += net/netfilter/ipv6/nf_defrag_ipv6.h -header-test- += net/netfilter/ipv6/nf_dup_ipv6.h -header-test- += net/netfilter/nf_conntrack.h -header-test- += net/netfilter/nf_conntrack_acct.h -header-test- += net/netfilter/nf_conntrack_bridge.h -header-test- += net/netfilter/nf_conntrack_core.h -header-test- += net/netfilter/nf_conntrack_count.h -header-test- += net/netfilter/nf_conntrack_ecache.h -header-test- += net/netfilter/nf_conntrack_expect.h -header-test- += net/netfilter/nf_conntrack_extend.h -header-test- += net/netfilter/nf_conntrack_helper.h -header-test- += net/netfilter/nf_conntrack_l4proto.h -header-test- += net/netfilter/nf_conntrack_labels.h -header-test- += net/netfilter/nf_conntrack_seqadj.h -header-test- += net/netfilter/nf_conntrack_synproxy.h -header-test- += net/netfilter/nf_conntrack_timeout.h -header-test- += net/netfilter/nf_conntrack_timestamp.h -header-test- += net/netfilter/nf_conntrack_tuple.h -header-test- += net/netfilter/nf_dup_netdev.h -header-test- += net/netfilter/nf_flow_table.h -header-test- += net/netfilter/nf_nat.h -header-test- += net/netfilter/nf_nat_helper.h -header-test- += net/netfilter/nf_nat_masquerade.h -header-test- += net/netfilter/nf_nat_redirect.h -header-test- += net/netfilter/nf_queue.h -header-test- += net/netfilter/nf_reject.h -header-test- += net/netfilter/nf_synproxy.h -header-test-$(CONFIG_NF_TABLES) += net/netfilter/nf_tables.h -header-test-$(CONFIG_NF_TABLES) += net/netfilter/nf_tables_core.h -header-test-$(CONFIG_NF_TABLES) += net/netfilter/nf_tables_ipv4.h -header-test- += net/netfilter/nf_tables_ipv6.h -header-test-$(CONFIG_NF_TABLES) += net/netfilter/nf_tables_offload.h -header-test- += net/netfilter/nft_fib.h -header-test- += net/netfilter/nft_meta.h -header-test- += net/netfilter/nft_reject.h header-test- += net/netns/can.h header-test- += net/netns/generic.h header-test- += net/netns/ieee802154_6lowpan.h
@@ -1140,18 +1078,6 @@ header-test- += uapi/linux/kvm_para.h header-test- += uapi/linux/lightnvm.h header-test- += uapi/linux/mic_common.h header-test- += uapi/linux/mman.h -header-test- += uapi/linux/netfilter/ipset/ip_set_bitmap.h -header-test- += uapi/linux/netfilter/ipset/ip_set_hash.h -header-test- += uapi/linux/netfilter/ipset/ip_set_list.h -header-test- += uapi/linux/netfilter/nf_synproxy.h -header-test- += uapi/linux/netfilter/xt_policy.h -header-test- += uapi/linux/netfilter/xt_set.h -header-test- += uapi/linux/netfilter_arp/arp_tables.h -header-test- += uapi/linux/netfilter_arp/arpt_mangle.h -header-test- += uapi/linux/netfilter_ipv4/ip_tables.h -header-test- += uapi/linux/netfilter_ipv4/ipt_LOG.h -header-test- += uapi/linux/netfilter_ipv6/ip6_tables.h -header-test- += uapi/linux/netfilter_ipv6/ip6t_LOG.h header-test- += uapi/linux/nilfs2_ondisk.h header-test- += uapi/linux/patchkey.h header-test- += uapi/linux/ptrace.h
Signature · 1 line
2.20.1
PATCH 6/8 netfilter: added missing IS_ENABLED(CONFIG_NETFILTER) checks to some header-files.
In reply to Jeremy Sowdenlinux/netfilter.h defines a number of struct and inline function definitions which are only available is CONFIG_NETFILTER is enabled. These structs and functions are used in declarations and definitions in other header-files. Added preprocessor checks to make sure these headers will compile if CONFIG_NETFILTER is disabled.
--- include/linux/netfilter/x_tables.h | 6 ++++++ include/linux/netfilter_arp/arp_tables.h | 2 ++ include/linux/netfilter_bridge/ebtables.h | 2 ++ include/linux/netfilter_ipv4/ip_tables.h | 4 ++++ include/linux/netfilter_ipv6/ip6_tables.h | 2 ++ include/net/netfilter/br_netfilter.h | 2 ++ include/net/netfilter/nf_conntrack_bridge.h | 2 ++ include/net/netfilter/nf_conntrack_core.h | 3 +++ include/net/netfilter/nf_conntrack_l4proto.h | 2 ++ include/net/netfilter/nf_conntrack_tuple.h | 2 ++ include/net/netfilter/nf_flow_table.h | 4 ++++ include/net/netfilter/nf_nat.h | 4 ++++ include/net/netfilter/nf_queue.h | 5 +++++ include/net/netfilter/nf_synproxy.h | 4 ++++ include/net/netfilter/nf_tables.h | 8 ++++++++ 15 files changed, 52 insertions(+)
include/linux/netfilter/x_tables.h +6 -0
@@ -35,12 +35,15 @@ struct xt_action_param {union {const void *matchinfo, *targinfo; }; +#if IS_ENABLED (CONFIG_NETFILTER )const struct nf_hook_state *state; +#endif int fragoff;unsigned int thoff;bool hotdrop; }; +#if IS_ENABLED (CONFIG_NETFILTER )static inline struct net *xt_net (const struct xt_action_param *par) {return par->state->net;
@@ -75,6 +78,7 @@ static inline u_int8_t xt_family(const struct xt_action_param *par) {return par->state->pf; } +#endif /** * struct xt_mtchk_param - parameters for match extensions'
@@ -446,7 +450,9 @@ xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu)return cnt; } +#if IS_ENABLED (CONFIG_NETFILTER )struct nf_hook_ops *xt_hook_ops_alloc (const struct xt_table *,nf_hookfn *); +#endif #ifdef CONFIG_COMPAT #include <net/compat.h>
include/linux/netfilter_arp/arp_tables.h +2 -0
@@ -49,6 +49,7 @@ struct arpt_error { }extern void *arpt_alloc_initial_table (const struct xt_table *); +#if IS_ENABLED (CONFIG_NETFILTER )int arpt_register_table (struct net *net,const struct xt_table *table,const struct arpt_replace *repl,const struct nf_hook_ops *ops,struct xt_table **res);
@@ -57,6 +58,7 @@ void arpt_unregister_table(struct net *net, struct xt_table *table,extern unsigned int arpt_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct xt_table *table); +#endif #ifdef CONFIG_COMPAT #include <net/compat.h>
include/linux/netfilter_bridge/ebtables.h +2 -0
@@ -105,6 +105,7 @@ struct ebt_table {#define EBT_ALIGN (s) (((s) + (__alignof__(struct _xt_align)-1)) & \ ~(__alignof__(struct _xt_align)-1)) +#if IS_ENABLED (CONFIG_NETFILTER ) extern int ebt_register_table(struct net *net, const struct ebt_table *table, const struct nf_hook_ops *ops,
@@ -114,6 +115,7 @@ extern void ebt_unregister_table(struct net *net, struct ebt_table *table,extern unsigned int ebt_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct ebt_table *table); +#endif /* True if the hook mask denotes that the rule is in a base chain, * used in the check() functions */
include/linux/netfilter_ipv4/ip_tables.h +4 -0
@@ -25,11 +25,13 @@extern void ipt_init (void )__init ; +#if IS_ENABLED (CONFIG_NETFILTER )int ipt_register_table (struct net *net,const struct xt_table *table,const struct ipt_replace *repl,const struct nf_hook_ops *ops,struct xt_table **res);void ipt_unregister_table (struct net *net,struct xt_table *table,const struct nf_hook_ops *ops); +#endif /* Standard entry. */ struct ipt_standard {
@@ -65,9 +67,11 @@ struct ipt_error { }extern void *ipt_alloc_initial_table (const struct xt_table *); +#if IS_ENABLED (CONFIG_NETFILTER )extern unsigned int ipt_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct xt_table *table); +#endif #ifdef CONFIG_COMPAT #include <net/compat.h>
include/linux/netfilter_ipv6/ip6_tables.h +2 -0
@@ -26,6 +26,7 @@extern void ip6t_init (void )__init ;extern void *ip6t_alloc_initial_table (const struct xt_table *); +#if IS_ENABLED (CONFIG_NETFILTER )int ip6t_register_table (struct net *net,const struct xt_table *table,const struct ip6t_replace *repl,const struct nf_hook_ops *ops,struct xt_table **res);
@@ -34,6 +35,7 @@ void ip6t_unregister_table(struct net *net, struct xt_table *table,extern unsigned int ip6t_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct xt_table *table); +#endif /* Check for an extension */ static inline int
include/net/netfilter/br_netfilter.h +2 -0
@@ -55,6 +55,7 @@ static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)struct net_device *setup_pre_routing (struct sk_buff *skb,const struct net *net); +#if IS_ENABLED (CONFIG_NETFILTER )#if IS_ENABLED (CONFIG_IPV6 )int br_validate_ipv6 (struct net *net,struct sk_buff *skb); unsigned int br_nf_pre_routing_ipv6(void *priv,
@@ -73,5 +74,6 @@ br_nf_pre_routing_ipv6(const struct nf_hook_ops *ops, struct sk_buff *skb,return NF_ACCEPT ; }#endif +#endif #endif /* _BR_NETFILTER_H_ */
include/net/netfilter/nf_conntrack_bridge.h +2 -0
@@ -6,7 +6,9 @@#include <uapi/linux/if_ether.h> struct nf_ct_bridge_info { +#if IS_ENABLED (CONFIG_NETFILTER )struct nf_hook_ops *ops; +#endif unsigned int ops_size;struct module *me; };
include/net/netfilter/nf_conntrack_core.h +3 -0
@@ -20,7 +20,10 @@/* This header is used to share core functionality between the standalone connection tracking module, and the compatibility layer's use of connection tracking. */ + +#if IS_ENABLED (CONFIG_NETFILTER )unsigned int nf_conntrack_in (struct sk_buff *skb,const struct nf_hook_state *state); +#endif int nf_conntrack_init_net (struct net *net);void nf_conntrack_cleanup_net (struct net *net);
include/net/netfilter/nf_conntrack_l4proto.h +2 -0
@@ -75,6 +75,7 @@ bool nf_conntrack_invert_icmp_tuple(struct nf_conntrack_tuple *tuple,bool nf_conntrack_invert_icmpv6_tuple (struct nf_conntrack_tuple *tuple,const struct nf_conntrack_tuple *orig); +#if IS_ENABLED (CONFIG_NETFILTER ) int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb, unsigned int dataoff, const struct nf_hook_state *state,
@@ -131,6 +132,7 @@ int nf_conntrack_gre_packet(struct nf_conn *ct,unsigned int dataoff, enum ip_conntrack_info ctinfo, const struct nf_hook_state *state); +#endif void nf_conntrack_generic_init_net (struct net *net);void nf_conntrack_tcp_init_net (struct net *net);
include/net/netfilter/nf_conntrack_tuple.h +2 -0
@@ -121,6 +121,7 @@ struct nf_conntrack_tuple_hash {struct nf_conntrack_tuple tuple; }; +#if IS_ENABLED (CONFIG_NETFILTER )static inline bool __nf_ct_tuple_src_equal (const struct nf_conntrack_tuple *t1,const struct nf_conntrack_tuple *t2) {
@@ -183,5 +184,6 @@ nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t,return nf_ct_tuple_src_mask_cmp (t, tuple, mask) &&__nf_ct_tuple_dst_equal (t, tuple); } +#endif #endif /* _NF_CONNTRACK_TUPLE_H */
include/net/netfilter/nf_flow_table.h +4 -0
@@ -17,7 +17,9 @@ struct nf_flowtable_type {int family;int (*init)(struct nf_flowtable *ft);void (*free)(struct nf_flowtable *ft); +#if IS_ENABLED (CONFIG_NETFILTER )nf_hookfn *hook; +#endif struct module *owner; };
@@ -115,10 +117,12 @@ struct flow_ports {__be16 source, dest; }; +#if IS_ENABLED (CONFIG_NETFILTER )unsigned int nf_flow_offload_ip_hook (void *priv,struct sk_buff *skb,const struct nf_hook_state *state);unsigned int nf_flow_offload_ipv6_hook (void *priv,struct sk_buff *skb,const struct nf_hook_state *state); +#endif #define MODULE_ALIAS_NF_FLOWTABLE (family) \ MODULE_ALIAS("nf-flowtable-" __stringify(family))
include/net/netfilter/nf_nat.h +4 -0
@@ -69,10 +69,12 @@ static inline bool nf_nat_oif_changed(unsigned int hooknum,#endif } +#if IS_ENABLED (CONFIG_NETFILTER )int nf_nat_register_fn (struct net *net,u8 pf,const struct nf_hook_ops *ops,const struct nf_hook_ops *nat_ops,unsigned int ops_count);void nf_nat_unregister_fn (struct net *net,u8 pf,const struct nf_hook_ops *ops,unsigned int ops_count); +#endif unsigned int nf_nat_packet (struct nf_conn *ct,enum ip_conntrack_info ctinfo,unsigned int hooknum,struct sk_buff *skb);
@@ -92,6 +94,7 @@ int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,enum ip_conntrack_info ctinfo, unsigned int hooknum, unsigned int hdrlen); +#if IS_ENABLED (CONFIG_NETFILTER )int nf_nat_ipv4_register_fn (struct net *net,const struct nf_hook_ops *ops);void nf_nat_ipv4_unregister_fn (struct net *net,const struct nf_hook_ops *ops);
@@ -104,6 +107,7 @@ void nf_nat_inet_unregister_fn(struct net *net, const struct nf_hook_ops *ops);unsigned int nf_nat_inet_fn (void *priv,struct sk_buff *skb,const struct nf_hook_state *state); +#endif int nf_xfrm_me_harder (struct net *n,struct sk_buff *s,unsigned int family);
include/net/netfilter/nf_queue.h +5 -0
@@ -15,7 +15,9 @@ struct nf_queue_entry {unsigned int id;unsigned int hook_index;/* index in hook_entries->hook[] */ +#if IS_ENABLED (CONFIG_NETFILTER )struct nf_hook_state state; +#endif u16 size;/* sizeof(entry) + saved route keys */ /* extra space to store route keys */
@@ -121,6 +123,9 @@ nfqueue_hash(const struct sk_buff *skb, u16 queue, u16 queues_total, u8 family, return queue; } +#if IS_ENABLED (CONFIG_NETFILTER )int nf_queue (struct sk_buff *skb,struct nf_hook_state *state,unsigned int index,unsigned int verdict); +#endif +#endif /* _NF_QUEUE_H */
include/net/netfilter/nf_synproxy.h +4 -0
@@ -20,8 +20,10 @@ bool synproxy_recv_client_ack(struct net *net,const struct tcphdr *th, struct synproxy_options *opts, u32 recv_seq); +#if IS_ENABLED (CONFIG_NETFILTER )unsigned int ipv4_synproxy_hook (void *priv,struct sk_buff *skb,const struct nf_hook_state *nhs); +#endif int nf_synproxy_ipv4_init (struct synproxy_net *snet,struct net *net);void nf_synproxy_ipv4_fini (struct synproxy_net *snet,struct net *net);
@@ -35,8 +37,10 @@ bool synproxy_recv_client_ack_ipv6(struct net *net, const struct sk_buff *skb,const struct tcphdr *th, struct synproxy_options *opts, u32 recv_seq); +#if IS_ENABLED (CONFIG_NETFILTER )unsigned int ipv6_synproxy_hook (void *priv,struct sk_buff *skb,const struct nf_hook_state *nhs); +#endif int nf_synproxy_ipv6_init (struct synproxy_net *snet,struct net *net);void nf_synproxy_ipv6_fini (struct synproxy_net *snet,struct net *net);#else
include/net/netfilter/nf_tables.h +8 -0
@@ -25,6 +25,7 @@ struct nft_pktinfo {struct xt_action_param xt; }; +#if IS_ENABLED (CONFIG_NETFILTER )static inline struct net *nft_net (const struct nft_pktinfo *pkt) {return pkt->xt.state->net;
@@ -57,6 +58,7 @@ static inline void nft_set_pktinfo(struct nft_pktinfo *pkt, pkt->skb = skb; pkt->xt.state = state; } +#endif static inline void nft_set_pktinfo_unspec (struct nft_pktinfo *pkt,struct sk_buff *skb)
@@ -927,9 +929,11 @@ struct nft_chain_type {int family;struct module *owner;unsigned int hook_mask; +#if IS_ENABLED (CONFIG_NETFILTER )nf_hookfn *hooks[NF_MAX_HOOKS ];int (*ops_register)(struct net *net,const struct nf_hook_ops *ops);void (*ops_unregister)(struct net *net,const struct nf_hook_ops *ops); +#endif }; int nft_chain_validate_dependency(const struct nft_chain *chain,
@@ -955,7 +959,9 @@ struct nft_stats {* @flow_block: flow block (for hardware offload) */ struct nft_base_chain { +#if IS_ENABLED (CONFIG_NETFILTER )struct nf_hook_ops ops; +#endif const struct nft_chain_type *type;u8 policy;u8 flags;
@@ -1152,7 +1158,9 @@ struct nft_flowtable { use:30 ;u64 handle;/* runtime data below here */ +#if IS_ENABLED (CONFIG_NETFILTER )struct nf_hook_ops *ops____cacheline_aligned ; +#endif struct nf_flowtable data; };
Signature · 1 line
2.20.1
PATCH 7/8 netfilter: removed "#ifdef __KERNEL__" guards from some headers.
In reply to Jeremy SowdenA number of non-UAPI Netfilter header-files contained superfluous "#ifdef __KERNEL__" guards. Removed them.
--- include/linux/netfilter/nf_conntrack_dccp.h | 3 --- include/linux/netfilter/nf_conntrack_h323.h | 4 ---- include/linux/netfilter/nf_conntrack_irc.h | 3 --- include/linux/netfilter/nf_conntrack_pptp.h | 3 --- include/linux/netfilter/nf_conntrack_proto_gre.h | 2 -- include/linux/netfilter/nf_conntrack_sane.h | 4 ---- include/linux/netfilter/nf_conntrack_sip.h | 2 -- 7 files changed, 21 deletions(-)
include/linux/netfilter/nf_conntrack_dccp.h +0 -3
@@ -25,7 +25,6 @@ enum ct_dccp_roles { };#define CT_DCCP_ROLE_MAX (__CT_DCCP_ROLE_MAX - 1) -#ifdef __KERNEL__#include <linux/netfilter/nf_conntrack_tuple_common.h> struct nf_ct_dccp {
@@ -36,6 +35,4 @@ struct nf_ct_dccp { u_int64_t handshake_seq; }; -#endif /* __KERNEL__ */ -#endif /* _NF_CONNTRACK_DCCP_H */
include/linux/netfilter/nf_conntrack_h323.h +0 -4
@@ -2,8 +2,6 @@#ifndef _NF_CONNTRACK_H323_H#define _NF_CONNTRACK_H323_H -#ifdef __KERNEL__ -#include <linux/netfilter.h> #include <linux/skbuff.h> #include <linux/types.h>
@@ -97,5 +95,3 @@ extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct, struct nf_conntrack_expect *exp);#endif - -#endif
include/linux/netfilter/nf_conntrack_irc.h +0 -3
@@ -2,8 +2,6 @@#ifndef _NF_CONNTRACK_IRC_H#define _NF_CONNTRACK_IRC_H -#ifdef __KERNEL__ -#include <linux/netfilter.h> #include <linux/skbuff.h> #include <net/netfilter/nf_conntrack_expect.h>
@@ -17,5 +15,4 @@ extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,unsigned int matchlen, struct nf_conntrack_expect *exp); -#endif /* __KERNEL__ */ #endif /* _NF_CONNTRACK_IRC_H */
include/linux/netfilter/nf_conntrack_pptp.h +0 -3
@@ -50,8 +50,6 @@ struct nf_nat_pptp {__be16 pac_call_id;/* NAT'ed PAC call id */ }; -#ifdef __KERNEL__ -#define PPTP_CONTROL_PORT 1723#define PPTP_PACKET_CONTROL 1
@@ -324,5 +322,4 @@ extern void (*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); -#endif /* __KERNEL__ */ #endif /* _NF_CONNTRACK_PPTP_H */
include/linux/netfilter/nf_conntrack_proto_gre.h +0 -2
@@ -10,7 +10,6 @@ struct nf_ct_gre {unsigned int timeout; }; -#ifdef __KERNEL__#include <net/netfilter/nf_conntrack_tuple.h> struct nf_conn ;
@@ -32,5 +31,4 @@ void nf_ct_gre_keymap_destroy(struct nf_conn *ct);bool gre_pkt_to_tuple (const struct sk_buff *skb,unsigned int dataoff,struct net *net,struct nf_conntrack_tuple *tuple); -#endif /* __KERNEL__ */ #endif /* _CONNTRACK_PROTO_GRE_H */
include/linux/netfilter/nf_conntrack_sane.h +0 -4
@@ -3,8 +3,6 @@#define _NF_CONNTRACK_SANE_H/* SANE tracking. */ -#ifdef __KERNEL__ -#define SANE_PORT 6566enum sane_state {
@@ -17,6 +15,4 @@ struct nf_ct_sane_master { enum sane_state state; }; -#endif /* __KERNEL__ */ -#endif /* _NF_CONNTRACK_SANE_H */
include/linux/netfilter/nf_conntrack_sip.h +0 -2
@@ -1,7 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __NF_CONNTRACK_SIP_H__#define __NF_CONNTRACK_SIP_H__ -#ifdef __KERNEL__#include <linux/skbuff.h> #include <linux/types.h>
@@ -196,5 +195,4 @@ int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,enum sdp_header_types term, unsigned int *matchoff, unsigned int *matchlen); -#endif /* __KERNEL__ */ #endif /* __NF_CONNTRACK_SIP_H__ */
Signature · 1 line
2.20.1
Pablo Neira Ayuso
maintainerRe: [PATCH net-next v1 1/8] netfilter: inlined four headers files into another one.
In reply to Jeremy SowdenHi Jeremy,
Thanks for working on this.
Cc'ing Jozsef.
On Wed, Aug 07, 2019 at 03:16:58PM +0100, Jeremy Sowden wrote:
[...]
include/linux/netfilter/ipset/ip_set.h bitmap_bytes(u32 a, u32 b) · line 533
Quoted 6 lines
include/linux/netfilter/ipset/ip_set.h +6
-0+/* Called from uadd only, protected by the set spinlock. +* The kadt functions don't use the comment extensions in any way. +*/ +static inline void +ip_set_init_comment (struct ip_set *set,struct ip_set_comment *comment, +const struct ip_set_ext *ext)
Not related to this patch, but I think the number of inline functions could be reduced a bit by exporting symbols? Specifically for functions that are called from the netlink control plane, ie. _uadd() functions. I think forcing the compiler to inline this is not useful. This could be done in a follow up patchset.
Thanks.
Re: [PATCH net-next v1 1/8] netfilter: inlined four headers files into another one.
In reply to Jeremy SowdenHi Jeremy,
Quoted 12 lines · Jeremy Sowden
linux/netfilter/ipset/ip_set.hincluded four other header files:
include/linux/netfilter/ipset/ip_set_comment.h
include/linux/netfilter/ipset/ip_set_counter.h
include/linux/netfilter/ipset/ip_set_skbinfo.h
include/linux/netfilter/ipset/ip_set_timeout.hOf these the first three were not included anywhere else. The last,
ip_set_timeout.h, was included in a couple of other places, but defined inline functions which call other inline functions defined inip_set.h, soip_set.hhad to be included before it.
Quoted 4 lines
Inlined all four into
ip_set.h, and updated the other files that includedip_set_timeout.h.Signed-off-by Jeremy Sowden <[email protected]>
Also, for the ipset part of patch 2/8, thank!
Best regards,
Jozsef
Quoted 592 lines
--- include/linux/netfilter/ipset/ip_set.h | 238 +++++++++++++++++- .../linux/netfilter/ipset/ip_set_comment.h | 73 ------ .../linux/netfilter/ipset/ip_set_counter.h | 84 ------- .../linux/netfilter/ipset/ip_set_skbinfo.h | 42 ---- .../linux/netfilter/ipset/ip_set_timeout.h | 77 ------ net/netfilter/ipset/ip_set_hash_gen.h | 2 +- net/netfilter/xt_set.c | 1 - 7 files changed, 235 insertions(+), 282 deletions(-) delete mode 100644 include/linux/netfilter/ipset/ip_set_comment.h delete mode 100644 include/linux/netfilter/ipset/ip_set_counter.h delete mode 100644 include/linux/netfilter/ipset/ip_set_skbinfo.h delete mode 100644 include/linux/netfilter/ipset/ip_set_timeout.hinclude/linux/netfilter/ipset/ip_set.h +234
-4@@ -452,10 +452,240 @@ bitmap_bytes(u32 a, u32 b)return 4 * ((((b - a +8 ) /8 ) +3 ) /4 ); } -#include <linux/netfilter/ipset/ip_set_timeout.h> -#include <linux/netfilter/ipset/ip_set_comment.h> -#include <linux/netfilter/ipset/ip_set_counter.h> -#include <linux/netfilter/ipset/ip_set_skbinfo.h> +/* How often should the gc be run by default */ +#define IPSET_GC_TIME (3 * 60) + +/* Timeout period depending on the timeout value of the given set */ +#define IPSET_GC_PERIOD (timeout) \ + ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) + +/* Entry is set with no timeout value */ +#define IPSET_ELEM_PERMANENT 0 + +/* Set is defined with timeout support: timeout value may be 0 */ +#define IPSET_NO_TIMEOUT UINT_MAX + +/* Max timeout value, see msecs_to_jiffies() in jiffies.h */ +#define IPSET_MAX_TIMEOUT (UINT_MAX >> 1)/MSEC_PER_SEC + +#define ip_set_adt_opt_timeout (opt, set) \ +((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (set)->timeout) + +static inline unsigned int +ip_set_timeout_uget (struct nlattr *tb) +{ +unsigned int timeout =ip_set_get_h32 (tb); + +/* Normalize to fit into jiffies */ +if (timeout >IPSET_MAX_TIMEOUT ) + timeout =IPSET_MAX_TIMEOUT ; + +return timeout; +} + +static inline bool +ip_set_timeout_expired (const unsigned long *t) +{ +return *t !=IPSET_ELEM_PERMANENT &&time_is_before_jiffies (*t); +} + +static inline void +ip_set_timeout_set (unsigned long *timeout,u32 value) +{ +unsigned long t; + +if (!value) { + *timeout =IPSET_ELEM_PERMANENT ; +return ; + } + + t =msecs_to_jiffies (value *MSEC_PER_SEC ) + jiffies; +if (t ==IPSET_ELEM_PERMANENT ) +/* Bingo! :-) */ + t--; + *timeout = t; +} + +static inline u32 +ip_set_timeout_get (const unsigned long *timeout) +{ +u32 t; + +if (*timeout ==IPSET_ELEM_PERMANENT ) +return 0 ; + + t =jiffies_to_msecs (*timeout - jiffies)/MSEC_PER_SEC ; +/* Zero value in userspace means no timeout */ +return t ==0 ?1 : t; +} + +static inline char * +ip_set_comment_uget (struct nlattr *tb) +{ +return nla_data (tb); +} + +/* Called from uadd only, protected by the set spinlock. +* The kadt functions don't use the comment extensions in any way. +*/ +static inline void +ip_set_init_comment (struct ip_set *set,struct ip_set_comment *comment, +const struct ip_set_ext *ext) +{ +struct ip_set_comment_rcu *c =rcu_dereference_protected (comment->c,1 ); +size_t len = ext->comment ?strlen (ext->comment) :0 ; + +if (unlikely (c)) { + set->ext_size -=sizeof (*c) +strlen (c->str) +1 ; +kfree_rcu (c, rcu); +rcu_assign_pointer (comment->c,NULL ); + } +if (!len) +return ; +if (unlikely (len >IPSET_MAX_COMMENT_SIZE )) + len =IPSET_MAX_COMMENT_SIZE ; + c =kmalloc (sizeof (*c) + len +1 ,GFP_ATOMIC ); +if (unlikely (!c)) +return ; +strlcpy (c->str, ext->comment, len +1 ); + set->ext_size +=sizeof (*c) +strlen (c->str) +1 ; +rcu_assign_pointer (comment->c, c); +} + +/* Used only when dumping a set, protected by rcu_read_lock() */ +static inline int +ip_set_put_comment (struct sk_buff *skb,const struct ip_set_comment *comment) +{ +struct ip_set_comment_rcu *c =rcu_dereference (comment->c); + +if (!c) +return 0 ; +return nla_put_string (skb,IPSET_ATTR_COMMENT , c->str); +} + +/* Called from uadd/udel, flush or the garbage collectors protected +* by the set spinlock. +* Called when the set is destroyed and when there can't be any user +* of the set data anymore. +*/ +static inline void +ip_set_comment_free (struct ip_set *set,struct ip_set_comment *comment) +{ +struct ip_set_comment_rcu *c; + + c =rcu_dereference_protected (comment->c,1 ); +if (unlikely (!c)) +return ; + set->ext_size -=sizeof (*c) +strlen (c->str) +1 ; +kfree_rcu (c, rcu); +rcu_assign_pointer (comment->c,NULL ); +} + +static inline void +ip_set_add_bytes (u64 bytes,struct ip_set_counter *counter) +{ +atomic64_add ((long long )bytes, &(counter)->bytes); +} + +static inline void +ip_set_add_packets (u64 packets,struct ip_set_counter *counter) +{ +atomic64_add ((long long )packets, &(counter)->packets); +} + +static inline u64 +ip_set_get_bytes (const struct ip_set_counter *counter) +{ +return (u64 )atomic64_read (&(counter)->bytes); +} + +static inline u64 +ip_set_get_packets (const struct ip_set_counter *counter) +{ +return (u64 )atomic64_read (&(counter)->packets); +} + +static inline bool +ip_set_match_counter (u64 counter,u64 match,u8 op) +{ +switch (op) { +case IPSET_COUNTER_NONE : +return true; +case IPSET_COUNTER_EQ : +return counter == match; +case IPSET_COUNTER_NE : +return counter != match; +case IPSET_COUNTER_LT : +return counter < match; +case IPSET_COUNTER_GT : +return counter > match; + } +return false; +} + +static inline void +ip_set_update_counter (struct ip_set_counter *counter, +const struct ip_set_ext *ext,u32 flags) +{ +if (ext->packets !=ULLONG_MAX && + !(flags &IPSET_FLAG_SKIP_COUNTER_UPDATE )) { +ip_set_add_bytes (ext->bytes, counter); +ip_set_add_packets (ext->packets, counter); + } +} + +static inline bool +ip_set_put_counter (struct sk_buff *skb,const struct ip_set_counter *counter) +{ +return nla_put_net64 (skb,IPSET_ATTR_BYTES , +cpu_to_be64 (ip_set_get_bytes (counter)), +IPSET_ATTR_PAD ) || +nla_put_net64 (skb,IPSET_ATTR_PACKETS , +cpu_to_be64 (ip_set_get_packets (counter)), +IPSET_ATTR_PAD ); +} + +static inline void +ip_set_init_counter (struct ip_set_counter *counter, +const struct ip_set_ext *ext) +{ +if (ext->bytes !=ULLONG_MAX ) +atomic64_set (&(counter)->bytes, (long long )(ext->bytes)); +if (ext->packets !=ULLONG_MAX ) +atomic64_set (&(counter)->packets, (long long )(ext->packets)); +} + +static inline void +ip_set_get_skbinfo (struct ip_set_skbinfo *skbinfo, +const struct ip_set_ext *ext, +struct ip_set_ext *mext,u32 flags) +{ + mext->skbinfo = *skbinfo; +} + +static inline bool +ip_set_put_skbinfo (struct sk_buff *skb,const struct ip_set_skbinfo *skbinfo) +{ +/* Send nonzero parameters only */ +return ((skbinfo->skbmark || skbinfo->skbmarkmask) && +nla_put_net64 (skb,IPSET_ATTR_SKBMARK , +cpu_to_be64 ((u64 )skbinfo->skbmark <<32 | + skbinfo->skbmarkmask), +IPSET_ATTR_PAD )) || + (skbinfo->skbprio && +nla_put_net32 (skb,IPSET_ATTR_SKBPRIO , +cpu_to_be32 (skbinfo->skbprio))) || + (skbinfo->skbqueue && +nla_put_net16 (skb,IPSET_ATTR_SKBQUEUE , +cpu_to_be16 (skbinfo->skbqueue))); +} + +static inline void +ip_set_init_skbinfo (struct ip_set_skbinfo *skbinfo, +const struct ip_set_ext *ext) +{ + *skbinfo = ext->skbinfo; +}#define IP_SET_INIT_KEXT (skb, opt, set) \ { .bytes = (skb)->len, .packets = 1, \include/linux/netfilter/ipset/ip_set_comment.h deleted +0
-73@@ -1,73 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _IP_SET_COMMENT_H -#define _IP_SET_COMMENT_H - -/* Copyright (C) 2013 Oliver Smith <[email protected]> -*/ - -#ifdef __KERNEL__ - -static inline char * -ip_set_comment_uget (struct nlattr *tb) -{ -return nla_data (tb); -} - -/* Called from uadd only, protected by the set spinlock. -* The kadt functions don't use the comment extensions in any way. -*/ -static inline void -ip_set_init_comment (struct ip_set *set,struct ip_set_comment *comment, -const struct ip_set_ext *ext) -{ -struct ip_set_comment_rcu *c =rcu_dereference_protected (comment->c,1 ); -size_t len = ext->comment ?strlen (ext->comment) :0 ; - -if (unlikely (c)) { - set->ext_size -=sizeof (*c) +strlen (c->str) +1 ; -kfree_rcu (c, rcu); -rcu_assign_pointer (comment->c,NULL ); - } -if (!len) -return ; -if (unlikely (len >IPSET_MAX_COMMENT_SIZE )) - len =IPSET_MAX_COMMENT_SIZE ; - c =kmalloc (sizeof (*c) + len +1 ,GFP_ATOMIC ); -if (unlikely (!c)) -return ; -strlcpy (c->str, ext->comment, len +1 ); - set->ext_size +=sizeof (*c) +strlen (c->str) +1 ; -rcu_assign_pointer (comment->c, c); -} - -/* Used only when dumping a set, protected by rcu_read_lock() */ -static inline int -ip_set_put_comment (struct sk_buff *skb,const struct ip_set_comment *comment) -{ -struct ip_set_comment_rcu *c =rcu_dereference (comment->c); - -if (!c) -return 0 ; -return nla_put_string (skb,IPSET_ATTR_COMMENT , c->str); -} - -/* Called from uadd/udel, flush or the garbage collectors protected -* by the set spinlock. -* Called when the set is destroyed and when there can't be any user -* of the set data anymore. -*/ -static inline void -ip_set_comment_free (struct ip_set *set,struct ip_set_comment *comment) -{ -struct ip_set_comment_rcu *c; - - c =rcu_dereference_protected (comment->c,1 ); -if (unlikely (!c)) -return ; - set->ext_size -=sizeof (*c) +strlen (c->str) +1 ; -kfree_rcu (c, rcu); -rcu_assign_pointer (comment->c,NULL ); -} - -#endif -#endif include/linux/netfilter/ipset/ip_set_counter.h deleted +0
-84@@ -1,84 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _IP_SET_COUNTER_H -#define _IP_SET_COUNTER_H - -/* Copyright (C) 2015 Jozsef Kadlecsik <[email protected]> */ - -#ifdef __KERNEL__ - -static inline void -ip_set_add_bytes (u64 bytes,struct ip_set_counter *counter) -{ -atomic64_add ((long long )bytes, &(counter)->bytes); -} - -static inline void -ip_set_add_packets (u64 packets,struct ip_set_counter *counter) -{ -atomic64_add ((long long )packets, &(counter)->packets); -} - -static inline u64 -ip_set_get_bytes (const struct ip_set_counter *counter) -{ -return (u64 )atomic64_read (&(counter)->bytes); -} - -static inline u64 -ip_set_get_packets (const struct ip_set_counter *counter) -{ -return (u64 )atomic64_read (&(counter)->packets); -} - -static inline bool -ip_set_match_counter (u64 counter,u64 match,u8 op) -{ -switch (op) { -case IPSET_COUNTER_NONE : -return true; -case IPSET_COUNTER_EQ : -return counter == match; -case IPSET_COUNTER_NE : -return counter != match; -case IPSET_COUNTER_LT : -return counter < match; -case IPSET_COUNTER_GT : -return counter > match; - } -return false; -} - -static inline void -ip_set_update_counter (struct ip_set_counter *counter, -const struct ip_set_ext *ext,u32 flags) -{ -if (ext->packets !=ULLONG_MAX && - !(flags &IPSET_FLAG_SKIP_COUNTER_UPDATE )) { -ip_set_add_bytes (ext->bytes, counter); -ip_set_add_packets (ext->packets, counter); - } -} - -static inline bool -ip_set_put_counter (struct sk_buff *skb,const struct ip_set_counter *counter) -{ -return nla_put_net64 (skb,IPSET_ATTR_BYTES , -cpu_to_be64 (ip_set_get_bytes (counter)), -IPSET_ATTR_PAD ) || -nla_put_net64 (skb,IPSET_ATTR_PACKETS , -cpu_to_be64 (ip_set_get_packets (counter)), -IPSET_ATTR_PAD ); -} - -static inline void -ip_set_init_counter (struct ip_set_counter *counter, -const struct ip_set_ext *ext) -{ -if (ext->bytes !=ULLONG_MAX ) -atomic64_set (&(counter)->bytes, (long long )(ext->bytes)); -if (ext->packets !=ULLONG_MAX ) -atomic64_set (&(counter)->packets, (long long )(ext->packets)); -} - -#endif /* __KERNEL__ */ -#endif /* _IP_SET_COUNTER_H */ include/linux/netfilter/ipset/ip_set_skbinfo.h deleted +0
-42@@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _IP_SET_SKBINFO_H -#define _IP_SET_SKBINFO_H - -/* Copyright (C) 2015 Jozsef Kadlecsik <[email protected]> */ - -#ifdef __KERNEL__ - -static inline void -ip_set_get_skbinfo (struct ip_set_skbinfo *skbinfo, -const struct ip_set_ext *ext, -struct ip_set_ext *mext,u32 flags) -{ - mext->skbinfo = *skbinfo; -} - -static inline bool -ip_set_put_skbinfo (struct sk_buff *skb,const struct ip_set_skbinfo *skbinfo) -{ -/* Send nonzero parameters only */ -return ((skbinfo->skbmark || skbinfo->skbmarkmask) && -nla_put_net64 (skb,IPSET_ATTR_SKBMARK , -cpu_to_be64 ((u64 )skbinfo->skbmark <<32 | - skbinfo->skbmarkmask), -IPSET_ATTR_PAD )) || - (skbinfo->skbprio && -nla_put_net32 (skb,IPSET_ATTR_SKBPRIO , -cpu_to_be32 (skbinfo->skbprio))) || - (skbinfo->skbqueue && -nla_put_net16 (skb,IPSET_ATTR_SKBQUEUE , -cpu_to_be16 (skbinfo->skbqueue))); -} - -static inline void -ip_set_init_skbinfo (struct ip_set_skbinfo *skbinfo, -const struct ip_set_ext *ext) -{ - *skbinfo = ext->skbinfo; -} - -#endif /* __KERNEL__ */ -#endif /* _IP_SET_SKBINFO_H */ include/linux/netfilter/ipset/ip_set_timeout.h deleted +0
-77@@ -1,77 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _IP_SET_TIMEOUT_H -#define _IP_SET_TIMEOUT_H - -/* Copyright (C) 2003-2013 Jozsef Kadlecsik <[email protected]> */ - -#ifdef __KERNEL__ - -/* How often should the gc be run by default */ -#define IPSET_GC_TIME (3 * 60) - -/* Timeout period depending on the timeout value of the given set */ -#define IPSET_GC_PERIOD (timeout) \ - ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) - -/* Entry is set with no timeout value */ -#define IPSET_ELEM_PERMANENT 0 - -/* Set is defined with timeout support: timeout value may be 0 */ -#define IPSET_NO_TIMEOUT UINT_MAX - -/* Max timeout value, see msecs_to_jiffies() in jiffies.h */ -#define IPSET_MAX_TIMEOUT (UINT_MAX >> 1)/MSEC_PER_SEC - -#define ip_set_adt_opt_timeout (opt, set) \ -((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (set)->timeout) - -static inline unsigned int -ip_set_timeout_uget (struct nlattr *tb) -{ -unsigned int timeout =ip_set_get_h32 (tb); - -/* Normalize to fit into jiffies */ -if (timeout >IPSET_MAX_TIMEOUT ) - timeout =IPSET_MAX_TIMEOUT ; - -return timeout; -} - -static inline bool -ip_set_timeout_expired (const unsigned long *t) -{ -return *t !=IPSET_ELEM_PERMANENT &&time_is_before_jiffies (*t); -} - -static inline void -ip_set_timeout_set (unsigned long *timeout,u32 value) -{ -unsigned long t; - -if (!value) { - *timeout =IPSET_ELEM_PERMANENT ; -return ; - } - - t =msecs_to_jiffies (value *MSEC_PER_SEC ) + jiffies; -if (t ==IPSET_ELEM_PERMANENT ) -/* Bingo! :-) */ - t--; - *timeout = t; -} - -static inline u32 -ip_set_timeout_get (const unsigned long *timeout) -{ -u32 t; - -if (*timeout ==IPSET_ELEM_PERMANENT ) -return 0 ; - - t =jiffies_to_msecs (*timeout - jiffies)/MSEC_PER_SEC ; -/* Zero value in userspace means no timeout */ -return t ==0 ?1 : t; -} - -#endif /* __KERNEL__ */ -#endif /* _IP_SET_TIMEOUT_H */ net/netfilter/ipset/ip_set_hash_gen.h +1
-1@@ -7,7 +7,7 @@#include <linux/rcupdate.h> #include <linux/jhash.h> #include <linux/types.h> -#include <linux/netfilter/ipset/ip_set_timeout.h> +#include <linux/netfilter/ipset/ip_set.h> #define __ipset_dereference_protected (p, c) rcu_dereference_protected(p, c)#define ipset_dereference_protected (p, set) \net/netfilter/xt_set.c +0
-1@@ -14,7 +14,6 @@#include <linux/netfilter/x_tables.h> #include <linux/netfilter/ipset/ip_set.h> -#include <linux/netfilter/ipset/ip_set_timeout.h> #include <uapi/linux/netfilter/xt_set.h> MODULE_LICENSE ("GPL" );Signature · 1 line
2.20.1
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
Re: [PATCH net-next v1 1/8] netfilter: inlined four headers files into another one.
In reply to Pablo Neira AyusoQuoted 14 lines · Pablo Neira Ayuso
On Wed, Aug 07, 2019 at 03:16:58PM +0100, Jeremy Sowden wrote:
[...]include/linux/netfilter/ipset/ip_set.h bitmap_bytes(u32 a, u32 b) · line 533
Quoted 6 lines
include/linux/netfilter/ipset/ip_set.h +6
-0+/* Called from uadd only, protected by the set spinlock. +* The kadt functions don't use the comment extensions in any way. +*/ +static inline void +ip_set_init_comment (struct ip_set *set,struct ip_set_comment *comment, +const struct ip_set_ext *ext)Not related to this patch, but I think the number of inline functions could be reduced a bit by exporting symbols? Specifically for functions that are called from the netlink control plane, ie.
_uadd()functions. I think forcing the compiler to inline this is not useful. This could be done in a follow up patchset.
I'll take a look.
J.
Pablo Neira Ayuso
maintainerRe: [PATCH net-next v1 0/8] netfilter: header compilation fixes
In reply to Jeremy SowdenQuoted 11 lines · Jeremy Sowden
A number of netfilter header files are on the header-test blacklist
becuse they cannot be compiled stand-alone. There are two main reasons
for this: missing inclusions of other headers, and missing conditionals checking for CONFIG_* symbols.The first six of these patches rectify these omissions, the seventh removes some unnecessary "#ifdef
__KERNEL__" checks, and the last removes all the NF headers from the blacklist.I've cc'ed Masahiro Yamada because the last patch removes 74 lines from
include/Kbuildand may conflict with his kbuild tree.
Series applied, one comment below.
Quoted 5 lines
Jeremy Sowden (8):
netfilter: inlined four headers files into another one.
netfilter: added missing includes to a number of header-files.
netfilter: added missingIS_ENABLED(CONFIG_BRIDGE_NETFILTER)checks to
header-file.
Quoted 8 lines
netfilter: added missing
IS_ENABLED(CONFIG_NF_TABLES)check to
header-file.
netfilter: added missingIS_ENABLED(CONFIG_NF_CONNTRACK)checks to
some header-files.
netfilter: added missingIS_ENABLED(CONFIG_NETFILTER)checks to some
header-files.
netfilter: removed "#ifdef__KERNEL__" guards from some headers.
kbuild: removed all netfilter headers from header-test blacklist.
Would you mind if - before pushing this out - I do this string replacement for the patch subject?
s/added/add
s/removed/remove
s/inlined/inline
I was told present tense is preferred for description. Otherwise, I'll leave them as is.
Thanks.
Re: [PATCH net-next v1 0/8] netfilter: header compilation fixes
Quoted 32 lines · Pablo Neira Ayuso
Quoted 11 lines · Jeremy Sowden
A number of netfilter header files are on the header-test blacklist
becuse they cannot be compiled stand-alone. There are two main
reasons for this: missing inclusions of other headers, and missing conditionals checking for CONFIG_* symbols.The first six of these patches rectify these omissions, the seventh removes some unnecessary "#ifdef
__KERNEL__" checks, and the last removes all the NF headers from the blacklist.I've cc'ed Masahiro Yamada because the last patch removes 74 lines from
include/Kbuildand may conflict with his kbuild tree.Series applied, one comment below.
Quoted 5 lines
Jeremy Sowden (8):
netfilter: inlined four headers files into another one.
netfilter: added missing includes to a number of header-files.
netfilter: added missingIS_ENABLED(CONFIG_BRIDGE_NETFILTER)checks to
header-file.Quoted 8 lines
netfilter: added missing
IS_ENABLED(CONFIG_NF_TABLES)check to
header-file.
netfilter: added missingIS_ENABLED(CONFIG_NF_CONNTRACK)checks to
some header-files.
netfilter: added missingIS_ENABLED(CONFIG_NETFILTER)checks to some
header-files.
netfilter: removed "#ifdef__KERNEL__" guards from some headers.
kbuild: removed all netfilter headers from header-test blacklist.Would you mind if - before pushing this out - I do this string replacement for the patch subject?
Quoted 6 lines
s/added/add
s/removed/remove
s/inlined/inlineI was told present tense is preferred for description. Otherwise, I'll leave them as is.
I adopted past tenses because at the point at which one is reading the description of a commit, one is usually reading about old behaviour and what has been done to change it. However, I wasn't aware that there was a preference and I am happy to switch to the present tense instead, so by all means feel free to change them.
J.
Pablo Neira Ayuso
maintainerRe: [PATCH net-next v1 0/8] netfilter: header compilation fixes
Quoted 37 lines · Jeremy Sowden
Quoted 36 lines · Pablo Neira Ayuso
Quoted 11 lines · Jeremy Sowden
A number of netfilter header files are on the header-test blacklist
becuse they cannot be compiled stand-alone. There are two main
reasons for this: missing inclusions of other headers, and missing conditionals checking for CONFIG_* symbols.The first six of these patches rectify these omissions, the seventh removes some unnecessary "#ifdef
__KERNEL__" checks, and the last removes all the NF headers from the blacklist.I've cc'ed Masahiro Yamada because the last patch removes 74 lines from
include/Kbuildand may conflict with his kbuild tree.Series applied, one comment below.
Quoted 5 lines
Jeremy Sowden (8):
netfilter: inlined four headers files into another one.
netfilter: added missing includes to a number of header-files.
netfilter: added missingIS_ENABLED(CONFIG_BRIDGE_NETFILTER)checks to
header-file.Quoted 8 lines
netfilter: added missing
IS_ENABLED(CONFIG_NF_TABLES)check to
header-file.
netfilter: added missingIS_ENABLED(CONFIG_NF_CONNTRACK)checks to
some header-files.
netfilter: added missingIS_ENABLED(CONFIG_NETFILTER)checks to some
header-files.
netfilter: removed "#ifdef__KERNEL__" guards from some headers.
kbuild: removed all netfilter headers from header-test blacklist.Would you mind if - before pushing this out - I do this string replacement for the patch subject?
s/added/add
s/removed/remove
s/inlined/inline
Quoted 8 lines
Quoted 2 lines
I was told present tense is preferred for description. Otherwise, I'll leave them as is.
I adopted past tenses because at the point at which one is reading the description of a commit, one is usually reading about old behaviour and what has been done to change it. However, I wasn't aware that there was a preference and I am happy to switch to the present tense instead, so by all means feel free to change them.
This is not in the Documentation tree, or I could not find this in a quick git grep:
https://kernelnewbies.org/PatchPhilosophy
"In patch descriptions and in the subject, it is common and preferable to use present-tense, imperative language. Write as if you are telling git what to do with your patch."
I remember though that maintainers have been asking for this in the past.
Thanks!
Re: [PATCH net-next v1 0/8] netfilter: header compilation fixes
Quoted 21 lines · Pablo Neira Ayuso
Quoted 8 lines · Jeremy Sowden
Quoted 7 lines · Pablo Neira Ayuso
Would you mind if - before pushing this out - I do this string replacement for the patch subject?
s/added/add
s/removed/remove
s/inlined/inlineQuoted 8 lines
Quoted 2 lines
I was told present tense is preferred for description. Otherwise, I'll leave them as is.
I adopted past tenses because at the point at which one is reading the description of a commit, one is usually reading about old behaviour and what has been done to change it. However, I wasn't aware that there was a preference and I am happy to switch to the present tense instead, so by all means feel free to change them.
This is not in the Documentation tree, or I could not find this in a quick git grep:
Quoted 8 lines
https://kernelnewbies.org/PatchPhilosophy
"In patch descriptions and in the subject, it is common and preferable to use present-tense, imperative language. Write as if you are telling git what to do with your patch."
I remember though that maintainers have been asking for this in the past.
Thanks for the pointer.
J.