Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: don't allocate space for decnet hooks unless needed

no need to define hook points if the family isn't supported.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Florian Westphal and committed by
Pablo Neira Ayuso
bb4badf3 ef57170b

+8
+2
include/linux/netfilter.h
··· 219 219 case NFPROTO_BRIDGE: 220 220 hook_head = rcu_dereference(net->nf.hooks_bridge[hook]); 221 221 break; 222 + #if IS_ENABLED(CONFIG_DECNET) 222 223 case NFPROTO_DECNET: 223 224 hook_head = rcu_dereference(net->nf.hooks_decnet[hook]); 224 225 break; 226 + #endif 225 227 default: 226 228 WARN_ON_ONCE(1); 227 229 break;
+2
include/net/netns/netfilter.h
··· 21 21 struct nf_hook_entries __rcu *hooks_ipv6[NF_INET_NUMHOOKS]; 22 22 struct nf_hook_entries __rcu *hooks_arp[NF_ARP_NUMHOOKS]; 23 23 struct nf_hook_entries __rcu *hooks_bridge[NF_INET_NUMHOOKS]; 24 + #if IS_ENABLED(CONFIG_DECNET) 24 25 struct nf_hook_entries __rcu *hooks_decnet[NF_DN_NUMHOOKS]; 26 + #endif 25 27 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) 26 28 bool defrag_ipv4; 27 29 #endif
+4
net/netfilter/core.c
··· 283 283 if (WARN_ON_ONCE(ARRAY_SIZE(net->nf.hooks_ipv6) <= reg->hooknum)) 284 284 return NULL; 285 285 return net->nf.hooks_ipv6 + reg->hooknum; 286 + #if IS_ENABLED(CONFIG_DECNET) 286 287 case NFPROTO_DECNET: 287 288 if (WARN_ON_ONCE(ARRAY_SIZE(net->nf.hooks_decnet) <= reg->hooknum)) 288 289 return NULL; 289 290 return net->nf.hooks_decnet + reg->hooknum; 291 + #endif 290 292 default: 291 293 WARN_ON_ONCE(1); 292 294 return NULL; ··· 575 573 __netfilter_net_init(net->nf.hooks_ipv6, ARRAY_SIZE(net->nf.hooks_ipv6)); 576 574 __netfilter_net_init(net->nf.hooks_arp, ARRAY_SIZE(net->nf.hooks_arp)); 577 575 __netfilter_net_init(net->nf.hooks_bridge, ARRAY_SIZE(net->nf.hooks_bridge)); 576 + #if IS_ENABLED(CONFIG_DECNET) 578 577 __netfilter_net_init(net->nf.hooks_decnet, ARRAY_SIZE(net->nf.hooks_decnet)); 578 + #endif 579 579 580 580 #ifdef CONFIG_PROC_FS 581 581 net->nf.proc_netfilter = proc_net_mkdir(net, "netfilter",