19 #include <vpp/app/version.h> 30 #include <openssl/sha.h> 32 #define IKEV2_LIVENESS_RETRIES 3 33 #define IKEV2_LIVENESS_PERIOD_CHECK 30 41 #define ikev2_set_state(sa, v) do { \ 43 ikev2_elog_sa_state("ispi %lx SA state changed to " #v, sa->ispi); \ 59 s =
format (s,
"ikev2: sw_if_index %d, next index %d",
66 #define foreach_ikev2_error \ 67 _(PROCESSED, "IKEv2 packets processed") \ 68 _(IKE_SA_INIT_RETRANSMIT, "IKE_SA_INIT retransmit ") \ 69 _(IKE_SA_INIT_IGNORE, "IKE_SA_INIT ignore (IKE SA already auth)") \ 70 _(IKE_REQ_RETRANSMIT, "IKE request retransmit") \ 71 _(IKE_REQ_IGNORE, "IKE request ignore (old msgid)") \ 72 _(NOT_IKEV2, "Non IKEv2 packets received") 76 #define _(sym,str) IKEV2_ERROR_##sym, 83 #define _(sym,string) string, 109 if (td->
type == IKEV2_TRANSFORM_TYPE_ENCR)
112 || t->
attrs[1] != 14)
130 u8 mandatory_bitmap, optional_bitmap;
134 mandatory_bitmap = (1 << IKEV2_TRANSFORM_TYPE_ENCR) |
135 (1 << IKEV2_TRANSFORM_TYPE_PRF) |
136 (1 << IKEV2_TRANSFORM_TYPE_INTEG) | (1 << IKEV2_TRANSFORM_TYPE_DH);
137 optional_bitmap = mandatory_bitmap;
141 mandatory_bitmap = (1 << IKEV2_TRANSFORM_TYPE_ENCR) |
142 (1 << IKEV2_TRANSFORM_TYPE_ESN);
143 optional_bitmap = mandatory_bitmap |
144 (1 << IKEV2_TRANSFORM_TYPE_INTEG) | (1 << IKEV2_TRANSFORM_TYPE_DH);
148 mandatory_bitmap = (1 << IKEV2_TRANSFORM_TYPE_INTEG) |
149 (1 << IKEV2_TRANSFORM_TYPE_ESN);
150 optional_bitmap = mandatory_bitmap | (1 << IKEV2_TRANSFORM_TYPE_DH);
165 if ((1 << transform->
type) & bitmap)
170 bitmap |= 1 << transform->
type;
177 if ((bitmap & mandatory_bitmap) == mandatory_bitmap &&
178 (bitmap & ~optional_bitmap) == 0)
182 RAND_bytes ((
u8 *) & rv->
spi, sizeof (rv->
spi));
222 if (proposal && proposal->
spi == spi && proposal->
protocol_id == prot_id)
332 if (sa->
dh_group == IKEV2_TRANSFORM_DH_TYPE_NONE)
340 if (t2->type == IKEV2_TRANSFORM_TYPE_DH && sa->
dh_group == t2->dh_type)
349 sa->
dh_group = IKEV2_TRANSFORM_DH_TYPE_NONE;
356 RAND_bytes ((
u8 *) & sa->
ispi, 8);
365 RAND_bytes ((
u8 *) & sa->
rspi, 8);
384 #define _(A) ({void* __tmp__ = (A); (A) = 0; __tmp__;}) 408 if (sa->
dh_group == IKEV2_TRANSFORM_DH_TYPE_NONE)
416 if (t2->type == IKEV2_TRANSFORM_TYPE_DH && sa->
dh_group == t2->dh_type)
425 sa->
dh_group = IKEV2_TRANSFORM_DH_TYPE_NONE;
442 u16 integ_key_len = 0;
452 integ_key_len = tr_integ->
key_len;
460 vec_add2 (s, tmp, 2 *
sizeof (*spi));
462 spi[0] = clib_host_to_net_u64 (sa->
ispi);
463 spi[1] = clib_host_to_net_u64 (sa->
rspi);
488 pos += integ_key_len;
493 pos += integ_key_len;
523 u16 integ_key_len = 0;
535 integ_key_len = ctr_integ->
key_len;
537 salt_len =
sizeof (
u32);
543 int len = ctr_encr->
key_len * 2 + integ_key_len * 2 + salt_len * 2;
577 pos += integ_key_len;
595 u32 len = clib_net_to_host_u32 (ike->length);
596 u8 payload = ike->nextpayload;
600 clib_net_to_host_u64 (ike->ispi),
601 clib_net_to_host_u64 (ike->rspi), sa->
iaddr.
as_u32);
603 sa->
ispi = clib_net_to_host_u64 (ike->ispi);
611 ike_payload_header_t *ikep = (ike_payload_header_t *) & ike->payload[p];
612 u32 plen = clib_net_to_host_u16 (ikep->length);
614 if (plen <
sizeof (ike_payload_header_t))
624 ike_ke_payload_header_t *ke = (ike_ke_payload_header_t *) ikep;
625 sa->
dh_group = clib_net_to_host_u16 (ke->dh_group);
655 payload = ikep->nextpayload;
667 u32 len = clib_net_to_host_u32 (ike->length);
668 u8 payload = ike->nextpayload;
670 sa->
ispi = clib_net_to_host_u64 (ike->ispi);
671 sa->
rspi = clib_net_to_host_u64 (ike->rspi);
674 "from %d.%d.%d.%d", sa->
ispi, sa->
rspi,
683 ike_payload_header_t *ikep = (ike_payload_header_t *) & ike->payload[p];
684 u32 plen = clib_net_to_host_u16 (ikep->length);
686 if (plen <
sizeof (ike_payload_header_t))
697 clib_host_to_net_u32 (clib_net_to_host_u32 (ike->msgid) + 1);
702 ike_ke_payload_header_t *ke = (ike_ke_payload_header_t *) ikep;
703 sa->
dh_group = clib_net_to_host_u16 (ke->dh_group);
733 payload = ikep->nextpayload;
744 u32 len = clib_net_to_host_u32 (ike->length);
745 ike_payload_header_t *ikep = 0;
754 ikep = (ike_payload_header_t *) & ike->payload[p];
755 plen = clib_net_to_host_u16 (ikep->length);
757 if (plen <
sizeof (*ikep))
762 last_payload = *payload;
775 *payload = ikep->nextpayload;
789 plen = plen -
sizeof (*ikep) - tr_integ->
key_trunc;
791 if (memcmp (hmac, &ikep->payload[plen], tr_integ->
key_trunc))
817 if (tmp->i_id.type != sa->i_id.type ||
818 vec_len(tmp->i_id.data) != vec_len(sa->i_id.data) ||
819 memcmp(sa->i_id.data, tmp->i_id.data, vec_len(sa->i_id.data)))
822 if (sa->rspi != tmp->rspi)
823 vec_add1(delete, tmp - km->per_thread_data[thread_index].sas);
827 for (i = 0; i <
vec_len (
delete); i++)
846 u8 payload = ike->nextpayload;
848 ike_payload_header_t *ikep;
852 "from %d.%d.%d.%d", clib_host_to_net_u64 (ike->ispi),
853 clib_host_to_net_u64 (ike->rspi),
865 goto cleanup_and_exit;
871 first_child_sa = &sa->
childs[0];
884 ikep = (ike_payload_header_t *) & plaintext[p];
885 plen = clib_net_to_host_u16 (ikep->length);
887 if (plen <
sizeof (ike_payload_header_t))
888 goto cleanup_and_exit;
905 ike_id_payload_header_t *
id = (ike_id_payload_header_t *) ikep;
913 ike_id_payload_header_t *
id = (ike_id_payload_header_t *) ikep;
921 ike_auth_payload_header_t *
a = (ike_auth_payload_header_t *) ikep;
939 if (n->
msg_type == IKEV2_NOTIFY_MSG_INITIAL_CONTACT)
972 payload = ikep->nextpayload;
985 u8 payload = ike->nextpayload;
987 ike_payload_header_t *ikep;
992 "from %d.%d.%d.%d", clib_host_to_net_u64 (ike->ispi),
993 clib_host_to_net_u64 (ike->rspi), sa->
iaddr.
as_u32);
998 goto cleanup_and_exit;
1004 ikep = (ike_payload_header_t *) & plaintext[p];
1005 plen = clib_net_to_host_u16 (ikep->length);
1007 if (plen <
sizeof (ike_payload_header_t))
1008 goto cleanup_and_exit;
1013 if (n->
msg_type == IKEV2_NOTIFY_MSG_AUTHENTICATION_FAILED)
1036 payload = ikep->nextpayload;
1049 u8 payload = ike->nextpayload;
1054 ike_payload_header_t *ikep;
1063 "from %d.%d.%d.%d", clib_host_to_net_u64 (ike->ispi),
1064 clib_host_to_net_u64 (ike->rspi), sa->
raddr.
as_u32);
1069 goto cleanup_and_exit;
1075 ikep = (ike_payload_header_t *) & plaintext[p];
1076 plen = clib_net_to_host_u16 (ikep->length);
1078 if (plen <
sizeof (ike_payload_header_t))
1079 goto cleanup_and_exit;
1088 if (n->
msg_type == IKEV2_NOTIFY_MSG_REKEY_SA)
1124 payload = ikep->nextpayload;
1155 goto cleanup_and_exit;
1239 ikev2_ts_t *ts, *p_tsi, *p_tsr, *tsi = 0, *tsr = 0;
1245 if (sa->is_initiator)
1266 if (ikev2_ts_cmp(p_tsi, ts))
1268 vec_add1 (tsi, ts[0]);
1290 sa->childs[0].tsi = tsi;
1291 sa->childs[0].tsr = tsr;
1306 u8 *authmsg, *key_pad, *psk = 0, *auth = 0;
1313 if (!(sa->
i_auth.
method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC ||
1317 "unsupported authentication method %u",
1344 if (p->rem_id.type != sa_id->type ||
1345 vec_len(p->rem_id.data) != vec_len(sa_id->data) ||
1346 memcmp(p->rem_id.data, sa_id->data, vec_len(p->rem_id.data)))
1349 if (sa_auth->method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
1351 if (!p->auth.data ||
1352 p->auth.method != IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
1355 psk = ikev2_calc_prf(tr_prf, p->auth.data, key_pad);
1356 auth = ikev2_calc_prf(tr_prf, psk, authmsg);
1358 if (!memcmp(auth, sa_auth->data, vec_len(sa_auth->data)))
1360 ikev2_set_state(sa, IKEV2_STATE_AUTHENTICATED);
1367 else if (sa_auth->
method == IKEV2_AUTH_METHOD_RSA_SIG)
1369 if (p->auth.method != IKEV2_AUTH_METHOD_RSA_SIG)
1372 if (ikev2_verify_sign(p->auth.key, sa_auth->data, authmsg) == 1)
1374 ikev2_set_state(sa, IKEV2_STATE_AUTHENTICATED);
1387 sa->udp_encap = sel_p->udp_encap;
1388 sa->dst_port = sel_p->dst_port;
1394 if (!sa->is_initiator)
1397 sa->r_id.data =
vec_dup (sel_p->loc_id.data);
1398 sa->r_id.type = sel_p->loc_id.type;
1402 if (sel_p->auth.method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
1405 sa->r_auth.method = IKEV2_AUTH_METHOD_SHARED_KEY_MIC;
1407 else if (sel_p->auth.method == IKEV2_AUTH_METHOD_RSA_SIG)
1410 sa->r_auth.method = IKEV2_AUTH_METHOD_RSA_SIG;
1416 sa->childs[0].r_proposals =
1420 if (~0 != sel_p->tun_itf)
1422 sa->is_tun_itf_set = 1;
1423 sa->tun_itf = sel_p->tun_itf;
1429 ikev2_elog_uint (IKEV2_LOG_ERROR,
"authentication failed, no matching " 1430 "profile found! ispi %lx", sa->ispi);
1442 u8 *authmsg, *key_pad, *psk = 0, *auth = 0;
1449 if (!(sa->
i_auth.
method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC ||
1453 "unsupported authentication method %u",
1465 if (sa->
i_auth.
method == IKEV2_AUTH_METHOD_SHARED_KEY_MIC)
1470 else if (sa->
i_auth.
method == IKEV2_AUTH_METHOD_RSA_SIG)
1485 return (0x80000000 | (ti << 24) | (sai << 12) | ci);
1491 return (0xc0000000 | (ti << 24) | (sai << 12) | ci);
1526 TUNNEL_ENCAP_DECAP_FLAG_NONE, IP_DSCP_CS0,
1527 TUNNEL_MODE_P2P, &sw_if_index);
1529 if (rv == VNET_API_ERROR_IF_ALREADY_EXISTS)
1546 "loc:%d.%d.%d.%d rem:%d.%d.%d.%d",
1573 (a->
flags | IPSEC_SA_FLAG_IS_INBOUND), 0,
1585 u32 child_index,
u8 is_rekey)
1621 a.
flags = IPSEC_SA_FLAG_USE_ANTI_REPLAY;
1624 a.
flags |= IPSEC_SA_FLAG_IS_TUNNEL;
1625 a.
flags |= IPSEC_SA_FLAG_UDP_ENCAP;
1631 a.
flags |= IPSEC_SA_FLAG_USE_ESN;
1641 encr_type = IPSEC_CRYPTO_ALG_AES_CBC_128;
1644 encr_type = IPSEC_CRYPTO_ALG_AES_CBC_192;
1647 encr_type = IPSEC_CRYPTO_ALG_AES_CBC_256;
1655 else if (tr->
encr_type == IKEV2_TRANSFORM_ENCR_TYPE_AES_GCM_16
1661 encr_type = IPSEC_CRYPTO_ALG_AES_GCM_128;
1664 encr_type = IPSEC_CRYPTO_ALG_AES_GCM_192;
1667 encr_type = IPSEC_CRYPTO_ALG_AES_GCM_256;
1696 case IKEV2_TRANSFORM_INTEG_TYPE_AUTH_HMAC_SHA2_256_128:
1697 integ_type = IPSEC_INTEG_ALG_SHA_256_128;
1699 case IKEV2_TRANSFORM_INTEG_TYPE_AUTH_HMAC_SHA2_384_192:
1700 integ_type = IPSEC_INTEG_ALG_SHA_384_192;
1702 case IKEV2_TRANSFORM_INTEG_TYPE_AUTH_HMAC_SHA2_512_256:
1703 integ_type = IPSEC_INTEG_ALG_SHA_512_256;
1705 case IKEV2_TRANSFORM_INTEG_TYPE_AUTH_HMAC_SHA1_96:
1706 integ_type = IPSEC_INTEG_ALG_SHA1_96;
1721 integ_type = IPSEC_INTEG_ALG_NONE;
1772 if (thread_index & 0xffffffc0)
1775 if (child_index & 0xfffff000 || sa_index & 0xfffff000)
1801 remote_sa_id |= mask;
1813 (
u8 *) & a,
sizeof (a));
1845 ipip_tunnel_key_t
key = {
1869 if (~0 != sw_if_index)
1912 ike_payload_header_t *ph;
1930 IKEV2_NOTIFY_MSG_NO_PROPOSAL_CHOSEN, 0);
1933 else if (sa->
dh_group == IKEV2_TRANSFORM_DH_TYPE_NONE)
1939 IKEV2_TRANSFORM_TYPE_DH);
1942 data[0] = (tr_dh->
dh_type >> 8) & 0xff;
1943 data[1] = (tr_dh->
dh_type) & 0xff;
1946 IKEV2_NOTIFY_MSG_INVALID_KE_PAYLOAD,
1957 IKEV2_NOTIFY_MSG_UNSUPPORTED_CRITICAL_PAYLOAD,
1963 ike->rspi = clib_host_to_net_u64 (sa->
rspi);
1982 IKEV2_NOTIFY_MSG_AUTHENTICATION_FAILED,
1996 IKEV2_NOTIFY_MSG_NO_PROPOSAL_CHOSEN, 0);
2008 IKEV2_NOTIFY_MSG_UNSUPPORTED_CRITICAL_PAYLOAD,
2064 IKEV2_NOTIFY_MSG_UNSUPPORTED_CRITICAL_PAYLOAD,
2082 *(
u32 *) data = clib_host_to_net_u32 (notify.
spi);
2111 IKEV2_NOTIFY_MSG_UNSUPPORTED_CRITICAL_PAYLOAD,
2119 IKEV2_NOTIFY_MSG_NO_ADDITIONAL_SAS,
2128 tlen =
sizeof (*ike);
2144 ike->length = clib_host_to_net_u32 (tlen);
2157 plen =
sizeof (*ph);
2158 ph = (ike_payload_header_t *) & ike->payload[0];
2169 ph->length = clib_host_to_net_u16 (plen);
2170 ike->length = clib_host_to_net_u32 (tlen);
2178 sizeof (*ike), integ, tr_integ->
key_trunc);
2201 if (sa->ispi == clib_net_to_host_u64(ike->ispi) &&
2202 sa->iaddr.as_u32 == iaddr.as_u32 &&
2203 sa->raddr.as_u32 == raddr.as_u32)
2206 u32 len = clib_net_to_host_u32(ike->length);
2207 u8 payload = ike->nextpayload;
2209 while (p < len && payload!= IKEV2_PAYLOAD_NONE) {
2210 ike_payload_header_t * ikep = (ike_payload_header_t *) &ike->payload[p];
2211 u32 plen = clib_net_to_host_u16(ikep->length);
2213 if (plen < sizeof(ike_payload_header_t))
2216 if (payload == IKEV2_PAYLOAD_NONCE)
2218 if (!memcmp(sa->i_nonce, ikep->payload, plen - sizeof(*ikep)))
2221 if (sa->state == IKEV2_STATE_SA_INIT)
2224 tmp = (ike_header_t*)sa->last_sa_init_res_packet_data;
2225 ike->ispi = tmp->ispi;
2226 ike->rspi = tmp->rspi;
2227 ike->nextpayload = tmp->nextpayload;
2228 ike->version = tmp->version;
2229 ike->exchange = tmp->exchange;
2230 ike->flags = tmp->flags;
2231 ike->msgid = tmp->msgid;
2232 ike->length = tmp->length;
2233 clib_memcpy_fast(ike->payload, tmp->payload,
2234 clib_net_to_host_u32(tmp->length) - sizeof(*ike));
2235 ikev2_elog_uint_peers (IKEV2_LOG_DEBUG,
2236 "ispi %lx IKE_SA_INIT retransmit " 2237 "from %d.%d.%d.%d to %d.%d.%d.%d",
2239 raddr.as_u32, iaddr.as_u32);
2245 ikev2_elog_uint_peers (IKEV2_LOG_DEBUG,
2246 "ispi %lx IKE_SA_INIT ignore " 2247 "from %d.%d.%d.%d to %d.%d.%d.%d",
2249 raddr.as_u32, iaddr.as_u32);
2254 payload = ikep->nextpayload;
2268 u32 msg_id = clib_net_to_host_u32 (ike->msgid);
2281 ike->ispi = tmp->ispi;
2282 ike->rspi = tmp->rspi;
2283 ike->nextpayload = tmp->nextpayload;
2284 ike->version = tmp->version;
2285 ike->exchange = tmp->exchange;
2286 ike->flags = tmp->flags;
2287 ike->msgid = tmp->msgid;
2288 ike->length = tmp->length;
2290 clib_net_to_host_u32 (tmp->length) -
sizeof (*ike));
2336 u32 n_left_from, *from, *to_next;
2345 while (n_left_from > 0)
2351 while (n_left_from > 0 && n_left_to_next > 0)
2371 n_left_to_next -= 1;
2383 IKEV2_ERROR_NOT_IKEV2, 1);
2394 if (ike0->rspi == 0)
2404 IKEV2_ERROR_IKE_SA_INIT_RETRANSMIT,
2406 len = clib_net_to_host_u32 (ike0->length);
2412 IKEV2_ERROR_IKE_SA_INIT_IGNORE,
2501 clib_net_to_host_u64 (ike0->rspi));
2512 IKEV2_ERROR_IKE_REQ_RETRANSMIT,
2514 len = clib_net_to_host_u32 (ike0->length);
2520 IKEV2_ERROR_IKE_REQ_IGNORE,
2551 clib_net_to_host_u64 (ike0->rspi));
2562 IKEV2_ERROR_IKE_REQ_RETRANSMIT,
2564 len = clib_net_to_host_u32 (ike0->length);
2570 IKEV2_ERROR_IKE_REQ_IGNORE,
2618 clib_net_to_host_u64 (ike0->rspi));
2629 IKEV2_ERROR_IKE_REQ_RETRANSMIT,
2631 len = clib_net_to_host_u32 (ike0->length);
2637 IKEV2_ERROR_IKE_REQ_IGNORE,
2674 "received from %d.%d.%d.%d to %d.%d.%d.%d",
2717 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
2725 n_left_to_next, bi0, next0);
2732 IKEV2_ERROR_PROCESSED, frame->
n_vectors);
2740 .vector_size =
sizeof (
u32),
2765 vec_add2 (*proposals, proposal, 1);
2773 if (td->
type == IKEV2_TRANSFORM_TYPE_ENCR
2778 attr[0] = clib_host_to_net_u16 (14 | (1 << 15));
2779 attr[1] = clib_host_to_net_u16 (td->
key_len << 3);
2794 if (is_ike || IKEV2_TRANSFORM_ENCR_TYPE_AES_GCM_16 != ts->
crypto_alg)
2800 if (td->
type == IKEV2_TRANSFORM_TYPE_INTEG
2811 (
"Didn't find any supported algorithm for IKEV2_TRANSFORM_TYPE_INTEG");
2823 if (td->
type == IKEV2_TRANSFORM_TYPE_PRF
2824 && td->
prf_type == IKEV2_TRANSFORM_PRF_TYPE_PRF_HMAC_SHA2_256)
2839 if (is_ike || ts->
dh_type != IKEV2_TRANSFORM_DH_TYPE_NONE)
2867 if (td->
type == IKEV2_TRANSFORM_TYPE_ESN)
2924 udp0->
dst_port = clib_host_to_net_u16 (500);
2925 udp0->
src_port = clib_host_to_net_u16 (500);
2962 if (km->
pkey == NULL)
2986 return VNET_API_ERROR_UDP_PORT_TAKEN;
3057 u8 * auth_data,
u8 data_hex_format)
3072 p->
auth.
hex = data_hex_format;
3074 if (auth_method == IKEV2_AUTH_METHOD_RSA_SIG)
3094 if (id_type > IKEV2_ID_TYPE_ID_RFC822_ADDR
3095 && id_type < IKEV2_ID_TYPE_ID_KEY_ID)
3191 u32 crypto_key_size)
3216 u32 crypto_key_size)
3266 return VNET_API_ERROR_INVALID_VALUE;
3271 return VNET_API_ERROR_VALUE_EXIST;
3279 return VNET_API_ERROR_IKE_NO_PORT;
3282 return VNET_API_ERROR_INVALID_VALUE;
3357 int len =
sizeof (ike_header_t);
3409 u8 nat_detection_source[8 + 8 + 4 + 2];
3412 u64 tmpspi = clib_host_to_net_u64 (sa.
ispi);
3414 tmpspi = clib_host_to_net_u64 (sa.
rspi);
3416 u16 tmpport = clib_host_to_net_u16 (500);
3419 u32 tmpip = clib_host_to_net_u32 (if_ip->
as_u32);
3421 SHA1 (nat_detection_source,
sizeof (nat_detection_source),
3422 nat_detection_sha1);
3424 nat_detection_sha1);
3427 SHA1 (nat_detection_source,
sizeof (nat_detection_source),
3428 nat_detection_sha1);
3430 IKEV2_NOTIFY_MSG_NAT_DETECTION_DESTINATION_IP,
3431 nat_detection_sha1);
3435 u64 tmpsig = clib_host_to_net_u64 (0x0001000200030004);
3438 IKEV2_NOTIFY_MSG_SIGNATURE_HASH_ALGORITHMS,
3446 ike0->length = clib_host_to_net_u32 (len);
3453 ike0->ispi = sa.
ispi;
3483 "%d.%d.%d.%d", clib_host_to_net_u64 (sa0->
ispi), 0,
3504 ike0->ispi = clib_host_to_net_u64 (sa->
ispi);
3505 ike0->rspi = clib_host_to_net_u64 (sa->
rspi);
3537 fchild = ikev2_sa_get_child(sa, ispi, IKEV2_PROTOCOL_ESP, 1);
3547 if (!fchild || !fsa)
3577 if (sa->ispi == ispi)
3604 ike0->ispi = clib_host_to_net_u64 (fsa->ispi);
3605 ike0->rspi = clib_host_to_net_u64 (fsa->rspi);
3608 fsa->del->spi = ispi;
3609 ike0->msgid = clib_host_to_net_u32 (fsa->last_init_msg_id + 1);
3610 fsa->last_init_msg_id = clib_net_to_host_u32 (ike0->msgid);
3652 ike0->ispi = clib_host_to_net_u64 (sa->
ispi);
3653 ike0->rspi = clib_host_to_net_u64 (sa->
rspi);
3662 RAND_bytes ((
u8 *) & proposals[0].
spi,
sizeof (proposals[0].spi));
3663 rekey->
spi = proposals[0].
spi;
3687 fchild = ikev2_sa_get_child(sa, ispi, IKEV2_PROTOCOL_ESP, 1);
3697 if (!fchild || !fsa)
3729 for (thread_id = 0; thread_id < tm->
n_vlib_mains - 1; thread_id++)
3804 if (~0 == sw_if_index)
3806 ip46_address_t local_ip;
3807 ip46_address_t remote_ip;
3820 ipip_tunnel_key_t
key = {
3865 if (period == 0 || max_retries == 0)
3893 fchild = ikev2_sa_get_child(sa, ipsec_sa->spi, IKEV2_PROTOCOL_ESP, 1);
3903 ipsec_sa->stat_index, &counts);
3905 if (fsa && fsa->is_profile_index_set)
3908 if (fchild && p && p->lifetime_maxdata)
3910 if (!fchild->is_expired && counts.bytes > p->lifetime_maxdata)
3912 fchild->time_to_expiration = now;
3927 sa = pool_elt_at_index (km->sais, sai);
3928 if (sa->init_response_received)
3932 if (vlib_buffer_alloc (km->vlib_main, &bi0, 1) != 1)
3935 vlib_buffer_t * b = vlib_get_buffer (km->vlib_main, bi0);
3936 clib_memcpy_fast (vlib_buffer_get_current (b),
3937 sa->last_sa_init_req_packet_data,
3938 vec_len (sa->last_sa_init_req_packet_data));
3939 ikev2_send_ike (km->vlib_main, &sa->iaddr, &sa->raddr, bi0,
3940 vec_len (sa->last_sa_init_req_packet_data));
3959 ike0->ispi = clib_host_to_net_u64 (sa->
ispi);
3960 ike0->rspi = clib_host_to_net_u64 (sa->
rspi);
4024 u32 *to_be_deleted = 0;
4028 ikev2_child_sa_t *c;
4030 if (sa->old_remote_id_present && 0 > sa->old_id_expiration)
4032 sa->old_remote_id_present = 0;
4040 req_sent |= ikev2_mngr_process_child_sa(sa, c, del_old_ids);
4051 if (sa->is_initiator && sa->is_profile_index_set)
4071 ikev2_mngr_process_ipsec_sa(sa);
4093 "ikev2-manager-process",
4097 .version = VPP_BUILD_VER,
4098 .description =
"Internet Key Exchange (IKEv2) Protocol",
ikev2_main_per_thread_data_t * per_thread_data
ipip_tunnel_t * ipip_tunnel_db_find(const ipip_tunnel_key_t *key)
#define ikev2_elog_exchange(_format, _ispi, _rspi, _addr)
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
static int ikev2_retransmit_sa_init(ike_header_t *ike, ip4_address_t iaddr, ip4_address_t raddr)
static int ikev2_create_tunnel_interface(vlib_main_t *vm, u32 thread_index, ikev2_sa_t *sa, ikev2_child_sa_t *child, u32 sa_index, u32 child_index, u8 is_rekey)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
void ikev2_payload_add_nonce(ikev2_payload_chain_t *c, u8 *nonce)
static u8 * format_ikev2_trace(u8 *s, va_list *args)
#define hash_set(h, key, value)
#define IKEV2_PAYLOAD_NONCE
clib_error_t * ikev2_set_profile_responder(vlib_main_t *vm, u8 *name, u32 sw_if_index, ip4_address_t ip4)
void ikev2_payload_add_notify(ikev2_payload_chain_t *c, u16 msg_type, u8 *data)
ikev2_transforms_set ike_ts
static int ikev2_delete_tunnel_interface(vnet_main_t *vnm, ikev2_sa_t *sa, ikev2_child_sa_t *child)
static u8 ikev2_mngr_process_child_sa(ikev2_sa_t *sa, ikev2_child_sa_t *csa, u8 del_old_ids)
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
ikev2_transform_integ_type_t
#define hash_unset(h, key)
static void ikev2_send_ike(vlib_main_t *vm, ip4_address_t *src, ip4_address_t *dst, u32 bi0, u32 len)
static void ikev2_del_sa_init(u64 ispi)
clib_error_t * ikev2_add_del_profile(vlib_main_t *vm, u8 *name, int is_add)
A representation of a IPIP tunnel.
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
void ikev2_payload_add_sa(ikev2_payload_chain_t *c, ikev2_sa_proposal_t *proposals)
vnet_main_t * vnet_get_main(void)
clib_error_t * ikev2_set_profile_udp_encap(vlib_main_t *vm, u8 *name)
static void ikev2_calc_keys(ikev2_sa_t *sa)
ikev2_sa_proposal_t * ikev2_parse_sa_payload(ike_payload_header_t *ikep)
static u32 ikev2_generate_message(ikev2_sa_t *sa, ike_header_t *ike, void *user)
#define IKEV2_PAYLOAD_NONE
ikev2_profile_t * profiles
clib_error_t * ikev2_initiate_delete_ike_sa(vlib_main_t *vm, u64 ispi)
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
#define clib_memcpy_fast(a, b, c)
u32 current_remote_id_mask
ikev2_ts_t * ikev2_parse_ts_payload(ike_payload_header_t *ikep)
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void ikev2_sa_free_child_sa(ikev2_child_sa_t *c)
v8 * ikev2_calc_prf(ikev2_sa_transform_t *tr, v8 *key, v8 *data)
static f64 vlib_time_now(vlib_main_t *vm)
void vnet_sw_interface_admin_up(vnet_main_t *vnm, u32 sw_if_index)
#define ikev2_elog_peers(_level, _format, _ip1, _ip2)
static void ikev2_complete_sa_data(ikev2_sa_t *sa, ikev2_sa_t *sai)
#define ikev2_elog_error(_msg)
static vlib_node_registration_t ikev2_mngr_process_node
(constructor) VLIB_REGISTER_NODE (ikev2_mngr_process_node)
#define IKEV2_EXCHANGE_SA_INIT
static void ikev2_delete_child_sa_internal(vlib_main_t *vm, ikev2_sa_t *sa, ikev2_child_sa_t *csa)
u16 current_length
Nbytes between current data and the end of this buffer.
#define IKEV2_PAYLOAD_VENDOR
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Combined counter to hold both packets and byte differences.
clib_error_t * ikev2_set_profile_tunnel_interface(vlib_main_t *vm, u8 *name, u32 sw_if_index)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
static void mhash_init_vec_string(mhash_t *h, uword n_value_bytes)
static udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
ip_lookup_main_t lookup_main
clib_error_t * ikev2_set_profile_sa_lifetime(vlib_main_t *vm, u8 *name, u64 lifetime, u32 jitter, u32 handover, u64 maxdata)
void ikev2_payload_add_ke(ikev2_payload_chain_t *c, u16 dh_group, u8 *dh_data)
static void ikev2_generate_sa_init_data(ikev2_sa_t *sa)
clib_error_t * ikev2_set_liveness_params(u32 period, u32 max_retries)
#define IKEV2_PAYLOAD_TSR
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
int ipsec_sa_add_and_lock(u32 id, u32 spi, ipsec_protocol_t proto, ipsec_crypto_alg_t crypto_alg, const ipsec_key_t *ck, ipsec_integ_alg_t integ_alg, const ipsec_key_t *ik, ipsec_sa_flags_t flags, u32 tx_table_id, u32 salt, const ip46_address_t *tun_src, const ip46_address_t *tun_dst, u32 *sa_out_index, u16 src_port, u16 dst_port)
int ipip_add_tunnel(ipip_transport_t transport, u32 instance, ip46_address_t *src, ip46_address_t *dst, u32 fib_index, tunnel_encap_decap_flags_t flags, ip_dscp_t dscp, tunnel_mode_t tmode, u32 *sw_if_indexp)
static_always_inline int ikev2_mngr_process_responder_sas(ikev2_sa_t *sa)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static void ikev2_delete_sa(ikev2_sa_t *sa)
void ipsec_mk_key(ipsec_key_t *key, const u8 *data, u8 len)
u8 * last_sa_init_res_packet_data
vnet_api_error_t ikev2_set_profile_ipsec_udp_port(vlib_main_t *vm, u8 *name, u16 port, u8 is_set)
ikev2_notify_t * ikev2_parse_notify_payload(ike_payload_header_t *ikep)
u8 init_response_received
ikev2_sa_transform_t * ikev2_sa_get_td_for_type(ikev2_sa_proposal_t *p, ikev2_transform_type_t type)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
#define clib_memcpy(d, s, n)
static void ikev2_mngr_process_ipsec_sa(ipsec_sa_t *ipsec_sa)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
ikev2_transform_dh_type_t
int ikev2_encrypt_data(ikev2_sa_t *sa, v8 *src, u8 *dst)
ikev2_child_sa_t * ikev2_sa_get_child(ikev2_sa_t *sa, u32 spi, ikev2_protocol_id_t prot_id, int by_initiator)
#define static_always_inline
#define IKEV2_PAYLOAD_DELETE
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
ikev2_sa_proposal_t * r_proposals
void ikev2_generate_dh(ikev2_sa_t *sa, ikev2_sa_transform_t *t)
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
EVP_PKEY * ikev2_load_cert_file(u8 *file)
clib_error_t * ikev2_initiate_sa_init(vlib_main_t *vm, u8 *name)
#define IKEV2_LIVENESS_PERIOD_CHECK
int ipsec_tun_protect_del(u32 sw_if_index, const ip_address_t *nh)
static ikev2_sa_transform_t * ikev2_find_transform_data(ikev2_sa_transform_t *t)
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
EVP_PKEY * ikev2_load_key_file(u8 *file)
clib_error_t * ikev2_set_profile_auth(vlib_main_t *vm, u8 *name, u8 auth_method, u8 *auth_data, u8 data_hex_format)
ipsec_crypto_alg_t encr_type
void ikev2_parse_vendor_payload(ike_payload_header_t *ikep)
#define hash_foreach(key_var, value_var, h, body)
ipsec_integ_alg_t integ_type
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
static u32 ikev2_get_new_ike_header_buff(vlib_main_t *vm, ike_header_t **ike)
int ipsec_sa_unlock_id(u32 id)
void ikev2_payload_add_id(ikev2_payload_chain_t *c, ikev2_id_t *id, u8 type)
#define IKEV2_PAYLOAD_NOTIFY
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static void ikev2_sa_match_ts(ikev2_sa_t *sa)
ikev2_sa_proposal_t * i_proposals
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)
static void ikev2_sa_auth(ikev2_sa_t *sa)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define ikev2_set_state(sa, v)
#define ikev2_payload_destroy_chain(V)
static void ikev2_del_sa_init_from_main(u64 *ispi)
ikev2_sa_transform_t * transforms
#define IKEV2_EXCHANGE_CREATE_CHILD_SA
static void ikev2_initial_contact_cleanup(ikev2_sa_t *sa)
ikev2_responder_t responder
vl_api_fib_path_type_t type
int ikev2_set_log_level(ikev2_log_level_t log_level)
static ikev2_profile_t * ikev2_profile_index_by_name(u8 *name)
clib_error_t * ikev2_set_profile_id(vlib_main_t *vm, u8 *name, u8 id_type, u8 *data, int is_local)
u8 * ikev2_calc_prfplus(ikev2_sa_transform_t *tr, u8 *key, u8 *seed, int len)
static u32 ikev2_mk_local_sa_id(u32 sai, u32 ci, u32 ti)
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)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void ikev2_cli_reference(void)
u8 * last_sa_init_req_packet_data
#define IKEV2_PAYLOAD_IDR
static_always_inline u32 ikev2_flip_alternate_sa_bit(u32 id)
#define ikev2_log_debug(...)
uword mhash_set_mem(mhash_t *h, void *key, uword *new_value, uword *old_value)
ikev2_sa_proposal_t * i_proposals
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define IKEV2_HDR_FLAG_RESPONSE
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
mhash_t profile_index_by_name
ikev2_sa_transform_t * supported_transforms
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
clib_error_t * ikev2_initiate_delete_child_sa(vlib_main_t *vm, u32 ispi)
static void ikev2_rekey_child_sa_internal(vlib_main_t *vm, ikev2_sa_t *sa, ikev2_child_sa_t *csa)
#define vec_del1(v, i)
Delete the element at index I.
#define IKEV2_PAYLOAD_FLAG_CRITICAL
static void ikev2_sa_auth_init(ikev2_sa_t *sa)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
clib_error_t * ikev2_set_local_key(vlib_main_t *vm, u8 *file)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
clib_error_t * ikev2_set_profile_ts(vlib_main_t *vm, u8 *name, u8 protocol_id, u16 start_port, u16 end_port, ip4_address_t start_addr, ip4_address_t end_addr, int is_local)
static void ikev2_process_pending_sa_init(ikev2_main_t *km)
#define IKEV2_EXCHANGE_INFORMATIONAL
void ikev2_payload_add_delete(ikev2_payload_chain_t *c, ikev2_delete_t *d)
static u32 ikev2_mk_remote_sa_id(u32 sai, u32 ci, u32 ti)
#define IKEV2_HDR_FLAG_INITIATOR
static void ikev2_add_tunnel_from_main(ikev2_add_ipsec_tunnel_args_t *a)
static uword ikev2_mngr_process_fn(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
clib_error_t * ikev2_initiate_rekey_child_sa(vlib_main_t *vm, u32 ispi)
#define VLIB_REGISTER_NODE(x,...)
#define ikev2_elog_uint(_level, _format, _val)
static_always_inline uword vlib_get_thread_index(void)
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
static u8 * ikev2_decrypt_sk_payload(ikev2_sa_t *sa, ike_header_t *ike, u8 *payload)
static void ikev2_sa_del_child_sa(ikev2_sa_t *sa, ikev2_child_sa_t *child)
ikev2_auth_method_t method
ikev2_transform_encr_type_t
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
static_always_inline vnet_api_error_t ikev2_register_udp_port(ikev2_profile_t *p, u16 port)
#define IKEV2_LIVENESS_RETRIES
static void ikev2_process_auth_req(vlib_main_t *vm, ikev2_sa_t *sa, ike_header_t *ike)
static uword ikev2_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
enum ipsec_sad_flags_t_ ipsec_sa_flags_t
static void ikev2_process_sa_init_resp(vlib_main_t *vm, ikev2_sa_t *sa, ike_header_t *ike)
static_always_inline void ikev2_unregister_udp_port(ikev2_profile_t *p)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define ikev2_log_error(...)
vlib_main_t vlib_node_runtime_t * node
ikev2_sa_proposal_t * r_proposals
static u8 * ikev2_sa_generate_authmsg(ikev2_sa_t *sa, int is_responder)
static void ikev2_calc_child_keys(ikev2_sa_t *sa, ikev2_child_sa_t *child)
#define hash_set1(h, key)
enum ikev2_log_level_t_ ikev2_log_level_t
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
#define hash_create(elts, value_bytes)
void ikev2_payload_add_auth(ikev2_payload_chain_t *c, ikev2_auth_t *auth)
ikev2_protocol_id_t protocol_id
vlib_combined_counter_main_t ipsec_sa_counters
SA packet & bytes counters.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static uword * mhash_get(mhash_t *h, const void *key)
static void ikev2_process_informational_req(vlib_main_t *vm, ikev2_sa_t *sa, ike_header_t *ike)
f64 liveness_period_check
void ikev2_sa_free_proposal_vector(ikev2_sa_proposal_t **v)
#define IKEV2_PAYLOAD_AUTH
#define ikev2_payload_new_chain(V)
ikev2_sa_proposal_t * r_proposal
void ikev2_complete_dh(ikev2_sa_t *sa, ikev2_sa_transform_t *t)
#define vec_append(v1, v2)
Append v2 after v1.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static vlib_node_registration_t ikev2_node
(constructor) VLIB_REGISTER_NODE (ikev2_node)
ikev2_log_level_t log_level
ikev2_sa_proposal_t * i_proposal
vlib_node_registration_t ipsec4_tun_input_node
(constructor) VLIB_REGISTER_NODE (ipsec4_tun_input_node)
#define IKEV2_PAYLOAD_TSI
static int ikev2_retransmit_resp(ikev2_sa_t *sa, ike_header_t *ike)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
u8 * last_res_packet_data
static char * ikev2_error_strings[]
void vnet_sw_interface_admin_down(vnet_main_t *vnm, u32 sw_if_index)
#define clib_atomic_bool_cmp_and_swap(addr, old, new)
static void ikev2_process_sa_init_req(vlib_main_t *vm, ikev2_sa_t *sa, ike_header_t *ike)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void ikev2_payload_chain_add_padding(ikev2_payload_chain_t *c, int bs)
VLIB buffer representation.
#define IKEV2_PAYLOAD_IDI
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)
#define ikev2_elog_uint_peers(_level, _format, _val, _ip1, _ip2)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void ikev2_process_create_child_sa_req(vlib_main_t *vm, ikev2_sa_t *sa, ike_header_t *ike)
ikev2_child_sa_t * childs
vlib_log_class_t log_class
int ipip_del_tunnel(u32 sw_if_index)
Linear Congruential Random Number Generator.
#define IKEV2_EXCHANGE_IKE_AUTH
static int ikev2_ts_cmp(ikev2_ts_t *ts1, ikev2_ts_t *ts2)
clib_error_t * ikev2_init(vlib_main_t *vm)
static u32 random_u32(u32 *seed)
32-bit random number generator
ip4_main_t ip4_main
Global ip4 main structure.
static vlib_thread_main_t * vlib_get_thread_main()
#define vec_foreach(var, vec)
Vector iterator.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static void ikev2_sa_free_all_child_sa(ikev2_child_sa_t **childs)
u16 flags
Copy of main node flags.
static ikev2_sa_proposal_t * ikev2_select_proposal(ikev2_sa_proposal_t *proposals, ikev2_protocol_id_t prot_id)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
ikev2_transforms_set esp_ts
#define VLIB_NODE_FLAG_TRACE
void ikev2_crypto_init(ikev2_main_t *km)
static void ikev2_del_tunnel_from_main(ikev2_del_ipsec_tunnel_args_t *a)
#define CLIB_CACHE_LINE_BYTES
void ikev2_payload_add_ts(ikev2_payload_chain_t *c, ikev2_ts_t *ts, u8 type)
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
v8 * ikev2_decrypt_data(ikev2_sa_t *sa, u8 *data, int len)
static void ikev2_sa_free_all_vec(ikev2_sa_t *sa)
static void ikev2_send_informational_request(ikev2_sa_t *sa)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define IPSEC_UDP_PORT_NONE
static u16 ip4_header_checksum(ip4_header_t *i)
u8 * ikev2_calc_sign(EVP_PKEY *pkey, u8 *data)
v8 * ikev2_calc_integr(ikev2_sa_transform_t *tr, v8 *key, u8 *data, int len)
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)
u8 * format_ikev2_id_type(u8 *s, va_list *args)
#define foreach_ikev2_error
static void ikev2_init_sa(vlib_main_t *vm, ikev2_sa_t *sa)
int ipsec_tun_protect_update(u32 sw_if_index, const ip_address_t *nh, u32 sa_out, u32 *sas_in)
void ikev2_payload_add_notify_2(ikev2_payload_chain_t *c, u16 msg_type, u8 *data, ikev2_notify_t *notify)
ikev2_delete_t * ikev2_parse_delete_payload(ike_payload_header_t *ikep)