u8 is_add = 1;
gid_address_t eid;
ip_prefix_t * prefp = &gid_address_ippref(&eid);
+ u8 * mac = gid_address_mac(&eid);
gid_address_t * eids = 0;
clib_error_t * error = 0;
u8 * locator_set_name = 0;
gid_address_vni (&eid) = vni;
else if (unformat (line_input, "eid %U", unformat_ip_prefix, prefp))
{
+ gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
+ vec_add1(eids, eid);
+ }
+ else if (unformat (line_input, "eid %U", unformat_mac_address, mac))
+ {
+ gid_address_type (&eid) = GID_ADDR_MAC;
vec_add1(eids, eid);
}
else if (unformat (line_input, "locator-set %_%v%_", &locator_set_name))
}
/* XXX treat batch configuration */
- gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
a->deid = eid;
a->is_add = is_add;
a->locator_set_index = locator_set_index;
ip_address_t rloc, * rlocs = 0;
ip_prefix_t * deid_ippref, * seid_ippref;
gid_address_t seid, deid;
+ u8 * dmac = gid_address_mac (&deid);
+ u8 * smac = gid_address_mac (&seid);
u8 deid_set = 0, seid_set = 0;
u8 * s = 0;
u32 vni, action = ~0;
seid_ippref = &gid_address_ippref(&seid);
deid_ippref = &gid_address_ippref(&deid);
- gid_address_type (&deid) = GID_ADDR_IP_PREFIX;
- gid_address_type (&seid) = GID_ADDR_IP_PREFIX;
-
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "del-all"))
else if (unformat (line_input, "deid %U",
unformat_ip_prefix, deid_ippref))
{
+ gid_address_type (&deid) = GID_ADDR_IP_PREFIX;
+ deid_set = 1;
+ }
+ else if (unformat (line_input, "deid %U",
+ unformat_mac_address, dmac))
+ {
+ gid_address_type (&deid) = GID_ADDR_MAC;
deid_set = 1;
}
else if (unformat (line_input, "vni %u", &vni))
else if (unformat (line_input, "seid %U",
unformat_ip_prefix, seid_ippref))
{
+ gid_address_type (&seid) = GID_ADDR_IP_PREFIX;
+ seid_set = 1;
+ }
+ else if (unformat (line_input, "seid %U",
+ unformat_mac_address, smac))
+ {
+ gid_address_type (&seid) = GID_ADDR_MAC;
seid_set = 1;
}
else if (unformat (line_input, "rloc %U", unformat_ip_address, &rloc))
goto done;
}
- /* if seid not set, make sure the ip version is the same as that of the
- * deid. This ensures the seid to be configured will be either 0/0 or
- * ::/0 */
- if (!seid_set)
- ip_prefix_version(seid_ippref) = ip_prefix_version(deid_ippref);
-
- if (is_add &&
- (ip_prefix_version (deid_ippref) != ip_prefix_version(seid_ippref)))
+ if (GID_ADDR_IP_PREFIX == gid_address_type (&deid))
{
- clib_warning ("source and destination EIDs are not"
- " in the same IP family!");
- goto done;
+ /* if seid not set, make sure the ip version is the same as that
+ * of the deid. This ensures the seid to be configured will be
+ * either 0/0 or ::/0 */
+ if (!seid_set)
+ ip_prefix_version(seid_ippref) = ip_prefix_version(deid_ippref);
+
+ if (is_add &&
+ (ip_prefix_version (deid_ippref)
+ != ip_prefix_version(seid_ippref)))
+ {
+ clib_warning ("source and destination EIDs are not"
+ " in the same IP family!");
+ goto done;
+ }
}
if (is_add && (~0 == action)
.function = lisp_pitr_set_locator_set_command_fn,
};
+
+static u8 *
+format_eid_entry (u8 * s, va_list * args)
+{
+ vnet_main_t * vnm = va_arg (*args, vnet_main_t *);
+ lisp_cp_main_t * lcm = va_arg (*args, lisp_cp_main_t *);
+ gid_address_t * gid = va_arg (*args, gid_address_t *);
+ locator_set_t * ls = va_arg (*args, locator_set_t *);
+ u32 * loc_index;
+ u8 first_line = 1;
+ u8 * loc;
+
+ u8 * type = ls->local ? format(0, "local(%s)", ls->name)
+ : format(0, "remote");
+
+ if (vec_len (ls->locator_indices) == 0)
+ {
+ s = format (s, "%-35U%-20s", format_gid_address, gid, type);
+ }
+ else
+ {
+ vec_foreach (loc_index, ls->locator_indices)
+ {
+ locator_t * l = pool_elt_at_index (lcm->locator_pool, loc_index[0]);
+ if (l->local)
+ loc = format (0, "%U", format_vnet_sw_if_index_name, vnm,
+ l->sw_if_index);
+ else
+ loc = format (0, "%U", format_ip_address,
+ &gid_address_ip (&l->address));
+
+ if (first_line)
+ {
+ s = format (s, "%-35U%-20s%-v\n", format_gid_address,
+ gid, type, loc);
+ first_line = 0;
+ }
+ else
+ s = format (s, "%55s%v\n", "", loc);
+ }
+ }
+ return s;
+}
+
static clib_error_t *
-lisp_show_local_eid_table_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
+lisp_show_eid_table_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
{
lisp_cp_main_t * lcm = vnet_lisp_cp_get_main();
mapping_t * mapit;
- vlib_cli_output (vm, "%=30s%=16s", "EID", "Locator");
+ vlib_cli_output (vm, "%-35s%-20s%-s", "EID", "type", "locators");
pool_foreach (mapit, lcm->mapping_pool,
({
- u8 * msg = 0;
locator_set_t * ls = pool_elt_at_index (lcm->locator_set_pool,
mapit->locator_set_index);
- vlib_cli_output (vm, "%-30U%16v", format_gid_address, &mapit->eid,
- ls->name);
- vec_free (msg);
+ vlib_cli_output (vm, "%U", format_eid_entry, lcm->vnet_main,
+ lcm, &mapit->eid, ls);
}));
return 0;
}
-VLIB_CLI_COMMAND (lisp_cp_show_local_eid_table_command) = {
+VLIB_CLI_COMMAND (lisp_cp_show_eid_table_command) = {
.path = "show lisp eid-table",
- .short_help = "Shows local EID table",
- .function = lisp_show_local_eid_table_command_fn,
+ .short_help = "Shows EID table",
+ .function = lisp_show_eid_table_command_fn,
};
/* cleans locator to locator-set data and removes locators not part of