xfrm: Assign the inner mode output function to the dst entry
[linux-2.6.git] / net / xfrm / xfrm_output.c
index 64f2ae1..47bacd8 100644 (file)
@@ -67,17 +67,10 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
                        goto error;
                }
 
-               if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
-                       XFRM_SKB_CB(skb)->seq.output = ++x->replay.oseq;
-                       if (unlikely(x->replay.oseq == 0)) {
-                               XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATESEQERROR);
-                               x->replay.oseq--;
-                               xfrm_audit_state_replay_overflow(x, skb);
-                               err = -EOVERFLOW;
-                               goto error;
-                       }
-                       if (xfrm_aevent_is_on(net))
-                               xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
+               err = x->repl->overflow(x, skb);
+               if (err) {
+                       XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATESEQERROR);
+                       goto error;
                }
 
                x->curlft.bytes += skb->len;
@@ -85,6 +78,8 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
 
                spin_unlock_bh(&x->lock);
 
+               skb_dst_force(skb);
+
                err = x->type->output(x, skb);
                if (err == -EINPROGRESS)
                        goto out_exit;
@@ -101,7 +96,7 @@ resume:
                        err = -EHOSTUNREACH;
                        goto error_nolock;
                }
-               skb_dst_set(skb, dst_clone(dst));
+               skb_dst_set(skb, dst);
                x = dst->xfrm;
        } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL));