28 #include <openssl/evp.h> 31 #define MAX_VALUE_U24 0xffffff 34 #define TIME_UNTIL_REFETCH_OR_DELETE 20 35 #define MAPPING_TIMEOUT (((m->ttl) * 60) - TIME_UNTIL_REFETCH_OR_DELETE) 81 u8 smr_invoked,
u8 is_resend);
93 vec_elt ((lm)->if_address_pool_index_by_sw_if_index, (sw_if_index)) :
132 if (addr->version ==
IP4)
137 memcpy (&prefix->
fp_addr.ip4, &addr->ip, sizeof (prefix->
fp_addr.ip4));
143 memcpy (&prefix->
fp_addr.ip6, &addr->ip, sizeof (prefix->
fp_addr.ip6));
155 fib_prefix->
fp_len = ip_prefix->len;
209 u8 with_default_route)
220 return VNET_API_ERROR_INVALID_VALUE;
228 clib_warning (
"vni %d not associated to a bridge domain!", vni);
229 return VNET_API_ERROR_INVALID_VALUE;
294 u32 i, limitp = 0, li, found = 0, esi;
326 if ((found && lp->
priority == limitp)
327 || (!found && lp->
priority >= limitp))
345 if ((
u32) ~ 0 == esi)
428 uword *feip = 0, *dpid, *rmts_stored_idxp = 0;
443 if (lcm->
flags & LISP_FLAG_PITR_MODE)
455 lcl_eid = &lcl_map->
eid;
461 rmt_eid = &rmt_map->
eid;
518 if (rv == 0 && (lcm->
flags & LISP_FLAG_USE_PETR))
558 if (!rmts_stored_idxp)
567 rmts_idx = (
u32) (*rmts_stored_idxp);
598 (
u8 *) & a,
sizeof (a));
620 if (gid_address_vni (&fwd->reid) != vni)
623 gid_address_copy (&adj.reid, &fwd->reid);
624 gid_address_copy (&adj.leid, &fwd->leid);
625 vec_add1 (adjs, adj);
674 return VNET_API_ERROR_LISP_DISABLED;
717 u32 * map_index_result)
720 u32 mi, *map_indexp, map_index,
i;
721 u32 **rmts = 0, *remote_idxp, rmts_itr, remote_idx;
731 return VNET_API_ERROR_INVALID_ARGUMENT;
736 return VNET_API_ERROR_INVALID_ARGUMENT;
749 return VNET_API_ERROR_VALUE_EXIST;
769 clib_warning (
"Locator set with index %d doesn't exist",
771 return VNET_API_ERROR_INVALID_VALUE;
778 vec_add1 (eid_indexes[0], map_index);
785 map_index_result[0] = map_index;
793 return VNET_API_ERROR_INVALID_VALUE;
799 for (i = 0; i <
vec_len (eid_indexes[0]); i++)
802 if (map_indexp[0] == mi)
830 if (lm_indexp[0] == mi)
843 vec_foreach_index (rmts_itr, rmts[0])
845 remote_idx = vec_elt (rmts[0], rmts_itr);
846 if (mi == remote_idx)
848 vec_del1 (rmts[0], rmts_itr);
870 u32 * map_index_result)
881 return VNET_API_ERROR_LISP_DISABLED;
895 return VNET_API_ERROR_INVALID_VALUE;
910 u32 bd = (
u32) (kvp->key[0] >> 32);
933 u32 bd = (
u32) (kvp->key[0] >> 32);
964 u32 bd = (
u32) (kvp->key[0] >> 32);
968 mac_copy (e.mac, (
void *) &kvp->value);
969 e.ip4 = (
u32) kvp->key[1];
999 u32 bd = (
u32) (kvp->key[0] >> 32);
1003 mac_copy (e.mac, (
void *) &kvp->value);
1030 return VNET_API_ERROR_LISP_DISABLED;
1042 return VNET_API_ERROR_ENTRY_ALREADY_EXISTS;
1052 clib_warning (
"ONE entry %U not found - cannot delete!",
1067 uword *dp_idp, *vnip, **dp_table_by_vni, **vni_by_dp_table;
1072 return VNET_API_ERROR_LISP_DISABLED;
1078 if (!is_l2 && (vni == 0 || dp_id == 0))
1080 clib_warning (
"can't add/del default vni-vrf mapping!");
1084 dp_idp =
hash_get (dp_table_by_vni[0], vni);
1085 vnip =
hash_get (vni_by_dp_table[0], dp_id);
1091 clib_warning (
"vni %d or vrf %d already used in vrf/vni " 1092 "mapping!", vni, dp_id);
1095 hash_set (dp_table_by_vni[0], vni, dp_id);
1096 hash_set (vni_by_dp_table[0], dp_id, vni);
1104 if (!dp_idp || !vnip)
1106 clib_warning (
"vni %d or vrf %d not used in any vrf/vni! " 1107 "mapping!", vni, dp_id);
1131 for (i = 0; i <
vec_len (new_locators); i++)
1133 old_li =
vec_elt (old_ls_indexes, i);
1266 u32 * res_map_index,
u8 * is_updated)
1270 u32 mi, ls_index = 0, dst_map_index;
1277 return VNET_API_ERROR_LISP_DISABLED;
1281 res_map_index[0] = ~0;
1299 return VNET_API_ERROR_LISP_RLOC_LOCAL;
1310 clib_warning (
"mapping %U rejected due to collision with local " 1338 res_map_index[0] = mi;
1348 ls_args->
index = ~0;
1358 res_map_index[0] = dst_map_index;
1384 res_map_index[0] = ~0;
1415 res_map_index[0] = mi;
1425 u32 mi, *map_indices = 0, *map_indexp;
1433 vec_add1 (map_indices, mi);
1476 u32 local_mi, remote_mi = ~0;
1481 return VNET_API_ERROR_LISP_DISABLED;
1488 clib_warning (
"Remote eid %U not found. Cannot add adjacency!",
1498 if (lcm->
flags & LISP_FLAG_PITR_MODE)
1528 clib_warning (
"Local eid %U not found. Cannot add adjacency!",
1551 return VNET_API_ERROR_LISP_DISABLED;
1554 if (mode >= _MR_MODE_MAX)
1556 clib_warning (
"Invalid LISP map request mode %d!", mode);
1557 return VNET_API_ERROR_INVALID_ARGUMENT;
1569 u32 locator_set_index = ~0;
1576 return VNET_API_ERROR_LISP_DISABLED;
1586 clib_warning (
"locator-set %v doesn't exist", locator_set_name);
1589 locator_set_index = p[0];
1619 u32 locator_set_index = ~0;
1626 return VNET_API_ERROR_LISP_DISABLED;
1632 clib_warning (
"locator-set %v doesn't exist", locator_set_name);
1635 locator_set_index = p[0];
1660 return VNET_API_ERROR_INVALID_ARGUMENT;
1694 return VNET_API_ERROR_LISP_DISABLED;
1709 ls_args->
index = ~0;
1719 lcm->
flags |= LISP_FLAG_USE_PETR;
1734 lcm->
flags &= ~LISP_FLAG_USE_PETR;
1745 u32 i, j, *loc_indexp, *ls_indexp, **ls_indexes, *to_be_deleted = 0;
1752 for (j = 0; j <
vec_len (ls_indexes[0]); j++)
1755 if (ls_indexp[0] == lsi)
1763 if (vec_len (ls_indexes[0]) == 0)
1772 for (i = 0; i <
vec_len (to_be_deleted); i++)
1781 static inline uword *
1820 return VNET_API_ERROR_VALUE_EXIST;
1829 u32 mapping_index,
u8 remove_only)
1833 uword *fei = 0, *rmts_idxp = 0;
1834 u32 **rmts = 0, *remote_idxp = 0, *rmts_copy = 0;
1847 rmts_copy =
vec_dup (rmts[0]);
1892 u32 ls_index,
u8 remove_only)
1902 for (i = 0; i <
vec_len (eid_indexes[0]); i++)
1911 u32 ls_index,
u32 loc_id)
1922 vec_del1 (ls_indexes[0], ls_index);
1932 u32 loc_index = ~0, ls_index = ~0, *locit =
NULL, **ls_indexes =
NULL;
1941 return VNET_API_ERROR_LISP_DISABLED;
1948 return VNET_API_ERROR_INVALID_ARGUMENT;
1956 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
1958 return VNET_API_ERROR_INVALID_ARGUMENT;
1965 ls_result[0] = p[0];
2006 if (0 == loc->
local &&
2043 return VNET_API_ERROR_LISP_DISABLED;
2051 if (p && p[0] != (
u32) ~ 0)
2056 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
2071 ls_result[0] = p[0];
2101 ls_result[0] = ls_index;
2122 clib_warning (
"locator-set with index %d doesn't exists", p[0]);
2128 clib_warning (
"Can't delete the locator-set used to constrain " 2129 "the itr-rlocs in map-requests!");
2136 if (
vec_len (eid_indexes[0]) != 0)
2139 (
"Can't delete a locator that supports a mapping!");
2215 dp_add_del_iface(lcm, vni, 0, 1,
2216 with_default_route);
2219 dp_add_del_iface(lcm, vni, 1, 1,
2220 with_default_route);
2251 a->
is_en = is_enable;
2256 a->
is_en ?
"enable" :
"disable");
2261 if (lcm->
flags & LISP_FLAG_XTR_MODE)
2275 if (lcm->
flags & LISP_FLAG_PETR_MODE)
2278 if (!(lcm->
flags & LISP_FLAG_XTR_MODE))
2287 if (lcm->
flags & LISP_FLAG_PITR_MODE)
2326 return VNET_API_ERROR_LISP_DISABLED;
2388 return VNET_API_ERROR_LISP_DISABLED;
2397 return VNET_API_ERROR_INVALID_ARGUMENT;
2411 #define foreach_lisp_cp_lookup_error \ 2413 _(MAP_REQUESTS_SENT, "map-request sent") \ 2414 _(ARP_REPLY_TX, "ARP replies sent") \ 2415 _(NDP_NEIGHBOR_ADVERTISEMENT_TX, \ 2416 "neighbor advertisement sent") 2419 #define _(sym,string) string, 2426 #define _(sym,str) LISP_CP_LOOKUP_ERROR_##sym, 2452 s =
format (s,
"LISP-CP-LOOKUP: map-resolver: %U destination eid %U",
2485 clib_warning (
"Can't find map-resolver and local interface ip!");
2515 addr = ip_interface_address_get_address (&lcm->im4->lookup_main, ia);
2516 ip_address_set (rloc, addr, IP4);
2517 ip_prefix_len (ippref) = 32;
2518 ip_prefix_normalize (ippref);
2519 vec_add1 (rlocs, gid[0]);
2526 addr = ip_interface_address_get_address (&lcm->im6->lookup_main, ia);
2527 ip_address_set (rloc, addr, IP6);
2528 ip_prefix_len (ippref) = 128;
2529 ip_prefix_normalize (ippref);
2530 vec_add1 (rlocs, gid[0]);
2549 clib_warning (
"Can't allocate buffer for Map-Request!");
2576 u64 * nonce_res,
u32 * bi_res)
2585 clib_warning (
"Can't allocate buffer for Map-Request!");
2634 #define foreach_msmr \ 2640 elect_map_ ## name (lisp_cp_main_t * lcm) \ 2643 vec_foreach (mr, lcm->map_ ## name ## s) \ 2647 ip_address_copy (&lcm->active_map_ ##name, &mr->address); \ 2648 lcm->do_map_ ## name ## _election = 0; \ 2688 addr = ip_interface_address_get_address (&lcm->im4->lookup_main,
2690 ip_address_set (new_ip, addr, IP4);
2697 addr = ip_interface_address_get_address (&lcm->im6->lookup_main,
2699 ip_address_set (new_ip, addr, IP6);
2723 add_locators (lcm, &rec, m->locator_set_index, NULL);
2724 vec_add1 (recs, rec);
2737 return VNET_CRYPTO_ALG_HMAC_SHA1;
2739 return VNET_CRYPTO_ALG_HMAC_SHA256;
2741 clib_warning (
"unsupported encryption key type: %d!", key_id);
2753 return VNET_CRYPTO_OP_SHA1_HMAC;
2755 return VNET_CRYPTO_OP_SHA256_HMAC;
2757 clib_warning (
"unsupported encryption key type: %d!", key_id);
2766 u16 auth_data_len,
u32 msg_len)
2769 MREG_KEY_ID (map_reg_hdr) = clib_host_to_net_u16 (key_id);
2777 op->
src = (
u8 *) map_reg_hdr;
2801 u32 bi, auth_data_len = 0, msg_len = 0;
2806 clib_warning (
"Can't allocate buffer for Map-Register!");
2817 auth_data_len, nonce_res,
2833 get_egress_map_ ##name## _ip (lisp_cp_main_t * lcm, ip_address_t * ip) \ 2836 while (lcm->do_map_ ## name ## _election \ 2837 | (0 == ip_fib_get_first_egress_ip_for_dst \ 2838 (lcm, &lcm->active_map_ ##name, ip))) \ 2840 if (0 == elect_map_ ## name (lcm)) \ 2844 vec_foreach (mr, lcm->map_ ## name ## s) mr->is_down = 0; \ 2854 #define foreach_lisp_cp_output_error \ 2855 _(MAP_REGISTERS_SENT, "map-registers sent") \ 2856 _(MAP_REQUESTS_SENT, "map-requests sent") \ 2857 _(RLOC_PROBES_SENT, "rloc-probes sent") 2859 #define _(sym,string) string, 2866 #define _(sym,str) LISP_CP_OUTPUT_ERROR_##sym, 2883 .name =
"lisp-cp-output",
2884 .vector_size =
sizeof (
u32),
2889 .error_strings = lisp_cp_output_error_strings,
2909 u32 next_index, *to_next;
2943 u32 si, rloc_probes_sent = 0;
2948 if (vec_len (e->locator_pairs) == 0)
2951 si = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &e->leid);
2954 clib_warning (
"internal error: cannot find local eid %U in " 2955 "map-cache!", format_gid_address, &e->leid);
2966 if (lp->priority != lprio)
2970 send_rloc_probe (lcm, &e->reid, lm->locator_set_index, &lp->lcl_loc,
2978 LISP_CP_OUTPUT_ERROR_RLOC_PROBES_SENT,
2987 u32 bi, map_registers_sent = 0;
2992 u32 next_index, *to_next;
2995 if (get_egress_map_server_ip (lcm, &sloc) < 0)
3014 for (k = r + 1; k <
vec_end (records); k++)
3027 want_map_notif, group, key_id, key, &bi);
3044 map_registers_sent++;
3055 LISP_CP_OUTPUT_ERROR_MAP_REGISTERS_SENT,
3056 map_registers_sent);
3061 #define send_encapsulated_map_request(lcm, seid, deid, smr) \ 3062 _send_encapsulated_map_request(lcm, seid, deid, smr, 0) 3064 #define resend_encapsulated_map_request(lcm, seid, deid, smr) \ 3065 _send_encapsulated_map_request(lcm, seid, deid, smr, 1) 3070 u8 is_smr_invoked,
u8 is_resend)
3072 u32 next_index, bi = 0, *to_next, map_index;
3087 if (!gid_address_cmp (&pmr->src, seid)
3088 && !gid_address_cmp (&pmr->dst, deid))
3090 duplicate_pmr = pmr;
3096 if (!is_resend && duplicate_pmr)
3102 u8 pitr_mode = lcm->flags & LISP_FLAG_PITR_MODE;
3108 if (map_index == ~0)
3110 clib_warning (
"No local mapping found in eid-table for %U!",
3120 (
"Mapping found for src eid %U is not marked as local!",
3124 ls_index = map->locator_set_index;
3130 if (lcm->pitr_map_index != ~0)
3134 ls_index = map->locator_set_index;
3143 if (lcm->nsh_map_index == (
u32) ~ 0)
3151 ls_index = map->locator_set_index;
3157 if (~0 != lcm->mreq_itr_rlocs)
3159 ls_index = lcm->mreq_itr_rlocs;
3164 if (get_egress_map_resolver_ip (lcm, &sloc) < 0)
3167 duplicate_pmr->to_be_removed = 1;
3173 &lcm->active_map_resolver,
3174 &sloc, is_smr_invoked, &nonce, &bi);
3193 LISP_CP_OUTPUT_ERROR_MAP_REQUESTS_SENT, 1);
3203 hash_unset (lcm->pending_map_requests_by_nonce, nonce_del[0]);
3208 hash_set (lcm->pending_map_requests_by_nonce, nonce,
3209 duplicate_pmr - lcm->pending_map_requests_pool);
3214 pool_get (lcm->pending_map_requests_pool, pmr);
3219 pmr->is_smr_invoked = is_smr_invoked;
3221 hash_set (lcm->pending_map_requests_by_nonce, nonce,
3222 pmr - lcm->pending_map_requests_pool);
3283 return bd_config->
bd_id;
3297 clib_warning (
"bridge domain %d is not mapped to any vni!", bd);
3309 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt;
3343 if (clib_net_to_host_u16 (eh->
type) == ETHERNET_TYPE_ARP)
3348 if (clib_net_to_host_u16 (ah->
opcode)
3349 != ETHERNET_ARP_OPCODE_request)
3364 if (clib_net_to_host_u16 (eh->
type) == ETHERNET_TYPE_IP6)
3369 if (IP_PROTOCOL_ICMP6 == ip->
protocol)
3371 icmp6_neighbor_solicitation_or_advertisement_header_t *ndh;
3373 if (ndh->icmp.type == ICMP6_neighbor_solicitation)
3378 opt = (
void *) (ndh + 1);
3379 if ((opt->header.type !=
3380 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address)
3381 || (opt->header.n_data_u64s != 1))
3395 &ndh->target_address,
IP6);
3418 if (clib_net_to_host_u16 (eh->
type) == ETHERNET_TYPE_NSH)
3422 u8 si = (
u8) clib_net_to_host_u32 (nh->
spi_si);
3437 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt;
3438 u32 *from, *to_next,
di, si;
3441 uword n_left_from, n_left_to_next;
3448 while (n_left_from > 0)
3452 while (n_left_from > 0 && n_left_to_next > 0)
3454 u32 pi0, sw_if_index0, next0;
3462 icmp6_neighbor_solicitation_or_advertisement_header_t *ndh;
3470 n_left_to_next -= 1;
3492 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
3504 b0->
error = node->
errors[LISP_CP_LOOKUP_ERROR_ARP_REPLY_TX];
3524 opt = (
void *) (ndh + 1);
3526 ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address;
3528 ndh->icmp.type = ICMP6_neighbor_advertisement;
3529 ndh->advertisement_flags = clib_host_to_net_u32
3532 ndh->icmp.checksum = 0;
3533 ndh->icmp.checksum =
3540 [LISP_CP_LOOKUP_ERROR_NDP_NEIGHBOR_ADVERTISEMENT_TX];
3584 b0->
error = node->
errors[LISP_CP_LOOKUP_ERROR_DROP];
3601 n_left_to_next, pi0, next0);
3641 .name =
"lisp-cp-lookup-ip4",
3642 .vector_size =
sizeof (
u32),
3661 .name =
"lisp-cp-lookup-ip6",
3662 .vector_size =
sizeof (
u32),
3681 .name =
"lisp-cp-lookup-l2",
3682 .vector_size =
sizeof (
u32),
3701 .name =
"lisp-cp-lookup-nsh",
3702 .vector_size =
sizeof (
u32),
3719 #define foreach_lisp_cp_input_error \ 3721 _(RLOC_PROBE_REQ_RECEIVED, "rloc-probe requests received") \ 3722 _(RLOC_PROBE_REP_RECEIVED, "rloc-probe replies received") \ 3723 _(MAP_NOTIFIES_RECEIVED, "map-notifies received") \ 3724 _(MAP_REPLIES_RECEIVED, "map-replies received") 3727 #define _(sym,string) string, 3734 #define _(sym,str) LISP_CP_INPUT_ERROR_##sym, 3754 s =
format (s,
"LISP-CP-INPUT: TODO");
3778 f64 expiration_time)
3783 u64 exp_clock_time = now + expiration_time * cpu_cps;
3876 u32 dst_map_index = 0;
3907 if (dst_map_index == (
u32) ~ 0)
3933 hash_unset(lcm->pending_map_requests_by_nonce, noncep[0]);
3955 u8 out[EVP_MAX_MD_SIZE] = { 0, };
3958 if ((
u16) ~ 0 == auth_data_len)
3960 clib_warning (
"invalid length for key_id %d!", key_id);
3987 result = memcmp (out, auth_data, auth_data_len);
4003 clib_warning (
"No pending map-register entry with nonce %lu!",
4038 u32 key_id,
u8 ** key_out)
4048 key_out[0] = m->
key;
4050 for (i = 1; i <
len; i++)
4077 for (i = 0; i <
count; i++)
4124 u16 auth_data_len = 0;
4158 - (
u8 *) mnotif_hdr, key_id, key))
4160 clib_warning (
"Map-notify auth data verification failed for nonce " 4161 "0x%lx!", a->
nonce);
4179 clib_warning (
"Can't allocate buffer for Map-Register!");
4206 u32 next_index, *to_next;
4224 b =
build_map_reply (lcm, &src, dst, nonce, probe_bit, records, dst_port,
4248 if (start < 0 && start < -
sizeof (b->
pre_data))
4254 *ip_hdr = b->
data + start;
4269 u32 i,
len = 0, rloc_probe_recv = 0;
4276 (
"Only SMR Map-Requests and RLOC probe supported for now!");
4331 src_port, &probed_loc);
4337 LISP_CP_INPUT_ERROR_RLOC_PROBE_REQ_RECEIVED,
4409 u32 n_left_from, *from, *to_next_drop, rloc_probe_rep_recv = 0,
4410 map_notifies_recv = 0;
4419 while (n_left_from > 0)
4421 u32 n_left_to_next_drop;
4424 to_next_drop, n_left_to_next_drop);
4425 while (n_left_from > 0 && n_left_to_next_drop > 0)
4433 to_next_drop[0] = bi0;
4435 n_left_to_next_drop -= 1;
4447 rloc_probe_rep_recv++;
4458 map_notifies_recv++;
4463 clib_warning (
"Unsupported LISP message type %d", type);
4467 b0->
error = node->
errors[LISP_CP_INPUT_ERROR_DROP];
4476 n_left_to_next_drop);
4479 LISP_CP_INPUT_ERROR_RLOC_PROBE_REP_RECEIVED,
4480 rloc_probe_rep_recv);
4482 LISP_CP_INPUT_ERROR_MAP_NOTIFIES_RECEIVED,
4490 .name =
"lisp-cp-input",
4491 .vector_size =
sizeof (
u32),
4496 .error_strings = lisp_cp_input_error_strings,
4548 lcm->
flags |= LISP_FLAG_XTR_MODE;
4594 if (lisp_stats_api_fill (lcm, lgm, &stat, key, index))
4595 vec_add1 (stats, stat);
4618 u8 smr_invoked,
u8 is_resend)
4628 (
u8 *) & a,
sizeof (a));
4651 clib_warning (
"Map resolver %U not found - probably deleted " 4657 clib_warning (
"map resolver %U is unreachable, ignoring",
4667 elect_map_resolver (lcm);
4691 u32 *to_be_removed = 0, *pmr_index;
4696 if (pmr->to_be_removed)
4698 clib_fifo_foreach (nonce, pmr->nonces, ({
4699 hash_unset (lcm->pending_map_requests_by_nonce, nonce[0]);
4702 vec_add1 (to_be_removed, pmr - lcm->pending_map_requests_pool);
4718 if (!lcm->is_enabled || !lcm->rloc_probing)
4747 clib_warning (
"Map server %U not found - probably deleted " 4753 clib_warning (
"map server %U is unreachable, ignoring",
4762 elect_map_server (lcm);
4781 u32 *to_be_removed = 0, *pmr_index;
4783 static u64 mreg_sent_counter = 0;
4794 if (!update_pending_map_register (pmr, dt, &del_all))
4798 vec_add1 (to_be_removed, pmr - lcm->pending_map_registers_pool);
4807 pool_free (lcm->pending_map_registers_pool);
4808 hash_free (lcm->map_register_messages_by_nonce);
4828 mreg_sent_counter++;
4854 if (!pmr->to_be_removed)
4855 update_pending_request (pmr, period);
4874 _vec_len (expired) = 0;
4888 return VNET_API_ERROR_LISP_DISABLED;
4891 lcm->
flags |= LISP_FLAG_STATS_ENABLED;
4893 lcm->
flags &= ~LISP_FLAG_STATS_ENABLED;
4904 return VNET_API_ERROR_LISP_DISABLED;
4906 return lcm->
flags & LISP_FLAG_STATS_ENABLED;
4916 "lisp-retry-service",
4928 return VNET_API_ERROR_INVALID_ARGUMENT;
4945 u8 pitr_mode = lcm->
flags & LISP_FLAG_PITR_MODE;
4946 u8 xtr_mode = lcm->
flags & LISP_FLAG_XTR_MODE;
4947 u8 petr_mode = lcm->
flags & LISP_FLAG_PETR_MODE;
4949 if (pitr_mode && is_enabled)
4950 return VNET_API_ERROR_INVALID_ARGUMENT;
4952 if (is_enabled && xtr_mode)
4954 if (!is_enabled && !xtr_mode)
4964 lcm->
flags |= LISP_FLAG_XTR_MODE;
4973 lcm->
flags &= ~LISP_FLAG_XTR_MODE;
4982 u8 xtr_mode = lcm->
flags & LISP_FLAG_XTR_MODE;
4983 u8 pitr_mode = lcm->
flags & LISP_FLAG_PITR_MODE;
4985 if (xtr_mode && is_enabled)
4986 return VNET_API_ERROR_INVALID_VALUE;
4988 if (is_enabled && pitr_mode)
4990 if (!is_enabled && !pitr_mode)
4997 lcm->
flags |= LISP_FLAG_PITR_MODE;
5002 lcm->
flags &= ~LISP_FLAG_PITR_MODE;
5011 u8 xtr_mode = lcm->
flags & LISP_FLAG_XTR_MODE;
5012 u8 petr_mode = lcm->
flags & LISP_FLAG_PETR_MODE;
5014 if (is_enabled && petr_mode)
5016 if (!is_enabled && !petr_mode)
5025 lcm->
flags |= LISP_FLAG_PETR_MODE;
5033 lcm->
flags &= ~LISP_FLAG_PETR_MODE;
5042 return (lcm->
flags & LISP_FLAG_XTR_MODE);
5049 return (lcm->
flags & LISP_FLAG_PITR_MODE);
5056 return (lcm->
flags & LISP_FLAG_PETR_MODE);
u32 vnet_crypto_process_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], u32 n_ops)
void lisp_gpe_tenant_l2_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
#define ICMP6_NEIGHBOR_ADVERTISEMENT_FLAG_SOLICITED
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
#define QUICK_MAP_REGISTER_INTERVAL
#define MNOTIFY_REC_COUNT(h_)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
fib_protocol_t fp_proto
protocol type
const lisp_gpe_tunnel_t * lisp_gpe_tunnel_get(index_t lgti)
#define MREQ_ITR_RLOC_COUNT(h_)
static uword lisp_cp_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
#define gid_address_ip_version(_a)
#define vec_foreach_index(var, v)
Iterate over vector indices.
map_records_arg_t ** map_records_args_pool
Per thread pool of records shared with thread0.
void * lisp_msg_put_mreq(lisp_cp_main_t *lcm, vlib_buffer_t *b, gid_address_t *seid, gid_address_t *deid, gid_address_t *rlocs, u8 is_smr_invoked, u8 rloc_probe_set, u64 *nonce)
void * lisp_msg_put_map_register(vlib_buffer_t *b, mapping_t *records, u8 want_map_notify, u16 auth_data_len, u64 *nonce, u32 *msg_len)
#define MREP_REC_COUNT(h_)
static int send_map_register(lisp_cp_main_t *lcm, u8 want_map_notif)
#define hash_set(h, key, value)
l2_input_config_t * configs
static u8 * vlib_buffer_get_tail(vlib_buffer_t *b)
Get pointer to the end of buffer's data.
boost::asio::ip::address ip_address_t
#define clib_fifo_head(v)
u8 vnet_lisp_get_pitr_mode(void)
#define gid_address_type(_a)
vlib_node_registration_t lisp_cp_lookup_ip4_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_lookup_ip4_node)
map_records_arg_t * parse_map_reply(vlib_buffer_t *b)
static void mapping_start_expiration_timer(lisp_cp_main_t *lcm, u32 mi, f64 expiration_time)
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...
#define hash_unset(h, key)
u32 * lcl_to_rmt_adjs_by_lcl_idx
void process_map_request(vlib_main_t *vm, vlib_node_runtime_t *node, lisp_cp_main_t *lcm, vlib_buffer_t *b)
lisp_api_l2_arp_entry_t * vnet_lisp_l2_arp_entries_get_by_bd(u32 bd)
#define SHA256_AUTH_DATA_LEN
static uword clib_fifo_elts(void *v)
ip_address_t active_map_resolver
vnet_main_t * vnet_get_main(void)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define RLOC_PROBING_INTERVAL
u32 bd_id
bridge domain id
lisp_msmr_t * map_resolvers
u32 vnet_lisp_set_transport_protocol(u8 protocol)
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix
#define MREQ_REC_COUNT(h_)
static vlib_buffer_t * build_encapsulated_map_request(lisp_cp_main_t *lcm, gid_address_t *seid, gid_address_t *deid, locator_set_t *loc_set, ip_address_t *mr_ip, ip_address_t *sloc, u8 is_smr_invoked, u64 *nonce_res, u32 *bi_res)
static void lisp_cp_register_dst_port(vlib_main_t *vm)
locator_pair_t * locator_pairs
static void queue_map_notify_for_processing(map_records_arg_t *a)
void timing_wheel_init(timing_wheel_t *w, u64 current_cpu_time, f64 cpu_clocks_per_second)
void lisp_gpe_tenant_l3_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
u32 retry_service_index
Retry service node index.
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
Enable/disable LISP-GPE.
#define foreach_lisp_cp_input_error
static uword lisp_cp_lookup_nsh(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u32 * local_mappings_indexes
static f64 vlib_time_now(vlib_main_t *vm)
static void update_adjacencies_by_map_index(lisp_cp_main_t *lcm, u32 mapping_index, u8 remove_only)
u32 vnet_lisp_gpe_add_nsh_iface(lisp_gpe_main_t *lgm)
Add LISP-GPE NSH interface.
static void lisp_cp_enable_l2_l3_ifaces(lisp_cp_main_t *lcm, u8 with_default_route)
lisp_cp_enable_l2_l3_ifaces
#define PENDING_MREQ_QUEUE_LEN
u8 vnet_lisp_get_map_request_mode(void)
vlib_node_registration_t lisp_cp_lookup_nsh_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_lookup_nsh_node)
void ip_address_to_fib_prefix(const ip_address_t *addr, fib_prefix_t *prefix)
convert from a LISP address to a FIB prefix
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static uword lisp_cp_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static u64 clib_cpu_time_now(void)
static void dp_del_fwd_entry(lisp_cp_main_t *lcm, u32 dst_map_index)
Combined counter to hold both packets and byte differences.
#define QUICK_MAP_REGISTER_MSG_COUNT
u32 ip_fib_get_egress_iface_for_dst(lisp_cp_main_t *lcm, ip_address_t *dst)
Find the sw_if_index of the interface that would be used to egress towards dst.
#define hash_set_mem(h, key, value)
static char * lisp_cp_input_error_strings[]
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
ip_lookup_main_t lookup_main
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
void vnet_lisp_gpe_add_fwd_counters(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 fwd_entry_index)
#define SHA1_AUTH_DATA_LEN
static void remove_dead_pending_map_requests(lisp_cp_main_t *lcm)
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
vnet_api_error_t vnet_lisp_stats_enable_disable(u8 enable)
int vnet_lisp_add_mapping(vnet_lisp_add_del_mapping_args_t *a, locator_t *rlocs, u32 *res_map_index, u8 *is_updated)
Adds/updates mapping.
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
static lisp_msmr_t * get_map_server(ip_address_t *a)
void timing_wheel_insert(timing_wheel_t *w, u64 insert_cpu_time, u32 user_data)
vlib_error_t * errors
Vector of errors for this node.
static int update_pending_map_register(pending_map_register_t *r, f64 dt, u8 *del_all)
static void * send_map_request_thread_fn(void *arg)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u8 vnet_lisp_stats_enable_disable_state(void)
void gid_dictionary_init(gid_dictionary_t *db)
u8 vnet_lisp_map_register_state_get(void)
static int send_map_reply(lisp_cp_main_t *lcm, u32 mi, ip_address_t *dst, u8 probe_bit, u64 nonce, u16 dst_port, ip_address_t *probed_loc)
void gid_address_from_ip(gid_address_t *g, ip_address_t *ip)
u8 vnet_lisp_get_petr_mode(void)
int vnet_lisp_set_map_request_mode(u8 mode)
static int is_local_ip(lisp_cp_main_t *lcm, ip_address_t *addr)
static void clean_locator_to_locator_set(lisp_cp_main_t *lcm, u32 lsi)
int vnet_lisp_add_del_adjacency(vnet_lisp_add_del_adjacency_args_t *a)
Adds adjacency or removes forwarding entry associated to remote mapping.
static char * lisp_cp_output_error_strings[]
#define NUMBER_OF_RETRIES
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
#define clib_memcpy(d, s, n)
#define MNOTIFY_NONCE(h_)
static int update_map_register_auth_data(map_register_hdr_t *map_reg_hdr, lisp_key_type_t key_id, u8 *key, u16 auth_data_len, u32 msg_len)
lisp_msmr_t * map_servers
lisp_transport_protocol_t vnet_lisp_get_transport_protocol(void)
int vnet_lisp_enable_disable_petr_mode(u8 is_enabled)
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
static void reset_pending_mr_counters(pending_map_request_t *r)
u32 ** locator_to_locator_sets