.function = lisp_pitr_set_locator_set_command_fn,
};
+static clib_error_t *
+lisp_show_pitr_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 * m;
+ locator_set_t * ls;
+ u8 * tmp_str = 0;
+
+ vlib_cli_output (vm, "%=20s%=16s",
+ "pitr", lcm->lisp_pitr ? "locator-set" : "");
+
+ if (!lcm->lisp_pitr) {
+ vlib_cli_output (vm, "%=20s", "disable");
+ return 0;
+ }
+
+ if (~0 == lcm->pitr_map_index) {
+ tmp_str = format(0, "N/A");
+ } else {
+ m = pool_elt_at_index (lcm->mapping_pool, lcm->pitr_map_index);
+ if (~0 != m->locator_set_index) {
+ ls = pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index);
+ tmp_str = format(0, "%s", ls->name);
+ } else {
+ tmp_str = format(0, "N/A");
+ }
+ }
+ vec_add1(tmp_str, 0);
+
+ vlib_cli_output (vm, "%=20s%=16s",
+ "enable", tmp_str);
+
+ vec_free(tmp_str);
+
+ return 0;
+}
+
+VLIB_CLI_COMMAND (lisp_show_pitr_command) = {
+ .path = "show lisp pitr",
+ .short_help = "Show pitr",
+ .function = lisp_show_pitr_command_fn,
+};
static u8 *
format_eid_entry (u8 * s, va_list * args)
vec_foreach(locit, ls->locator_indices)
{
itloc = pool_elt_at_index(lcm->locator_pool, locit[0]);
- if (itloc->sw_if_index == loc->sw_if_index ||
- !gid_address_cmp(&itloc->address, &loc->address))
+ if ((ls->local && itloc->sw_if_index == loc->sw_if_index) ||
+ (!ls->local && !gid_address_cmp(&itloc->address, &loc->address)))
{
clib_warning("Duplicate locator");
return VNET_API_ERROR_VALUE_EXIST;
({
u8 * msg = 0;
int next_line = 0;
- msg = format (msg, "%=16v", lsit->name);
+ if (lsit->local)
+ {
+ msg = format (msg, "%=16v", lsit->name);
+ }
+ else
+ {
+ msg = format (msg, "%=16s", "remote");
+ }
vec_foreach (locit, lsit->locator_indices)
{
if (next_line)
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, * line_input = &_line_input;
- u8 is_add = 1;
+ u8 is_add = 1, addr_set = 0;
ip_address_t ip_addr;
clib_error_t * error = 0;
int rv = 0;
else if (unformat (line_input, "del"))
is_add = 0;
else if (unformat (line_input, "%U", unformat_ip_address, &ip_addr))
- ;
+ addr_set = 1;
else
{
error = unformat_parse_error(line_input);
goto done;
}
}
+
+ if (!addr_set)
+ {
+ error = clib_error_return(0, "Map-resolver address must be set!");
+ goto done;
+ }
+
a->is_add = is_add;
a->address = ip_addr;
rv = vnet_lisp_add_del_map_resolver (a);