Skip to content

Commit

Permalink
ipv4, route: pass 0 instead of LOOPBACK_IFINDEX to fib_validate_source()
Browse files Browse the repository at this point in the history
In my special case, when a packet is redirected from veth0 to lo,
its skb->dev->ifindex would be LOOPBACK_IFINDEX. Meanwhile we
pass the hard-coded LOOPBACK_IFINDEX to fib_validate_source()
in ip_route_input_slow(). This would cause the following check
in fib_validate_source() fail:

            (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))

when rp_filter is disabeld on loopback. As suggested by Julian,
the caller should pass 0 here so that we will not end up by
calling __fib_validate_source().

Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Julian Anastasov <ja@ssi.bg>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
congwang1986 authored and davem330 committed Apr 16, 2014
1 parent 6a66271 commit 0d5edc6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,8 +1700,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,

if (res.type == RTN_LOCAL) {
err = fib_validate_source(skb, saddr, daddr, tos,
LOOPBACK_IFINDEX,
dev, in_dev, &itag);
0, dev, in_dev, &itag);
if (err < 0)
goto martian_source_keep_err;
goto local_input;
Expand Down

0 comments on commit 0d5edc6

Please sign in to comment.