Skip to content

Commit

Permalink
[NETFILTER]: xt_hashlimit: remove ip6tables module dependency
Browse files Browse the repository at this point in the history
Switch from ipv6_find_hdr to ipv6_skip_exthdr to avoid pulling in ip6_tables
and ipv6 when only using it for IPv4.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jan 28, 2008
1 parent 17dfc93 commit 193b23c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/netfilter/xt_hashlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <net/ipv6.h>
#include <net/net_namespace.h>

#include <linux/netfilter/x_tables.h>
Expand Down Expand Up @@ -379,7 +380,7 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
const struct sk_buff *skb, unsigned int protoff)
{
__be16 _ports[2], *ports;
int nexthdr;
u8 nexthdr;

memset(dst, 0, sizeof(*dst));

Expand Down Expand Up @@ -407,8 +408,9 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
if (!(hinfo->cfg.mode &
(XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT)))
return 0;
nexthdr = ipv6_find_hdr(skb, &protoff, -1, NULL);
if (nexthdr < 0)
nexthdr = ipv6_hdr(skb)->nexthdr;
protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
if ((int)protoff < 0)
return -1;
break;
#endif
Expand Down

0 comments on commit 193b23c

Please sign in to comment.