Skip to content

Commit

Permalink
netfilter: bpf: Only define get_proto_defrag_hook() if necessary
Browse files Browse the repository at this point in the history
Before, we were getting this warning:

  net/netfilter/nf_bpf_link.c:32:1: warning: 'get_proto_defrag_hook' defined but not used [-Wunused-function]

Guard the definition with CONFIG_NF_DEFRAG_IPV[4|6].

Fixes: 91721c2 ("netfilter: bpf: Support BPF_F_NETFILTER_IP_DEFRAG in netfilter link")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307291213.fZ0zDmoG-lkp@intel.com/
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/b128b6489f0066db32c4772ae4aaee1480495929.1690840454.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
danobi authored and Alexei Starovoitov committed Aug 1, 2023
1 parent e99688e commit 81584c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/netfilter/nf_bpf_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct bpf_nf_link {
const struct nf_defrag_hook *defrag_hook;
};

#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) || IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
static const struct nf_defrag_hook *
get_proto_defrag_hook(struct bpf_nf_link *link,
const struct nf_defrag_hook __rcu *global_hook,
Expand Down Expand Up @@ -68,6 +69,7 @@ get_proto_defrag_hook(struct bpf_nf_link *link,

return hook;
}
#endif

static int bpf_nf_enable_defrag(struct bpf_nf_link *link)
{
Expand Down

0 comments on commit 81584c2

Please sign in to comment.