/* TODO check if route/next-hop for eid exists in fib and add
* more specific for the eid with the next-hop found */
case SEND_MAP_REQUEST:
- /* TODO insert tunnel that always sends map-request */
+ /* insert tunnel that always sends map-request */
+ adj.rewrite_header.sw_if_index = ~0;
+ adj.lookup_next_index = (u32) (ip_prefix_version(dpref) == IP4) ?
+ LGPE_IP4_LOOKUP_NEXT_LISP_CP_LOOKUP:
+ LGPE_IP6_LOOKUP_NEXT_LISP_CP_LOOKUP;
+ /* add/delete route for prefix */
+ return ip_sd_fib_add_del_route (lgm, dpref, spref, a->table_id, &adj,
+ a->is_add);
case DROP:
/* for drop fwd entries, just add route, no need to add encap tunnel */
adj.lookup_next_index = (u32) (ip_prefix_version(dpref) == IP4 ?
/* add/delete route for prefix */
return ip_sd_fib_add_del_route (lgm, dpref, spref, a->table_id, &adj,
a->is_add);
- break;
default:
return -1;
}
uword * lookup_next_index, * lgpe_sw_if_index, * lnip;
u8 ip_ver;
+ if (vnet_lisp_gpe_enable_disable_status() == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
/* treat negative fwd entries separately */
if (a->is_negative)
return add_del_negative_fwd_entry (lgm, a);
/* setup adjacency for eid */
memset (&adj, 0, sizeof(adj));
adj.n_adj = 1;
- adj.explicit_fib_index = ~0;
+
+ /* fill in lookup_next_index with a 'legal' value to avoid problems */
+ adj.lookup_next_index = (ip_ver == IP4) ?
+ lgm->ip4_lookup_next_lgpe_ip4_lookup :
+ lgm->ip6_lookup_next_lgpe_ip6_lookup;
if (a->is_add)
{
ASSERT(lookup_next_index != 0);
ASSERT(lgpe_sw_if_index != 0);
- adj.lookup_next_index = lookup_next_index[0];
+ /* hijack explicit fib index to store lisp interface node index */
+ adj.explicit_fib_index = lookup_next_index[0];
adj.rewrite_header.node_index = tun_index;
adj.rewrite_header.sw_if_index = lgpe_sw_if_index[0];
}
gid_address_t * eids = 0, eid;
clib_error_t * error = 0;
u32 i;
+ int rv;
prefp = &gid_address_ippref(&eid);
a.deid = eids[i];
a.slocator = slocators[i];
a.dlocator = dlocators[i];
- vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
+ rv = vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s gpe maptunnel!",
+ is_add ? "add" : "delete");
+ break;
+ }
}
done:
vec_free(eids);
vec_free(slocators);
+ vec_free(dlocators);
return error;
}
.function = lisp_gpe_enable_disable_command_fn,
};
+static clib_error_t *
+lisp_show_iface_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ lisp_gpe_main_t * lgm = &lisp_gpe_main;
+ hash_pair_t * p;
+
+ vlib_cli_output (vm, "%=10s%=12s", "vrf", "hw_if_index");
+ hash_foreach_pair (p, lgm->lisp_gpe_hw_if_index_by_table_id, ({
+ vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]);
+ }));
+ return 0;
+}
+
+VLIB_CLI_COMMAND (lisp_show_iface_command) = {
+ .path = "show lisp gpe interface",
+ .short_help = "show lisp gpe interface",
+ .function = lisp_show_iface_command_fn,
+};
+
clib_error_t *
lisp_gpe_init (vlib_main_t *vm)
{