]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/ipv4/xfrm4_protocol.c
Merge tag 'mpx-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/daveh/x86-mpx
[linux.git] / net / ipv4 / xfrm4_protocol.c
index 8a4285712808e3c0b3f3d63a78d75b17387ec525..ea595c8549c7776a6d6e2fdb2f95e03307e11556 100644 (file)
@@ -72,6 +72,14 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
        if (!head)
                goto out;
 
+       if (!skb_dst(skb)) {
+               const struct iphdr *iph = ip_hdr(skb);
+
+               if (ip_route_input_noref(skb, iph->daddr, iph->saddr,
+                                        iph->tos, skb->dev))
+                       goto drop;
+       }
+
        for_each_protocol_rcu(*head, handler)
                if ((ret = handler->input_handler(skb, nexthdr, spi, encap_type)) != -EINVAL)
                        return ret;
@@ -79,6 +87,7 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
 out:
        icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
 
+drop:
        kfree_skb(skb);
        return 0;
 }