32 u8 smr_invoked,
u8 is_resend);
36 u32 sw_if_index,
u8 loop)
43 (
vec_len ((lm)->if_address_pool_index_by_sw_if_index) > (sw_if_index)) ?
44 vec_elt ((lm)->if_address_pool_index_by_sw_if_index, (sw_if_index)) :
63 u8 version, ip_address_t * result)
107 return adj->rewrite_header.sw_if_index;
131 ip_address_t * result)
160 uword *dp_table, *intf;
170 return VNET_API_ERROR_INVALID_VALUE;
178 clib_warning (
"vni %d not associated to a bridge domain!", vni);
179 return VNET_API_ERROR_INVALID_VALUE;
206 clib_warning (
"interface for vni %d doesn't exist!", vni);
207 return VNET_API_ERROR_INVALID_VALUE;
226 memset (a, 0,
sizeof (*a));
258 u32 i, limitp = 0, li, found = 0, esi;
260 ip_address_t _lcl_addr, *lcl_addr = &_lcl_addr;
290 if ((found && lp->
priority == limitp)
291 || (!found && lp->
priority >= limitp))
309 if ((
u32) ~ 0 == esi)
328 memset (&pair, 0,
sizeof (pair));
352 uword *feip = 0, *dpid;
356 memset (a, 0,
sizeof (*a));
406 LISP_GPE_INPUT_NEXT_IP4_INPUT : LISP_GPE_INPUT_NEXT_IP6_INPUT;
423 u32 * map_index_result)
426 u32 mi, *map_indexp, map_index,
i;
439 return VNET_API_ERROR_VALUE_EXIST;
456 clib_warning (
"Locator set with index %d doesn't exist",
458 return VNET_API_ERROR_INVALID_VALUE;
465 vec_add1 (eid_indexes[0], map_index);
472 map_index_result[0] = map_index;
480 return VNET_API_ERROR_INVALID_VALUE;
486 for (i = 0; i <
vec_len (eid_indexes[0]); i++)
489 if (map_indexp[0] == mi)
502 if (lm_indexp[0] == mi)
522 u32 * map_index_result)
533 return VNET_API_ERROR_LISP_DISABLED;
547 return VNET_API_ERROR_INVALID_VALUE;
564 u8 *locator_set_name = 0;
565 u32 locator_set_index = 0, map_index = 0;
571 memset (&eid, 0,
sizeof (eid));
572 memset (a, 0,
sizeof (*a));
582 else if (
unformat (line_input,
"del"))
586 else if (
unformat (line_input,
"vni %d", &vni))
588 else if (
unformat (line_input,
"locator-set %_%v%_", &locator_set_name))
597 locator_set_index = p[0];
623 is_add ?
"add" :
"delete");
627 if (locator_set_name)
635 .path =
"lisp eid-table",
636 .short_help =
"lisp eid-table add/del [vni <vni>] eid <eid> " 637 "locator-set <locator-set>",
646 uword *dp_idp, *vnip, **dp_table_by_vni, **vni_by_dp_table;
657 if (!is_l2 && (vni == 0 || dp_id == 0))
659 clib_warning (
"can't add/del default vni-vrf mapping!");
663 dp_idp =
hash_get (dp_table_by_vni[0], vni);
664 vnip =
hash_get (vni_by_dp_table[0], dp_id);
670 clib_warning (
"vni %d or vrf %d already used in vrf/vni " 671 "mapping!", vni, dp_id);
674 hash_set (dp_table_by_vni[0], vni, dp_id);
675 hash_set (vni_by_dp_table[0], dp_id, vni);
682 if (!dp_idp || !vnip)
684 clib_warning (
"vni %d or vrf %d not used in any vrf/vni! " 685 "mapping!", vni, dp_id);
703 u8 is_add = 1, is_l2 = 0;
704 u32 vni = 0, dp_id = 0;
715 else if (
unformat (line_input,
"vni %d", &vni))
717 else if (
unformat (line_input,
"vrf %d", &dp_id))
719 else if (
unformat (line_input,
"bd %d", &dp_id))
732 .path =
"lisp eid-table map",
733 .short_help =
"lisp eid-table map [del] vni <vni> vrf <vrf> | bd <bdi>",
749 for (i = 0; i <
vec_len (new_locators); i++)
751 old_li =
vec_elt (old_ls_indexes, i);
777 u8 authoritative,
u32 ttl,
u8 is_add,
u8 is_static,
783 u32 mi, ls_index = 0, dst_map_index;
789 return VNET_API_ERROR_LISP_DISABLED;
793 res_map_index[0] = ~0;
795 memset (m_args, 0,
sizeof (m_args[0]));
796 memset (ls_args, 0,
sizeof (ls_args[0]));
812 clib_warning (
"mapping %U rejected due to collision with local " 835 res_map_index[0] = mi;
855 res_map_index[0] = dst_map_index;
881 res_map_index[0] = mi;
892 u32 mi, *map_indices = 0, *map_indexp;
900 vec_add1 (map_indices, mi);
943 u32 local_mi, remote_mi = ~0;
948 return VNET_API_ERROR_LISP_DISABLED;
954 clib_warning (
"Remote eid %U not found. Cannot add adjacency!",
973 clib_warning (
"Local eid %U not found. Cannot add adjacency!",
1010 u8 is_add = 1, del_all = 0;
1011 locator_t rloc, *rlocs = 0, *curr_rloc = 0;
1014 u32 vni, action = ~0, p, w;
1021 memset (&eid, 0,
sizeof (eid));
1022 memset (&rloc, 0,
sizeof (rloc));
1026 if (
unformat (line_input,
"del-all"))
1028 else if (
unformat (line_input,
"del"))
1030 else if (
unformat (line_input,
"add"))
1034 else if (
unformat (line_input,
"vni %u", &vni))
1038 else if (
unformat (line_input,
"p %d w %d", &p, &w))
1043 (
"No RLOC configured for setting priority/weight!");
1046 curr_rloc->priority = p;
1047 curr_rloc->weight = w;
1053 curr_rloc = &rlocs[
vec_len (rlocs) - 1];
1055 else if (
unformat (line_input,
"action %U",
1073 if (is_add && (~0 == action) && 0 ==
vec_len (rlocs))
1075 clib_warning (
"no action set for negative map-reply!");
1104 clib_warning (
"failed to %s remote mapping!", is_add ?
"add" :
"delete");
1114 .path =
"lisp remote-mapping",.short_help =
1115 "lisp remote-mapping add|del [del-all] vni <vni> " 1116 "eid <est-eid> [action <no-action|natively-forward|" 1117 "send-map-request|drop>] rloc <dst-locator> p <prio> w <weight> " 1118 "[rloc <dst-locator> ... ]",.function =
1133 ip_prefix_t *deid_ippref, *seid_ippref;
1137 u8 deid_set = 0, seid_set = 0;
1139 u32 vni, action = ~0;
1146 memset (&deid, 0,
sizeof (deid));
1147 memset (&seid, 0,
sizeof (seid));
1148 memset (&rloc, 0,
sizeof (rloc));
1157 else if (
unformat (line_input,
"add"))
1159 else if (
unformat (line_input,
"deid %U",
1170 else if (
unformat (line_input,
"vni %u", &vni))
1175 else if (
unformat (line_input,
"seid %U",
1212 " in the same IP family!");
1217 if (is_add && (~0 == action) && 0 ==
vec_len (rlocs))
1219 clib_warning (
"no action set for negative map-reply!");
1223 memset (a, 0,
sizeof (a[0]));
1231 clib_warning (
"failed to %s adjacency!", is_add ?
"add" :
"delete");
1242 .path =
"lisp adjacency",
1243 .short_help =
"lisp adjacency add|del vni <vni>" 1244 "deid <dest-eid> seid <src-eid> [action <no-action|natively-forward|" 1245 "send-map-request|drop>] rloc <dst-locator> [rloc <dst-locator> ... ]",
1267 .path =
"show lisp map-resolvers",
1268 .short_help =
"show lisp map-resolvers",
1277 u32 locator_set_index = ~0;
1284 return VNET_API_ERROR_LISP_DISABLED;
1290 clib_warning (
"locator-set %v doesn't exist", locator_set_name);
1293 locator_set_index = p[0];
1321 u8 locator_name_set = 0;
1322 u8 *locator_set_name = 0;
1334 if (
unformat (line_input,
"ls %_%v%_", &locator_set_name))
1335 locator_name_set = 1;
1336 else if (
unformat (line_input,
"disable"))
1342 if (!locator_name_set)
1351 is_add ?
"add" :
"delete");
1355 if (locator_set_name)
1362 .path =
"lisp pitr",
1363 .short_help =
"lisp pitr [disable] ls <locator-set-name>",
1378 "pitr", lcm->
lisp_pitr ?
"locator-set" :
"");
1388 tmp_str =
format (0,
"N/A");
1401 tmp_str =
format (0,
"N/A");
1415 .path =
"show lisp pitr",
1416 .short_help =
"Show pitr",
1458 gid, type, loc, ttl, aut);
1462 s =
format (s,
"%55s%v\n",
"", loc);
1481 memset (&eid, 0,
sizeof (eid));
1491 else if (
unformat (line_input,
"local"))
1493 else if (
unformat (line_input,
"remote"))
1501 "EID",
"type",
"locators",
"ttl",
"autoritative");
1508 locator_set_t * ls = pool_elt_at_index (lcm->locator_set_pool,
1509 mapit->locator_set_index);
1510 if (filter && !((1 == filter && ls->local) ||
1511 (2 == filter && !ls->local)))
1523 if ((
u32) ~ 0 == mi)
1528 mapit->locator_set_index);
1530 if (filter && !((1 == filter && ls->
local) ||
1531 (2 == filter && !ls->
local)))
1545 .path =
"show lisp eid-table",
1546 .short_help =
"Shows EID table",
1556 u32 i, j, *loc_indexp, *ls_indexp, **ls_indexes, *to_be_deleted = 0;
1563 for (j = 0; j <
vec_len (ls_indexes[0]); j++)
1566 if (ls_indexp[0] == lsi)
1574 if (vec_len (ls_indexes[0]) == 0)
1583 for (i = 0; i <
vec_len (to_be_deleted); i++)
1592 static inline uword *
1630 return VNET_API_ERROR_VALUE_EXIST;
1639 u32 ls_index,
u32 loc_id)
1650 vec_del1 (ls_indexes[0], ls_index);
1660 u32 loc_index = ~0, ls_index = ~0, *locit =
NULL, **ls_indexes =
NULL;
1669 return VNET_API_ERROR_LISP_DISABLED;
1676 return VNET_API_ERROR_INVALID_ARGUMENT;
1684 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
1686 return VNET_API_ERROR_INVALID_ARGUMENT;
1693 ls_result[0] = p[0];
1730 if (0 == loc->
local &&
1757 return VNET_API_ERROR_LISP_DISABLED;
1765 if (p && p[0] != (
u32) ~ 0)
1770 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
1785 ls_result[0] = p[0];
1791 memset (ls, 0,
sizeof (*ls));
1815 ls_result[0] = ls_index;
1836 clib_warning (
"locator-set with index %d doesn't exists", p[0]);
1842 clib_warning (
"Can't delete the locator-set used to constrain " 1843 "the itr-rlocs in map-requests!");
1850 if (
vec_len (eid_indexes[0]) != 0)
1853 (
"Can't delete a locator that supports a mapping!");
1891 a->
is_en = is_enable;
1896 a->
is_en ?
"enable" :
"disable");
1905 dp_add_del_iface(lcm, vni, 0, 1);
1908 dp_add_del_iface(lcm, vni, 1, 1);
1940 if (
unformat (line_input,
"enable"))
1945 else if (
unformat (line_input,
"disable"))
1963 .short_help =
"lisp [enable|disable]",
1987 msg =
format (msg,
"feature: %U\ngpe: %U\n",
1996 .path =
"show lisp status",
1997 .short_help =
"show lisp status",
2015 vlib_cli_output (vm,
"%=10d%=10d", p->key, p->value[0]);
2024 .path =
"show lisp eid-table map",
2025 .short_help =
"show lisp eid-table vni to vrf mappings",
2040 u8 *locator_set_name = 0;
2046 memset (&locator, 0,
sizeof (locator));
2047 memset (a, 0,
sizeof (a[0]));
2055 if (
unformat (line_input,
"add %_%v%_", &locator_set_name))
2057 else if (
unformat (line_input,
"del %_%v%_", &locator_set_name))
2059 else if (
unformat (line_input,
"iface %U p %d w %d",
2074 a->
name = locator_set_name;
2083 is_add ?
"add" :
"delete");
2088 if (locator_set_name)
2095 .path =
"lisp locator-set",
2096 .short_help =
"lisp locator-set add/del <name> [iface <iface-name> " 2097 "p <priority> w <weight>]",
2112 u8 *locator_set_name = 0;
2113 u8 locator_set_name_set = 0;
2118 memset (&locator, 0,
sizeof (locator));
2119 memset (a, 0,
sizeof (a[0]));
2129 else if (
unformat (line_input,
"del"))
2131 else if (
unformat (line_input,
"locator-set %_%v%_", &locator_set_name))
2132 locator_set_name_set = 1;
2133 else if (
unformat (line_input,
"iface %U p %d w %d",
2148 if (!locator_set_name_set)
2154 a->
name = locator_set_name;
2169 .path =
"lisp locator",
2170 .short_help =
"lisp locator add/del locator-set <name> iface <iface-name> " 2171 "p <priority> w <weight>",
2186 vlib_cli_output (vm,
"%=20s%=16s%=16s%=16s",
"Locator-set",
"Locator",
2187 "Priority",
"Weight");
2196 msg = format (msg,
"%=16v", lsit->name);
2200 msg = format (msg,
"%=16s",
"remote");
2206 msg = format (msg,
"%16s",
" ");
2227 .path =
"show lisp locator-set",
2228 .short_help =
"Shows locator-sets",
2259 return VNET_API_ERROR_LISP_DISABLED;
2272 memset (mr, 0,
sizeof (*mr));
2303 u8 is_add = 1, addr_set = 0;
2304 ip_address_t ip_addr;
2317 else if (
unformat (line_input,
"del"))
2340 is_add ?
"add" :
"delete");
2349 .path =
"lisp map-resolver",
2350 .short_help =
"lisp map-resolver add/del <ip_address>",
2364 return VNET_API_ERROR_LISP_DISABLED;
2373 return VNET_API_ERROR_INVALID_ARGUMENT;
2393 u8 *locator_set_name = 0;
2406 else if (
unformat (line_input,
"add %s", &locator_set_name))
2421 is_add ?
"add" :
"delete");
2433 .path =
"lisp map-request itr-rlocs",
2434 .short_help =
"lisp map-request itr-rlocs add/del <locator_set_name>",
2463 .path =
"show lisp map-request itr-rlocs",
2464 .short_help =
"Shows map-request itr-rlocs",
2470 #define foreach_lisp_cp_lookup_error \ 2472 _(MAP_REQUESTS_SENT, "map-request sent") 2475 #define _(sym,string) string, 2482 #define _(sym,str) LISP_CP_LOOKUP_ERROR_##sym, 2509 s =
format (s,
"LISP-CP-LOOKUP: map-resolver: %U destination eid %U",
2517 ip_address_t * sloc)
2542 clib_warning (
"Can't find map-resolver and local interface ip!");
2559 memset (gid, 0,
sizeof (gid[0]));
2572 addr = ip_interface_address_get_address (&lcm->im4->lookup_main, ia);
2573 ip_address_set (rloc, addr, IP4);
2574 ip_prefix_len (ippref) = 32;
2575 ip_prefix_normalize (ippref);
2576 vec_add1 (rlocs, gid[0]);
2583 addr = ip_interface_address_get_address (&lcm->im6->lookup_main, ia);
2584 ip_address_set (rloc, addr, IP6);
2585 ip_prefix_len (ippref) = 128;
2586 ip_prefix_normalize (ippref);
2587 vec_add1 (rlocs, gid[0]);
2599 ip_address_t * sloc,
u8 is_smr_invoked,
2600 u64 * nonce_res,
u32 * bi_res)
2609 clib_warning (
"Can't allocate buffer for Map-Request!");
2661 #define send_encapsulated_map_request(lcm, seid, deid, smr) \ 2662 _send_encapsulated_map_request(lcm, seid, deid, smr, 0) 2664 #define resend_encapsulated_map_request(lcm, seid, deid, smr) \ 2665 _send_encapsulated_map_request(lcm, seid, deid, smr, 1) 2670 u8 is_smr_invoked,
u8 is_resend)
2673 u32 next_index, bi = 0, *to_next, map_index;
2690 if (!gid_address_cmp (&pmr->src, seid)
2691 && !gid_address_cmp (&pmr->dst, deid))
2693 duplicate_pmr = pmr;
2699 if (!is_resend && duplicate_pmr)
2706 if (!lcm->lisp_pitr)
2709 if (map_index == ~0)
2711 clib_warning (
"No local mapping found in eid-table for %U!",
2721 (
"Mapping found for src eid %U is not marked as local!",
2725 ls_index = map->locator_set_index;
2729 map_index = lcm->pitr_map_index;
2731 ls_index = map->locator_set_index;
2735 if (~0 != lcm->mreq_itr_rlocs)
2737 ls_index = lcm->mreq_itr_rlocs;
2742 while (lcm->do_map_resolver_election
2744 &lcm->active_map_resolver,
2751 duplicate_pmr->to_be_removed = 1;
2754 vec_foreach (mr, lcm->map_resolvers) mr->is_down = 0;
2762 &lcm->active_map_resolver,
2763 &sloc, is_smr_invoked, &nonce, &bi);
2789 hash_unset (lcm->pending_map_requests_by_nonce, nonce_del[0]);
2794 hash_set (lcm->pending_map_requests_by_nonce, nonce,
2795 duplicate_pmr - lcm->pending_map_requests_pool);
2800 pool_get (lcm->pending_map_requests_pool, pmr);
2801 memset (pmr, 0,
sizeof (*pmr));
2805 pmr->is_smr_invoked = is_smr_invoked;
2807 hash_set (lcm->pending_map_requests_by_nonce, nonce,
2808 pmr - lcm->pending_map_requests_pool);
2838 u32 vni = ~0, table_id = ~0, fib_index;
2865 clib_warning (
"vrf %d is not mapped to any vni!", table_id);
2889 clib_warning (
"bridge domain %d is not mapped to any vni!",
2902 memset (src, 0,
sizeof (*src));
2903 memset (dst, 0,
sizeof (*dst));
2909 u8 version, preflen;
2949 u32 *from, *to_next_drop,
di, si;
2951 u32 pkts_mapped = 0;
2952 uword n_left_from, n_left_to_next_drop;
2957 while (n_left_from > 0)
2960 to_next_drop, n_left_to_next_drop);
2962 while (n_left_from > 0 && n_left_to_next_drop > 0)
2971 to_next_drop[0] = pi0;
2973 n_left_to_next_drop -= 1;
2976 b0->
error = node->
errors[LISP_CP_LOOKUP_ERROR_DROP];
3019 memset (tr, 0,
sizeof (*tr));
3029 n_left_to_next_drop);
3032 LISP_CP_LOOKUP_ERROR_MAP_REQUESTS_SENT,
3040 .name =
"lisp-cp-lookup",
3041 .vector_size =
sizeof (
u32),
3059 #define foreach_lisp_cp_input_error \ 3061 _(MAP_REPLIES_RECEIVED, "map-replies received") 3064 #define _(sym,string) string, 3071 #define _(sym,str) LISP_CP_INPUT_ERROR_##sym, 3097 s =
format (s,
"LISP-CP-INPUT: TODO");
3106 u32 len = 0,
i, ttl, dst_map_index = 0;
3114 u8 authoritative, action;
3126 clib_warning (
"No pending map-request entry with nonce %lu!", nonce);
3154 1, 0 , &dst_map_index);
3157 if ((
u32) ~ 0 != dst_map_index)
3167 hash_unset(lcm->pending_map_requests_by_nonce, noncep[0]);
3196 clib_warning (
"Only SMR Map-Requests supported for now!");
3221 memset (&dst, 0,
sizeof (dst));
3251 u32 n_left_from, *from, *to_next_drop;
3259 while (n_left_from > 0)
3261 u32 n_left_to_next_drop;
3264 to_next_drop, n_left_to_next_drop);
3265 while (n_left_from > 0 && n_left_to_next_drop > 0)
3273 to_next_drop[0] = bi0;
3275 n_left_to_next_drop -= 1;
3289 clib_warning (
"Unsupported LISP message type %d", type);
3293 b0->
error = node->
errors[LISP_CP_INPUT_ERROR_DROP];
3302 n_left_to_next_drop);
3310 .name =
"lisp-cp-input",
3311 .vector_size =
sizeof (
u32),
3316 .error_strings = lisp_cp_input_error_strings,
3382 u8 smr_invoked,
u8 is_resend)
3392 (
u8 *) & a,
sizeof (a));
3415 clib_warning (
"Map resolver %U not found - probably deleted " 3421 clib_warning (
"map resolver %U is unreachable, ignoring",
3455 u32 *to_be_removed = 0, *pmr_index;
3462 if (pmr->to_be_removed)
3464 clib_fifo_foreach (nonce, pmr->nonces, ({
3465 hash_unset (lcm->pending_map_requests_by_nonce, nonce[0]);
3468 vec_add1 (to_be_removed, pmr - lcm->pending_map_requests_pool);
3474 pool_put_index (lcm->pending_map_requests_by_nonce, pmr_index[0]);
3499 if (!pmr->to_be_removed)
3500 update_pending_request (pmr, period);
3517 .name =
"lisp-retry-service",
3518 .process_log2_n_stack_bytes = 16,
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static clib_error_t * lisp_show_map_resolvers_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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 foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
#define VNET_SW_INTERFACE_FLAG_UNNUMBERED
ip4_fib_t * find_ip4_fib_by_table_index_or_id(ip4_main_t *im, u32 table_index_or_id, u32 flags)
Get or create an IPv4 fib.
#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.
#define MREP_REC_COUNT(h_)
#define hash_set(h, key, value)
l2_input_config_t * configs
sll srl srl sll sra u16x4 i
#define clib_fifo_head(v)
#define gid_address_type(_a)
static clib_error_t * lisp_pitr_set_locator_set_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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)
static uword clib_fifo_elts(void *v)
ip_address_t active_map_resolver
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
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)
#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)
ip_lookup_next_t lookup_next_index
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
locator_pair_t * locator_pairs
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
#define foreach_lisp_cp_input_error
static clib_error_t * lisp_show_status_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 * local_mappings_indexes
static f64 vlib_time_now(vlib_main_t *vm)
#define PENDING_MREQ_QUEUE_LEN
static int elect_map_resolver(lisp_cp_main_t *lcm)
uword unformat_ip_address(unformat_input_t *input, va_list *args)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
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)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
unformat_function_t unformat_vnet_sw_interface
static void remove_dead_pending_map_requests(lisp_cp_main_t *lcm)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static uword lisp_cp_lookup(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static clib_error_t * lisp_add_del_locator_in_set_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define ip_prefix_version(_a)
format_function_t format_vnet_sw_if_index_name
void gid_dictionary_init(gid_dictionary_t *db)
static clib_error_t * lisp_eid_table_map_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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)
#define NUMBER_OF_RETRIES
static clib_error_t * lisp_cp_show_locator_sets_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
map_resolver_t * map_resolvers
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
uword unformat_negative_mapping_action(unformat_input_t *input, va_list *args)
static void reset_pending_mr_counters(pending_map_request_t *r)
u32 ** locator_to_locator_sets
vnet_main_t * vnet_get_main(void)
vlib_node_registration_t lisp_cp_lookup_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_lookup_node)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static clib_error_t * lisp_add_del_local_eid_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void queue_map_reply(vlib_buffer_t *b)
#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.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define hash_foreach(key_var, value_var, h, body)
volatile u32 * pending_map_request_lock
ip6_fib_t * find_ip6_fib_by_table_index_or_id(ip6_main_t *im, u32 table_index_or_id, u32 flags)
Get or create an IPv6 fib.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 * fwd_entry_by_mapping_index
u32 ip4_fib_lookup_with_table(ip4_main_t *im, u32 fib_index, ip4_address_t *dst, u32 disable_default_route)
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
#define clib_warning(format, args...)
int vlib_main(vlib_main_t *vm, unformat_input_t *input)
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...
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, u64 *nonce)
static lisp_cp_main_t * vnet_lisp_cp_get_main()
#define vlib_call_init_function(vm, x)
static void * send_map_request_thread_fn(void *arg)
#define ip_addr_version(_a)
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)
static clib_error_t * lisp_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
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.
#define hash_unset_mem(h, key)
u8 do_map_resolver_election
#define clib_fifo_sub1(f, e)
u16 current_length
Nbytes between current data and the end of this buffer.
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u32 value, u8 is_add)
#define gid_address_mac(_a)
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 gid_address_free(gid_address_t *a)
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
u32 * local_locator_set_indexes
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 u8 compare_locators(lisp_cp_main_t *lcm, u32 *old_ls_indexes, locator_t *new_locators)
#define foreach_lisp_cp_lookup_error
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define MAX_LISP_MSG_ENCAP_LEN
#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).
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ip_address_t map_resolver_ip
int vnet_lisp_add_del_mapping(gid_address_t *eid, locator_t *rlocs, u8 action, u8 authoritative, u32 ttl, u8 is_add, u8 is_static, u32 *res_map_index)
Adds/removes/updates mapping.
#define clib_fifo_foreach(v, f, body)
static clib_error_t * lisp_add_del_map_resolver_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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)
static clib_error_t * lisp_show_eid_table_map_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define gid_address_ippref(_a)
static void * vlib_buffer_pull(vlib_buffer_t *b, u8 size)
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)
static clib_error_t * lisp_add_del_mreq_itr_rlocs_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void * vlib_buffer_make_headroom(vlib_buffer_t *b, u8 size)
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)
int lisp_add_del_adjacency(lisp_cp_main_t *lcm, gid_address_t *local_eid, gid_address_t *remote_eid, u8 is_add)
Adds adjacency or removes forwarding entry associated to remote mapping.
u8 * format_lisp_cp_input_trace(u8 *s, va_list *args)
#define MAP_REC_ACTION(h)
int gid_address_cmp(gid_address_t *a1, gid_address_t *a2)
static void lisp_pending_map_request_lock(lisp_cp_main_t *lcm)
#define vec_free(V)
Free vector's memory (no header).
#define gid_address_ippref_len(_a)
u32 lisp_msg_parse_mapping_record(vlib_buffer_t *b, gid_address_t *eid, locator_t **locs, locator_t *probed_)
static void lisp_pending_map_request_unlock(lisp_cp_main_t *lcm)
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 locator_cmp(locator_t *l1, locator_t *l2)
static map_resolver_t * get_map_resolver(ip_address_t *a)
u32 ip6_fib_lookup_with_table(ip6_main_t *im, u32 fib_index, ip6_address_t *dst)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
int vnet_lisp_gpe_add_del_iface(vnet_lisp_gpe_add_del_iface_args_t *a, u32 *hw_if_indexp)
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
lisp_gpe_main_t lisp_gpe_main
void * ip_interface_get_first_address(ip_lookup_main_t *lm, u32 sw_if_index, u8 version)
u32 unnumbered_sw_if_index
u8 vnet_lisp_enable_disable_status(void)
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
uword unformat_mac_address(unformat_input_t *input, va_list *args)
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
#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)
static lisp_msg_type_e lisp_msg_type(void *b)
u8 * format_ip_address(u8 *s, va_list *args)
int vnet_lisp_clear_all_remote_adjacencies(void)
ip_lookup_main_t lookup_main
static void get_src_and_dst_ip(void *hdr, ip_address_t *src, ip_address_t *dst)
clib_error_t * lisp_gpe_init(vlib_main_t *vm)
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)
uword * l2_dp_intf_by_vni
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 clib_error_t * lisp_show_mreq_itr_rlocs_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 ** locator_set_to_eids
#define LISP_CONTROL_PORT
static u8 * format_eid_entry(u8 *s, va_list *args)
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)
static clib_error_t * lisp_add_del_adjacency_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Handler for add/del adjacency CLI.
#define clib_fifo_free(f)
static void * clib_mem_alloc(uword size)
u32 ip_fib_get_egress_iface_for_dst_with_lm(lisp_cp_main_t *lcm, ip_address_t *dst, ip_lookup_main_t *lm)
fwd_entry_t * fwd_entry_pool
#define VLIB_BUFFER_IS_TRACED
#define IP6_ROUTE_FLAG_FIB_INDEX
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.
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)
#define clib_fifo_add1(f, e)
#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)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
static uword * get_locator_set_index(vnet_lisp_add_del_locator_set_args_t *a, uword *p)
void locator_free(locator_t *l)
#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 hash_foreach_pair(p, v, body)
static void dp_del_fwd_entry(lisp_cp_main_t *lcm, u32 src_map_index, u32 dst_map_index)
#define IP4_ROUTE_FLAG_FIB_INDEX
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
int ip_address_cmp(ip_address_t *ip1, ip_address_t *ip2)
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
static clib_error_t * lisp_show_eid_table_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 ip_address_max_len(u8 version)
uword * locator_set_index_by_name
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)
#define hash_get_mem(h, key)
void mac_copy(void *dst, void *src)
static 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)
u32 lisp_msg_parse_eid_rec(vlib_buffer_t *b, gid_address_t *eid)
static clib_error_t * lisp_show_pitr_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void * clib_mem_alloc_aligned(uword size, uword align)
#define VLIB_REGISTER_NODE(x,...)
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.
void process_map_request(vlib_main_t *vm, lisp_cp_main_t *lcm, vlib_buffer_t *b)
This packet is to be rewritten and forwarded to the next processing node.
#define vec_foreach(var, vec)
Vector iterator.
void * process_map_reply(void *arg)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
#define clib_error_return(e, args...)
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.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static u8 * format_lisp_status(u8 *s, va_list *args)
u32 * fib_index_by_sw_if_index
static u32 ip_fib_lookup_with_table(lisp_cp_main_t *lcm, u32 fib_index, ip_address_t *dst)
void ip_address_set(ip_address_t *dst, void *src, u8 version)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define send_encapsulated_map_request(lcm, seid, deid, smr)
static clib_error_t * lisp_add_del_locator_set_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 * format_lisp_cp_lookup_trace(u8 *s, va_list *args)
void ip_address_copy(ip_address_t *dst, ip_address_t *src)
static clib_error_t * lisp_add_del_remote_mapping_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Handler for add/del remote mapping CLI.
#define ip_prefix_addr(_a)
#define resend_encapsulated_map_request(lcm, seid, deid, smr)
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
#define PENDING_MREQ_EXPIRATION_TIME