VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / net / ipv6 / xfrm6_state.c
index c00c8ef..d98b92d 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/ipsec.h>
 #include <net/ipv6.h>
 
-extern struct xfrm_state_afinfo xfrm6_state_afinfo;
+static struct xfrm_state_afinfo xfrm6_state_afinfo;
 
 static void
 __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
@@ -81,18 +81,13 @@ __xfrm6_find_acq(u8 mode, u32 reqid, u8 proto,
                    proto == x->id.proto &&
                    !ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)x->props.saddr.a6) &&
                    reqid == x->props.reqid &&
-                   x->km.state == XFRM_STATE_ACQ) {
-                           if (!x0)
-                                   x0 = x;
-                           if (x->id.spi)
-                                   continue;
+                   x->km.state == XFRM_STATE_ACQ &&
+                   !x->id.spi) {
                            x0 = x;
                            break;
                    }
        }
-       if (x0) {
-               xfrm_state_hold(x0);
-       } else if (create && (x0 = xfrm_state_alloc()) != NULL) {
+       if (!x0 && create && (x0 = xfrm_state_alloc()) != NULL) {
                ipv6_addr_copy((struct in6_addr *)x0->sel.daddr.a6,
                               (struct in6_addr *)daddr);
                ipv6_addr_copy((struct in6_addr *)x0->sel.saddr.a6,
@@ -110,11 +105,14 @@ __xfrm6_find_acq(u8 mode, u32 reqid, u8 proto,
                x0->props.reqid = reqid;
                x0->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
                xfrm_state_hold(x0);
-               mod_timer(&x0->timer, jiffies + XFRM_ACQ_EXPIRES*HZ);
+               x0->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+               add_timer(&x0->timer);
                xfrm_state_hold(x0);
                list_add_tail(&x0->bydst, xfrm6_state_afinfo.state_bydst+h);
                wake_up(&km_waitq);
        }
+       if (x0)
+               xfrm_state_hold(x0);
        return x0;
 }