26 #include <openssl/evp.h> 27 #include <openssl/hmac.h> 81 clib_warning (
"unsupported encryption key type: %d!", key_id);
89 u8 smr_invoked,
u8 is_resend);
93 u32 sw_if_index,
u8 loop)
100 (
vec_len ((lm)->if_address_pool_index_by_sw_if_index) > (sw_if_index)) ?
101 vec_elt ((lm)->if_address_pool_index_by_sw_if_index, (sw_if_index)) :
120 u8 version, ip_address_t * result)
140 if (addr->version ==
IP4)
145 memcpy (&prefix->
fp_addr.ip4, &addr->ip, sizeof (prefix->
fp_addr.ip4));
151 memcpy (&prefix->
fp_addr.ip6, &addr->ip, sizeof (prefix->
fp_addr.ip6));
163 fib_prefix->
fp_len = ip_prefix->len;
189 ip_address_t * result)
227 return VNET_API_ERROR_INVALID_VALUE;
235 clib_warning (
"vni %d not associated to a bridge domain!", vni);
236 return VNET_API_ERROR_INVALID_VALUE;
265 memset (a, 0,
sizeof (*a));
299 u32 i, limitp = 0, li, found = 0, esi;
301 ip_address_t _lcl_addr, *lcl_addr = &_lcl_addr;
331 if ((found && lp->
priority == limitp)
332 || (!found && lp->
priority >= limitp))
350 if ((
u32) ~ 0 == esi)
369 memset (&pair, 0,
sizeof (pair));
432 uword *feip = 0, *dpid;
436 memset (a, 0,
sizeof (*a));
507 LISP_GPE_INPUT_NEXT_IP4_INPUT : LISP_GPE_INPUT_NEXT_IP6_INPUT;
544 if (gid_address_vni (&fwd->reid) != vni)
547 gid_address_copy (&adj.reid, &fwd->reid);
548 gid_address_copy (&adj.leid, &fwd->leid);
549 vec_add1 (adjs, adj);
572 if (
unformat (line_input,
"vni %d", &vni))
602 .path =
"show lisp adjacencies",
603 .short_help =
"show lisp adjacencies",
650 return VNET_API_ERROR_LISP_DISABLED;
662 memset (ms, 0,
sizeof (*ms));
688 u8 is_add = 1, ip_set = 0;
700 else if (
unformat (line_input,
"del"))
721 is_add ?
"add" :
"delete");
728 .path =
"lisp map-server",
729 .short_help =
"lisp map-server add|del <ip>",
739 u32 * map_index_result)
742 u32 mi, *map_indexp, map_index,
i;
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)
820 if (lm_indexp[0] == mi)
840 u32 * map_index_result)
851 return VNET_API_ERROR_LISP_DISABLED;
865 return VNET_API_ERROR_INVALID_VALUE;
882 u8 *locator_set_name = 0;
883 u32 locator_set_index = 0, map_index = 0;
891 memset (&eid, 0,
sizeof (eid));
892 memset (a, 0,
sizeof (*a));
902 else if (
unformat (line_input,
"del"))
906 else if (
unformat (line_input,
"vni %d", &vni))
908 else if (
unformat (line_input,
"secret-key %_%v%_", &key))
913 else if (
unformat (line_input,
"locator-set %_%v%_", &locator_set_name))
922 locator_set_index = p[0];
939 if (key && (0 == key_id))
956 is_add ?
"add" :
"delete");
960 if (locator_set_name)
969 .path =
"lisp eid-table",
970 .short_help =
"lisp eid-table add/del [vni <vni>] eid <eid> " 971 "locator-set <locator-set> [key <secret-key> key-id sha1|sha256 ]",
980 uword *dp_idp, *vnip, **dp_table_by_vni, **vni_by_dp_table;
991 if (!is_l2 && (vni == 0 || dp_id == 0))
993 clib_warning (
"can't add/del default vni-vrf mapping!");
997 dp_idp =
hash_get (dp_table_by_vni[0], vni);
998 vnip =
hash_get (vni_by_dp_table[0], dp_id);
1004 clib_warning (
"vni %d or vrf %d already used in vrf/vni " 1005 "mapping!", vni, dp_id);
1008 hash_set (dp_table_by_vni[0], vni, dp_id);
1009 hash_set (vni_by_dp_table[0], dp_id, vni);
1016 if (!dp_idp || !vnip)
1018 clib_warning (
"vni %d or vrf %d not used in any vrf/vni! " 1019 "mapping!", vni, dp_id);
1037 u8 is_add = 1, is_l2 = 0;
1038 u32 vni = 0, dp_id = 0;
1049 else if (
unformat (line_input,
"vni %d", &vni))
1051 else if (
unformat (line_input,
"vrf %d", &dp_id))
1053 else if (
unformat (line_input,
"bd %d", &dp_id))
1066 .path =
"lisp eid-table map",
1067 .short_help =
"lisp eid-table map [del] vni <vni> vrf <vrf> | bd <bdi>",
1083 for (i = 0; i <
vec_len (new_locators); i++)
1085 old_li =
vec_elt (old_ls_indexes, i);
1152 memset (&a, 0,
sizeof (a));
1199 u8 authoritative,
u32 ttl,
u8 is_add,
u8 is_static,
1200 u32 * res_map_index)
1205 u32 mi, ls_index = 0, dst_map_index;
1211 return VNET_API_ERROR_LISP_DISABLED;
1215 res_map_index[0] = ~0;
1217 memset (m_args, 0,
sizeof (m_args[0]));
1218 memset (ls_args, 0,
sizeof (ls_args[0]));
1234 clib_warning (
"mapping %U rejected due to collision with local " 1243 old_map->
action = action;
1257 res_map_index[0] = mi;
1266 ls_args->
index = ~0;
1280 res_map_index[0] = dst_map_index;
1310 res_map_index[0] = mi;
1321 u32 mi, *map_indices = 0, *map_indexp;
1329 vec_add1 (map_indices, mi);
1372 u32 local_mi, remote_mi = ~0;
1377 return VNET_API_ERROR_LISP_DISABLED;
1381 remote_eid, local_eid);
1384 clib_warning (
"Remote eid %U not found. Cannot add adjacency!",
1403 clib_warning (
"Local eid %U not found. Cannot add adjacency!",
1440 u8 is_add = 1, del_all = 0;
1441 locator_t rloc, *rlocs = 0, *curr_rloc = 0;
1444 u32 vni, action = ~0, p, w;
1451 memset (&eid, 0,
sizeof (eid));
1452 memset (&rloc, 0,
sizeof (rloc));
1456 if (
unformat (line_input,
"del-all"))
1458 else if (
unformat (line_input,
"del"))
1460 else if (
unformat (line_input,
"add"))
1464 else if (
unformat (line_input,
"vni %u", &vni))
1468 else if (
unformat (line_input,
"p %d w %d", &p, &w))
1473 (
"No RLOC configured for setting priority/weight!");
1476 curr_rloc->priority = p;
1477 curr_rloc->weight = w;
1489 curr_rloc = &rlocs[
vec_len (rlocs) - 1];
1491 else if (
unformat (line_input,
"action %U",
1509 if (is_add && (~0 == action) && 0 ==
vec_len (rlocs))
1511 clib_warning (
"no action set for negative map-reply!");
1540 clib_warning (
"failed to %s remote mapping!", is_add ?
"add" :
"delete");
1550 .path =
"lisp remote-mapping",.short_help =
1551 "lisp remote-mapping add|del [del-all] vni <vni> " 1552 "eid <est-eid> [action <no-action|natively-forward|" 1553 "send-map-request|drop>] rloc <dst-locator> p <prio> w <weight> " 1554 "[rloc <dst-locator> ... ]",.function =
1568 ip_prefix_t *reid_ippref, *leid_ippref;
1572 u8 reid_set = 0, leid_set = 0;
1580 memset (&reid, 0,
sizeof (reid));
1581 memset (&leid, 0,
sizeof (leid));
1590 else if (
unformat (line_input,
"add"))
1592 else if (
unformat (line_input,
"reid %U",
1603 else if (
unformat (line_input,
"vni %u", &vni))
1608 else if (
unformat (line_input,
"leid %U",
1626 if (!reid_set || !leid_set)
1637 clib_warning (
"remote and local EIDs are of different types!");
1641 memset (a, 0,
sizeof (a[0]));
1649 clib_warning (
"failed to %s adjacency!", is_add ?
"add" :
"delete");
1658 .path =
"lisp adjacency",
1659 .short_help =
"lisp adjacency add|del vni <vni> reid <remote-eid> " 1673 return VNET_API_ERROR_LISP_DISABLED;
1676 if (mode >= _MR_MODE_MAX)
1678 clib_warning (
"Invalid LISP map request mode %d!", mode);
1679 return VNET_API_ERROR_INVALID_ARGUMENT;
1711 if (_MR_MODE_MAX == mr_mode)
1724 .path =
"lisp map-request mode",
1725 .short_help =
"lisp map-request mode dst-only|src-dst",
1733 u32 mode = va_arg (*args,
u32);
1738 return format (0,
"dst-only");
1740 return format (0,
"src-dst");
1757 .path =
"show lisp map-request mode",
1758 .short_help =
"show lisp map-request mode",
1780 .path =
"show lisp map-resolvers",
1781 .short_help =
"show lisp map-resolvers",
1790 u32 locator_set_index = ~0;
1797 return VNET_API_ERROR_LISP_DISABLED;
1803 clib_warning (
"locator-set %v doesn't exist", locator_set_name);
1806 locator_set_index = p[0];
1834 u8 locator_name_set = 0;
1835 u8 *locator_set_name = 0;
1847 if (
unformat (line_input,
"ls %_%v%_", &locator_set_name))
1848 locator_name_set = 1;
1849 else if (
unformat (line_input,
"disable"))
1855 if (!locator_name_set)
1864 is_add ?
"add" :
"delete");
1868 if (locator_set_name)
1875 .path =
"lisp pitr",
1876 .short_help =
"lisp pitr [disable] ls <locator-set-name>",
1891 "pitr", lcm->
lisp_pitr ?
"locator-set" :
"");
1901 tmp_str =
format (0,
"N/A");
1914 tmp_str =
format (0,
"N/A");
1928 .path =
"show lisp pitr",
1929 .short_help =
"Show pitr",
1971 gid, type, loc, ttl, aut);
1975 s =
format (s,
"%55s%v\n",
"", loc);
1994 memset (&eid, 0,
sizeof (eid));
2004 else if (
unformat (line_input,
"local"))
2006 else if (
unformat (line_input,
"remote"))
2014 "EID",
"type",
"locators",
"ttl",
"autoritative");
2021 locator_set_t * ls = pool_elt_at_index (lcm->locator_set_pool,
2022 mapit->locator_set_index);
2023 if (filter && !((1 == filter && ls->local) ||
2024 (2 == filter && !ls->local)))
2036 if ((
u32) ~ 0 == mi)
2041 mapit->locator_set_index);
2043 if (filter && !((1 == filter && ls->
local) ||
2044 (2 == filter && !ls->
local)))
2058 .path =
"show lisp eid-table",
2059 .short_help =
"Shows EID table",
2069 u32 i, j, *loc_indexp, *ls_indexp, **ls_indexes, *to_be_deleted = 0;
2076 for (j = 0; j <
vec_len (ls_indexes[0]); j++)
2079 if (ls_indexp[0] == lsi)
2087 if (vec_len (ls_indexes[0]) == 0)
2096 for (i = 0; i <
vec_len (to_be_deleted); i++)
2105 static inline uword *
2143 return VNET_API_ERROR_VALUE_EXIST;
2152 u32 ls_index,
u32 loc_id)
2163 vec_del1 (ls_indexes[0], ls_index);
2173 u32 loc_index = ~0, ls_index = ~0, *locit =
NULL, **ls_indexes =
NULL;
2182 return VNET_API_ERROR_LISP_DISABLED;
2189 return VNET_API_ERROR_INVALID_ARGUMENT;
2197 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
2199 return VNET_API_ERROR_INVALID_ARGUMENT;
2206 ls_result[0] = p[0];
2243 if (0 == loc->
local &&
2270 return VNET_API_ERROR_LISP_DISABLED;
2278 if (p && p[0] != (
u32) ~ 0)
2283 clib_warning (
"locator-set %d to be overwritten doesn't exist!",
2298 ls_result[0] = p[0];
2304 memset (ls, 0,
sizeof (*ls));
2328 ls_result[0] = ls_index;
2349 clib_warning (
"locator-set with index %d doesn't exists", p[0]);
2355 clib_warning (
"Can't delete the locator-set used to constrain " 2356 "the itr-rlocs in map-requests!");
2363 if (
vec_len (eid_indexes[0]) != 0)
2366 (
"Can't delete a locator that supports a mapping!");
2422 a->
is_en = is_enable;
2427 a->
is_en ?
"enable" :
"disable");
2436 dp_add_del_iface(lcm, vni, 0, 1);
2439 dp_add_del_iface(lcm, vni, 1, 1);
2470 if (
unformat (line_input,
"enable"))
2475 else if (
unformat (line_input,
"disable"))
2494 .short_help =
"lisp [enable|disable]",
2514 if (
unformat (line_input,
"enable"))
2519 else if (
unformat (line_input,
"disable"))
2541 .path =
"lisp map-register",
2542 .short_help =
"lisp map-register [enable|disable]",
2562 if (
unformat (line_input,
"enable"))
2567 else if (
unformat (line_input,
"disable"))
2589 .path =
"lisp rloc-probe",
2590 .short_help =
"lisp rloc-probe [enable|disable]",
2614 msg =
format (msg,
"feature: %U\ngpe: %U\n",
2623 .path =
"show lisp status",
2624 .short_help =
"show lisp status",
2637 uword *vni_table = 0;
2651 else if (
unformat (line_input,
"l3"))
2681 .path =
"show lisp eid-table map",
2682 .short_help =
"show lisp eid-table l2|l3",
2697 u8 *locator_set_name = 0;
2703 memset (&locator, 0,
sizeof (locator));
2704 memset (a, 0,
sizeof (a[0]));
2712 if (
unformat (line_input,
"add %_%v%_", &locator_set_name))
2714 else if (
unformat (line_input,
"del %_%v%_", &locator_set_name))
2716 else if (
unformat (line_input,
"iface %U p %d w %d",
2731 a->
name = locator_set_name;
2740 is_add ?
"add" :
"delete");
2745 if (locator_set_name)
2752 .path =
"lisp locator-set",
2753 .short_help =
"lisp locator-set add/del <name> [iface <iface-name> " 2754 "p <priority> w <weight>]",
2769 u8 *locator_set_name = 0;
2770 u8 locator_set_name_set = 0;
2775 memset (&locator, 0,
sizeof (locator));
2776 memset (a, 0,
sizeof (a[0]));
2786 else if (
unformat (line_input,
"del"))
2788 else if (
unformat (line_input,
"locator-set %_%v%_", &locator_set_name))
2789 locator_set_name_set = 1;
2790 else if (
unformat (line_input,
"iface %U p %d w %d",
2805 if (!locator_set_name_set)
2811 a->
name = locator_set_name;
2826 .path =
"lisp locator",
2827 .short_help =
"lisp locator add/del locator-set <name> iface <iface-name> " 2828 "p <priority> w <weight>",
2844 "Priority",
"Weight");
2853 msg = format (msg,
"%v", lsit->name);
2857 msg = format (msg,
"<%s-%d>",
"remote", lsit - lcm->locator_set_pool);
2863 msg = format (msg,
"%16s",
" ");
2884 .path =
"show lisp locator-set",
2885 .short_help =
"Shows locator-sets",
2900 return VNET_API_ERROR_LISP_DISABLED;
2913 memset (mr, 0,
sizeof (*mr));
2944 u8 is_add = 1, addr_set = 0;
2945 ip_address_t ip_addr;
2958 else if (
unformat (line_input,
"del"))
2981 is_add ?
"add" :
"delete");
2990 .path =
"lisp map-resolver",
2991 .short_help =
"lisp map-resolver add/del <ip_address>",
3005 return VNET_API_ERROR_LISP_DISABLED;
3014 return VNET_API_ERROR_INVALID_ARGUMENT;
3034 u8 *locator_set_name = 0;
3047 else if (
unformat (line_input,
"add %_%v%_", &locator_set_name))
3062 is_add ?
"add" :
"delete");
3074 .path =
"lisp map-request itr-rlocs",
3075 .short_help =
"lisp map-request itr-rlocs add/del <locator_set_name>",
3104 .path =
"show lisp map-request itr-rlocs",
3105 .short_help =
"Shows map-request itr-rlocs",
3111 #define foreach_lisp_cp_lookup_error \ 3113 _(MAP_REQUESTS_SENT, "map-request sent") 3116 #define _(sym,string) string, 3123 #define _(sym,str) LISP_CP_LOOKUP_ERROR_##sym, 3148 s =
format (s,
"LISP-CP-LOOKUP: map-resolver: %U destination eid %U",
3156 ip_address_t * sloc)
3181 clib_warning (
"Can't find map-resolver and local interface ip!");
3198 memset (gid, 0,
sizeof (gid[0]));
3211 addr = ip_interface_address_get_address (&lcm->im4->lookup_main, ia);
3212 ip_address_set (rloc, addr, IP4);
3213 ip_prefix_len (ippref) = 32;
3214 ip_prefix_normalize (ippref);
3215 vec_add1 (rlocs, gid[0]);
3222 addr = ip_interface_address_get_address (&lcm->im6->lookup_main, ia);
3223 ip_address_set (rloc, addr, IP6);
3224 ip_prefix_len (ippref) = 128;
3225 ip_prefix_normalize (ippref);
3226 vec_add1 (rlocs, gid[0]);
3236 ip_address_t * sloc, ip_address_t * rloc,
3245 clib_warning (
"Can't allocate buffer for Map-Request!");
3271 ip_address_t * sloc,
u8 is_smr_invoked,
3272 u64 * nonce_res,
u32 * bi_res)
3281 clib_warning (
"Can't allocate buffer for Map-Request!");
3297 memset (&sd, 0,
sizeof (sd));
3357 ip_address_t * probed_loc)
3378 addr = ip_interface_address_get_address (&lcm->im4->lookup_main,
3380 ip_address_set (new_ip, addr, IP4);
3387 addr = ip_interface_address_get_address (&lcm->im6->lookup_main,
3389 ip_address_set (new_ip, addr, IP6);
3413 add_locators (lcm, &rec, m->locator_set_index, NULL);
3414 vec_add1 (recs, rec);
3424 u16 auth_data_len,
u32 msg_len)
3426 MREG_KEY_ID (map_reg_hdr) = clib_host_to_net_u16 (key_id);
3430 (
unsigned char *) map_reg_hdr, msg_len,
NULL,
3439 ip_address_t * ms_ip,
u64 * nonce_res,
u8 want_map_notif,
3445 u32 bi, auth_data_len = 0, msg_len = 0;
3450 clib_warning (
"Can't allocate buffer for Map-Register!");
3461 auth_data_len, nonce_res,
3497 u32 local_locator_set_index, ip_address_t * sloc,
3498 ip_address_t * rloc)
3505 u32 next_index, *to_next;
3545 if (vec_len (e->locator_pairs) == 0)
3548 si = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &e->leid);
3551 clib_warning (
"internal error: cannot find local eid %U in " 3552 "map-cache!", format_gid_address, &e->leid);
3563 if (lp->priority != lprio)
3567 send_rloc_probe (lcm, &e->reid, lm->locator_set_index, &lp->lcl_loc,
3584 u32 next_index, *to_next;
3585 ip_address_t *ms = 0;
3596 clib_warning (
"no eligible interface address found for %U!",
3642 #define send_encapsulated_map_request(lcm, seid, deid, smr) \ 3643 _send_encapsulated_map_request(lcm, seid, deid, smr, 0) 3645 #define resend_encapsulated_map_request(lcm, seid, deid, smr) \ 3646 _send_encapsulated_map_request(lcm, seid, deid, smr, 1) 3651 u8 is_smr_invoked,
u8 is_resend)
3653 u32 next_index, bi = 0, *to_next, map_index;
3668 if (!gid_address_cmp (&pmr->src, seid)
3669 && !gid_address_cmp (&pmr->dst, deid))
3671 duplicate_pmr = pmr;
3677 if (!is_resend && duplicate_pmr)
3684 if (!lcm->lisp_pitr)
3687 if (map_index == ~0)
3689 clib_warning (
"No local mapping found in eid-table for %U!",
3699 (
"Mapping found for src eid %U is not marked as local!",
3703 ls_index = map->locator_set_index;
3707 map_index = lcm->pitr_map_index;
3709 ls_index = map->locator_set_index;
3713 if (~0 != lcm->mreq_itr_rlocs)
3715 ls_index = lcm->mreq_itr_rlocs;
3723 duplicate_pmr->to_be_removed = 1;
3729 &lcm->active_map_resolver,
3730 &sloc, is_smr_invoked, &nonce, &bi);
3756 hash_unset (lcm->pending_map_requests_by_nonce, nonce_del[0]);
3761 hash_set (lcm->pending_map_requests_by_nonce, nonce,
3762 duplicate_pmr - lcm->pending_map_requests_pool);
3767 pool_get (lcm->pending_map_requests_pool, pmr);
3768 memset (pmr, 0,
sizeof (*pmr));
3772 pmr->is_smr_invoked = is_smr_invoked;
3774 hash_set (lcm->pending_map_requests_by_nonce, nonce,
3775 pmr - lcm->pending_map_requests_pool);
3805 u32 vni = ~0, table_id = ~0;
3818 clib_warning (
"vrf %d is not mapped to any vni!", table_id);
3842 clib_warning (
"bridge domain %d is not mapped to any vni!",
3855 memset (src, 0,
sizeof (*src));
3856 memset (dst, 0,
sizeof (*dst));
3862 u8 version, preflen;
3903 u32 *from, *to_next_drop,
di, si;
3905 u32 pkts_mapped = 0;
3906 uword n_left_from, n_left_to_next_drop;
3911 while (n_left_from > 0)
3914 to_next_drop, n_left_to_next_drop);
3916 while (n_left_from > 0 && n_left_to_next_drop > 0)
3925 to_next_drop[0] = pi0;
3927 n_left_to_next_drop -= 1;
3930 b0->
error = node->
errors[LISP_CP_LOOKUP_ERROR_DROP];
3975 memset (tr, 0,
sizeof (*tr));
3985 n_left_to_next_drop);
3988 LISP_CP_LOOKUP_ERROR_MAP_REQUESTS_SENT,
4017 .name =
"lisp-cp-lookup-ip4",
4018 .vector_size =
sizeof (
u32),
4036 .name =
"lisp-cp-lookup-ip6",
4037 .vector_size =
sizeof (
u32),
4055 .name =
"lisp-cp-lookup-l2",
4056 .vector_size =
sizeof (
u32),
4072 #define foreach_lisp_cp_input_error \ 4074 _(MAP_REPLIES_RECEIVED, "map-replies received") 4077 #define _(sym,string) string, 4084 #define _(sym,str) LISP_CP_INPUT_ERROR_##sym, 4110 s =
format (s,
"LISP-CP-INPUT: TODO");
4128 f64 expiration_time)
4133 u64 exp_clock_time = now + expiration_time * cpu_cps;
4159 u32 dst_map_index = 0;
4181 1, 0 , &dst_map_index);
4184 if ((
u32) ~ 0 != dst_map_index)
4196 hash_unset(lcm->pending_map_requests_by_nonce, noncep[0]);
4217 if ((
u16) ~ 0 == auth_data_len)
4219 clib_warning (
"invalid length for key_id %d!", key_id);
4232 (
unsigned char *) h, msg_len,
NULL,
NULL);
4234 result = memcmp (code, auth_data, auth_data_len);
4250 clib_warning (
"No pending map-register entry with nonce %lu!",
4281 u32 key_id,
u8 ** key_out)
4291 key_out[0] = m->
key;
4293 for (i = 1; i < len; i++)
4318 for (i = 0; i < count; i++)
4346 u16 auth_data_len = 0;
4350 memset (a, 0,
sizeof (*a));
4353 memset (&deid, 0,
sizeof (deid));
4379 - (
u8 *) mnotif_hdr, key_id, key))
4381 clib_warning (
"Map-notify auth data verification failed for nonce %lu!",
4391 ip_address_t * dst,
u64 nonce,
u8 probe_bit,
4400 clib_warning (
"Can't allocate buffer for Map-Register!");
4420 u8 probe_bit,
u64 nonce,
u16 dst_port,
4421 ip_address_t * probed_loc)
4427 u32 next_index, *to_next;
4436 memset (&src, 0,
sizeof (src));
4445 b =
build_map_reply (lcm, &src, dst, nonce, probe_bit, records, dst_port,
4469 u8 *ip_hdr = 0, *udp_hdr;
4472 ip_address_t *dst_loc = 0, probed_loc, src_loc;
4489 ip_hdr = (
u8 *) ip4;
4494 if ((flags & 0xF0000000) == 0x60000000)
4495 ip_hdr = (
u8 *) ip6;
4498 clib_warning (
"internal error: cannot determine whether packet " 4511 (
"Only SMR Map-Requests and RLOC probe supported for now!");
4528 memset (&dst, 0,
sizeof (dst));
4543 memset (&m, 0,
sizeof (m));
4556 src_port, &probed_loc);
4574 memset (a, 0,
sizeof (*a));
4584 memset (&m, 0,
sizeof (m));
4623 u32 n_left_from, *from, *to_next_drop;
4632 while (n_left_from > 0)
4634 u32 n_left_to_next_drop;
4637 to_next_drop, n_left_to_next_drop);
4638 while (n_left_from > 0 && n_left_to_next_drop > 0)
4646 to_next_drop[0] = bi0;
4648 n_left_to_next_drop -= 1;
4669 clib_warning (
"Unsupported LISP message type %d", type);
4673 b0->
error = node->
errors[LISP_CP_INPUT_ERROR_DROP];
4682 n_left_to_next_drop);
4690 .name =
"lisp-cp-input",
4691 .vector_size =
sizeof (
u32),
4696 .error_strings = lisp_cp_input_error_strings,
4757 u8 smr_invoked,
u8 is_resend)
4767 (
u8 *) & a,
sizeof (a));
4790 clib_warning (
"Map resolver %U not found - probably deleted " 4796 clib_warning (
"map resolver %U is unreachable, ignoring",
4830 u32 *to_be_removed = 0, *pmr_index;
4835 if (pmr->to_be_removed)
4837 clib_fifo_foreach (nonce, pmr->nonces, ({
4838 hash_unset (lcm->pending_map_requests_by_nonce, nonce[0]);
4841 vec_add1 (to_be_removed, pmr - lcm->pending_map_requests_pool);
4847 pool_put_index (lcm->pending_map_requests_by_nonce, pmr_index[0]);
4857 if (!lcm->is_enabled || !lcm->rloc_probing)
4872 static u64 mreg_sent_counter = 0;
4884 mreg_sent_counter++;
4910 if (!pmr->to_be_removed)
4911 update_pending_request (pmr, period);
4930 _vec_len (expired) = 0;
4942 .name =
"lisp-retry-service",
4943 .process_log2_n_stack_bytes = 16,
void lisp_gpe_tenant_l2_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
static u8 * vlib_buffer_get_tail(vlib_buffer_t *b)
#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 QUICK_MAP_REGISTER_INTERVAL
#define MNOTIFY_REC_COUNT(h_)
fib_protocol_t fp_proto
protocol type
#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.
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
sll srl srl sll sra u16x4 i
#define clib_fifo_head(v)
static clib_error_t * lisp_map_request_mode_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define gid_address_type(_a)
vlib_node_registration_t lisp_cp_lookup_ip4_node
(constructor) VLIB_REGISTER_NODE (lisp_cp_lookup_ip4_node)
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 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)
#define SHA256_AUTH_DATA_LEN
static uword clib_fifo_elts(void *v)
ip_address_t active_map_resolver
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
#define RLOC_PROBING_INTERVAL
lisp_msmr_t * map_resolvers
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)
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 u8 * format_lisp_map_request_mode(u8 *s, va_list *args)
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.
static map_records_arg_t * parse_map_reply(vlib_buffer_t *b)
static clib_error_t * lisp_show_adjacencies_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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 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
u8 vnet_lisp_get_map_request_mode(void)
static int elect_map_resolver(lisp_cp_main_t *lcm)
#define ip_prefix_len(_a)
void ip_address_to_fib_prefix(const ip_address_t *addr, fib_prefix_t *prefix)
convert from a LISP address to a FIB prefix
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).
static u64 clib_cpu_time_now(void)
#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)
unformat_function_t unformat_vnet_sw_interface
#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)
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)
static clib_error_t * lisp_map_register_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
uword unformat_hmac_key_id(unformat_input_t *input, va_list *args)
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)
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)
int vnet_lisp_set_map_request_mode(u8 mode)
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)
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)
#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
static void reset_pending_mr_counters(pending_map_request_t *r)
u32 ** locator_to_locator_sets
vnet_main_t * vnet_get_main(void)
static clib_error_t * lisp_rloc_probe_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#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)
#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.
u16 bd_id
bridge domain id
gid_address_t * eids_to_be_deleted
#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.
Aggregrate type for a prefix.
u32 * fwd_entry_by_mapping_index
void vl_api_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static mapping_t * get_mapping(lisp_cp_main_t *lcm, gid_address_t *e)
#define clib_warning(format, args...)
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...
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)
static void * send_map_request_thread_fn(void *arg)
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.
#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)
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)
u32 gid_dictionary_lookup(gid_dictionary_t *db, gid_address_t *key)
#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)
u8 do_map_resolver_election
#define clib_fifo_sub1(f, e)
u32 table_id
table (vrf) id
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)
u32 gid_dictionary_add_del(gid_dictionary_t *db, gid_address_t *key, u32 value, u8 is_add)
#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)
#define MNOTIFY_KEY_ID(h_)
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 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
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
#define MREG_AUTH_DATA_LEN(h_)
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 void process_map_notify(map_records_arg_t *a)
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)
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)
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)
u32 vni
VNI/tenant id in HOST byte order.
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)
u8 * format_lisp_cp_input_trace(u8 *s, va_list *args)
static lisp_msmr_t * get_map_resolver(ip_address_t *a)
#define MAP_REC_ACTION(h)
int gid_address_cmp(gid_address_t *a1, gid_address_t *a2)
#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.
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)
static void update_map_register(lisp_cp_main_t *lcm, f64 dt)
int vnet_lisp_map_register_enable_disable(u8 is_enable)
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)
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_gpe_main_t lisp_gpe_main
LISP-GPE global state.
void * ip_interface_get_first_address(ip_lookup_main_t *lm, u32 sw_if_index, u8 version)
static 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.
u32 unnumbered_sw_if_index
#define fid_addr_ippref(_a)
#define VLIB_CLI_COMMAND(x,...)
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)
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.
uword unformat_mac_address(unformat_input_t *input, va_list *args)
u8 * format_vnet_lisp_gpe_status(u8 *s, va_list *args)
Format LISP-GPE status.
#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)
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 clib_error_t * lisp_show_map_request_mode_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * lisp_show_mreq_itr_rlocs_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void gid_address_sd_to_flat(gid_address_t *dst, gid_address_t *src, fid_address_t *fid)
int vnet_lisp_rloc_probe_enable_disable(u8 is_enable)
u32 ** locator_set_to_eids
#define LISP_CONTROL_PORT
static u8 * format_eid_entry(u8 *s, va_list *args)
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
gid_address_t rmt_eid
remote eid
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)
fwd_entry_t * fwd_entry_pool
#define VLIB_BUFFER_IS_TRACED
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)
negative_fwd_actions_e action
action for negative mappings
#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)
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)
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 hash_foreach_pair(p, v, body)
Iterate over hash pairs.
static void dp_del_fwd_entry(lisp_cp_main_t *lcm, u32 src_map_index, u32 dst_map_index)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
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 int get_egress_map_resolver_ip(lisp_cp_main_t *lcm, ip_address_t *ip)
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)
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 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 map_records_arg_free(map_records_arg_t *a)
#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)
#define vec_foreach(var, vec)
Vector iterator.
uword * map_register_messages_by_nonce
static void free_map_register_records(mapping_t *maps)
static void update_rloc_probing(lisp_cp_main_t *lcm, f64 dt)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
void * process_map_reply(map_records_arg_t *a)
#define clib_error_return(e, args...)
static int parse_map_records(vlib_buffer_t *b, map_records_arg_t *a, u8 count)
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)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static const EVP_MD * get_encrypt_fcn(lisp_key_type_t key_id)
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)
gid_address_t lcl_eid
local eid
static u8 * format_lisp_status(u8 *s, va_list *args)
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.
#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)
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)
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)
static clib_error_t * lisp_add_del_map_server_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define resend_encapsulated_map_request(lcm, seid, deid, smr)
#define PENDING_MREQ_EXPIRATION_TIME
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)