Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd7fc25

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Pablo Neira Ayuso says: ==================== If time allows, please consider pulling the following patchset contains two late Netfilter fixes, they are: * Skip broadcast/multicast locally generated traffic in the rpfilter, (closes netfilter bugzilla torvalds#814), from Florian Westphal. * Fix missing elements in the listing of ipset bitmap ip,mac set type with timeout support enabled, from Jozsef Kadlecsik. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 6a4cd3f + f83a7ea commit fd7fc25

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

net/ipv4/netfilter/ipt_rpfilter.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ static bool rpfilter_lookup_reverse(struct flowi4 *fl4,
6666
return dev_match;
6767
}
6868

69+
static bool rpfilter_is_local(const struct sk_buff *skb)
70+
{
71+
const struct rtable *rt = skb_rtable(skb);
72+
return rt && (rt->rt_flags & RTCF_LOCAL);
73+
}
74+
6975
static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
7076
{
7177
const struct xt_rpfilter_info *info;
@@ -76,7 +82,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
7682
info = par->matchinfo;
7783
invert = info->flags & XT_RPFILTER_INVERT;
7884

79-
if (par->in->flags & IFF_LOOPBACK)
85+
if (rpfilter_is_local(skb))
8086
return true ^ invert;
8187

8288
iph = ip_hdr(skb);

net/ipv6/netfilter/ip6t_rpfilter.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,20 @@ static bool rpfilter_lookup_reverse6(const struct sk_buff *skb,
7171
return ret;
7272
}
7373

74+
static bool rpfilter_is_local(const struct sk_buff *skb)
75+
{
76+
const struct rt6_info *rt = (const void *) skb_dst(skb);
77+
return rt && (rt->rt6i_flags & RTF_LOCAL);
78+
}
79+
7480
static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
7581
{
7682
const struct xt_rpfilter_info *info = par->matchinfo;
7783
int saddrtype;
7884
struct ipv6hdr *iph;
7985
bool invert = info->flags & XT_RPFILTER_INVERT;
8086

81-
if (par->in->flags & IFF_LOOPBACK)
87+
if (rpfilter_is_local(skb))
8288
return true ^ invert;
8389

8490
iph = ipv6_hdr(skb);

net/netfilter/ipset/ip_set_bitmap_ipmac.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,11 @@ bitmap_ipmac_tlist(const struct ip_set *set,
339339
nla_put_failure:
340340
nla_nest_cancel(skb, nested);
341341
ipset_nest_end(skb, atd);
342-
return -EMSGSIZE;
342+
if (unlikely(id == first)) {
343+
cb->args[2] = 0;
344+
return -EMSGSIZE;
345+
}
346+
return 0;
343347
}
344348

345349
static int

0 commit comments

Comments
 (0)