diff --git a/src/vnet/ipsec/esp_decrypt.c b/src/vnet/ipsec/esp_decrypt.c
index e69cd85..7289b26 100644
--- a/src/vnet/ipsec/esp_decrypt.c
+++ b/src/vnet/ipsec/esp_decrypt.c
@@ -190,6 +190,8 @@
 		}
 	    }
 
+	  sa0->total_data_size += i_b0->current_length;
+
 	  if (PREDICT_TRUE (sa0->integ_alg != IPSEC_INTEG_ALG_NONE))
 	    {
 	      u8 sig[64];
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index 7b7f9b9..44ae229 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -182,6 +182,8 @@
 	      goto trace;
 	    }
 
+	  sa0->total_data_size += i_b0->current_length;
+
 	  /* grab free buffer */
 	  last_empty_buffer = vec_len (empty_buffers) - 1;
 	  o_bi0 = empty_buffers[last_empty_buffer];
diff --git a/src/vnet/ipsec/ikev2.c b/src/vnet/ipsec/ikev2.c
index 5a6c367..0920933 100644
--- a/src/vnet/ipsec/ikev2.c
+++ b/src/vnet/ipsec/ikev2.c
@@ -21,6 +21,7 @@
 #include <vnet/ipsec/ipsec.h>
 #include <vnet/ipsec/ikev2.h>
 #include <vnet/ipsec/ikev2_priv.h>
+#include <openssl/sha.h>
 
 static int ikev2_delete_tunnel_interface (vnet_main_t * vnm,
 					  ikev2_sa_t * sa,
@@ -202,13 +203,15 @@
 }
 
 ikev2_child_sa_t *
-ikev2_sa_get_child (ikev2_sa_t * sa, u32 spi, ikev2_protocol_id_t prot_id)
+ikev2_sa_get_child (ikev2_sa_t * sa, u32 spi, ikev2_protocol_id_t prot_id,
+		    int by_initiator)
 {
   ikev2_child_sa_t *c;
   vec_foreach (c, sa->childs)
   {
-    if (c->i_proposals[0].spi == spi
-	&& c->i_proposals[0].protocol_id == prot_id)
+    ikev2_sa_proposal_t *proposal =
+      by_initiator ? &c->i_proposals[0] : &c->r_proposals[0];
+    if (proposal && proposal->spi == spi && proposal->protocol_id == prot_id)
       return c;
   }
 
@@ -271,6 +274,7 @@
   vec_free (sa->i_nonce);
   vec_free (sa->i_dh_data);
   vec_free (sa->dh_shared_key);
+  vec_free (sa->dh_private_key);
 
   ikev2_sa_free_proposal_vector (&sa->r_proposals);
   ikev2_sa_free_proposal_vector (&sa->i_proposals);
@@ -341,15 +345,84 @@
       return;
     }
 
-  /* generate rspi */
-  RAND_bytes ((u8 *) & sa->rspi, 8);
+  if (sa->is_initiator)
+    {
+      /* generate rspi */
+      RAND_bytes ((u8 *) & sa->ispi, 8);
 
-  /* generate nonce */
-  sa->r_nonce = vec_new (u8, IKEV2_NONCE_SIZE);
-  RAND_bytes ((u8 *) sa->r_nonce, IKEV2_NONCE_SIZE);
+      /* generate nonce */
+      sa->i_nonce = vec_new (u8, IKEV2_NONCE_SIZE);
+      RAND_bytes ((u8 *) sa->i_nonce, IKEV2_NONCE_SIZE);
+    }
+  else
+    {
+      /* generate rspi */
+      RAND_bytes ((u8 *) & sa->rspi, 8);
+
+      /* generate nonce */
+      sa->r_nonce = vec_new (u8, IKEV2_NONCE_SIZE);
+      RAND_bytes ((u8 *) sa->r_nonce, IKEV2_NONCE_SIZE);
+    }
 
   /* generate dh keys */
   ikev2_generate_dh (sa, t);
+
+}
+
+static void
+ikev2_complete_sa_data (ikev2_sa_t * sa, ikev2_sa_t * sai)
+{
+  ikev2_sa_transform_t *t = 0, *t2;
+  ikev2_main_t *km = &ikev2_main;
+
+
+  /*move some data to the new SA */
+#define _(A) ({void* __tmp__ = (A); (A) = 0; __tmp__;})
+  sa->i_nonce = _(sai->i_nonce);
+  sa->i_dh_data = _(sai->i_dh_data);
+  sa->dh_private_key = _(sai->dh_private_key);
+  sa->iaddr.as_u32 = sai->iaddr.as_u32;
+  sa->raddr.as_u32 = sai->raddr.as_u32;
+  sa->is_initiator = sai->is_initiator;
+  sa->profile = sai->profile;
+  sa->i_id.type = sai->i_id.type;
+  sa->i_id.data = _(sai->i_id.data);
+  sa->i_auth.method = sai->i_auth.method;
+  sa->i_auth.hex = sai->i_auth.hex;
+  sa->i_auth.data = _(sai->i_auth.data);
+  sa->i_auth.key = _(sai->i_auth.key);
+  sa->last_sa_init_req_packet_data = _(sai->last_sa_init_req_packet_data);
+  sa->childs = _(sai->childs);
+#undef _
+
+
+  if (sa->dh_group == IKEV2_TRANSFORM_DH_TYPE_NONE)
+    {
+      return;
+    }
+
+  /* check if received DH group is on our list of supported groups */
+  vec_foreach (t2, km->supported_transforms)
+  {
+    if (t2->type == IKEV2_TRANSFORM_TYPE_DH && sa->dh_group == t2->dh_type)
+      {
+	t = t2;
+	break;
+      }
+  }
+
+  if (!t)
+    {
+      clib_warning ("unknown dh data group %u (data len %u)", sa->dh_group,
+		    vec_len (sa->i_dh_data));
+      sa->dh_group = IKEV2_TRANSFORM_DH_TYPE_NONE;
+      return;
+    }
+
+
+  /* generate dh keys */
+  ikev2_complete_dh (sa, t);
+
 }
 
 static void
@@ -551,6 +624,86 @@
   ikev2_set_state (sa, IKEV2_STATE_SA_INIT);
 }
 
+static void
+ikev2_process_sa_init_resp (vlib_main_t * vm, ikev2_sa_t * sa,
+			    ike_header_t * ike)
+{
+  int p = 0;
+  u32 len = clib_net_to_host_u32 (ike->length);
+  u8 payload = ike->nextpayload;
+
+  clib_warning ("ispi %lx rspi %lx nextpayload %x version %x "
+		"exchange %x flags %x msgid %x length %u",
+		clib_net_to_host_u64 (ike->ispi),
+		clib_net_to_host_u64 (ike->rspi),
+		payload, ike->version,
+		ike->exchange, ike->flags,
+		clib_net_to_host_u32 (ike->msgid), len);
+
+  sa->ispi = clib_net_to_host_u64 (ike->ispi);
+  sa->rspi = clib_net_to_host_u64 (ike->rspi);
+
+  /* store whole IKE payload - needed for PSK auth */
+  vec_free (sa->last_sa_init_res_packet_data);
+  vec_add (sa->last_sa_init_res_packet_data, ike, len);
+
+  while (p < len && payload != IKEV2_PAYLOAD_NONE)
+    {
+      ike_payload_header_t *ikep = (ike_payload_header_t *) & ike->payload[p];
+      u32 plen = clib_net_to_host_u16 (ikep->length);
+
+      if (plen < sizeof (ike_payload_header_t))
+	return;
+
+      if (payload == IKEV2_PAYLOAD_SA)
+	{
+	  ikev2_sa_free_proposal_vector (&sa->r_proposals);
+	  sa->r_proposals = ikev2_parse_sa_payload (ikep);
+	  if (sa->r_proposals)
+	    {
+	      ikev2_set_state (sa, IKEV2_STATE_SA_INIT);
+	      ike->msgid =
+		clib_host_to_net_u32 (clib_net_to_host_u32 (ike->msgid) + 1);
+	    }
+	}
+      else if (payload == IKEV2_PAYLOAD_KE)
+	{
+	  ike_ke_payload_header_t *ke = (ike_ke_payload_header_t *) ikep;
+	  sa->dh_group = clib_net_to_host_u16 (ke->dh_group);
+	  vec_free (sa->r_dh_data);
+	  vec_add (sa->r_dh_data, ke->payload, plen - sizeof (*ke));
+	}
+      else if (payload == IKEV2_PAYLOAD_NONCE)
+	{
+	  vec_free (sa->r_nonce);
+	  vec_add (sa->r_nonce, ikep->payload, plen - sizeof (*ikep));
+	}
+      else if (payload == IKEV2_PAYLOAD_NOTIFY)
+	{
+	  ikev2_notify_t *n = ikev2_parse_notify_payload (ikep);
+	  vec_free (n);
+	}
+      else if (payload == IKEV2_PAYLOAD_VENDOR)
+	{
+	  ikev2_parse_vendor_payload (ikep);
+	}
+      else
+	{
+	  clib_warning ("unknown payload %u flags %x length %u", payload,
+			ikep->flags, plen);
+	  if (ikep->flags & IKEV2_PAYLOAD_FLAG_CRITICAL)
+	    {
+	      ikev2_set_state (sa, IKEV2_STATE_NOTIFY_AND_DELETE);
+	      sa->unsupported_cp = payload;
+	      return;
+	    }
+	}
+
+      payload = ikep->nextpayload;
+      p += plen;
+    }
+}
+
 static u8 *
 ikev2_decrypt_sk_payload (ikev2_sa_t * sa, ike_header_t * ike, u8 * payload)
 {
@@ -599,8 +752,9 @@
       return 0;
     }
 
-  hmac = ikev2_calc_integr (tr_integ, sa->sk_ai, (u8 *) ike,
-			    len - tr_integ->key_trunc);
+  hmac =
+    ikev2_calc_integr (tr_integ, sa->is_initiator ? sa->sk_ar : sa->sk_ai,
+		       (u8 *) ike, len - tr_integ->key_trunc);
 
   plen = plen - sizeof (*ikep) - tr_integ->key_trunc;
 
@@ -683,9 +837,16 @@
       goto cleanup_and_exit;
     }
 
-  /* create 1st child SA */
-  ikev2_sa_free_all_child_sa (&sa->childs);
-  vec_add2 (sa->childs, first_child_sa, 1);
+  /* select or create 1st child SA */
+  if (sa->is_initiator)
+    {
+      first_child_sa = &sa->childs[0];
+    }
+  else
+    {
+      ikev2_sa_free_all_child_sa (&sa->childs);
+      vec_add2 (sa->childs, first_child_sa, 1);
+    }
 
 
   /* process encrypted payload */
@@ -701,27 +862,54 @@
       if (payload == IKEV2_PAYLOAD_SA)	/* 33 */
 	{
 	  clib_warning ("received payload SA, len %u", plen - sizeof (*ikep));
-	  ikev2_sa_free_proposal_vector (&first_child_sa->i_proposals);
-	  first_child_sa->i_proposals = ikev2_parse_sa_payload (ikep);
+	  if (sa->is_initiator)
+	    {
+	      ikev2_sa_free_proposal_vector (&first_child_sa->r_proposals);
+	      first_child_sa->r_proposals = ikev2_parse_sa_payload (ikep);
+	    }
+	  else
+	    {
+	      ikev2_sa_free_proposal_vector (&first_child_sa->i_proposals);
+	      first_child_sa->i_proposals = ikev2_parse_sa_payload (ikep);
+	    }
 	}
-      else if (payload == IKEV2_PAYLOAD_IDI)	/* 35 */
+      else if (payload == IKEV2_PAYLOAD_IDI || payload == IKEV2_PAYLOAD_IDR)	/* 35, 36 */
 	{
 	  ike_id_payload_header_t *id = (ike_id_payload_header_t *) ikep;
 
-	  sa->i_id.type = id->id_type;
-	  vec_free (sa->i_id.data);
-	  vec_add (sa->i_id.data, id->payload, plen - sizeof (*id));
+	  if (sa->is_initiator)
+	    {
+	      sa->r_id.type = id->id_type;
+	      vec_free (sa->r_id.data);
+	      vec_add (sa->r_id.data, id->payload, plen - sizeof (*id));
+	    }
+	  else
+	    {
+	      sa->i_id.type = id->id_type;
+	      vec_free (sa->i_id.data);
+	      vec_add (sa->i_id.data, id->payload, plen - sizeof (*id));
+	    }
 
-	  clib_warning ("received payload IDi, len %u id_type %u",
+	  clib_warning ("received payload %s, len %u id_type %u",
+			(payload == IKEV2_PAYLOAD_IDI ? "IDi" : "IDr"),
 			plen - sizeof (*id), id->id_type);
 	}
       else if (payload == IKEV2_PAYLOAD_AUTH)	/* 39 */
 	{
 	  ike_auth_payload_header_t *a = (ike_auth_payload_header_t *) ikep;
 
-	  sa->i_auth.method = a->auth_method;
-	  vec_free (sa->i_auth.data);
-	  vec_add (sa->i_auth.data, a->payload, plen - sizeof (*a));
+	  if (sa->is_initiator)
+	    {
+	      sa->r_auth.method = a->auth_method;
+	      vec_free (sa->r_auth.data);
+	      vec_add (sa->r_auth.data, a->payload, plen - sizeof (*a));
+	    }
+	  else
+	    {
+	      sa->i_auth.method = a->auth_method;
+	      vec_free (sa->i_auth.data);
+	      vec_add (sa->i_auth.data, a->payload, plen - sizeof (*a));
+	    }
 
 	  clib_warning ("received payload AUTH, len %u auth_type %u",
 			plen - sizeof (*a), a->auth_method);
@@ -857,7 +1045,7 @@
   u8 payload = ike->nextpayload;
   u8 *plaintext = 0;
   u8 rekeying = 0;
-  u8 i_nonce[IKEV2_NONCE_SIZE];
+  u8 nonce[IKEV2_NONCE_SIZE];
 
   ike_payload_header_t *ikep;
   u32 plen;
@@ -912,7 +1100,7 @@
 	}
       else if (payload == IKEV2_PAYLOAD_NONCE)
 	{
-	  clib_memcpy (i_nonce, ikep->payload, plen - sizeof (*ikep));
+	  clib_memcpy (nonce, ikep->payload, plen - sizeof (*ikep));
 	}
       else if (payload == IKEV2_PAYLOAD_TSI)
 	{
@@ -939,10 +1127,29 @@
       p += plen;
     }
 
-  if (rekeying)
+  if (sa->is_initiator && proposal->protocol_id == IKEV2_PROTOCOL_ESP)
+    {
+      ikev2_rekey_t *rekey = &sa->rekey[0];
+      rekey->protocol_id = proposal->protocol_id;
+      rekey->i_proposal =
+	ikev2_select_proposal (proposal, IKEV2_PROTOCOL_ESP);
+      rekey->i_proposal->spi = rekey->spi;
+      rekey->r_proposal = proposal;
+      rekey->tsi = tsi;
+      rekey->tsr = tsr;
+      /* update Nr */
+      vec_free (sa->r_nonce);
+      vec_add (sa->r_nonce, nonce, IKEV2_NONCE_SIZE);
+      child_sa = ikev2_sa_get_child (sa, rekey->ispi, IKEV2_PROTOCOL_ESP, 1);
+      if (child_sa)
+	{
+	  child_sa->rekey_retries = 0;
+	}
+    }
+  else if (rekeying)
     {
       ikev2_rekey_t *rekey;
-      child_sa = ikev2_sa_get_child (sa, n->spi, n->protocol_id);
+      child_sa = ikev2_sa_get_child (sa, n->spi, n->protocol_id, 1);
       if (!child_sa)
 	{
 	  clib_warning ("child SA spi %lx not found", n->spi);
@@ -958,7 +1165,7 @@
       rekey->tsr = tsr;
       /* update Ni */
       vec_free (sa->i_nonce);
-      vec_add (sa->i_nonce, i_nonce, IKEV2_NONCE_SIZE);
+      vec_add (sa->i_nonce, nonce, IKEV2_NONCE_SIZE);
       /* generate new Nr */
       vec_free (sa->r_nonce);
       sa->r_nonce = vec_new (u8, IKEV2_NONCE_SIZE);
@@ -1030,20 +1237,34 @@
 {
   ikev2_main_t *km = &ikev2_main;
   ikev2_profile_t *p;
-  ikev2_ts_t *ts, *tsi = 0, *tsr = 0;
+  ikev2_ts_t *ts, *p_tsi, *p_tsr, *tsi = 0, *tsr = 0;
+  ikev2_id_t *id;
 
   /* *INDENT-OFF* */
   pool_foreach (p, km->profiles, ({
 
+    if (sa->is_initiator)
+      {
+        p_tsi = &p->loc_ts;
+        p_tsr = &p->rem_ts;
+        id = &sa->r_id;
+      }
+    else
+      {
+        p_tsi = &p->rem_ts;
+        p_tsr = &p->loc_ts;
+        id = &sa->i_id;
+      }
+
     /* check id */
-    if (p->rem_id.type != sa->i_id.type ||
-        vec_len(p->rem_id.data) != vec_len(sa->i_id.data) ||
-        memcmp(p->rem_id.data, sa->i_id.data, vec_len(p->rem_id.data)))
+    if (p->rem_id.type != id->type ||
+        vec_len(p->rem_id.data) != vec_len(id->data) ||
+        memcmp(p->rem_id.data, id->data, vec_len(p->rem_id.data)))
       continue;
 
     vec_foreach(ts, sa->childs[0].tsi)
       {
-        if (ikev2_ts_cmp(&p->rem_ts, ts))
+        if (ikev2_ts_cmp(p_tsi, ts))
           {
             tsi = vec_dup(ts);
             break;
@@ -1052,7 +1273,7 @@
 
     vec_foreach(ts, sa->childs[0].tsr)
       {
-        if (ikev2_ts_cmp(&p->loc_ts, ts))
+        if (ikev2_ts_cmp(p_tsr, ts))
           {
             tsr = vec_dup(ts);
             break;
@@ -1100,18 +1321,32 @@
     }
 
   key_pad = format (0, "%s", IKEV2_KEY_PAD);
-  authmsg = ikev2_sa_generate_authmsg (sa, 0);
+  authmsg = ikev2_sa_generate_authmsg (sa, sa->is_initiator);
+
+  ikev2_id_t *sa_id;
+  ikev2_auth_t *sa_auth;
+
+  if (sa->is_initiator)
+    {
+      sa_id = &sa->r_id;
+      sa_auth = &sa->r_auth;
+    }
+  else
+    {
+      sa_id = &sa->i_id;
+      sa_auth = &sa->i_auth;
+    }
 
   /* *INDENT-OFF* */
   pool_foreach (p, km->profiles, ({
 
     /* check id */
-    if (p->rem_id.type != sa->i_id.type ||
-        vec_len(p->rem_id.data) != vec_len(sa->i_id.data) ||
-        memcmp(p->rem_id.data, sa->i_id.data, vec_len(p->rem_id.data)))
+    if (p->rem_id.type != sa_id->type ||
+        vec_len(p->rem_id.data) != vec_len(sa_id->data) ||
+        memcmp(p->rem_id.data, sa_id->data, vec_len(p->rem_id.data)))
       continue;
 
-    if (sa->i_auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
+    if (sa_auth->method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
       {
         if (!p->auth.data ||
              p->auth.method != IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
@@ -1120,7 +1355,7 @@
         psk = ikev2_calc_prf(tr_prf, p->auth.data, key_pad);
         auth = ikev2_calc_prf(tr_prf, psk, authmsg);
 
-        if (!memcmp(auth, sa->i_auth.data, vec_len(sa->i_auth.data)))
+        if (!memcmp(auth, sa_auth->data, vec_len(sa_auth->data)))
           {
             ikev2_set_state(sa, IKEV2_STATE_AUTHENTICATED);
             vec_free(auth);
@@ -1129,12 +1364,12 @@
           }
 
       }
-    else if (sa->i_auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
+    else if (sa_auth->method == IKEV2_AUTH_METHOD_RSA_SIG)
       {
         if (p->auth.method != IKEV2_AUTH_METHOD_RSA_SIG)
           continue;
 
-        if (ikev2_verify_sign(p->auth.key, sa->i_auth.data, authmsg) == 1)
+        if (ikev2_verify_sign(p->auth.key, sa_auth->data, authmsg) == 1)
           {
             ikev2_set_state(sa, IKEV2_STATE_AUTHENTICATED);
             sel_p = p;
@@ -1151,28 +1386,32 @@
 
   if (sa->state == IKEV2_STATE_AUTHENTICATED)
     {
-      vec_free (sa->r_id.data);
-      sa->r_id.data = vec_dup (sel_p->loc_id.data);
-      sa->r_id.type = sel_p->loc_id.type;
-
-      /* generate our auth data */
-      authmsg = ikev2_sa_generate_authmsg (sa, 1);
-      if (sel_p->auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
+      if (!sa->is_initiator)
 	{
-	  sa->r_auth.data = ikev2_calc_prf (tr_prf, psk, authmsg);
-	  sa->r_auth.method = IKEV2_AUTH_METHOD_SHARED_KEY_MIC;
-	}
-      else if (sel_p->auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
-	{
-	  sa->r_auth.data = ikev2_calc_sign (km->pkey, authmsg);
-	  sa->r_auth.method = IKEV2_AUTH_METHOD_RSA_SIG;
-	}
-      vec_free (authmsg);
+	  vec_free (sa->r_id.data);
+	  sa->r_id.data = vec_dup (sel_p->loc_id.data);
+	  sa->r_id.type = sel_p->loc_id.type;
 
-      /* select transforms for 1st child sa */
-      ikev2_sa_free_proposal_vector (&sa->childs[0].r_proposals);
-      sa->childs[0].r_proposals =
-	ikev2_select_proposal (sa->childs[0].i_proposals, IKEV2_PROTOCOL_ESP);
+	  /* generate our auth data */
+	  authmsg = ikev2_sa_generate_authmsg (sa, 1);
+	  if (sel_p->auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
+	    {
+	      sa->r_auth.data = ikev2_calc_prf (tr_prf, psk, authmsg);
+	      sa->r_auth.method = IKEV2_AUTH_METHOD_SHARED_KEY_MIC;
+	    }
+	  else if (sel_p->auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
+	    {
+	      sa->r_auth.data = ikev2_calc_sign (km->pkey, authmsg);
+	      sa->r_auth.method = IKEV2_AUTH_METHOD_RSA_SIG;
+	    }
+	  vec_free (authmsg);
+
+	  /* select transforms for 1st child sa */
+	  ikev2_sa_free_proposal_vector (&sa->childs[0].r_proposals);
+	  sa->childs[0].r_proposals =
+	    ikev2_select_proposal (sa->childs[0].i_proposals,
+				   IKEV2_PROTOCOL_ESP);
+	}
     }
   else
     {
@@ -1182,12 +1421,58 @@
   vec_free (key_pad);
 }
 
+
+static void
+ikev2_sa_auth_init (ikev2_sa_t * sa)
+{
+  ikev2_main_t *km = &ikev2_main;
+  u8 *authmsg, *key_pad, *psk = 0, *auth = 0;
+  ikev2_sa_transform_t *tr_prf;
+
+  tr_prf =
+    ikev2_sa_get_td_for_type (sa->r_proposals, IKEV2_TRANSFORM_TYPE_PRF);
+
+  /* only shared key and rsa signature */
+  if (!(sa->i_auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC ||
+	sa->i_auth.method == IKEV2_AUTH_METHOD_RSA_SIG))
+    {
+      clib_warning ("unsupported authentication method %u",
+		    sa->i_auth.method);
+      ikev2_set_state (sa, IKEV2_STATE_AUTH_FAILED);
+      return;
+    }
+
+  key_pad = format (0, "%s", IKEV2_KEY_PAD);
+  authmsg = ikev2_sa_generate_authmsg (sa, 0);
+  psk = ikev2_calc_prf (tr_prf, sa->i_auth.data, key_pad);
+  auth = ikev2_calc_prf (tr_prf, psk, authmsg);
+
+
+  if (sa->i_auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
+    {
+      sa->i_auth.data = ikev2_calc_prf (tr_prf, psk, authmsg);
+      sa->i_auth.method = IKEV2_AUTH_METHOD_SHARED_KEY_MIC;
+    }
+  else if (sa->i_auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
+    {
+      sa->i_auth.data = ikev2_calc_sign (km->pkey, authmsg);
+      sa->i_auth.method = IKEV2_AUTH_METHOD_RSA_SIG;
+    }
+
+  vec_free (psk);
+  vec_free (key_pad);
+  vec_free (auth);
+  vec_free (authmsg);
+}
+
+
 static int
 ikev2_create_tunnel_interface (vnet_main_t * vnm, ikev2_sa_t * sa,
 			       ikev2_child_sa_t * child)
 {
   ipsec_add_del_tunnel_args_t a;
   ikev2_sa_transform_t *tr;
+  ikev2_sa_proposal_t *proposals;
   u8 encr_type = 0;
 
   if (!child->r_proposals)
@@ -1198,21 +1483,31 @@
 
   memset (&a, 0, sizeof (a));
   a.is_add = 1;
-  a.local_ip.as_u32 = sa->raddr.as_u32;
-  a.remote_ip.as_u32 = sa->iaddr.as_u32;
-  a.local_spi = child->i_proposals[0].spi;
-  a.remote_spi = child->r_proposals[0].spi;
+  if (sa->is_initiator)
+    {
+      a.local_ip.as_u32 = sa->iaddr.as_u32;
+      a.remote_ip.as_u32 = sa->raddr.as_u32;
+      proposals = child->i_proposals;
+      a.local_spi = child->r_proposals[0].spi;
+      a.remote_spi = child->i_proposals[0].spi;
+    }
+  else
+    {
+      a.local_ip.as_u32 = sa->raddr.as_u32;
+      a.remote_ip.as_u32 = sa->iaddr.as_u32;
+      proposals = child->r_proposals;
+      a.local_spi = child->i_proposals[0].spi;
+      a.remote_spi = child->r_proposals[0].spi;
+    }
   a.anti_replay = 1;
 
-  tr =
-    ikev2_sa_get_td_for_type (child->r_proposals, IKEV2_TRANSFORM_TYPE_ESN);
+  tr = ikev2_sa_get_td_for_type (proposals, IKEV2_TRANSFORM_TYPE_ESN);
   if (tr)
     a.esn = tr->esn_type;
   else
     a.esn = 0;
 
-  tr =
-    ikev2_sa_get_td_for_type (child->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
+  tr = ikev2_sa_get_td_for_type (proposals, IKEV2_TRANSFORM_TYPE_ENCR);
   if (tr)
     {
       if (tr->encr_type == IKEV2_TRANSFORM_ENCR_TYPE_AES_CBC && tr->key_len)
@@ -1246,8 +1541,7 @@
       return 1;
     }
 
-  tr =
-    ikev2_sa_get_td_for_type (child->r_proposals, IKEV2_TRANSFORM_TYPE_INTEG);
+  tr = ikev2_sa_get_td_for_type (proposals, IKEV2_TRANSFORM_TYPE_INTEG);
   if (tr)
     {
       if (tr->integ_type != IKEV2_TRANSFORM_INTEG_TYPE_AUTH_HMAC_SHA1_96)
@@ -1264,17 +1558,44 @@
 
   ikev2_calc_child_keys (sa, child);
 
+  u8 *loc_ckey, *rem_ckey, *loc_ikey, *rem_ikey;
+  if (sa->is_initiator)
+    {
+      loc_ikey = child->sk_ai;
+      rem_ikey = child->sk_ar;
+      loc_ckey = child->sk_ei;
+      rem_ckey = child->sk_er;
+    }
+  else
+    {
+      loc_ikey = child->sk_ar;
+      rem_ikey = child->sk_ai;
+      loc_ckey = child->sk_er;
+      rem_ckey = child->sk_ei;
+    }
+
   a.integ_alg = IPSEC_INTEG_ALG_SHA1_96;
-  a.local_integ_key_len = vec_len (child->sk_ar);
-  clib_memcpy (a.local_integ_key, child->sk_ar, a.local_integ_key_len);
-  a.remote_integ_key_len = vec_len (child->sk_ai);
-  clib_memcpy (a.remote_integ_key, child->sk_ai, a.remote_integ_key_len);
+  a.local_integ_key_len = vec_len (loc_ikey);
+  clib_memcpy (a.local_integ_key, loc_ikey, a.local_integ_key_len);
+  a.remote_integ_key_len = vec_len (rem_ikey);
+  clib_memcpy (a.remote_integ_key, rem_ikey, a.remote_integ_key_len);
 
   a.crypto_alg = encr_type;
-  a.local_crypto_key_len = vec_len (child->sk_er);
-  clib_memcpy (a.local_crypto_key, child->sk_er, a.local_crypto_key_len);
-  a.remote_crypto_key_len = vec_len (child->sk_ei);
-  clib_memcpy (a.remote_crypto_key, child->sk_ei, a.remote_crypto_key_len);
+  a.local_crypto_key_len = vec_len (loc_ckey);
+  clib_memcpy (a.local_crypto_key, loc_ckey, a.local_crypto_key_len);
+  a.remote_crypto_key_len = vec_len (rem_ckey);
+  clib_memcpy (a.remote_crypto_key, rem_ckey, a.remote_crypto_key_len);
+
+  if (sa->profile && sa->profile->lifetime)
+    {
+      child->time_to_expiration = vlib_time_now (vnm->vlib_main)
+	+ sa->profile->lifetime;
+      if (sa->profile->lifetime_jitter)
+	{
+	  child->time_to_expiration +=
+	    1 + (rand () % sa->profile->lifetime_jitter);
+	}
+    }
 
   ipsec_add_del_tunnel_if (&a);
 
@@ -1287,21 +1608,35 @@
 {
   ipsec_add_del_tunnel_args_t a;
 
-  if (!vec_len (child->r_proposals))
-    return 0;
+  if (sa->is_initiator)
+    {
+      if (!vec_len (child->i_proposals))
+	return 0;
 
-  a.is_add = 0;
-  a.local_ip.as_u32 = sa->raddr.as_u32;
-  a.remote_ip.as_u32 = sa->iaddr.as_u32;
-  a.local_spi = child->i_proposals[0].spi;
-  a.remote_spi = child->r_proposals[0].spi;
+      a.is_add = 0;
+      a.local_ip.as_u32 = sa->iaddr.as_u32;
+      a.remote_ip.as_u32 = sa->raddr.as_u32;
+      a.local_spi = child->r_proposals[0].spi;
+      a.remote_spi = child->i_proposals[0].spi;
+    }
+  else
+    {
+      if (!vec_len (child->r_proposals))
+	return 0;
+
+      a.is_add = 0;
+      a.local_ip.as_u32 = sa->raddr.as_u32;
+      a.remote_ip.as_u32 = sa->iaddr.as_u32;
+      a.local_spi = child->i_proposals[0].spi;
+      a.remote_spi = child->r_proposals[0].spi;
+    }
 
   ipsec_add_del_tunnel_if (&a);
   return 0;
 }
 
 static u32
-ikev2_generate_resp (ikev2_sa_t * sa, ike_header_t * ike)
+ikev2_generate_message (ikev2_sa_t * sa, ike_header_t * ike, void *user)
 {
   v8 *integ = 0;
   ike_payload_header_t *ph;
@@ -1404,6 +1739,14 @@
 				    data);
 	  vec_free (data);
 	}
+      else if (sa->state == IKEV2_STATE_SA_INIT)
+	{
+	  ikev2_payload_add_id (chain, &sa->i_id, IKEV2_PAYLOAD_IDI);
+	  ikev2_payload_add_auth (chain, &sa->i_auth);
+	  ikev2_payload_add_sa (chain, sa->childs[0].i_proposals);
+	  ikev2_payload_add_ts (chain, sa->childs[0].tsi, IKEV2_PAYLOAD_TSI);
+	  ikev2_payload_add_ts (chain, sa->childs[0].tsr, IKEV2_PAYLOAD_TSR);
+	}
       else
 	{
 	  ikev2_set_state (sa, IKEV2_STATE_DELETED);
@@ -1415,10 +1758,13 @@
       /* if pending delete */
       if (sa->del)
 	{
-	  /* The response to a request that deletes the IKE SA is an empty
-	     INFORMATIONAL response. */
 	  if (sa->del[0].protocol_id == IKEV2_PROTOCOL_IKE)
 	    {
+	      if (sa->is_initiator)
+		ikev2_payload_add_delete (chain, sa->del);
+
+	      /* The response to a request that deletes the IKE SA is an empty
+	         INFORMATIONAL response. */
 	      ikev2_set_state (sa, IKEV2_STATE_NOTIFY_AND_DELETE);
 	    }
 	  /* The response to a request that deletes ESP or AH SAs will contain
@@ -1452,37 +1798,71 @@
     }
   else if (ike->exchange == IKEV2_EXCHANGE_CREATE_CHILD_SA)
     {
-      if (sa->rekey)
+      if (sa->is_initiator)
 	{
-	  ikev2_payload_add_sa (chain, sa->rekey[0].r_proposal);
-	  ikev2_payload_add_nonce (chain, sa->r_nonce);
-	  ikev2_payload_add_ts (chain, sa->rekey[0].tsi, IKEV2_PAYLOAD_TSI);
-	  ikev2_payload_add_ts (chain, sa->rekey[0].tsr, IKEV2_PAYLOAD_TSR);
-	  vec_del1 (sa->rekey, 0);
-	}
-      else if (sa->unsupported_cp)
-	{
-	  u8 *data = vec_new (u8, 1);
 
-	  data[0] = sa->unsupported_cp;
-	  ikev2_payload_add_notify (chain,
-				    IKEV2_NOTIFY_MSG_UNSUPPORTED_CRITICAL_PAYLOAD,
-				    data);
+	  ikev2_sa_proposal_t *proposals = (ikev2_sa_proposal_t *) user;
+	  ikev2_notify_t notify;
+	  u8 *data = vec_new (u8, 4);
+	  memset (&notify, 0, sizeof (notify));
+	  notify.protocol_id = IKEV2_PROTOCOL_ESP;
+	  notify.spi = sa->childs[0].i_proposals->spi;
+	  *(u32 *) data = clib_host_to_net_u32 (notify.spi);
+
+	  ikev2_payload_add_sa (chain, proposals);
+	  ikev2_payload_add_nonce (chain, sa->i_nonce);
+	  ikev2_payload_add_ts (chain, sa->childs[0].tsi, IKEV2_PAYLOAD_TSI);
+	  ikev2_payload_add_ts (chain, sa->childs[0].tsr, IKEV2_PAYLOAD_TSR);
+	  ikev2_payload_add_notify_2 (chain, IKEV2_NOTIFY_MSG_REKEY_SA, data,
+				      &notify);
+
 	  vec_free (data);
-	  sa->unsupported_cp = 0;
 	}
       else
 	{
-	  ikev2_payload_add_notify (chain, IKEV2_NOTIFY_MSG_NO_ADDITIONAL_SAS,
-				    0);
+	  if (sa->rekey)
+	    {
+	      ikev2_payload_add_sa (chain, sa->rekey[0].r_proposal);
+	      ikev2_payload_add_nonce (chain, sa->r_nonce);
+	      ikev2_payload_add_ts (chain, sa->rekey[0].tsi,
+				    IKEV2_PAYLOAD_TSI);
+	      ikev2_payload_add_ts (chain, sa->rekey[0].tsr,
+				    IKEV2_PAYLOAD_TSR);
+	      vec_del1 (sa->rekey, 0);
+	    }
+	  else if (sa->unsupported_cp)
+	    {
+	      u8 *data = vec_new (u8, 1);
+
+	      data[0] = sa->unsupported_cp;
+	      ikev2_payload_add_notify (chain,
+					IKEV2_NOTIFY_MSG_UNSUPPORTED_CRITICAL_PAYLOAD,
+					data);
+	      vec_free (data);
+	      sa->unsupported_cp = 0;
+	    }
+	  else
+	    {
+	      ikev2_payload_add_notify (chain,
+					IKEV2_NOTIFY_MSG_NO_ADDITIONAL_SAS,
+					0);
+	    }
 	}
     }
 
   /* IKEv2 header */
   ike->version = IKE_VERSION_2;
-  ike->flags = IKEV2_HDR_FLAG_RESPONSE;
   ike->nextpayload = IKEV2_PAYLOAD_SK;
   tlen = sizeof (*ike);
+  if (sa->is_initiator)
+    {
+      ike->flags = IKEV2_HDR_FLAG_INITIATOR;
+      sa->last_init_msg_id = clib_net_to_host_u32 (ike->msgid);
+    }
+  else
+    {
+      ike->flags = IKEV2_HDR_FLAG_RESPONSE;
+    }
 
 
   if (ike->exchange == IKEV2_EXCHANGE_SA_INIT)
@@ -1518,8 +1898,9 @@
       ike->length = clib_host_to_net_u32 (tlen);
 
       /* calc integrity data for whole packet except hash itself */
-      integ = ikev2_calc_integr (tr_integ, sa->sk_ar, (u8 *) ike,
-				 tlen - tr_integ->key_trunc);
+      integ =
+	ikev2_calc_integr (tr_integ, sa->is_initiator ? sa->sk_ai : sa->sk_ar,
+			   (u8 *) ike, tlen - tr_integ->key_trunc);
 
       clib_memcpy (ike->payload + tlen - tr_integ->key_trunc - sizeof (*ike),
 		   integ, tr_integ->key_trunc);
@@ -1708,43 +2089,81 @@
 	      sa0 = &sa;
 	      memset (sa0, 0, sizeof (*sa0));
 
-	      if (ike0->rspi == 0)
+	      if (ike0->flags & IKEV2_HDR_FLAG_INITIATOR)
 		{
-		  sa0->raddr.as_u32 = ip40->dst_address.as_u32;
-		  sa0->iaddr.as_u32 = ip40->src_address.as_u32;
-
-		  r = ikev2_retransmit_sa_init (ike0, sa0->iaddr, sa0->raddr);
-		  if (r == 1)
+		  if (ike0->rspi == 0)
 		    {
-		      vlib_node_increment_counter (vm, ikev2_node.index,
-						   IKEV2_ERROR_IKE_SA_INIT_RETRANSMIT,
-						   1);
-		      len = clib_net_to_host_u32 (ike0->length);
-		      goto dispatch0;
-		    }
-		  else if (r == -1)
-		    {
-		      vlib_node_increment_counter (vm, ikev2_node.index,
-						   IKEV2_ERROR_IKE_SA_INIT_IGNORE,
-						   1);
-		      goto dispatch0;
-		    }
+		      sa0->raddr.as_u32 = ip40->dst_address.as_u32;
+		      sa0->iaddr.as_u32 = ip40->src_address.as_u32;
 
-		  ikev2_process_sa_init_req (vm, sa0, ike0);
+		      r = ikev2_retransmit_sa_init (ike0, sa0->iaddr,
+						    sa0->raddr);
+		      if (r == 1)
+			{
+			  vlib_node_increment_counter (vm, ikev2_node.index,
+						       IKEV2_ERROR_IKE_SA_INIT_RETRANSMIT,
+						       1);
+			  len = clib_net_to_host_u32 (ike0->length);
+			  goto dispatch0;
+			}
+		      else if (r == -1)
+			{
+			  vlib_node_increment_counter (vm, ikev2_node.index,
+						       IKEV2_ERROR_IKE_SA_INIT_IGNORE,
+						       1);
+			  goto dispatch0;
+			}
+
+		      ikev2_process_sa_init_req (vm, sa0, ike0);
+
+		      if (sa0->state == IKEV2_STATE_SA_INIT)
+			{
+			  ikev2_sa_free_proposal_vector (&sa0->r_proposals);
+			  sa0->r_proposals =
+			    ikev2_select_proposal (sa0->i_proposals,
+						   IKEV2_PROTOCOL_IKE);
+			  ikev2_generate_sa_init_data (sa0);
+			}
+
+		      if (sa0->state == IKEV2_STATE_SA_INIT
+			  || sa0->state == IKEV2_STATE_NOTIFY_AND_DELETE)
+			{
+			  len = ikev2_generate_message (sa0, ike0, 0);
+			}
+
+		      if (sa0->state == IKEV2_STATE_SA_INIT)
+			{
+			  /* add SA to the pool */
+			  pool_get (km->per_thread_data[cpu_index].sas, sa0);
+			  clib_memcpy (sa0, &sa, sizeof (*sa0));
+			  hash_set (km->per_thread_data[cpu_index].sa_by_rspi,
+				    sa0->rspi,
+				    sa0 - km->per_thread_data[cpu_index].sas);
+			}
+		      else
+			{
+			  ikev2_sa_free_all_vec (sa0);
+			}
+		    }
+		}
+	      else
+		{
+		  ikev2_process_sa_init_resp (vm, sa0, ike0);
 
 		  if (sa0->state == IKEV2_STATE_SA_INIT)
 		    {
-		      ikev2_sa_free_proposal_vector (&sa0->r_proposals);
-		      sa0->r_proposals =
-			ikev2_select_proposal (sa0->i_proposals,
-					       IKEV2_PROTOCOL_IKE);
-		      ikev2_generate_sa_init_data (sa0);
-		    }
+		      ike0->exchange = IKEV2_EXCHANGE_IKE_AUTH;
+		      uword *p = hash_get (km->sa_by_ispi, ike0->ispi);
+		      if (p)
+			{
+			  ikev2_sa_t *sai =
+			    pool_elt_at_index (km->sais, p[0]);
 
-		  if (sa0->state == IKEV2_STATE_SA_INIT ||
-		      sa0->state == IKEV2_STATE_NOTIFY_AND_DELETE)
-		    {
-		      len = ikev2_generate_resp (sa0, ike0);
+			  ikev2_complete_sa_data (sa0, sai);
+			  ikev2_calc_keys (sa0);
+			  ikev2_sa_auth_init (sa0);
+			  len = ikev2_generate_message (sa0, ike0, 0);
+			}
 		    }
 
 		  if (sa0->state == IKEV2_STATE_SA_INIT)
@@ -1799,7 +2218,23 @@
 			ikev2_create_tunnel_interface (km->vnet_main, sa0,
 						       &sa0->childs[0]);
 		    }
-		  len = ikev2_generate_resp (sa0, ike0);
+
+		  if (sa0->is_initiator)
+		    {
+		      uword *p = hash_get (km->sa_by_ispi, ike0->ispi);
+		      if (p)
+			{
+			  ikev2_sa_t *sai =
+			    pool_elt_at_index (km->sais, p[0]);
+			  hash_unset (km->sa_by_ispi, sai->ispi);
+			  ikev2_sa_free_all_vec (sai);
+			  pool_put (km->sais, sai);
+			}
+		    }
+		  else
+		    {
+		      len = ikev2_generate_message (sa0, ike0, 0);
+		    }
 		}
 	    }
 	  else if (ike0->exchange == IKEV2_EXCHANGE_INFORMATIONAL)
@@ -1839,22 +2274,32 @@
 			  {
 			    ikev2_child_sa_t *ch_sa;
 			    ch_sa = ikev2_sa_get_child (sa0, d->spi,
-							d->protocol_id);
+							d->protocol_id,
+							!sa0->is_initiator);
 			    if (ch_sa)
 			      {
 				ikev2_delete_tunnel_interface (km->vnet_main,
 							       sa0, ch_sa);
-				vec_add2 (resp, tmp, 1);
-				tmp->protocol_id = d->protocol_id;
-				tmp->spi = ch_sa->r_proposals[0].spi;
+				if (!sa0->is_initiator)
+				  {
+				    vec_add2 (resp, tmp, 1);
+				    tmp->protocol_id = d->protocol_id;
+				    tmp->spi = ch_sa->r_proposals[0].spi;
+				  }
 				ikev2_sa_del_child_sa (sa0, ch_sa);
 			      }
 			  }
-			  vec_free (sa0->del);
-			  sa0->del = resp;
+			  if (!sa0->is_initiator)
+			    {
+			      vec_free (sa0->del);
+			      sa0->del = resp;
+			    }
 			}
 		    }
-		  len = ikev2_generate_resp (sa0, ike0);
+		  if (!sa0->is_initiator)
+		    {
+		      len = ikev2_generate_message (sa0, ike0, 0);
+		    }
 		}
 	    }
 	  else if (ike0->exchange == IKEV2_EXCHANGE_CREATE_CHILD_SA)
@@ -1898,7 +2343,14 @@
 			  ikev2_create_tunnel_interface (km->vnet_main, sa0,
 							 child);
 			}
-		      len = ikev2_generate_resp (sa0, ike0);
+		      if (sa0->is_initiator)
+			{
+			  vec_del1 (sa0->rekey, 0);
+			}
+		      else
+			{
+			  len = ikev2_generate_message (sa0, ike0, 0);
+			}
 		    }
 		}
 	    }
@@ -1915,8 +2367,16 @@
 	  if (len)
 	    {
 	      next0 = IKEV2_NEXT_IP4_LOOKUP;
-	      ip40->dst_address.as_u32 = sa0->iaddr.as_u32;
-	      ip40->src_address.as_u32 = sa0->raddr.as_u32;
+	      if (sa0->is_initiator)
+		{
+		  ip40->dst_address.as_u32 = sa0->raddr.as_u32;
+		  ip40->src_address.as_u32 = sa0->iaddr.as_u32;
+		}
+	      else
+		{
+		  ip40->dst_address.as_u32 = sa0->iaddr.as_u32;
+		  ip40->src_address.as_u32 = sa0->raddr.as_u32;
+		}
 	      udp0->length =
 		clib_host_to_net_u16 (len + sizeof (udp_header_t));
 	      udp0->checksum = 0;
@@ -1979,6 +2439,126 @@
 /* *INDENT-ON* */
 
 
+static clib_error_t *
+ikev2_set_initiator_proposals (vlib_main_t * vm, ikev2_sa_t * sa,
+			       ikev2_transforms_set * ts,
+			       ikev2_sa_proposal_t ** proposals, int is_ike)
+{
+  clib_error_t *r;
+  ikev2_main_t *km = &ikev2_main;
+  ikev2_sa_proposal_t *proposal;
+  vec_add2 (*proposals, proposal, 1);
+  ikev2_sa_transform_t *td;
+  int error;
+
+  /* Encryption */
+  error = 1;
+  vec_foreach (td, km->supported_transforms)
+  {
+    if (td->type == IKEV2_TRANSFORM_TYPE_ENCR
+	&& td->encr_type == IKEV2_TRANSFORM_ENCR_TYPE_AES_CBC
+	&& td->key_len == ts->crypto_key_size / 8)
+      {
+	u16 attr[2];
+	attr[0] = clib_host_to_net_u16 (14 | (1 << 15));
+	attr[1] = clib_host_to_net_u16 (td->key_len << 3);
+	vec_add (td->attrs, (u8 *) attr, 4);
+	vec_add1 (proposal->transforms, *td);
+	td->attrs = 0;
+
+	error = 0;
+	break;
+      }
+  }
+  if (error)
+    {
+      r = clib_error_return (0, "Unsupported algorithm");
+      return r;
+    }
+
+  /* Integrity */
+  error = 1;
+  vec_foreach (td, km->supported_transforms)
+  {
+    if (td->type == IKEV2_TRANSFORM_TYPE_INTEG
+	&& td->integ_type == IKEV2_TRANSFORM_INTEG_TYPE_AUTH_HMAC_SHA1_96)
+      {
+	vec_add1 (proposal->transforms, *td);
+	error = 0;
+	break;
+      }
+  }
+  if (error)
+    {
+      r = clib_error_return (0, "Unsupported algorithm");
+      return r;
+    }
+
+  /* PRF */
+  if (is_ike)
+    {
+      error = 1;
+      vec_foreach (td, km->supported_transforms)
+      {
+	if (td->type == IKEV2_TRANSFORM_TYPE_PRF
+	    && td->prf_type == IKEV2_TRANSFORM_PRF_TYPE_PRF_HMAC_SHA1)
+	  {
+	    vec_add1 (proposal->transforms, *td);
+	    error = 0;
+	    break;
+	  }
+      }
+      if (error)
+	{
+	  r = clib_error_return (0, "Unsupported algorithm");
+	  return r;
+	}
+    }
+
+  /* DH */
+  error = 1;
+  vec_foreach (td, km->supported_transforms)
+  {
+    if (td->type == IKEV2_TRANSFORM_TYPE_DH && td->dh_type == ts->dh_type)
+      {
+	vec_add1 (proposal->transforms, *td);
+	if (is_ike)
+	  {
+	    sa->dh_group = td->dh_type;
+	  }
+	error = 0;
+	break;
+      }
+  }
+  if (error)
+    {
+      r = clib_error_return (0, "Unsupported algorithm");
+      return r;
+    }
+
+  if (!is_ike)
+    {
+      error = 1;
+      vec_foreach (td, km->supported_transforms)
+      {
+	if (td->type == IKEV2_TRANSFORM_TYPE_ESN)
+	  {
+	    vec_add1 (proposal->transforms, *td);
+	    error = 0;
+	    break;
+	  }
+      }
+      if (error)
+	{
+	  r = clib_error_return (0, "Unsupported algorithm");
+	  return r;
+	}
+    }
+
+
+  return 0;
+}
+
 static ikev2_profile_t *
 ikev2_profile_index_by_name (u8 * name)
 {
@@ -1992,6 +2572,64 @@
   return pool_elt_at_index (km->profiles, p[0]);
 }
 
+
+static void
+ikev2_send_ike (vlib_main_t * vm, ip4_address_t * src, ip4_address_t * dst,
+		u32 bi0, u32 len)
+{
+  ip4_header_t *ip40;
+  udp_header_t *udp0;
+  vlib_buffer_t *b0;
+  vlib_frame_t *f;
+  u32 *to_next;
+
+  b0 = vlib_get_buffer (vm, bi0);
+  vlib_buffer_advance (b0, -sizeof (udp_header_t));
+  udp0 = vlib_buffer_get_current (b0);
+  vlib_buffer_advance (b0, -sizeof (ip4_header_t));
+  ip40 = vlib_buffer_get_current (b0);
+
+
+  ip40->ip_version_and_header_length = 0x45;
+  ip40->tos = 0;
+  ip40->fragment_id = 0;
+  ip40->flags_and_fragment_offset = 0;
+  ip40->ttl = 0xff;
+  ip40->protocol = IP_PROTOCOL_UDP;
+  ip40->dst_address.as_u32 = dst->as_u32;
+  ip40->src_address.as_u32 = src->as_u32;
+  udp0->dst_port = clib_host_to_net_u16 (500);
+  udp0->src_port = clib_host_to_net_u16 (500);
+  udp0->length = clib_host_to_net_u16 (len + sizeof (udp_header_t));
+  udp0->checksum = 0;
+  b0->current_length = len + sizeof (ip4_header_t) + sizeof (udp_header_t);
+  ip40->length = clib_host_to_net_u16 (b0->current_length);
+  ip40->checksum = ip4_header_checksum (ip40);
+
+
+  /* send the request */
+  f = vlib_get_frame_to_node (vm, ip4_lookup_node.index);
+  to_next = vlib_frame_vector_args (f);
+  to_next[0] = bi0;
+  f->n_vectors = 1;
+  vlib_put_frame_to_node (vm, ip4_lookup_node.index, f);
+
+}
+
+static u32
+ikev2_get_new_ike_header_buff (vlib_main_t * vm, ike_header_t ** ike)
+{
+  u32 bi0;
+  if (vlib_buffer_alloc (vm, &bi0, 1) != 1)
+    {
+      *ike = 0;
+      return 0;
+    }
+  vlib_buffer_t *b0 = vlib_get_buffer (vm, bi0);
+  *ike = vlib_buffer_get_current (b0);
+  return bi0;
+}
+
 clib_error_t *
 ikev2_set_local_key (vlib_main_t * vm, u8 * file)
 {
@@ -2018,6 +2656,7 @@
       pool_get (km->profiles, p);
       memset (p, 0, sizeof (*p));
       p->name = vec_dup (name);
+      p->responder.sw_if_index = ~0;
       uword index = p - km->profiles;
       mhash_set_mem (&km->profile_index_by_name, name, &index, 0);
     }
@@ -2145,6 +2784,470 @@
 
 
 clib_error_t *
+ikev2_set_profile_responder (vlib_main_t * vm, u8 * name,
+			     u32 sw_if_index, ip4_address_t ip4)
+{
+  ikev2_profile_t *p;
+  clib_error_t *r;
+
+  p = ikev2_profile_index_by_name (name);
+
+  if (!p)
+    {
+      r = clib_error_return (0, "unknown profile %v", name);
+      return r;
+    }
+
+  p->responder.sw_if_index = sw_if_index;
+  p->responder.ip4 = ip4;
+
+  return 0;
+}
+
+clib_error_t *
+ikev2_set_profile_ike_transforms (vlib_main_t * vm, u8 * name,
+				  ikev2_transform_encr_type_t crypto_alg,
+				  ikev2_transform_integ_type_t integ_alg,
+				  ikev2_transform_dh_type_t dh_type,
+				  u32 crypto_key_size)
+{
+  ikev2_profile_t *p;
+  clib_error_t *r;
+
+  p = ikev2_profile_index_by_name (name);
+
+  if (!p)
+    {
+      r = clib_error_return (0, "unknown profile %v", name);
+      return r;
+    }
+
+  p->ike_ts.crypto_alg = crypto_alg;
+  p->ike_ts.integ_alg = integ_alg;
+  p->ike_ts.dh_type = dh_type;
+  p->ike_ts.crypto_key_size = crypto_key_size;
+  return 0;
+}
+
+clib_error_t *
+ikev2_set_profile_esp_transforms (vlib_main_t * vm, u8 * name,
+				  ikev2_transform_encr_type_t crypto_alg,
+				  ikev2_transform_integ_type_t integ_alg,
+				  ikev2_transform_dh_type_t dh_type,
+				  u32 crypto_key_size)
+{
+  ikev2_profile_t *p;
+  clib_error_t *r;
+
+  p = ikev2_profile_index_by_name (name);
+
+  if (!p)
+    {
+      r = clib_error_return (0, "unknown profile %v", name);
+      return r;
+    }
+
+  p->esp_ts.crypto_alg = crypto_alg;
+  p->esp_ts.integ_alg = integ_alg;
+  p->esp_ts.dh_type = dh_type;
+  p->esp_ts.crypto_key_size = crypto_key_size;
+  return 0;
+}
+
+clib_error_t *
+ikev2_set_profile_sa_lifetime (vlib_main_t * vm, u8 * name,
+			       u64 lifetime, u32 jitter, u32 handover,
+			       u64 maxdata)
+{
+  ikev2_profile_t *p;
+  clib_error_t *r;
+
+  p = ikev2_profile_index_by_name (name);
+
+  if (!p)
+    {
+      r = clib_error_return (0, "unknown profile %v", name);
+      return r;
+    }
+
+  p->lifetime = lifetime;
+  p->lifetime_jitter = jitter;
+  p->handover = handover;
+  p->lifetime_maxdata = maxdata;
+  return 0;
+}
+
+clib_error_t *
+ikev2_initiate_sa_init (vlib_main_t * vm, u8 * name)
+{
+  ikev2_profile_t *p;
+  clib_error_t *r;
+  ip4_main_t *im = &ip4_main;
+  ikev2_main_t *km = &ikev2_main;
+
+  p = ikev2_profile_index_by_name (name);
+
+  if (!p)
+    {
+      r = clib_error_return (0, "unknown profile %v", name);
+      return r;
+    }
+
+  if (p->responder.sw_if_index == ~0 || p->responder.ip4.data_u32 == 0)
+    {
+      r = clib_error_return (0, "responder not set for profile %v", name);
+      return r;
+    }
+
+
+  /* Create the Initiator Request */
+  {
+    ike_header_t *ike0;
+    u32 bi0 = 0;
+    ip_lookup_main_t *lm = &im->lookup_main;
+    u32 if_add_index0;
+    int len = sizeof (ike_header_t);
+
+    /* Get own iface IP */
+    if_add_index0 =
+      lm->if_address_pool_index_by_sw_if_index[p->responder.sw_if_index];
+    ip_interface_address_t *if_add =
+      pool_elt_at_index (lm->if_address_pool, if_add_index0);
+    ip4_address_t *if_ip = ip_interface_address_get_address (lm, if_add);
+
+    bi0 = ikev2_get_new_ike_header_buff (vm, &ike0);
+
+    /* Prepare the SA and the IKE payload */
+    ikev2_sa_t sa;
+    memset (&sa, 0, sizeof (ikev2_sa_t));
+    ikev2_payload_chain_t *chain = 0;
+    ikev2_payload_new_chain (chain);
+
+    /* Build the IKE proposal payload */
+    ikev2_sa_proposal_t *proposals = 0;
+    ikev2_set_initiator_proposals (vm, &sa, &p->ike_ts, &proposals, 1);
+    proposals[0].proposal_num = 1;
+    proposals[0].protocol_id = IKEV2_PROTOCOL_IKE;
+
+    /* Add and then cleanup proposal data */
+    ikev2_payload_add_sa (chain, proposals);
+    ikev2_sa_free_proposal_vector (&proposals);
+
+    sa.is_initiator = 1;
+    sa.profile = p;
+    sa.state = IKEV2_STATE_SA_INIT;
+    ikev2_generate_sa_init_data (&sa);
+    ikev2_payload_add_ke (chain, sa.dh_group, sa.i_dh_data);
+    ikev2_payload_add_nonce (chain, sa.i_nonce);
+
+    /* Build the child SA proposal */
+    vec_resize (sa.childs, 1);
+    ikev2_set_initiator_proposals (vm, &sa, &p->esp_ts,
+				   &sa.childs[0].i_proposals, 0);
+    sa.childs[0].i_proposals[0].proposal_num = 1;
+    sa.childs[0].i_proposals[0].protocol_id = IKEV2_PROTOCOL_ESP;
+    RAND_bytes ((u8 *) & sa.childs[0].i_proposals[0].spi,
+		sizeof (sa.childs[0].i_proposals[0].spi));
+
+
+
+    /* Add NAT detection notification messages (mandatory) */
+    u8 nat_detection_source[8 + 8 + 4 + 2];
+    u8 *nat_detection_sha1 = vec_new (u8, 20);
+
+    u64 tmpspi = clib_host_to_net_u64 (sa.ispi);
+    clib_memcpy (&nat_detection_source[0], &tmpspi, sizeof (tmpspi));
+    tmpspi = clib_host_to_net_u64 (sa.rspi);
+    clib_memcpy (&nat_detection_source[8], &tmpspi, sizeof (tmpspi));
+    u16 tmpport = clib_host_to_net_u16 (500);
+    clib_memcpy (&nat_detection_source[8 + 8 + 4], &tmpport,
+		 sizeof (tmpport));
+    u32 tmpip = clib_host_to_net_u32 (if_ip->as_u32);
+    clib_memcpy (&nat_detection_source[8 + 8], &tmpip, sizeof (tmpip));
+    SHA1 (nat_detection_source, sizeof (nat_detection_source),
+	  nat_detection_sha1);
+    ikev2_payload_add_notify (chain, IKEV2_NOTIFY_MSG_NAT_DETECTION_SOURCE_IP,
+			      nat_detection_sha1);
+    tmpip = clib_host_to_net_u32 (p->responder.ip4.as_u32);
+    clib_memcpy (&nat_detection_source[8 + 8], &tmpip, sizeof (tmpip));
+    SHA1 (nat_detection_source, sizeof (nat_detection_source),
+	  nat_detection_sha1);
+    ikev2_payload_add_notify (chain,
+			      IKEV2_NOTIFY_MSG_NAT_DETECTION_DESTINATION_IP,
+			      nat_detection_sha1);
+    vec_free (nat_detection_sha1);
+
+    u8 *sig_hash_algo = vec_new (u8, 8);
+    u64 tmpsig = clib_host_to_net_u64 (0x0001000200030004);
+    clib_memcpy (sig_hash_algo, &tmpsig, sizeof (tmpsig));
+    ikev2_payload_add_notify (chain,
+			      IKEV2_NOTIFY_MSG_SIGNATURE_HASH_ALGORITHMS,
+			      sig_hash_algo);
+    vec_free (sig_hash_algo);
+
+
+    /* Buffer update and bolierplate */
+    len += vec_len (chain->data);
+    ike0->nextpayload = chain->first_payload_type;
+    ike0->length = clib_host_to_net_u32 (len);
+    clib_memcpy (ike0->payload, chain->data, vec_len (chain->data));
+    ikev2_payload_destroy_chain (chain);
+
+    ike0->version = IKE_VERSION_2;
+    ike0->flags = IKEV2_HDR_FLAG_INITIATOR;
+    ike0->exchange = IKEV2_EXCHANGE_SA_INIT;
+    ike0->ispi = sa.ispi;
+
+    /* store whole IKE payload - needed for PSK auth */
+    vec_free (sa.last_sa_init_req_packet_data);
+    vec_add (sa.last_sa_init_req_packet_data, ike0, len);
+
+    /* add data to the SA then add it to the pool */
+    sa.iaddr.as_u32 = if_ip->as_u32;
+    sa.raddr.as_u32 = p->responder.ip4.as_u32;
+    sa.i_id.type = p->loc_id.type;
+    sa.i_id.data = vec_dup (p->loc_id.data);
+    sa.i_auth.method = p->auth.method;
+    sa.i_auth.hex = p->auth.hex;
+    sa.i_auth.data = vec_dup (p->auth.data);
+    sa.i_auth.key = vec_dup (p->auth.key);
+    vec_add (sa.childs[0].tsi, &p->loc_ts, 1);
+    vec_add (sa.childs[0].tsr, &p->rem_ts, 1);
+
+    /* add SA to the pool */
+    ikev2_sa_t *sa0 = 0;
+    pool_get (km->sais, sa0);
+    clib_memcpy (sa0, &sa, sizeof (*sa0));
+    hash_set (km->sa_by_ispi, sa0->ispi, sa0 - km->sais);
+
+    ikev2_send_ike (vm, if_ip, &p->responder.ip4, bi0, len);
+
+  }
+
+  return 0;
+}
+
+static void
+ikev2_delete_child_sa_internal (vlib_main_t * vm, ikev2_sa_t * sa,
+				ikev2_child_sa_t * csa)
+{
+  /* Create the Initiator notification for child SA removal */
+  ikev2_main_t *km = &ikev2_main;
+  ike_header_t *ike0;
+  u32 bi0 = 0;
+  int len;
+
+  bi0 = ikev2_get_new_ike_header_buff (vm, &ike0);
+
+
+  ike0->exchange = IKEV2_EXCHANGE_INFORMATIONAL;
+  ike0->ispi = clib_host_to_net_u64 (sa->ispi);
+  ike0->rspi = clib_host_to_net_u64 (sa->rspi);
+  vec_resize (sa->del, 1);
+  sa->del->protocol_id = IKEV2_PROTOCOL_ESP;
+  sa->del->spi = csa->i_proposals->spi;
+  ike0->msgid = clib_host_to_net_u32 (sa->last_init_msg_id + 1);
+  sa->last_init_msg_id = clib_net_to_host_u32 (ike0->msgid);
+  len = ikev2_generate_message (sa, ike0, 0);
+
+  ikev2_send_ike (vm, &sa->iaddr, &sa->raddr, bi0, len);
+
+  /* delete local child SA */
+  ikev2_delete_tunnel_interface (km->vnet_main, sa, csa);
+  ikev2_sa_del_child_sa (sa, csa);
+}
+
+clib_error_t *
+ikev2_initiate_delete_child_sa (vlib_main_t * vm, u32 ispi)
+{
+  clib_error_t *r;
+  ikev2_main_t *km = &ikev2_main;
+  ikev2_main_per_thread_data_t *tkm;
+  ikev2_sa_t *fsa = 0;
+  ikev2_child_sa_t *fchild = 0;
+
+  /* Search for the child SA */
+  vec_foreach (tkm, km->per_thread_data)
+  {
+    ikev2_sa_t *sa;
+    if (fchild)
+      break;
+    /* *INDENT-OFF* */
+    pool_foreach (sa, tkm->sas, ({
+      fchild = ikev2_sa_get_child(sa, ispi, IKEV2_PROTOCOL_ESP, 1);
+      if (fchild)
+        {
+          fsa = sa;
+          break;
+        }
+    }));
+    /* *INDENT-ON* */
+  }
+
+  if (!fchild || !fsa)
+    {
+      r = clib_error_return (0, "Child SA not found");
+      return r;
+    }
+  else
+    {
+      ikev2_delete_child_sa_internal (vm, fsa, fchild);
+    }
+
+  return 0;
+}
+
+clib_error_t *
+ikev2_initiate_delete_ike_sa (vlib_main_t * vm, u64 ispi)
+{
+  clib_error_t *r;
+  ikev2_main_t *km = &ikev2_main;
+  ikev2_main_per_thread_data_t *tkm;
+  ikev2_sa_t *fsa = 0;
+  ikev2_main_per_thread_data_t *ftkm = 0;
+
+  /* Search for the IKE SA */
+  vec_foreach (tkm, km->per_thread_data)
+  {
+    ikev2_sa_t *sa;
+    if (fsa)
+      break;
+    /* *INDENT-OFF* */
+    pool_foreach (sa, tkm->sas, ({
+      if (sa->ispi == ispi)
+        {
+          fsa = sa;
+          ftkm = tkm;
+          break;
+        }
+    }));
+    /* *INDENT-ON* */
+  }
+
+  if (!fsa)
+    {
+      r = clib_error_return (0, "IKE SA not found");
+      return r;
+    }
+
+
+  /* Create the Initiator notification for IKE SA removal */
+  {
+    ike_header_t *ike0;
+    u32 bi0 = 0;
+    int len;
+
+    bi0 = ikev2_get_new_ike_header_buff (vm, &ike0);
+
+
+    ike0->exchange = IKEV2_EXCHANGE_INFORMATIONAL;
+    ike0->ispi = clib_host_to_net_u64 (fsa->ispi);
+    ike0->rspi = clib_host_to_net_u64 (fsa->rspi);
+    vec_resize (fsa->del, 1);
+    fsa->del->protocol_id = IKEV2_PROTOCOL_IKE;
+    fsa->del->spi = ispi;
+    ike0->msgid = clib_host_to_net_u32 (fsa->last_init_msg_id + 1);
+    fsa->last_init_msg_id = clib_net_to_host_u32 (ike0->msgid);
+    len = ikev2_generate_message (fsa, ike0, 0);
+
+    ikev2_send_ike (vm, &fsa->iaddr, &fsa->raddr, bi0, len);
+  }
+
+
+  /* delete local SA */
+  ikev2_child_sa_t *c;
+  vec_foreach (c, fsa->childs)
+  {
+    ikev2_delete_tunnel_interface (km->vnet_main, fsa, c);
+    ikev2_sa_del_child_sa (fsa, c);
+  }
+  ikev2_sa_free_all_vec (fsa);
+  uword *p = hash_get (ftkm->sa_by_rspi, fsa->rspi);
+  if (p)
+    {
+      hash_unset (ftkm->sa_by_rspi, fsa->rspi);
+      pool_put (ftkm->sas, fsa);
+    }
+
+
+  return 0;
+}
+
+static void
+ikev2_rekey_child_sa_internal (vlib_main_t * vm, ikev2_sa_t * sa,
+			       ikev2_child_sa_t * csa)
+{
+  /* Create the Initiator request for create child SA */
+  ike_header_t *ike0;
+  u32 bi0 = 0;
+  int len;
+
+
+  bi0 = ikev2_get_new_ike_header_buff (vm, &ike0);
+
+
+  ike0->version = IKE_VERSION_2;
+  ike0->flags = IKEV2_HDR_FLAG_INITIATOR;
+  ike0->exchange = IKEV2_EXCHANGE_CREATE_CHILD_SA;
+  ike0->ispi = clib_host_to_net_u64 (sa->ispi);
+  ike0->rspi = clib_host_to_net_u64 (sa->rspi);
+  ike0->msgid = clib_host_to_net_u32 (sa->last_init_msg_id + 1);
+  sa->last_init_msg_id = clib_net_to_host_u32 (ike0->msgid);
+
+  ikev2_rekey_t *rekey;
+  vec_add2 (sa->rekey, rekey, 1);
+  ikev2_sa_proposal_t *proposals = vec_dup (csa->i_proposals);
+
+  /*need new ispi */
+  RAND_bytes ((u8 *) & proposals[0].spi, sizeof (proposals[0].spi));
+  rekey->spi = proposals[0].spi;
+  rekey->ispi = csa->i_proposals->spi;
+  len = ikev2_generate_message (sa, ike0, proposals);
+  ikev2_send_ike (vm, &sa->iaddr, &sa->raddr, bi0, len);
+  vec_free (proposals);
+}
+
+clib_error_t *
+ikev2_initiate_rekey_child_sa (vlib_main_t * vm, u32 ispi)
+{
+  clib_error_t *r;
+  ikev2_main_t *km = &ikev2_main;
+  ikev2_main_per_thread_data_t *tkm;
+  ikev2_sa_t *fsa = 0;
+  ikev2_child_sa_t *fchild = 0;
+
+  /* Search for the child SA */
+  vec_foreach (tkm, km->per_thread_data)
+  {
+    ikev2_sa_t *sa;
+    if (fchild)
+      break;
+    /* *INDENT-OFF* */
+    pool_foreach (sa, tkm->sas, ({
+      fchild = ikev2_sa_get_child(sa, ispi, IKEV2_PROTOCOL_ESP, 1);
+      if (fchild)
+        {
+          fsa = sa;
+          break;
+        }
+    }));
+    /* *INDENT-ON* */
+  }
+
+  if (!fchild || !fsa)
+    {
+      r = clib_error_return (0, "Child SA not found");
+      return r;
+    }
+  else
+    {
+      ikev2_rekey_child_sa_internal (vm, fsa, fchild);
+    }
+
+  return 0;
+}
+
+clib_error_t *
 ikev2_init (vlib_main_t * vm)
 {
   ikev2_main_t *km = &ikev2_main;
@@ -2167,6 +3270,9 @@
 	hash_create (0, sizeof (uword));
     }
 
+  km->sa_by_ispi = hash_create (0, sizeof (uword));
+
+
   if ((error = vlib_call_init_function (vm, ikev2_cli_init)))
     return error;
 
@@ -2176,6 +3282,146 @@
 }
 
 
+static u8
+ikev2_mngr_process_child_sa (ikev2_sa_t * sa, ikev2_child_sa_t * csa)
+{
+  ikev2_main_t *km = &ikev2_main;
+  vlib_main_t *vm = km->vlib_main;
+  f64 now = vlib_time_now (vm);
+  u8 res = 0;
+
+  if (sa->is_initiator && sa->profile && csa->time_to_expiration
+      && now > csa->time_to_expiration)
+    {
+      if (!csa->is_expired || csa->rekey_retries > 0)
+	{
+	  ikev2_rekey_child_sa_internal (vm, sa, csa);
+	  csa->time_to_expiration = now + sa->profile->handover;
+	  csa->is_expired = 1;
+	  if (csa->rekey_retries == 0)
+	    {
+	      csa->rekey_retries = 5;
+	    }
+	  else if (csa->rekey_retries > 0)
+	    {
+	      csa->rekey_retries--;
+	      clib_warning ("Rekeing Child SA 0x%x, retries left %d",
+			    csa->i_proposals->spi, csa->rekey_retries);
+	      if (csa->rekey_retries == 0)
+		{
+		  csa->rekey_retries = -1;
+		}
+	    }
+	  res |= 1;
+	}
+      else
+	{
+	  csa->time_to_expiration = 0;
+	  ikev2_delete_child_sa_internal (vm, sa, csa);
+	  res |= 1;
+	}
+    }
+
+  return res;
+}
+
+static void
+ikev2_mngr_process_ipsec_sa (ipsec_sa_t * ipsec_sa)
+{
+  ikev2_main_t *km = &ikev2_main;
+  vlib_main_t *vm = km->vlib_main;
+  ikev2_main_per_thread_data_t *tkm;
+  ikev2_sa_t *fsa = 0;
+  ikev2_child_sa_t *fchild = 0;
+  f64 now = vlib_time_now (vm);
+
+  /* Search for the SA and child SA */
+  vec_foreach (tkm, km->per_thread_data)
+  {
+    ikev2_sa_t *sa;
+    if (fchild)
+      break;
+    /* *INDENT-OFF* */
+    pool_foreach (sa, tkm->sas, ({
+      fchild = ikev2_sa_get_child(sa, ipsec_sa->spi, IKEV2_PROTOCOL_ESP, 1);
+      if (fchild)
+        {
+          fsa = sa;
+          break;
+        }
+    }));
+    /* *INDENT-ON* */
+  }
+
+  if (fchild && fsa && fsa->profile && fsa->profile->lifetime_maxdata)
+    {
+      if (!fchild->is_expired
+	  && ipsec_sa->total_data_size > fsa->profile->lifetime_maxdata)
+	{
+	  fchild->time_to_expiration = now;
+	}
+    }
+}
+
+static vlib_node_registration_t ikev2_mngr_process_node;
+
+static uword
+ikev2_mngr_process_fn (vlib_main_t * vm, vlib_node_runtime_t * rt,
+		       vlib_frame_t * f)
+{
+  ikev2_main_t *km = &ikev2_main;
+  ipsec_main_t *im = &ipsec_main;
+
+  while (1)
+    {
+      u8 req_sent = 0;
+      vlib_process_wait_for_event_or_clock (vm, 1);
+      vlib_process_get_events (vm, NULL);
+
+      /* process ike child sas */
+      ikev2_main_per_thread_data_t *tkm;
+      vec_foreach (tkm, km->per_thread_data)
+      {
+	ikev2_sa_t *sa;
+        /* *INDENT-OFF* */
+        pool_foreach (sa, tkm->sas, ({
+          ikev2_child_sa_t *c;
+          vec_foreach (c, sa->childs)
+            {
+            req_sent |= ikev2_mngr_process_child_sa(sa, c);
+            }
+        }));
+        /* *INDENT-ON* */
+      }
+
+      /* process ipsec sas */
+      ipsec_sa_t *sa;
+      /* *INDENT-OFF* */
+      pool_foreach (sa, im->sad, ({
+        ikev2_mngr_process_ipsec_sa(sa);
+      }));
+      /* *INDENT-ON* */
+
+      if (req_sent)
+	{
+	  vlib_process_wait_for_event_or_clock (vm, 5);
+	  vlib_process_get_events (vm, NULL);
+	  req_sent = 0;
+	}
+
+    }
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (ikev2_mngr_process_node, static) = {
+    .function = ikev2_mngr_process_fn,
+    .type = VLIB_NODE_TYPE_PROCESS,
+    .name =
+    "ikev2-manager-process",
+};
+
+/* *INDENT-ON* */
 
 /*
  * fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/ipsec/ikev2.h b/src/vnet/ipsec/ikev2.h
index 723fdde..84a8be5 100644
--- a/src/vnet/ipsec/ikev2.h
+++ b/src/vnet/ipsec/ikev2.h
@@ -371,6 +371,31 @@
 				    u8 protocol_id, u16 start_port,
 				    u16 end_port, ip4_address_t start_addr,
 				    ip4_address_t end_addr, int is_local);
+clib_error_t *ikev2_set_profile_responder (vlib_main_t * vm, u8 * name,
+					   u32 sw_if_index,
+					   ip4_address_t ip4);
+clib_error_t *ikev2_set_profile_ike_transforms (vlib_main_t * vm, u8 * name,
+						ikev2_transform_encr_type_t
+						crypto_alg,
+						ikev2_transform_integ_type_t
+						integ_alg,
+						ikev2_transform_dh_type_t
+						dh_type, u32 crypto_key_size);
+clib_error_t *ikev2_set_profile_esp_transforms (vlib_main_t * vm, u8 * name,
+						ikev2_transform_encr_type_t
+						crypto_alg,
+						ikev2_transform_integ_type_t
+						integ_alg,
+						ikev2_transform_dh_type_t
+						dh_type, u32 crypto_key_size);
+clib_error_t *ikev2_set_profile_sa_lifetime (vlib_main_t * vm, u8 * name,
+					     u64 lifetime, u32 jitter,
+					     u32 handover, u64 maxdata);
+clib_error_t *ikev2_initiate_sa_init (vlib_main_t * vm, u8 * name);
+clib_error_t *ikev2_initiate_delete_child_sa (vlib_main_t * vm, u32 ispi);
+clib_error_t *ikev2_initiate_delete_ike_sa (vlib_main_t * vm, u64 ispi);
+clib_error_t *ikev2_initiate_rekey_child_sa (vlib_main_t * vm, u32 ispi);
+
 /* ikev2_format.c */
 u8 *format_ikev2_auth_method (u8 * s, va_list * args);
 u8 *format_ikev2_id_type (u8 * s, va_list * args);
diff --git a/src/vnet/ipsec/ikev2_cli.c b/src/vnet/ipsec/ikev2_cli.c
index 1369c18..5c88d8d 100644
--- a/src/vnet/ipsec/ikev2_cli.c
+++ b/src/vnet/ipsec/ikev2_cli.c
@@ -173,14 +173,21 @@
 				  unformat_input_t * input,
 				  vlib_cli_command_t * cmd)
 {
+  vnet_main_t *vnm = vnet_get_main ();
   unformat_input_t _line_input, *line_input = &_line_input;
   u8 *name = 0;
   clib_error_t *r = 0;
   u32 id_type;
   u8 *data = 0;
   u32 tmp1, tmp2, tmp3;
+  u64 tmp4, tmp5;
   ip4_address_t ip4;
   ip4_address_t end_addr;
+  u32 responder_sw_if_index = (u32) ~ 0;
+  ip4_address_t responder_ip4;
+  ikev2_transform_encr_type_t crypto_alg;
+  ikev2_transform_integ_type_t integ_alg;
+  ikev2_transform_dh_type_t dh_type;
 
   const char *valid_chars = "a-zA-Z0-9_";
 
@@ -308,6 +315,53 @@
 				  ip4, end_addr, /*remote */ 0);
 	  goto done;
 	}
+      else if (unformat (line_input, "set %U responder %U %U",
+			 unformat_token, valid_chars, &name,
+			 unformat_vnet_sw_interface, vnm,
+			 &responder_sw_if_index, unformat_ip4_address,
+			 &responder_ip4))
+	{
+	  r =
+	    ikev2_set_profile_responder (vm, name, responder_sw_if_index,
+					 responder_ip4);
+	  goto done;
+	}
+      else
+	if (unformat
+	    (line_input,
+	     "set %U ike-crypto-alg %U %u ike-integ-alg %U ike-dh %U",
+	     unformat_token, valid_chars, &name,
+	     unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1,
+	     unformat_ikev2_transform_integ_type, &integ_alg,
+	     unformat_ikev2_transform_dh_type, &dh_type))
+	{
+	  r =
+	    ikev2_set_profile_ike_transforms (vm, name, crypto_alg, integ_alg,
+					      dh_type, tmp1);
+	  goto done;
+	}
+      else
+	if (unformat
+	    (line_input,
+	     "set %U esp-crypto-alg %U %u esp-integ-alg %U esp-dh %U",
+	     unformat_token, valid_chars, &name,
+	     unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1,
+	     unformat_ikev2_transform_integ_type, &integ_alg,
+	     unformat_ikev2_transform_dh_type, &dh_type))
+	{
+	  r =
+	    ikev2_set_profile_esp_transforms (vm, name, crypto_alg, integ_alg,
+					      dh_type, tmp1);
+	  goto done;
+	}
+      else if (unformat (line_input, "set %U sa-lifetime %lu %u %u %lu",
+			 unformat_token, valid_chars, &name,
+			 &tmp4, &tmp1, &tmp2, &tmp5))
+	{
+	  r =
+	    ikev2_set_profile_sa_lifetime (vm, name, tmp4, tmp1, tmp2, tmp5);
+	  goto done;
+	}
       else
 	break;
     }
@@ -332,7 +386,11 @@
     "ikev2 profile set <id> id <local|remote> <type> <data>\n"
     "ikev2 profile set <id> traffic-selector <local|remote> ip-range "
     "<start-addr> - <end-addr> port-range <start-port> - <end-port> "
-    "protocol <protocol-number>",
+    "protocol <protocol-number>\n"
+    "ikev2 profile set <id> responder <interface> <addr>\n"
+    "ikev2 profile set <id> ike-crypto-alg <crypto alg> <key size> ike-integ-alg <integ alg> ike-dh <dh type>\n"
+    "ikev2 profile set <id> esp-crypto-alg <crypto alg> <key size> esp-integ-alg <integ alg> esp-dh <dh type>\n"
+    "ikev2 profile set <id> sa-lifetime <seconds> <jitter> <handover> <max bytes>",
     .function = ikev2_profile_add_del_command_fn,
 };
 /* *INDENT-ON* */
@@ -462,6 +520,71 @@
 };
 /* *INDENT-ON* */
 
+
+static clib_error_t *
+ikev2_initiate_command_fn (vlib_main_t * vm,
+			   unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  clib_error_t *r = 0;
+  u8 *name = 0;
+  u32 tmp1;
+  u64 tmp2;
+
+  const char *valid_chars = "a-zA-Z0-9_";
+
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat
+	  (line_input, "sa-init %U", unformat_token, valid_chars, &name))
+	{
+	  r = ikev2_initiate_sa_init (vm, name);
+	  goto done;
+	}
+      else if (unformat (line_input, "del-child-sa %x", &tmp1))
+	{
+	  r = ikev2_initiate_delete_child_sa (vm, tmp1);
+	  goto done;
+	}
+      else if (unformat (line_input, "del-sa %lx", &tmp2))
+	{
+	  r = ikev2_initiate_delete_ike_sa (vm, tmp2);
+	  goto done;
+	}
+      else if (unformat (line_input, "rekey-child-sa %x", &tmp1))
+	{
+	  r = ikev2_initiate_rekey_child_sa (vm, tmp1);
+	  goto done;
+	}
+      else
+	break;
+    }
+
+  r = clib_error_return (0, "parse error: '%U'",
+			 format_unformat_error, line_input);
+
+done:
+  vec_free (name);
+  unformat_free (line_input);
+  return r;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (ikev2_initiate_command, static) = {
+    .path = "ikev2 initiate",
+    .short_help =
+        "ikev2 initiate sa-init <profile id>\n"
+        "ikev2 initiate del-child-sa <child sa ispi>\n"
+        "ikev2 initiate del-sa <sa ispi>\n"
+        "ikev2 initiate rekey-child-sa <profile id> <child sa ispi>\n",
+    .function = ikev2_initiate_command_fn,
+};
+/* *INDENT-ON* */
+
+
 clib_error_t *
 ikev2_cli_init (vlib_main_t * vm)
 {
diff --git a/src/vnet/ipsec/ikev2_crypto.c b/src/vnet/ipsec/ikev2_crypto.c
index 3292762..c201d3e 100644
--- a/src/vnet/ipsec/ikev2_crypto.c
+++ b/src/vnet/ipsec/ikev2_crypto.c
@@ -343,6 +343,7 @@
   v8 *r;
   int out_len = 0, block_size;
   ikev2_sa_transform_t *tr_encr;
+  u8 *key = sa->is_initiator ? sa->sk_er : sa->sk_ei;
 
   tr_encr =
     ikev2_sa_get_td_for_type (sa->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
@@ -357,7 +358,7 @@
 
   EVP_CIPHER_CTX_init (&ctx);
   r = vec_new (u8, len - block_size);
-  EVP_DecryptInit_ex (&ctx, tr_encr->cipher, NULL, sa->sk_ei, data);
+  EVP_DecryptInit_ex (&ctx, tr_encr->cipher, NULL, key, data);
   EVP_DecryptUpdate (&ctx, r, &out_len, data + block_size, len - block_size);
   EVP_DecryptFinal_ex (&ctx, r + out_len, &out_len);
 
@@ -375,6 +376,7 @@
   int out_len;
   int bs;
   ikev2_sa_transform_t *tr_encr;
+  u8 *key = sa->is_initiator ? sa->sk_ei : sa->sk_er;
 
   tr_encr =
     ikev2_sa_get_td_for_type (sa->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
@@ -385,7 +387,7 @@
 
   EVP_CIPHER_CTX_init (&ctx);
 
-  EVP_EncryptInit_ex (&ctx, tr_encr->cipher, NULL, sa->sk_er, dst /* dst */ );
+  EVP_EncryptInit_ex (&ctx, tr_encr->cipher, NULL, key, dst /* dst */ );
   EVP_EncryptUpdate (&ctx, dst + bs, &out_len, src, vec_len (src));
 
   EVP_CIPHER_CTX_cleanup (&ctx);
@@ -407,16 +409,29 @@
       BN_hex2bn (&dh->g, t->dh_g);
       DH_generate_key (dh);
 
-      sa->r_dh_data = vec_new (u8, t->key_len);
-      r = BN_bn2bin (dh->pub_key, sa->r_dh_data);
-      ASSERT (r == t->key_len);
+      if (sa->is_initiator)
+	{
+	  sa->i_dh_data = vec_new (u8, t->key_len);
+	  r = BN_bn2bin (dh->pub_key, sa->i_dh_data);
+	  ASSERT (r == t->key_len);
 
-      BIGNUM *ex;
-      sa->dh_shared_key = vec_new (u8, t->key_len);
-      ex = BN_bin2bn (sa->i_dh_data, vec_len (sa->i_dh_data), NULL);
-      r = DH_compute_key (sa->dh_shared_key, ex, dh);
-      ASSERT (r == t->key_len);
-      BN_clear_free (ex);
+	  sa->dh_private_key = vec_new (u8, t->key_len);
+	  r = BN_bn2bin (dh->priv_key, sa->dh_private_key);
+	  ASSERT (r == t->key_len);
+
+	}
+      else
+	{
+	  sa->r_dh_data = vec_new (u8, t->key_len);
+	  r = BN_bn2bin (dh->pub_key, sa->r_dh_data);
+	  ASSERT (r == t->key_len);
+	  BIGNUM *ex;
+	  sa->dh_shared_key = vec_new (u8, t->key_len);
+	  ex = BN_bin2bn (sa->i_dh_data, vec_len (sa->i_dh_data), NULL);
+	  r = DH_compute_key (sa->dh_shared_key, ex, dh);
+	  ASSERT (r == t->key_len);
+	  BN_clear_free (ex);
+	}
       DH_free (dh);
     }
   else if (t->dh_group == IKEV2_DH_GROUP_ECP)
@@ -439,21 +454,113 @@
       len = t->key_len / 2;
 
       EC_POINT_get_affine_coordinates_GFp (group, r_point, x, y, bn_ctx);
-      sa->r_dh_data = vec_new (u8, t->key_len);
-      x_off = len - BN_num_bytes (x);
-      memset (sa->r_dh_data, 0, x_off);
-      BN_bn2bin (x, sa->r_dh_data + x_off);
-      y_off = t->key_len - BN_num_bytes (y);
-      memset (sa->r_dh_data + len, 0, y_off - len);
-      BN_bn2bin (y, sa->r_dh_data + y_off);
+
+      if (sa->is_initiator)
+	{
+	  sa->i_dh_data = vec_new (u8, t->key_len);
+	  x_off = len - BN_num_bytes (x);
+	  memset (sa->i_dh_data, 0, x_off);
+	  BN_bn2bin (x, sa->i_dh_data + x_off);
+	  y_off = t->key_len - BN_num_bytes (y);
+	  memset (sa->i_dh_data + len, 0, y_off - len);
+	  BN_bn2bin (y, sa->i_dh_data + y_off);
+
+	  const BIGNUM *prv = EC_KEY_get0_private_key (ec);
+	  sa->dh_private_key = vec_new (u8, BN_num_bytes (prv));
+	  r = BN_bn2bin (prv, sa->dh_private_key);
+	  ASSERT (r == BN_num_bytes (prv));
+	}
+      else
+	{
+	  sa->r_dh_data = vec_new (u8, t->key_len);
+	  x_off = len - BN_num_bytes (x);
+	  memset (sa->r_dh_data, 0, x_off);
+	  BN_bn2bin (x, sa->r_dh_data + x_off);
+	  y_off = t->key_len - BN_num_bytes (y);
+	  memset (sa->r_dh_data + len, 0, y_off - len);
+	  BN_bn2bin (y, sa->r_dh_data + y_off);
+
+	  x = BN_bin2bn (sa->i_dh_data, len, x);
+	  y = BN_bin2bn (sa->i_dh_data + len, len, y);
+	  EC_POINT_set_affine_coordinates_GFp (group, i_point, x, y, bn_ctx);
+	  sa->dh_shared_key = vec_new (u8, t->key_len);
+	  EC_POINT_mul (group, shared_point, NULL, i_point,
+			EC_KEY_get0_private_key (ec), NULL);
+	  EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y,
+					       bn_ctx);
+	  x_off = len - BN_num_bytes (x);
+	  memset (sa->dh_shared_key, 0, x_off);
+	  BN_bn2bin (x, sa->dh_shared_key + x_off);
+	  y_off = t->key_len - BN_num_bytes (y);
+	  memset (sa->dh_shared_key + len, 0, y_off - len);
+	  BN_bn2bin (y, sa->dh_shared_key + y_off);
+	}
+
+      EC_KEY_free (ec);
+      BN_free (x);
+      BN_free (y);
+      BN_CTX_free (bn_ctx);
+      EC_POINT_free (i_point);
+      EC_POINT_free (shared_point);
+    }
+}
+
+void
+ikev2_complete_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t)
+{
+  int r;
+
+  if (t->dh_group == IKEV2_DH_GROUP_MODP)
+    {
+      DH *dh = DH_new ();
+      BN_hex2bn (&dh->p, t->dh_p);
+      BN_hex2bn (&dh->g, t->dh_g);
+      dh->priv_key =
+	BN_bin2bn (sa->dh_private_key, vec_len (sa->dh_private_key), NULL);
+
+      BIGNUM *ex;
+      sa->dh_shared_key = vec_new (u8, t->key_len);
+      ex = BN_bin2bn (sa->r_dh_data, vec_len (sa->r_dh_data), NULL);
+      r = DH_compute_key (sa->dh_shared_key, ex, dh);
+      ASSERT (r == t->key_len);
+      BN_clear_free (ex);
+      DH_free (dh);
+    }
+  else if (t->dh_group == IKEV2_DH_GROUP_ECP)
+    {
+      EC_KEY *ec = EC_KEY_new_by_curve_name (t->nid);
+      ASSERT (ec);
+
+      const EC_GROUP *group = EC_KEY_get0_group (ec);
+      BIGNUM *x = NULL, *y = NULL;
+      BN_CTX *bn_ctx = BN_CTX_new ();
+      u16 x_off, y_off, len;
+      BIGNUM *prv;
+
+      prv =
+	BN_bin2bn (sa->dh_private_key, vec_len (sa->dh_private_key), NULL);
+      EC_KEY_set_private_key (ec, prv);
+
+      x = BN_new ();
+      y = BN_new ();
+      len = t->key_len / 2;
+
+      x = BN_bin2bn (sa->r_dh_data, len, x);
+      y = BN_bin2bn (sa->r_dh_data + len, len, y);
+      EC_POINT *r_point = EC_POINT_new (group);
+      EC_POINT_set_affine_coordinates_GFp (group, r_point, x, y, bn_ctx);
+      EC_KEY_set_public_key (ec, r_point);
+
+      EC_POINT *i_point = EC_POINT_new (group);
+      EC_POINT *shared_point = EC_POINT_new (group);
 
       x = BN_bin2bn (sa->i_dh_data, len, x);
       y = BN_bin2bn (sa->i_dh_data + len, len, y);
       EC_POINT_set_affine_coordinates_GFp (group, i_point, x, y, bn_ctx);
-      sa->dh_shared_key = vec_new (u8, t->key_len);
-      EC_POINT_mul (group, shared_point, NULL, i_point,
+      EC_POINT_mul (group, shared_point, NULL, r_point,
 		    EC_KEY_get0_private_key (ec), NULL);
       EC_POINT_get_affine_coordinates_GFp (group, shared_point, x, y, bn_ctx);
+      sa->dh_shared_key = vec_new (u8, t->key_len);
       x_off = len - BN_num_bytes (x);
       memset (sa->dh_shared_key, 0, x_off);
       BN_bn2bin (x, sa->dh_shared_key + x_off);
@@ -464,8 +571,10 @@
       EC_KEY_free (ec);
       BN_free (x);
       BN_free (y);
+      BN_free (prv);
       BN_CTX_free (bn_ctx);
       EC_POINT_free (i_point);
+      EC_POINT_free (r_point);
       EC_POINT_free (shared_point);
     }
 }
diff --git a/src/vnet/ipsec/ikev2_payload.c b/src/vnet/ipsec/ikev2_payload.c
index dd14812..3459538 100644
--- a/src/vnet/ipsec/ikev2_payload.c
+++ b/src/vnet/ipsec/ikev2_payload.c
@@ -133,13 +133,28 @@
 void
 ikev2_payload_add_notify (ikev2_payload_chain_t * c, u16 msg_type, u8 * data)
 {
+  ikev2_payload_add_notify_2(c, msg_type, data, 0);
+}
+
+void
+ikev2_payload_add_notify_2 (ikev2_payload_chain_t * c, u16 msg_type,
+                               u8 * data, ikev2_notify_t * notify)
+{
   ike_notify_payload_header_t *n;
 
   n =
     (ike_notify_payload_header_t *) ikev2_payload_add_hdr (c,
-							   IKEV2_PAYLOAD_NOTIFY,
-							   sizeof (*n));
+                                                           IKEV2_PAYLOAD_NOTIFY,
+                                                           sizeof (*n));
   n->msg_type = clib_host_to_net_u16 (msg_type);
+  if (notify)
+    {
+      n->protocol_id = notify->protocol_id;
+      if (notify->spi)
+        {
+          n->spi_size = 4;
+        }
+    }
   ikev2_payload_add_data (c, data);
 }
 
diff --git a/src/vnet/ipsec/ikev2_priv.h b/src/vnet/ipsec/ikev2_priv.h
index 9f67ad2..5a3dc52 100644
--- a/src/vnet/ipsec/ikev2_priv.h
+++ b/src/vnet/ipsec/ikev2_priv.h
@@ -109,6 +109,21 @@
 
 typedef struct
 {
+  u32 sw_if_index;
+  ip4_address_t ip4;
+} ikev2_responder_t;
+
+typedef struct
+{
+  ikev2_transform_encr_type_t crypto_alg;
+  ikev2_transform_integ_type_t integ_alg;
+  ikev2_transform_dh_type_t dh_type;
+  u32 crypto_key_size;
+} ikev2_transforms_set;
+
+
+typedef struct
+{
   ikev2_id_type_t type:8;
   u8 *data;
 } ikev2_id_t;
@@ -128,6 +143,11 @@
   u8 *sk_ar;
   u8 *sk_ei;
   u8 *sk_er;
+
+  /* lifetime data */
+  f64 time_to_expiration;
+  u8 is_expired;
+  i8 rekey_retries;
 } ikev2_child_sa_t;
 
 typedef struct
@@ -140,6 +160,7 @@
 {
   u8 protocol_id;
   u32 spi;
+  u32 ispi;
   ikev2_sa_proposal_t *i_proposal;
   ikev2_sa_proposal_t *r_proposal;
   ikev2_ts_t *tsi;
@@ -154,6 +175,24 @@
   u8 *data;
 } ikev2_notify_t;
 
+typedef struct
+{
+  u8 *name;
+  u8 is_enabled;
+
+  ikev2_auth_t auth;
+  ikev2_id_t loc_id;
+  ikev2_id_t rem_id;
+  ikev2_ts_t loc_ts;
+  ikev2_ts_t rem_ts;
+  ikev2_responder_t responder;
+  ikev2_transforms_set ike_ts;
+  ikev2_transforms_set esp_ts;
+  u64 lifetime;
+  u64 lifetime_maxdata;
+  u32 lifetime_jitter;
+  u32 handover;
+} ikev2_profile_t;
 
 typedef struct
 {
@@ -170,6 +209,7 @@
   /* DH data */
   u16 dh_group;
   u8 *dh_shared_key;
+  u8 *dh_private_key;
   u8 *i_dh_data;
   u8 *r_dh_data;
 
@@ -208,20 +248,13 @@
   u32 last_msg_id;
   u8 *last_res_packet_data;
 
+  u8 is_initiator;
+  u32 last_init_msg_id;
+  ikev2_profile_t *profile;
+
   ikev2_child_sa_t *childs;
 } ikev2_sa_t;
 
-typedef struct
-{
-  u8 *name;
-  u8 is_enabled;
-
-  ikev2_auth_t auth;
-  ikev2_id_t loc_id;
-  ikev2_id_t rem_id;
-  ikev2_ts_t loc_ts;
-  ikev2_ts_t rem_ts;
-} ikev2_profile_t;
 
 typedef struct
 {
@@ -250,6 +283,11 @@
   vlib_main_t *vlib_main;
   vnet_main_t *vnet_main;
 
+  /* pool of IKEv2 Security Associations created in initiator mode */
+  ikev2_sa_t *sais;
+  /* hash */
+  uword *sa_by_ispi;
+
   ikev2_main_per_thread_data_t *per_thread_data;
 
 } ikev2_main_t;
@@ -269,6 +307,7 @@
 v8 *ikev2_decrypt_data (ikev2_sa_t * sa, u8 * data, int len);
 int ikev2_encrypt_data (ikev2_sa_t * sa, v8 * src, u8 * dst);
 void ikev2_generate_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t);
+void ikev2_complete_dh (ikev2_sa_t * sa, ikev2_sa_transform_t * t);
 int ikev2_verify_sign (EVP_PKEY * pkey, u8 * sigbuf, u8 * data);
 u8 *ikev2_calc_sign (EVP_PKEY * pkey, u8 * data);
 EVP_PKEY *ikev2_load_cert_file (u8 * file);
@@ -291,6 +330,8 @@
 
 void ikev2_payload_add_notify (ikev2_payload_chain_t * c, u16 msg_type,
 			       u8 * data);
+void ikev2_payload_add_notify_2 (ikev2_payload_chain_t * c, u16 msg_type,
+				 u8 * data, ikev2_notify_t * notify);
 void ikev2_payload_add_sa (ikev2_payload_chain_t * c,
 			   ikev2_sa_proposal_t * proposals);
 void ikev2_payload_add_ke (ikev2_payload_chain_t * c, u16 dh_group,
diff --git a/src/vnet/ipsec/ipsec.api b/src/vnet/ipsec/ipsec.api
index 178bb75..ef090f8 100644
--- a/src/vnet/ipsec/ipsec.api
+++ b/src/vnet/ipsec/ipsec.api
@@ -394,6 +394,234 @@
   i32 retval;
 };
 
+/** \brief IKEv2: Set IKEv2 responder interface and IP address
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param name - IKEv2 profile name
+    @param sw_if_index - interface index
+    @param address - interface address
+*/
+define ikev2_set_responder
+{
+  u32 client_index;
+  u32 context;
+
+  u8 name[64];
+  u32 sw_if_index;
+  u8 address[4];
+};
+
+/** \brief Reply for IKEv2: Set IKEv2 responder interface and IP address
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_set_responder_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+
+/** \brief IKEv2: Set IKEv2 IKE transforms in SA_INIT proposal (RFC 7296)
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param name - IKEv2 profile name
+    @param crypto_alg - encryption algorithm
+    @param crypto_key_size - encryption key size
+    @param integ_alg - integrity algorithm
+    @param dh_group - Diffie-Hellman group
+    
+*/
+define ikev2_set_ike_transforms
+{
+  u32 client_index;
+  u32 context;
+
+  u8 name[64];
+  u32 crypto_alg;
+  u32 crypto_key_size;
+  u32 integ_alg;
+  u32 dh_group;
+};
+
+/** \brief Reply for IKEv2: Set IKEv2 IKE transforms
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_set_ike_transforms_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief IKEv2: Set IKEv2 ESP transforms in SA_INIT proposal (RFC 7296)
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param name - IKEv2 profile name
+    @param crypto_alg - encryption algorithm
+    @param crypto_key_size - encryption key size
+    @param integ_alg - integrity algorithm
+    @param dh_group - Diffie-Hellman group
+    
+*/
+define ikev2_set_esp_transforms
+{
+  u32 client_index;
+  u32 context;
+
+  u8 name[64];
+  u32 crypto_alg;
+  u32 crypto_key_size;
+  u32 integ_alg;
+  u32 dh_group;
+};
+
+/** \brief Reply for IKEv2: Set IKEv2 ESP transforms
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_set_esp_transforms_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief IKEv2: Set Child SA lifetime, limited by time and/or data
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param name - IKEv2 profile name
+    @param lifetime - SA maximum life time in seconds (0 to disable)
+    @param lifetime_jitter - Jitter added to prevent simultaneounus rekeying
+    @param handover - Hand over time
+    @param lifetime_maxdata - SA maximum life time in bytes (0 to disable)
+    
+*/
+define ikev2_set_sa_lifetime
+{
+  u32 client_index;
+  u32 context;
+
+  u8 name[64];
+  u64 lifetime;
+  u32 lifetime_jitter;
+  u32 handover;
+  u64 lifetime_maxdata;
+};
+
+/** \brief Reply for IKEv2: Set Child SA lifetime
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_set_sa_lifetime_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief IKEv2: Initiate the SA_INIT exchange
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param name - IKEv2 profile name
+    
+*/
+define ikev2_initiate_sa_init
+{
+  u32 client_index;
+  u32 context;
+
+  u8 name[64];
+};
+
+/** \brief Reply for IKEv2: Initiate the SA_INIT exchange
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_initiate_sa_init_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief IKEv2: Initiate the delete IKE SA exchange
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param ispi - IKE SA initiator SPI
+    
+*/
+define ikev2_initiate_del_ike_sa
+{
+  u32 client_index;
+  u32 context;
+
+  u64 ispi;
+};
+
+/** \brief Reply for IKEv2: Initiate the delete IKE SA exchange
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_initiate_del_ike_sa_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief IKEv2: Initiate the delete Child SA exchange
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param ispi - Child SA initiator SPI
+    
+*/
+define ikev2_initiate_del_child_sa
+{
+  u32 client_index;
+  u32 context;
+
+  u32 ispi;
+};
+
+/** \brief Reply for IKEv2: Initiate the delete Child SA exchange
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_initiate_del_child_sa_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief IKEv2: Initiate the rekey Child SA exchange
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+
+    @param ispi - Child SA initiator SPI
+    
+*/
+define ikev2_initiate_rekey_child_sa
+{
+  u32 client_index;
+  u32 context;
+
+  u32 ispi;
+};
+
+/** \brief Reply for IKEv2: Initiate the rekey Child SA exchange
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define ikev2_initiate_rekey_child_sa_reply
+{
+  u32 context;
+  i32 retval;
+};
+
 /** \brief Dump ipsec policy database data
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
diff --git a/src/vnet/ipsec/ipsec.h b/src/vnet/ipsec/ipsec.h
index 6726dba..58f0f14 100644
--- a/src/vnet/ipsec/ipsec.h
+++ b/src/vnet/ipsec/ipsec.h
@@ -127,6 +127,9 @@
   u32 last_seq;
   u32 last_seq_hi;
   u64 replay_window;
+
+  /*lifetime data */
+  u64 total_data_size;
 } ipsec_sa_t;
 
 typedef struct
diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c
index 3073226..49b475c 100644
--- a/src/vnet/ipsec/ipsec_api.c
+++ b/src/vnet/ipsec/ipsec_api.c
@@ -58,7 +58,15 @@
 _(IKEV2_PROFILE_SET_AUTH, ikev2_profile_set_auth)                       \
 _(IKEV2_PROFILE_SET_ID, ikev2_profile_set_id)                           \
 _(IKEV2_PROFILE_SET_TS, ikev2_profile_set_ts)                           \
-_(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key)
+_(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key)                             \
+_(IKEV2_SET_RESPONDER, ikev2_set_responder)                             \
+_(IKEV2_SET_IKE_TRANSFORMS, ikev2_set_ike_transforms)                   \
+_(IKEV2_SET_ESP_TRANSFORMS, ikev2_set_esp_transforms)                   \
+_(IKEV2_SET_SA_LIFETIME, ikev2_set_sa_lifetime)                         \
+_(IKEV2_INITIATE_SA_INIT, ikev2_initiate_sa_init)                       \
+_(IKEV2_INITIATE_DEL_IKE_SA, ikev2_initiate_del_ike_sa)                 \
+_(IKEV2_INITIATE_DEL_CHILD_SA, ikev2_initiate_del_child_sa)             \
+_(IKEV2_INITIATE_REKEY_CHILD_SA, ikev2_initiate_rekey_child_sa)
 
 static void vl_api_ipsec_spd_add_del_t_handler
   (vl_api_ipsec_spd_add_del_t * mp)
@@ -461,6 +469,194 @@
   REPLY_MACRO (VL_API_IKEV2_SET_LOCAL_KEY_REPLY);
 }
 
+static void
+vl_api_ikev2_set_responder_t_handler (vl_api_ikev2_set_responder_t * mp)
+{
+  vl_api_ikev2_set_responder_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  u8 *tmp = format (0, "%s", mp->name);
+  ip4_address_t ip4;
+  clib_memcpy (&ip4, mp->address, sizeof (ip4));
+
+  error = ikev2_set_profile_responder (vm, tmp, mp->sw_if_index, ip4);
+  vec_free (tmp);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_SET_RESPONDER_REPLY);
+}
+
+static void
+vl_api_ikev2_set_ike_transforms_t_handler (vl_api_ikev2_set_ike_transforms_t *
+					   mp)
+{
+  vl_api_ikev2_set_ike_transforms_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  u8 *tmp = format (0, "%s", mp->name);
+
+  error =
+    ikev2_set_profile_ike_transforms (vm, tmp, mp->crypto_alg, mp->integ_alg,
+				      mp->dh_group, mp->crypto_key_size);
+  vec_free (tmp);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_SET_IKE_TRANSFORMS_REPLY);
+}
+
+static void
+vl_api_ikev2_set_esp_transforms_t_handler (vl_api_ikev2_set_esp_transforms_t *
+					   mp)
+{
+  vl_api_ikev2_set_esp_transforms_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  u8 *tmp = format (0, "%s", mp->name);
+
+  error =
+    ikev2_set_profile_esp_transforms (vm, tmp, mp->crypto_alg, mp->integ_alg,
+				      mp->dh_group, mp->crypto_key_size);
+  vec_free (tmp);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_SET_ESP_TRANSFORMS_REPLY);
+}
+
+static void
+vl_api_ikev2_set_sa_lifetime_t_handler (vl_api_ikev2_set_sa_lifetime_t * mp)
+{
+  vl_api_ikev2_set_sa_lifetime_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  u8 *tmp = format (0, "%s", mp->name);
+
+  error =
+    ikev2_set_profile_sa_lifetime (vm, tmp, mp->lifetime, mp->lifetime_jitter,
+				   mp->handover, mp->lifetime_maxdata);
+  vec_free (tmp);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_SET_SA_LIFETIME_REPLY);
+}
+
+static void
+vl_api_ikev2_initiate_sa_init_t_handler (vl_api_ikev2_initiate_sa_init_t * mp)
+{
+  vl_api_ikev2_initiate_sa_init_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  u8 *tmp = format (0, "%s", mp->name);
+
+  error = ikev2_initiate_sa_init (vm, tmp);
+  vec_free (tmp);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_INITIATE_SA_INIT_REPLY);
+}
+
+static void
+vl_api_ikev2_initiate_del_ike_sa_t_handler (vl_api_ikev2_initiate_del_ike_sa_t
+					    * mp)
+{
+  vl_api_ikev2_initiate_del_ike_sa_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  error = ikev2_initiate_delete_ike_sa (vm, mp->ispi);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_IKE_SA_REPLY);
+}
+
+static void
+  vl_api_ikev2_initiate_del_child_sa_t_handler
+  (vl_api_ikev2_initiate_del_child_sa_t * mp)
+{
+  vl_api_ikev2_initiate_del_child_sa_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  error = ikev2_initiate_delete_child_sa (vm, mp->ispi);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_INITIATE_DEL_CHILD_SA_REPLY);
+}
+
+static void
+  vl_api_ikev2_initiate_rekey_child_sa_t_handler
+  (vl_api_ikev2_initiate_rekey_child_sa_t * mp)
+{
+  vl_api_ikev2_initiate_rekey_child_sa_reply_t *rmp;
+  int rv = 0;
+
+#if WITH_LIBSSL > 0
+  vlib_main_t *vm = vlib_get_main ();
+  clib_error_t *error;
+
+  error = ikev2_initiate_rekey_child_sa (vm, mp->ispi);
+  if (error)
+    rv = VNET_API_ERROR_UNSPECIFIED;
+#else
+  rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif
+
+  REPLY_MACRO (VL_API_IKEV2_INITIATE_REKEY_CHILD_SA_REPLY);
+}
+
 /*
  * ipsec_api_hookup
  * Add vpe's API message handlers to the table.
