vec_free (delete);
sa->initial_contact = 0;
-
- km->log_level = IKEV2_LOG_ERROR;
- km->log_class = vlib_log_register_class ("ikev2", 0);
}
static void
sa->childs[0].r_proposals =
ikev2_select_proposal (sa->childs[0].i_proposals,
IKEV2_PROTOCOL_ESP);
+
+ if (~0 != sel_p->tun_itf)
+ {
+ sa->is_tun_itf_set = 1;
+ sa->tun_itf = sel_p->tun_itf;
+ }
}
}
else
hash_set1 (km->sw_if_indices, sw_if_index);
}
else
- sw_if_index = a->sw_if_index;
+ {
+ sw_if_index = a->sw_if_index;
+ vnet_sw_interface_admin_up (vnet_get_main (), sw_if_index);
+ }
if (rv)
{
u32 *sas_in = NULL;
vec_add1 (sas_in, a->remote_sa_id);
- rv |= ipsec_tun_protect_update (sw_if_index, a->local_sa_id, sas_in);
+ rv |= ipsec_tun_protect_update (sw_if_index, NULL, a->local_sa_id, sas_in);
}
static int
sw_if_index = ~0;
}
else
- sw_if_index = a->sw_if_index;
+ {
+ sw_if_index = a->sw_if_index;
+ vnet_sw_interface_admin_down (vnet_get_main (), sw_if_index);
+ }
if (~0 != sw_if_index)
- ipsec_tun_protect_del (sw_if_index);
+ ipsec_tun_protect_del (sw_if_index, NULL);
ipsec_sa_unlock_id (a->remote_sa_id);
ipsec_sa_unlock_id (a->local_sa_id);
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);
+ ikev2_payload_add_notify (chain, IKEV2_NOTIFY_MSG_INITIAL_CONTACT,
+ 0);
}
else
{
clib_memset (p, 0, sizeof (*p));
p->name = vec_dup (name);
p->responder.sw_if_index = ~0;
+ p->tun_itf = ~0;
uword index = p - km->profiles;
mhash_set_mem (&km->profile_index_by_name, name, &index, 0);
}
sa.state = IKEV2_STATE_SA_INIT;
sa.tun_itf = p->tun_itf;
sa.is_tun_itf_set = 1;
+ sa.initial_contact = 1;
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);
vec_add (sa.childs[0].tsi, &p->loc_ts, 1);
vec_add (sa.childs[0].tsr, &p->rem_ts, 1);
+ ikev2_initial_contact_cleanup (&sa);
+
/* add SA to the pool */
ikev2_sa_t *sa0 = 0;
pool_get (km->sais, sa0);
ikev2_cli_reference ();
+ km->log_level = IKEV2_LOG_ERROR;
+ km->log_class = vlib_log_register_class ("ikev2", 0);
return 0;
}