Commit 0d5edc68739f1c1e0519acbea1d3f0c1882a15d7

Authored by Cong Wang
Committed by David S. Miller
1 parent 6a662719c9

ipv4, route: pass 0 instead of LOOPBACK_IFINDEX to fib_validate_source()

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>

Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff

... ... @@ -1700,8 +1700,7 @@
1700 1700  
1701 1701 if (res.type == RTN_LOCAL) {
1702 1702 err = fib_validate_source(skb, saddr, daddr, tos,
1703   - LOOPBACK_IFINDEX,
1704   - dev, in_dev, &itag);
  1703 + 0, dev, in_dev, &itag);
1705 1704 if (err < 0)
1706 1705 goto martian_source_keep_err;
1707 1706 goto local_input;