[SPARC64]: Respect gfp_t argument to dma_alloc_coherent().
[powerpc.git] / net / ipv4 / xfrm4_output.c
index d4df0dd..4ef8efa 100644 (file)
@@ -62,7 +62,7 @@ static void xfrm4_encap(struct sk_buff *skb)
        top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ?
                0 : (iph->frag_off & htons(IP_DF));
        if (!top_iph->frag_off)
-               __ip_select_ident(top_iph, dst, 0);
+               __ip_select_ident(top_iph, dst->child, 0);
 
        top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT);
 
@@ -152,10 +152,16 @@ error_nolock:
        goto out_exit;
 }
 
-int xfrm4_output_finish(struct sk_buff *skb)
+static int xfrm4_output_finish(struct sk_buff *skb)
 {
        int err;
 
+#ifdef CONFIG_NETFILTER
+       if (!skb->dst->xfrm) {
+               IPCB(skb)->flags |= IPSKB_REROUTED;
+               return dst_output(skb);
+       }
+#endif
        while (likely((err = xfrm4_output_one(skb)) == 0)) {
                nf_reset(skb);
 
@@ -178,6 +184,7 @@ int xfrm4_output_finish(struct sk_buff *skb)
 
 int xfrm4_output(struct sk_buff *skb)
 {
-       return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
-                      xfrm4_output_finish);
+       return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, skb->dst->dev,
+                           xfrm4_output_finish,
+                           !(IPCB(skb)->flags & IPSKB_REROUTED));
 }