Otherwise we might violate reverse path filtering.
Signed-off-by: David S. Miller <davem@davemloft.net>
struct net *net = dev_net(skb->dev);
const struct iphdr *iph;
const struct tcphdr *th;
+ struct net_device *dev;
struct sock *sk;
int err;
if (!pskb_may_pull(skb, ip_hdrlen(skb) + th->doff * 4))
goto out_err;
+ dev = skb->dev;
sk = __inet_lookup_established(net, &tcp_hashinfo,
iph->saddr, th->source,
iph->daddr, th->dest,
- skb->dev->ifindex);
+ dev->ifindex);
if (sk) {
skb->sk = sk;
skb->destructor = sock_edemux;
if (dst)
dst = dst_check(dst, 0);
if (dst) {
- skb_dst_set_noref(skb, dst);
- err = 0;
+ struct rtable *rt = (struct rtable *) dst;
+
+ if (rt->rt_iif == dev->ifindex) {
+ skb_dst_set_noref(skb, dst);
+ err = 0;
+ }
}
}
}