Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362648
b: refs/heads/master
c: f83a7ea
h: refs/heads/master
v: v3
  • Loading branch information
Florian Westphal authored and Pablo Neira Ayuso committed Apr 18, 2013
1 parent 8453aab commit 86b6d14
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5add189a125e6b497e31bffdaaed8145ec6d4984
refs/heads/master: f83a7ea2075ca896f2dbf07672bac9cf3682ff74
8 changes: 7 additions & 1 deletion trunk/net/ipv4/netfilter/ipt_rpfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ static bool rpfilter_lookup_reverse(struct flowi4 *fl4,
return dev_match;
}

static bool rpfilter_is_local(const struct sk_buff *skb)
{
const struct rtable *rt = skb_rtable(skb);
return rt && (rt->rt_flags & RTCF_LOCAL);
}

static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_rpfilter_info *info;
Expand All @@ -76,7 +82,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
info = par->matchinfo;
invert = info->flags & XT_RPFILTER_INVERT;

if (par->in->flags & IFF_LOOPBACK)
if (rpfilter_is_local(skb))
return true ^ invert;

iph = ip_hdr(skb);
Expand Down
8 changes: 7 additions & 1 deletion trunk/net/ipv6/netfilter/ip6t_rpfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ static bool rpfilter_lookup_reverse6(const struct sk_buff *skb,
return ret;
}

static bool rpfilter_is_local(const struct sk_buff *skb)
{
const struct rt6_info *rt = (const void *) skb_dst(skb);
return rt && (rt->rt6i_flags & RTF_LOCAL);
}

static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_rpfilter_info *info = par->matchinfo;
int saddrtype;
struct ipv6hdr *iph;
bool invert = info->flags & XT_RPFILTER_INVERT;

if (par->in->flags & IFF_LOOPBACK)
if (rpfilter_is_local(skb))
return true ^ invert;

iph = ipv6_hdr(skb);
Expand Down

0 comments on commit 86b6d14

Please sign in to comment.