28 #include <openssl/evp.h> 29 #include <openssl/hmac.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) 89 clib_warning (
"unsupported encryption key type: %d!", key_id);
97 u8 smr_invoked,
u8 is_resend);
101 u32 sw_if_index,
u8 loop)
108 (
vec_len ((lm)->if_address_pool_index_by_sw_if_index) > (sw_if_index)) ?
109 vec_elt ((lm)->if_address_pool_index_by_sw_if_index, (sw_if_index)) :
128 u8 version, ip_address_t * result)
148 if (addr->version ==
IP4)
153 memcpy (&prefix->
fp_addr.ip4, &addr->ip, sizeof (prefix->
fp_addr.ip4));
159 memcpy (&prefix->
fp_addr.ip6, &addr->ip, sizeof (prefix->
fp_addr.ip6));
171 fib_prefix->
fp_len = ip_prefix->len;
197 ip_address_t * result)
235 return VNET_API_ERROR_INVALID_VALUE;
243 clib_warning (
"vni %d not associated to a bridge domain!", vni);
244 return VNET_API_ERROR_INVALID_VALUE;
273 memset (a, 0,
sizeof (*a));
308 u32 i, limitp = 0, li, found = 0, esi;
310 ip_address_t _lcl_addr, *lcl_addr = &_lcl_addr;
340 if ((found && lp->
priority == limitp)
341 || (!found && lp->
priority >= limitp))
359 if ((
u32) ~ 0 == esi)
378 memset (&pair, 0,
sizeof (pair));
441 u32 sw_if_index, **rmts, rmts_idx;
442 uword *feip = 0, *dpid, *rmts_stored_idxp = 0;
444 u8 type, is_src_dst = 0;
447 memset (a, 0,
sizeof (*a));
461 lcl_eid = &lcl_map->
eid;
467 rmt_eid = &rmt_map->
eid;
524 if (rv == 0 && (lcm->
flags & LISP_FLAG_USE_PETR))
564 if (!rmts_stored_idxp)
567 memset (rmts, 0,
sizeof (*rmts));
573 rmts_idx = (
u32) (*rmts_stored_idxp);
599 memset (&a, 0,
sizeof (a));
604 (
u8 *) & a,
sizeof (a));
626 if (gid_address_vni (&fwd->reid) != vni)
629 gid_address_copy (&adj.reid, &fwd->reid);
630 gid_address_copy (&adj.leid, &fwd->leid);
631 vec_add1 (adjs, adj);
680 return VNET_API_ERROR_LISP_DISABLED;
692 memset (ms, 0,
sizeof (*ms));
723 u32 * map_index_result)
726 u32 mi, *map_indexp, map_index,
i;
727 u32 **rmts = 0, *remote_idxp, rmts_itr, remote_idx;
737 return VNET_API_ERROR_INVALID_ARGUMENT;
742 return VNET_API_ERROR_INVALID_ARGUMENT;
755 return VNET_API_ERROR_VALUE_EXIST;
774 clib_warning (
"Locator set with index %d doesn't exist",
776 return VNET_API_ERROR_INVALID_VALUE;
783 vec_add1 (eid_indexes[0], map_index);
790 map_index_result[0] = map_index;
798 return VNET_API_ERROR_INVALID_VALUE;
804 for (i = 0; i <
vec_len (eid_indexes[0]); i++)
807 if (map_indexp[0] == mi)
835 if (lm_indexp[0] == mi)
848 vec_foreach_index (rmts_itr, rmts[0])
850 remote_idx = vec_elt (rmts[0], rmts_itr);
851 if (mi == remote_idx)
853 vec_del1 (rmts[0], rmts_itr);
875 u32 * map_index_result)
886 return VNET_API_ERROR_LISP_DISABLED;
900 return VNET_API_ERROR_INVALID_VALUE;
911 u32 version = (
u32) kvp->key[0];
915 u32 bd = (
u32) (kvp->key[0] >> 32);
934 u32 version = (
u32) kvp->key[0];
938 u32 bd = (
u32) (kvp->key[0] >> 32);
965 u32 version = (
u32) kvp->key[0];
969 u32 bd = (
u32) (kvp->key[0] >> 32);
973 mac_copy (e.mac, (
void *) &kvp->value);
974 e.ip4 = (
u32) kvp->key[1];
1000 u32 version = (
u32) kvp->key[0];
1004 u32 bd = (
u32) (kvp->key[0] >> 32);
1008 mac_copy (e.mac, (
void *) &kvp->value);
1035 return VNET_API_ERROR_LISP_DISABLED;
1047 return VNET_API_ERROR_ENTRY_ALREADY_EXISTS;
1057 clib_warning (
"ONE entry %U not found - cannot delete!",
1072 uword *dp_idp, *vnip, **dp_table_by_vni, **vni_by_dp_table;
1077 return VNET_API_ERROR_LISP_DISABLED;
1083 if (!is_l2 && (vni == 0 || dp_id == 0))
1085 clib_warning (
"can't add/del default vni-vrf mapping!");
1089 dp_idp =
hash_get (dp_table_by_vni[0], vni);
1090 vnip =
hash_get (vni_by_dp_table[0], dp_id);
1096 clib_warning (
"vni %d or vrf %d already used in vrf/vni " 1097 "mapping!", vni, dp_id);
1100 hash_set (dp_table_by_vni[0], vni, dp_id);
1101 hash_set (vni_by_dp_table[0], dp_id, vni);
1108 if (!dp_idp || !vnip)
1110 clib_warning (
"vni %d or vrf %d not used in any vrf/vni! " 1111 "mapping!", vni, dp_id);
1135 for (i = 0; i <
vec_len (new_locators); i++)
1137 old_li =
vec_elt (old_ls_indexes, i);
1205 memset (&a, 0,
sizeof (a));
1226 memset (adj_args, 0,
sizeof (adj_args[0]));
1270 u32 * res_map_index,
u8 * is_updated)
1274 u32 mi, ls_index = 0, dst_map_index;
1281 return VNET_API_ERROR_LISP_DISABLED;
1285 res_map_index[0] = ~0;
1289 memset (ls_args, 0,
sizeof (ls_args[0]));
1303 return VNET_API_ERROR_LISP_RLOC_LOCAL;
1314 clib_warning (
"mapping %U rejected due to collision with local " 1342 res_map_index[0] = mi;
1352 ls_args->
index = ~0;
1362 res_map_index[0] = dst_map_index;
1385 memset (ls_args, 0,
sizeof (ls_args[0]));
1386 memset (m_args, 0,
sizeof (m_args[0]));
1388 res_map_index[0] = ~0;
1419 res_map_index[0] = mi;
1429 u32 mi, *map_indices = 0, *map_indexp;
1437 vec_add1 (map_indices, mi);
1480 u32 local_mi, remote_mi = ~0;
1485 return VNET_API_ERROR_LISP_DISABLED;
1492 clib_warning (
"Remote eid %U not found. Cannot add adjacency!",
1522 clib_warning (
"Local eid %U not found. Cannot add adjacency!",
1545 return VNET_API_ERROR_LISP_DISABLED;
1548 if (mode >= _MR_MODE_MAX)
1550 clib_warning (
"Invalid LISP map request mode %d!", mode);
1551 return VNET_API_ERROR_INVALID_ARGUMENT;
1563 u32 locator_set_index = ~0;
1570 return VNET_API_ERROR_LISP_DISABLED;
1580 clib_warning (
"locator-set %v doesn't exist", locator_set_name);
1583 locator_set_index = p[0];
1586 memset (m, 0,
sizeof *m);
1613 u32 locator_set_index = ~0;
1620 return VNET_API_ERROR_LISP_DISABLED;
1626 clib_warning (
"locator-set %v doesn't exist", locator_set_name);
1629 locator_set_index = p[0];
1659 return VNET_API_ERROR_INVALID_ARGUMENT;
1693 return VNET_API_ERROR_LISP_DISABLED;
1696 memset (ls_args, 0,
sizeof (*ls_args));
1701 memset (&loc, 0,
sizeof (loc));
1708 ls_args->
index = ~0;
1718 lcm->
flags |= LISP_FLAG_USE_PETR;
1733 lcm->
flags &= ~LISP_FLAG_USE_PETR;
1743 u32 i, j, *loc_indexp, *ls_indexp, **ls_indexes, *to_be_deleted = 0;
1750 for (j = 0; j <
vec_len (ls_indexes[0]); j++)
1753 if (ls_indexp[0] == lsi)
1761 if (vec_len (ls_indexes[0]) == 0)
1770 for (i = 0; i <
vec_len (to_be_deleted); i++)
1779 static inline uword *
1817 return VNET_API_ERROR_VALUE_EXIST;
1826 u32 mapping_index,
u8 remove_only)
1837 if ((is_local && 0 == gid_address_cmp (&map->eid, &fwd->leid)) ||
1838 (!is_local && 0 == gid_address_cmp (&map->eid, &fwd->reid)))
1841 gid_address_copy (&a->leid, &fwd->leid);
1842 gid_address_copy (&a->reid, &fwd->reid);
1844 vnet_lisp_add_del_adjacency (a);
1849 vnet_lisp_add_del_adjacency (a);
1858 u32 ls_index,
u8 remove_only)
1868 for (i = 0; i <
vec_len (eid_indexes[0]); i++)
1878 u32 ls_index,
u32 loc_id)
1889 vec_del1 (ls_indexes[0], ls_index);
1899 u32 loc_index = ~0, ls_index = ~0, *locit =
NULL, **ls_indexes =
NULL;
1908 return VNET_API_ERROR_LISP_DISABLED;
1915 return VNET_API_ERROR_INVALID_ARGUMENT;
1923 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
1925 return VNET_API_ERROR_INVALID_ARGUMENT;
1932 ls_result[0] = p[0];
1973 if (0 == loc->
local &&
2010 return VNET_API_ERROR_LISP_DISABLED;
2018 if (p && p[0] != (
u32) ~ 0)
2023 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
2038 ls_result[0] = p[0];
2044 memset (ls, 0,
sizeof (*ls));
2068 ls_result[0] = ls_index;
2089 clib_warning (
"locator-set with index %d doesn't exists", p[0]);
2095 clib_warning (
"Can't delete the locator-set used to constrain " 2096 "the itr-rlocs in map-requests!");
2103 if (
vec_len (eid_indexes[0]) != 0)
2106 (
"Can't delete a locator that supports a mapping!");
2157 u32 vni, dp_table, **rmts;
2162 a->
is_en = is_enable;
2167 a->
is_en ?
"enable" :
"disable");
2176 dp_add_del_iface(lcm, vni, 0, 1);
2179 dp_add_del_iface(lcm, vni, 1, 1);
2222 return VNET_API_ERROR_LISP_DISABLED;
2235 memset (mr, 0,
sizeof (*mr));
2284 return VNET_API_ERROR_LISP_DISABLED;
2293 return VNET_API_ERROR_INVALID_ARGUMENT;
2307 #define foreach_lisp_cp_lookup_error \ 2309 _(MAP_REQUESTS_SENT, "map-request sent") \ 2310 _(ARP_REPLY_TX, "ARP replies sent") \ 2311 _(NDP_NEIGHBOR_ADVERTISEMENT_TX, \ 2312 "neighbor advertisement sent") 2315 #define _(sym,string) string, 2322 #define _(sym,str) LISP_CP_LOOKUP_ERROR_##sym, 2348 s =
format (s,
"LISP-CP-LOOKUP: map-resolver: %U destination eid %U",
2356 ip_address_t * sloc)
2381 clib_warning (
"Can't find map-resolver and local interface ip!");
2398 memset (gid, 0,
sizeof (gid[0]));
2411 addr = ip_interface_address_get_address (&lcm->im4->lookup_main, ia);
2412 ip_address_set (rloc, addr, IP4);
2413 ip_prefix_len (ippref) = 32;
2414 ip_prefix_normalize (ippref);
2415 vec_add1 (rlocs, gid[0]);
2422 addr = ip_interface_address_get_address (&lcm->im6->lookup_main, ia);
2423 ip_address_set (rloc, addr, IP6);
2424 ip_prefix_len (ippref) = 128;
2425 ip_prefix_normalize (ippref);
2426 vec_add1 (rlocs, gid[0]);
2436 ip_address_t * sloc, ip_address_t * rloc,
2445 clib_warning (
"Can't allocate buffer for Map-Request!");
2471 ip_address_t * sloc,
u8 is_smr_invoked,
2472 u64 * nonce_res,
u32 * bi_res)
2481 clib_warning (
"Can't allocate buffer for Map-Request!");
2498 memset (&sd, 0,
sizeof (sd));
2530 #define foreach_msmr \ 2536 elect_map_ ## name (lisp_cp_main_t * lcm) \ 2539 vec_foreach (mr, lcm->map_ ## name ## s) \ 2543 ip_address_copy (&lcm->active_map_ ##name, &mr->address); \ 2544 lcm->do_map_ ## name ## _election = 0; \ 2563 ip_address_t * probed_loc)
2584 addr = ip_interface_address_get_address (&lcm->im4->lookup_main,
2586 ip_address_set (new_ip, addr, IP4);
2593 addr = ip_interface_address_get_address (&lcm->im6->lookup_main,
2595 ip_address_set (new_ip, addr, IP6);
2619 add_locators (lcm, &rec, m->locator_set_index, NULL);
2620 vec_add1 (recs, rec);
2630 u16 auth_data_len,
u32 msg_len)
2632 MREG_KEY_ID (map_reg_hdr) = clib_host_to_net_u16 (key_id);
2636 (
unsigned char *) map_reg_hdr, msg_len,
NULL,
2645 ip_address_t * ms_ip,
u64 * nonce_res,
u8 want_map_notif,
2651 u32 bi, auth_data_len = 0, msg_len = 0;
2656 clib_warning (
"Can't allocate buffer for Map-Register!");
2667 auth_data_len, nonce_res,
2683 get_egress_map_ ##name## _ip (lisp_cp_main_t * lcm, ip_address_t * ip) \ 2686 while (lcm->do_map_ ## name ## _election \ 2687 | (0 == ip_fib_get_first_egress_ip_for_dst \ 2688 (lcm, &lcm->active_map_ ##name, ip))) \ 2690 if (0 == elect_map_ ## name (lcm)) \ 2694 vec_foreach (mr, lcm->map_ ## name ## s) mr->is_down = 0; \ 2704 #define foreach_lisp_cp_output_error \ 2705 _(MAP_REGISTERS_SENT, "map-registers sent") \ 2706 _(MAP_REQUESTS_SENT, "map-requests sent") \ 2707 _(RLOC_PROBES_SENT, "rloc-probes sent") 2709 #define _(sym,string) string, 2716 #define _(sym,str) LISP_CP_OUTPUT_ERROR_##sym, 2733 .name =
"lisp-cp-output",
2734 .vector_size =
sizeof (
u32),
2739 .error_strings = lisp_cp_output_error_strings,
2751 u32 local_locator_set_index, ip_address_t * sloc,
2752 ip_address_t * rloc)
2759 u32 next_index, *to_next;
2793 u32 si, rloc_probes_sent = 0;
2798 if (vec_len (e->locator_pairs) == 0)
2801 si = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &e->leid);
2804 clib_warning (
"internal error: cannot find local eid %U in " 2805 "map-cache!", format_gid_address, &e->leid);
2816 if (lp->priority != lprio)
2820 send_rloc_probe (lcm, &e->reid, lm->locator_set_index, &lp->lcl_loc,
2828 LISP_CP_OUTPUT_ERROR_RLOC_PROBES_SENT,
2837 u32 bi, map_registers_sent = 0;
2842 u32 next_index, *to_next;
2845 if (get_egress_map_server_ip (lcm, &sloc) < 0)
2864 for (k = r + 1; k <
vec_end (records); k++)
2877 want_map_notif, group, key_id, key, &bi);
2894 map_registers_sent++;
2897 memset (pmr, 0,
sizeof (*pmr));
2905 LISP_CP_OUTPUT_ERROR_MAP_REGISTERS_SENT,
2906 map_registers_sent);
2911 #define send_encapsulated_map_request(lcm, seid, deid, smr) \ 2912 _send_encapsulated_map_request(lcm, seid, deid, smr, 0) 2914 #define resend_encapsulated_map_request(lcm, seid, deid, smr) \ 2915 _send_encapsulated_map_request(lcm, seid, deid, smr, 1) 2920 u8 is_smr_invoked,
u8 is_resend)
2922 u32 next_index, bi = 0, *to_next, map_index;
2937 if (!gid_address_cmp (&pmr->src, seid)
2938 && !gid_address_cmp (&pmr->dst, deid))
2940 duplicate_pmr = pmr;
2946 if (!is_resend && duplicate_pmr)
2956 if (map_index == ~0)
2958 clib_warning (
"No local mapping found in eid-table for %U!",
2968 (
"Mapping found for src eid %U is not marked as local!",
2972 ls_index = map->locator_set_index;
2979 ls_index = map->locator_set_index;
2983 if (lcm->nsh_map_index == (
u32) ~ 0)
2991 ls_index = map->locator_set_index;
2997 if (~0 != lcm->mreq_itr_rlocs)
2999 ls_index = lcm->mreq_itr_rlocs;
3004 if (get_egress_map_resolver_ip (lcm, &sloc) < 0)
3007 duplicate_pmr->to_be_removed = 1;
3013 &lcm->active_map_resolver,
3014 &sloc, is_smr_invoked, &nonce, &bi);
3033 LISP_CP_OUTPUT_ERROR_MAP_REQUESTS_SENT, 1);
3043 hash_unset (lcm->pending_map_requests_by_nonce, nonce_del[0]);
3048 hash_set (lcm->pending_map_requests_by_nonce, nonce,
3049 duplicate_pmr - lcm->pending_map_requests_pool);
3054 pool_get (lcm->pending_map_requests_pool, pmr);
3055 memset (pmr, 0,
sizeof (*pmr));
3059 pmr->is_smr_invoked = is_smr_invoked;
3061 hash_set (lcm->pending_map_requests_by_nonce, nonce,
3062 pmr - lcm->pending_map_requests_pool);
3092 u32 vni = ~0, table_id = ~0;
3105 clib_warning (
"vrf %d is not mapped to any vni!", table_id);
3123 return bd_config->
bd_id;
3137 clib_warning (
"bridge domain %d is not mapped to any vni!", bd);
3149 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt;
3151 memset (src, 0,
sizeof (*src));
3152 memset (dst, 0,
sizeof (*dst));
3160 u8 version, preflen;
3183 if (clib_net_to_host_u16 (eh->
type) == ETHERNET_TYPE_ARP)
3186 if (clib_net_to_host_u16 (ah->
opcode)
3187 != ETHERNET_ARP_OPCODE_request)
3197 if (clib_net_to_host_u16 (eh->
type) == ETHERNET_TYPE_IP6)
3202 if (IP_PROTOCOL_ICMP6 == ip->
protocol)
3204 icmp6_neighbor_solicitation_or_advertisement_header_t *ndh;
3206 if (ndh->icmp.type == ICMP6_neighbor_solicitation)
3208 opt = (
void *) (ndh + 1);
3209 if ((opt->header.type !=
3210 ICMP6_NEIGHBOR_DISCOVERY_OPTION_source_link_layer_address)
3211 || (opt->header.n_data_u64s != 1))
3218 &ndh->target_address,
IP6);
3241 if (clib_net_to_host_u16 (eh->
type) == ETHERNET_TYPE_NSH)
3244 u32 spi = clib_net_to_host_u32 (nh->
spi_si << 8);
3245 u8 si = (
u8) clib_net_to_host_u32 (nh->
spi_si);
3260 icmp6_neighbor_discovery_ethernet_link_layer_address_option_t *opt;
3261 u32 *from, *to_next,
di, si;
3264 uword n_left_from, n_left_to_next;
3271 while (n_left_from > 0)
3275 while (n_left_from > 0 && n_left_to_next > 0)
3277 u32 pi0, sw_if_index0, next0;
3285 icmp6_neighbor_solicitation_or_advertisement_header_t *ndh;
3293 n_left_to_next -= 1;
3315 arp0->
opcode = clib_host_to_net_u16 (ETHERNET_ARP_OPCODE_reply);
3328 b0->
error = node->
errors[LISP_CP_LOOKUP_ERROR_ARP_REPLY_TX];
3348 opt = (
void *) (ndh + 1);
3350 ICMP6_NEIGHBOR_DISCOVERY_OPTION_target_link_layer_address;
3352 ndh->icmp.type = ICMP6_neighbor_advertisement;
3353 ndh->advertisement_flags = clib_host_to_net_u32
3356 ndh->icmp.checksum = 0;
3357 ndh->icmp.checksum =
3364 [LISP_CP_LOOKUP_ERROR_NDP_NEIGHBOR_ADVERTISEMENT_TX];
3408 b0->
error = node->
errors[LISP_CP_LOOKUP_ERROR_DROP];
3416 memset (tr, 0,
sizeof (*tr));
3425 n_left_to_next, pi0, next0);
3465 .name =
"lisp-cp-lookup-ip4",
3466 .vector_size =
sizeof (
u32),
3485 .name =
"lisp-cp-lookup-ip6",
3486 .vector_size =
sizeof (
u32),
3505 .name =
"lisp-cp-lookup-l2",
3506 .vector_size =
sizeof (
u32),
3525 .name =
"lisp-cp-lookup-nsh",
3526 .vector_size =
sizeof (
u32),
3543 #define foreach_lisp_cp_input_error \ 3545 _(RLOC_PROBE_REQ_RECEIVED, "rloc-probe requests received") \ 3546 _(RLOC_PROBE_REP_RECEIVED, "rloc-probe replies received") \ 3547 _(MAP_NOTIFIES_RECEIVED, "map-notifies received") \ 3548 _(MAP_REPLIES_RECEIVED, "map-replies received") 3551 #define _(sym,string) string, 3558 #define _(sym,str) LISP_CP_INPUT_ERROR_##sym, 3578 s =
format (s,
"LISP-CP-INPUT: TODO");
3587 memset (adj_args, 0,
sizeof (adj_args[0]));
3602 f64 expiration_time)
3607 u64 exp_clock_time = now + expiration_time * cpu_cps;
3638 memset (a, 0,
sizeof (*a));
3657 memset (&mr_args, 0,
sizeof (mr_args));
3700 u32 dst_map_index = 0;
3721 memset (m_args, 0,
sizeof (m_args[0]));
3731 if (dst_map_index == (
u32) ~ 0)
3738 memset (adj_args, 0,
sizeof (adj_args[0]));
3757 hash_unset(lcm->pending_map_requests_by_nonce, noncep[0]);
3778 if ((
u16) ~ 0 == auth_data_len)
3780 clib_warning (
"invalid length for key_id %d!", key_id);
3793 (
unsigned char *) h, msg_len,
NULL,
NULL);
3795 result = memcmp (code, auth_data, auth_data_len);
3811 clib_warning (
"No pending map-register entry with nonce %lu!",
3846 u32 key_id,
u8 ** key_out)
3856 key_out[0] = m->
key;
3858 for (i = 1; i < len; i++)
3882 memset (&m, 0,
sizeof (m));
3885 for (i = 0; i <
count; i++)
3932 u16 auth_data_len = 0;
3937 memset (a, 0,
sizeof (*a));
3940 memset (&deid, 0,
sizeof (deid));
3966 - (
u8 *) mnotif_hdr, key_id, key))
3968 clib_warning (
"Map-notify auth data verification failed for nonce " 3969 "0x%lx!", a->
nonce);
3978 ip_address_t * dst,
u64 nonce,
u8 probe_bit,
3987 clib_warning (
"Can't allocate buffer for Map-Register!");
4007 u8 probe_bit,
u64 nonce,
u16 dst_port,
4008 ip_address_t * probed_loc)
4014 u32 next_index, *to_next;
4023 memset (&src, 0,
sizeof (src));
4032 b =
build_map_reply (lcm, &src, dst, nonce, probe_bit, records, dst_port,
4056 if (start < 0 && start < -
sizeof (b->
pre_data))
4062 *ip_hdr = b->
data + start;
4072 ip_address_t *dst_loc = 0, probed_loc, src_loc;
4077 u32 i, len = 0, rloc_probe_recv = 0;
4084 (
"Only SMR Map-Requests and RLOC probe supported for now!");
4104 memset (&dst, 0,
sizeof (dst));
4126 memset (&m, 0,
sizeof (m));
4139 src_port, &probed_loc);
4145 LISP_CP_INPUT_ERROR_RLOC_PROBE_REQ_RECEIVED,
4162 memset (a, 0,
sizeof (*a));
4178 memset (&m, 0,
sizeof (m));
4217 u32 n_left_from, *from, *to_next_drop, rloc_probe_rep_recv = 0,
4218 map_notifies_recv = 0;
4227 while (n_left_from > 0)
4229 u32 n_left_to_next_drop;
4232 to_next_drop, n_left_to_next_drop);
4233 while (n_left_from > 0 && n_left_to_next_drop > 0)
4241 to_next_drop[0] = bi0;
4243 n_left_to_next_drop -= 1;
4255 rloc_probe_rep_recv++;
4266 map_notifies_recv++;
4271 clib_warning (
"Unsupported LISP message type %d", type);
4275 b0->
error = node->
errors[LISP_CP_INPUT_ERROR_DROP];
4284 n_left_to_next_drop);
4287 LISP_CP_INPUT_ERROR_RLOC_PROBE_REP_RECEIVED,
4288 rloc_probe_rep_recv);
4290 LISP_CP_INPUT_ERROR_MAP_NOTIFIES_RECEIVED,
4298 .name =
"lisp-cp-input",
4299 .vector_size =
sizeof (
u32),
4304 .error_strings = lisp_cp_input_error_strings,
4373 memset (stat, 0,
sizeof (*stat));
4374 memset (&fwd_key, 0,
sizeof (fwd_key));
4404 if (lisp_stats_api_fill (lcm, lgm, &stat, key, index))
4405 vec_add1 (stats, stat);
4428 u8 smr_invoked,
u8 is_resend)
4438 (
u8 *) & a,
sizeof (a));
4461 clib_warning (
"Map resolver %U not found - probably deleted " 4467 clib_warning (
"map resolver %U is unreachable, ignoring",
4477 elect_map_resolver (lcm);
4501 u32 *to_be_removed = 0, *pmr_index;
4506 if (pmr->to_be_removed)
4508 clib_fifo_foreach (nonce, pmr->nonces, ({
4509 hash_unset (lcm->pending_map_requests_by_nonce, nonce[0]);
4512 vec_add1 (to_be_removed, pmr - lcm->pending_map_requests_pool);
4528 if (!lcm->is_enabled || !lcm->rloc_probing)
4557 clib_warning (
"Map server %U not found - probably deleted " 4563 clib_warning (
"map server %U is unreachable, ignoring",
4572 elect_map_server (lcm);
4591 u32 *to_be_removed = 0, *pmr_index;
4593 static u64 mreg_sent_counter = 0;
4604 if (!update_pending_map_register (pmr, dt, &del_all))
4608 vec_add1 (to_be_removed, pmr - lcm->pending_map_registers_pool);
4617 pool_free (lcm->pending_map_registers_pool);
4618 hash_free (lcm->map_register_messages_by_nonce);
4638 mreg_sent_counter++;
4664 if (!pmr->to_be_removed)
4665 update_pending_request (pmr, period);
4684 _vec_len (expired) = 0;
4698 return VNET_API_ERROR_LISP_DISABLED;
4701 lcm->
flags |= LISP_FLAG_STATS_ENABLED;
4703 lcm->
flags &= ~LISP_FLAG_STATS_ENABLED;
4714 return VNET_API_ERROR_LISP_DISABLED;
4716 return lcm->
flags & LISP_FLAG_STATS_ENABLED;
4723 .name =
"lisp-retry-service",
4724 .process_log2_n_stack_bytes = 16,
4735 return VNET_API_ERROR_INVALID_ARGUMENT;
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_)
fib_protocol_t fp_proto
protocol type
const lisp_gpe_tunnel_t * lisp_gpe_tunnel_get(index_t lgti)
#define VNET_SW_INTERFACE_FLAG_UNNUMBERED
#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.
sll srl srl sll sra u16x4 i
#define clib_fifo_head(v)
#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)
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.
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)
u32 vnet_lisp_gpe_add_nsh_iface(lisp_gpe_main_t *lgm)
Add LISP-GPE NSH interface.
#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[]
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)
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 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)
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
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u64 value, u8 is_add)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void add_ndp_bd(BVT(clib_bihash_kv)*kvp, void *arg)
#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...
int ip_fib_get_first_egress_ip_for_dst(lisp_cp_main_t *lcm, ip_address_t *dst, ip_address_t *result)
Find first IP of the interface that would be used to egress towards dst.
#define ICMP6_NEIGHBOR_ADVERTISEMENT_FLAG_OVERRIDE
gid_address_t * eids_to_be_deleted
vlib_combined_counter_main_t counters
static int dp_add_fwd_entry_from_mt(u32 si, u32 di)
#define hash_foreach(key_var, value_var, h, body)
#define gid_address_sd_src(_a)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void vnet_lisp_gpe_del_fwd_counters(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 fwd_entry_index)
Aggregrate type for a prefix.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
u32 * fwd_entry_by_mapping_index
#define clib_error_return(e, args...)
u32 expired_map_registers
u8 pre_data[VLIB_BUFFER_PRE_DATA_SIZE]
Space for inserting data before buffer start.
static mapping_t * get_mapping(lisp_cp_main_t *lcm, gid_address_t *e)
int vnet_lisp_eid_table_map(u32 vni, u32 dp_id, u8 is_l2, u8 is_add)
static u32 get_locator_pairs(lisp_cp_main_t *lcm, mapping_t *lcl_map, mapping_t *rmt_map, locator_pair_t **locator_pairs)
Finds first remote locator with best (lowest) priority that has a local peer locator with an underlyi...
lisp_api_ndp_entry_t * vnet_lisp_ndp_entries_get_by_bd(u32 bd)
#define vec_end(v)
End (last data address) of vector.
u32 lisp_gpe_tenant_l2_iface_add_or_lock(u32 vni, u32 bd_id)
Add/create and lock a new or find and lock the existing L2 interface for the tenant.
static lisp_cp_main_t * vnet_lisp_cp_get_main()
u16 fp_len
The mask length.
#define vlib_call_init_function(vm, x)
u8 do_map_server_election
u8 delete_after_expiration
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
u32 petr_map_index
Proxy ETR map index.
#define ip_addr_version(_a)
void gid_to_dp_address(gid_address_t *g, dp_address_t *d)
static void update_pending_request(pending_map_request_t *r, f64 dt)
Take an action with a pending map request depending on expiration time and re-try counters...
clib_error_t * vnet_lisp_enable_disable(u8 is_enable)
#define MAX_EXPIRED_MAP_REGISTERS_DEFAULT
vlib_node_registration_t lisp_cp_lookup_ip6_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_lookup_ip6_node)
static void add_locators(lisp_cp_main_t *lcm, mapping_t *m, u32 locator_set_index, ip_address_t *probed_loc)
void vnet_lisp_gpe_del_nsh_iface(lisp_gpe_main_t *lgm)
Del LISP-GPE NSH interface.
#define MREQ_RLOC_PROBE(h_)
static void mapping_delete_timer(lisp_cp_main_t *lcm, u32 mi)
int vnet_lisp_pitr_set_locator_set(u8 *locator_set_name, u8 is_add)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u8 vnet_lisp_rloc_probe_state_get(void)
static void queue_map_reply_for_processing(map_records_arg_t *a)
#define hash_unset_mem(h, key)
Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
counter_t packets
packet counter
u8 do_map_resolver_election
#define clib_fifo_sub1(f, e)
u32 table_id
table (vrf) id
#define gid_address_arp_ndp_ip(_a)
static void * vlib_buffer_make_headroom(vlib_buffer_t *b, u8 size)
Make head room, typically for packet headers.
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
void gid_dict_foreach_subprefix(gid_dictionary_t *db, gid_address_t *eid, foreach_subprefix_match_cb_t cb, void *arg)
#define gid_address_mac(_a)
static u16 auth_data_len_by_key_id(lisp_key_type_t key_id)
int get_mr_and_local_iface_ip(lisp_cp_main_t *lcm, ip_address_t *mr_ip, ip_address_t *sloc)
int vnet_lisp_map_cache_add_del(vnet_lisp_add_del_mapping_args_t *a, u32 *map_index_result)
Add/remove mapping to/from map-cache.
int vnet_lisp_add_del_local_mapping(vnet_lisp_add_del_mapping_args_t *a, u32 *map_index_result)
Add/update/delete mapping to/in/from map-cache.
u32 lisp_msg_parse_addr(vlib_buffer_t *b, gid_address_t *eid)
static vlib_node_registration_t lisp_retry_service_node
(constructor) VLIB_REGISTER_NODE (lisp_retry_service_node)
vlib_node_registration_t lisp_cp_input_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_input_node)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define MNOTIFY_KEY_ID(h_)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
void gid_address_free(gid_address_t *a)
vlib_node_registration_t lisp_cp_lookup_l2_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_lookup_l2_node)
#define pool_put(P, E)
Free an object E in pool P.
#define gid_address_sd_dst_type(_a)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
static void cleanup(void)
lisp_api_stats_t * vnet_lisp_get_stats(void)
static void remove_expired_mapping(lisp_cp_main_t *lcm, u32 mi)
u32 * local_locator_set_indexes
static int map_record_integrity_check(lisp_cp_main_t *lcm, mapping_t *maps, u32 key_id, u8 **key_out)
When map-notify is received it is necessary that all EIDs in the record list share common key...
uword unformat_gid_address(unformat_input_t *input, va_list *args)
#define vec_del1(v, i)
Delete the element at index I.
u8 * format_gid_address(u8 *s, va_list *args)
static uword lisp_cp_lookup_ip4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static u8 compare_locators(lisp_cp_main_t *lcm, u32 *old_ls_indexes, locator_t *new_locators)
#define foreach_lisp_cp_lookup_error
vlib_node_registration_t lisp_cp_output_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_output_node)
u32 node_index
Node index.
#define MAX_LISP_MSG_ENCAP_LEN
#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).
ip_address_t map_resolver_ip
#define hash_foreach_mem(key_var, value_var, h, body)
#define TIME_UNTIL_REFETCH_OR_DELETE
#define MREG_AUTH_DATA_LEN(h_)
void * pkt_push_udp_and_ip(vlib_main_t *vm, vlib_buffer_t *b, u16 sp, u16 dp, ip_address_t *sip, ip_address_t *dip, u8 csum_offload)
#define clib_fifo_foreach(v, f, body)
static void process_map_notify(map_records_arg_t *a)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static int queue_map_request(gid_address_t *seid, gid_address_t *deid, u8 smr_invoked, u8 is_resend)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static void remove_locator_from_locator_set(locator_set_t *ls, u32 *locit, u32 ls_index, u32 loc_id)
#define gid_address_ippref(_a)
lisp_adjacency_t * vnet_lisp_adjacencies_get_by_vni(u32 vni)
Returns vector of adjacencies.
u32 fib_entry_get_resolving_interface(fib_node_index_t entry_index)
u8 is_negative
type of mapping
static int is_locator_in_locator_set(lisp_cp_main_t *lcm, locator_set_t *ls, locator_t *loc)
#define pool_free(p)
Free a pool.
u32 lisp_msg_parse_itr_rlocs(vlib_buffer_t *b, gid_address_t **rlocs, u8 rloc_count)
clib_error_t * lisp_cp_init(vlib_main_t *vm)
u32 * vnet_lisp_ndp_bds_get(void)
u32 vni
VNI/tenant id in HOST byte order.
u8 * format_lisp_cp_input_trace(u8 *s, va_list *args)
static vlib_buffer_t * build_map_reply(lisp_cp_main_t *lcm, ip_address_t *sloc, ip_address_t *dst, u64 nonce, u8 probe_bit, mapping_t *records, u16 dst_port, u32 *bi_res)
static uword lisp_cp_lookup_l2(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
uword * pending_map_requests_by_nonce
static void dp_add_fwd_entry(lisp_cp_main_t *lcm, u32 src_map_index, u32 dst_map_index)
int vnet_lisp_add_del_mreq_itr_rlocs(vnet_lisp_add_del_mreq_itr_rloc_args_t *a)
static_always_inline uword vlib_get_thread_index(void)
static lisp_msmr_t * get_map_resolver(ip_address_t *a)
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...
#define MAP_REC_ACTION(h)
int gid_address_cmp(gid_address_t *a1, gid_address_t *a2)
#define gid_address_arp_bd
#define vec_free(V)
Free vector's memory (no header).
#define gid_address_ippref_len(_a)
static map_records_arg_t * parse_map_notify(vlib_buffer_t *b)
u32 lisp_msg_parse_mapping_record(vlib_buffer_t *b, gid_address_t *eid, locator_t **locs, locator_t *probed_)
static void remove_mapping_if_needed(u32 mi, void *arg)
Callback invoked when a sub-prefix is found.
#define clib_warning(format, args...)
#define VLIB_BUFFER_IS_TRACED
void * lisp_msg_push_ecm(vlib_main_t *vm, vlib_buffer_t *b, int lp, int rp, gid_address_t *la, gid_address_t *ra)
#define clib_memcpy(a, b, c)
u32 * timing_wheel_advance(timing_wheel_t *w, u64 advance_cpu_time, u32 *expired_user_data, u64 *next_expiring_element_cpu_time)
void timing_wheel_delete(timing_wheel_t *w, u32 user_data)
u32 locator_cmp(locator_t *l1, locator_t *l2)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static void update_map_register(lisp_cp_main_t *lcm, f64 dt)
int vnet_lisp_map_register_enable_disable(u8 is_enable)
u32 vnet_lisp_map_register_fallback_threshold_get(void)
u32 fib_node_index_t
A typedef of a node index.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void * lisp_msg_put_map_reply(vlib_buffer_t *b, mapping_t *records, u64 nonce, u8 probe_bit)
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.
static int send_rloc_probe(lisp_cp_main_t *lcm, gid_address_t *deid, u32 local_locator_set_index, ip_address_t *sloc, ip_address_t *rloc)
lisp_transport_protocol_t
#define PENDING_MREG_EXPIRATION_TIME
#define gid_address_nsh_si(_a)
#define vec_is_equal(v1, v2)
Compare two vectors, not NULL-pointer tolerant.
void * ip_interface_get_first_address(ip_lookup_main_t *lm, u32 sw_if_index, u8 version)
enum fib_entry_flag_t_ fib_entry_flag_t
static void * ip6_next_header(ip6_header_t *i)
lisp_gpe_tunnel_key_t * key
RLOC pair and rloc fib_index.
u32 unnumbered_sw_if_index
#define fid_addr_ippref(_a)
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
Forwarding entry create/remove dispatcher.
u8 vnet_lisp_enable_disable_status(void)
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
static uword send_map_resolver_service(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
struct _gid_address_t gid_address_t
u32 fib_table_get_table_id_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the Table-ID of the FIB bound to the interface.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define pool_put_index(p, i)
Free pool element with given index.
int ip_interface_get_first_ip_address(lisp_cp_main_t *lcm, u32 sw_if_index, u8 version, ip_address_t *result)
int vnet_lisp_add_del_map_server(ip_address_t *addr, u8 is_add)
#define fid_addr_type(_a)
static lisp_msg_type_e lisp_msg_type(void *b)
u8 * format_ip_address(u8 *s, va_list *args)
static int send_rloc_probes(lisp_cp_main_t *lcm)
int vnet_lisp_clear_all_remote_adjacencies(void)
ip_lookup_main_t lookup_main
#define gid_address_sd_dst(_a)
#define MAP_REGISTER_INTERVAL
static void get_src_and_dst_ip(void *hdr, ip_address_t *src, ip_address_t *dst)
lisp_transport_protocol_t transport_protocol
either UDP based or binary API.
clib_error_t * lisp_gpe_init(vlib_main_t *vm)
LISP-GPE init function.
gid_dictionary_t mapping_index_by_gid
ip_interface_address_t * ip_interface_get_first_interface_address(ip_lookup_main_t *lm, u32 sw_if_index, u8 loop)
u32 gid_dictionary_sd_lookup(gid_dictionary_t *db, gid_address_t *dst, gid_address_t *src)
static u32 lisp_get_vni_from_buffer_ip(lisp_cp_main_t *lcm, vlib_buffer_t *b, u8 version)
locator_set_t * locator_set_pool
static void clib_mem_free(void *p)
static void gid_address_sd_to_flat(gid_address_t *dst, gid_address_t *src, fid_address_t *fid)
#define gid_address_ndp_bd
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
u32 ** locator_set_to_eids
#define LISP_CONTROL_PORT
static u64 mac_to_u64(u8 *m)
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
gid_address_t rmt_eid
remote eid
u64 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
static void add_l2_arp_entry(BVT(clib_bihash_kv)*kvp, void *arg)
#define foreach_lisp_cp_output_error
#define clib_fifo_free(f)
pending_map_register_t * pending_map_registers_pool
fwd_entry_t * fwd_entry_pool
static vlib_main_t * vlib_get_main(void)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_elt(v, i)
Get vector value at index i.
int vnet_lisp_map_register_fallback_threshold_set(u32 value)
pending_map_request_t * pending_map_requests_pool
int vnet_lisp_add_del_locator_set(vnet_lisp_add_del_locator_set_args_t *a, u32 *ls_result)
#define gid_address_ip(_a)
static void add_ndp_entry(BVT(clib_bihash_kv)*kvp, void *arg)
negative_fwd_actions_e action
action for negative mappings
#define clib_fifo_add1(f, e)
static u32 lisp_get_bd_from_buffer_eth(vlib_buffer_t *b)
static u8 vlib_buffer_has_space(vlib_buffer_t *b, word l)
Check if there is enough space in buffer to advance.
#define gid_address_vni(_a)
#define hash_create_vec(elts, key_bytes, value_bytes)
static u32 lisp_get_vni_from_buffer_eth(lisp_cp_main_t *lcm, vlib_buffer_t *b)
static vlib_buffer_t * build_map_register(lisp_cp_main_t *lcm, ip_address_t *sloc, ip_address_t *ms_ip, u64 *nonce_res, u8 want_map_notif, mapping_t *records, lisp_key_type_t key_id, u8 *key, u32 *bi_res)
static uword * get_locator_set_index(vnet_lisp_add_del_locator_set_args_t *a, uword *p)
void locator_free(locator_t *l)
ip_address_t active_map_server
static void remove_overlapping_sub_prefixes(lisp_cp_main_t *lcm, gid_address_t *eid, u8 is_negative)
This function searches map cache and looks for IP prefixes that are subset of the provided one...
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static char * lisp_cp_lookup_error_strings[]
static int dp_add_del_iface(lisp_cp_main_t *lcm, u32 vni, u8 is_l2, u8 is_add)
#define GID_LOOKUP_MISS_L2
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define gid_address_nsh_spi(_a)
int vnet_lisp_del_mapping(gid_address_t *eid, u32 *res_map_index)
Removes a mapping.
u32 * vnet_lisp_l2_arp_bds_get(void)
int vnet_lisp_add_del_locator(vnet_lisp_add_del_locator_set_args_t *a, locator_set_t *ls, u32 *ls_result)
locator_pair_t * locator_pairs
vector of locator pairs
static mapping_t * lisp_get_petr_mapping(lisp_cp_main_t *lcm)
u8 ip_address_max_len(u8 version)
uword * locator_set_index_by_name
int vnet_lisp_nsh_set_locator_set(u8 *locator_set_name, u8 is_add)
static map_records_arg_t * map_record_args_get()
static gid_address_t * build_itr_rloc_list(lisp_cp_main_t *lcm, locator_set_t *loc_set)
l2_bridge_domain_t * bd_configs
void gid_address_copy(gid_address_t *dst, gid_address_t *src)
A collection of combined counters.
static vlib_buffer_t * build_map_request(lisp_cp_main_t *lcm, gid_address_t *deid, ip_address_t *sloc, ip_address_t *rloc, gid_address_t *itr_rlocs, u64 *nonce_res, u32 *bi_res)
#define hash_get_mem(h, key)
void mac_copy(void *dst, void *src)
static void add_l2_arp_bd(BVT(clib_bihash_kv)*kvp, void *arg)
u32 lisp_msg_parse_eid_rec(vlib_buffer_t *b, gid_address_t *eid)
static void map_records_arg_free(map_records_arg_t *a)
#define VLIB_REGISTER_NODE(x,...)
void get_src_and_dst_eids_from_buffer(lisp_cp_main_t *lcm, vlib_buffer_t *b, gid_address_t *src, gid_address_t *dst, u16 type)
int vnet_lisp_add_del_map_resolver(vnet_lisp_add_del_map_resolver_args_t *a)
ip4_main_t ip4_main
Global ip4 main structure.
int vnet_lisp_gpe_get_fwd_stats(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, vlib_counter_t *c)
int vnet_lisp_add_del_l2_arp_ndp_entry(gid_address_t *key, u8 *mac, u8 is_add)
u32 ** lcl_to_rmt_adjacencies
static vlib_thread_main_t * vlib_get_thread_main()
static void find_ip_header(vlib_buffer_t *b, u8 **ip_hdr)
static void process_expired_mapping(lisp_cp_main_t *lcm, u32 mi)
#define vec_foreach(var, vec)
Vector iterator.
static void * vlib_buffer_pull(vlib_buffer_t *b, u8 size)
Retrieve bytes from buffer head.
uword * map_register_messages_by_nonce
static void update_rloc_probing(lisp_cp_main_t *lcm, f64 dt)
lisp_cp_main_t lisp_control_main
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
#define gid_address_arp_ip4(_a)
void * process_map_reply(map_records_arg_t *a)
static int parse_map_records(vlib_buffer_t *b, map_records_arg_t *a, u8 count)
uword * lisp_stats_index_by_key
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
#define pool_foreach_index(i, v, body)
Iterate pool by index.
u32 max_expired_map_registers
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
int vnet_lisp_map_register_set_ttl(u32 ttl)
static void update_fwd_entries_by_locator_set(lisp_cp_main_t *lcm, u8 is_local, u32 ls_index, u8 remove_only)
static u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
u32 vnet_lisp_map_register_get_ttl(void)
static const EVP_MD * get_encrypt_fcn(lisp_key_type_t key_id)
static void * dp_add_fwd_entry_thread_fn(void *arg)
void build_src_dst(gid_address_t *sd, gid_address_t *src, gid_address_t *dst)
static uword lisp_cp_lookup_ip6(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
int vnet_lisp_use_petr(ip_address_t *ip, u8 is_add)
Configure Proxy-ETR.
static void update_adjacencies_by_map_index(lisp_cp_main_t *lcm, u8 is_local, u32 mapping_index, u8 remove_only)
gid_address_t lcl_eid
local eid
u32 lisp_gpe_tenant_l3_iface_add_or_lock(u32 vni, u32 table_id)
Add/create and lock a new or find and lock the existing L3 interface for the tenant.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static foreach_msmr void free_map_register_records(mapping_t *maps)
#define send_encapsulated_map_request(lcm, seid, deid, smr)
#define MREP_RLOC_PROBE(h_)
static int is_auth_data_valid(map_notify_hdr_t *h, u32 msg_len, lisp_key_type_t key_id, u8 *key)
static mapping_t * build_map_register_record_list(lisp_cp_main_t *lcm)
u8 * format_lisp_cp_lookup_trace(u8 *s, va_list *args)
#define MAP_REGISTER_DEFAULT_TTL
#define ip_prefix_addr(_a)
#define resend_encapsulated_map_request(lcm, seid, deid, smr)
#define PENDING_MREQ_EXPIRATION_TIME
void gid_dict_foreach_l2_arp_ndp_entry(gid_dictionary_t *db, void(*cb)(BVT(clib_bihash_kv)*kvp, void *arg), void *ht)
static int lisp_stats_api_fill(lisp_cp_main_t *lcm, lisp_gpe_main_t *lgm, lisp_api_stats_t *stat, lisp_stats_key_t *key, u32 stats_index)
static uword lisp_cp_lookup_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int overlay)
int ip_address_cmp(const ip_address_t *ip1, const ip_address_t *ip2)
fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index)