Skip to content

Commit

Permalink
netfilter: xt_hashlimit: fix unused variable warning if IPv6 disabled
Browse files Browse the repository at this point in the history
Fixes this warning when CONFIG_IP6_NF_IPTABLES is not enabled:

net/netfilter/xt_hashlimit.c: In function ‘hashlimit_init_dst’:
net/netfilter/xt_hashlimit.c:448:9: warning: unused variable ‘frag_off’ [-Wunused-variable]

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Stephen Rothwell authored and Pablo Neira Ayuso committed Jan 16, 2012
1 parent 7c7c7f0 commit 412662d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/netfilter/xt_hashlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
{
__be16 _ports[2], *ports;
u8 nexthdr;
__be16 frag_off;
int poff;

memset(dst, 0, sizeof(*dst));
Expand All @@ -466,6 +465,9 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
break;
#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
case NFPROTO_IPV6:
{
__be16 frag_off;

if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP) {
memcpy(&dst->ip6.dst, &ipv6_hdr(skb)->daddr,
sizeof(dst->ip6.dst));
Expand All @@ -485,6 +487,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
if ((int)protoff < 0)
return -1;
break;
}
#endif
default:
BUG();
Expand Down

0 comments on commit 412662d

Please sign in to comment.