*/
#include <vnet/fib/fib_table.h>
+#include <vnet/fib/fib_entry_track.h>
#include <vnet/fib/ip6_fib.h>
#include <vnet/adj/adj.h>
#include <vppinfra/crc32.h>
/*
- * Save usre-assigned MAP domain names ("tags") in a vector of
+ * Save user-assigned MAP domain names ("tags") in a vector of
* extra domain information.
*/
static void
-map_save_extras (u32 map_domain_index, char *tag)
+map_save_extras (u32 map_domain_index, u8 * tag)
{
map_main_t *mm = &map_main;
map_domain_extra_t *de;
- u32 len;
if (map_domain_index == ~0)
return;
if (!tag)
return;
- len = strlen (tag) + 1;
- de->tag = clib_mem_alloc (len);
- clib_memcpy (de->tag, tag, len);
+ de->tag = vec_dup (tag);
}
{
map_main_t *mm = &map_main;
map_domain_extra_t *de;
- char *tag;
+ u8 *tag;
if (map_domain_index == ~0)
return;
if (!tag)
return;
- clib_mem_free (tag);
+ vec_free (tag);
de->tag = 0;
}
u8 ea_bits_len,
u8 psid_offset,
u8 psid_length,
- u32 * map_domain_index, u16 mtu, u8 flags, char *tag)
+ u32 * map_domain_index, u16 mtu, u8 flags, u8 * tag)
{
u8 suffix_len, suffix_shift;
map_main_t *mm = &map_main;
.fp_addr = *addr,
};
- pr->fei = fib_table_entry_special_add (0, // default fib
- &pfx,
- FIB_SOURCE_RR, FIB_ENTRY_FLAG_NONE);
- pr->sibling = fib_entry_child_add (pr->fei, FIB_NODE_TYPE_MAP_E, proto);
+ pr->fei = fib_entry_track (0, // default fib
+ &pfx, FIB_NODE_TYPE_MAP_E, proto, &pr->sibling);
map_stack (pr);
}
map_fib_unresolve (map_main_pre_resolved_t * pr,
fib_protocol_t proto, u8 len, const ip46_address_t * addr)
{
- fib_prefix_t pfx = {
- .fp_proto = proto,
- .fp_len = len,
- .fp_addr = *addr,
- };
-
if (pr->fei != FIB_NODE_INDEX_INVALID)
{
- fib_entry_child_remove (pr->fei, pr->sibling);
+ fib_entry_untrack (pr->fei, pr->sibling);
- fib_table_entry_special_remove (0, // default fib
- &pfx, FIB_SOURCE_RR);
dpo_reset (&pr->dpo);
pr->fei = FIB_NODE_INDEX_INVALID;
num_m_args++;
else if (unformat (line_input, "mtu %d", &mtu))
num_m_args++;
- else if (unformat (line_input, "tag %s", &tag))
+ else if (unformat (line_input, "tag %v", &tag))
;
else
{
map_create_domain (&ip4_prefix, ip4_prefix_len,
&ip6_prefix, ip6_prefix_len, &ip6_src, ip6_src_len,
ea_bits_len, psid_offset, psid_length, &map_domain_index,
- mtu, flags, (char *) tag);
+ mtu, flags, tag);
done:
unformat_free (line_input);
de = vec_elt_at_index (mm->domain_extras, map_domain_index);
s = format (s,
- "[%d] tag {%s} ip4-pfx %U/%d ip6-pfx %U/%d ip6-src %U/%d "
+ "[%d] tag {%v} ip4-pfx %U/%d ip6-pfx %U/%d ip6-src %U/%d "
"ea-bits-len %d psid-offset %d psid-len %d mtu %d %s",
map_domain_index, de->tag,
format_ip4_address, &d->ip4_prefix, d->ip4_prefix_len,
vlib_node_t *n = vlib_get_node (vm, node_index);
u32 ci;
- ci = vlib_error_get_code (e);
+ ci = vlib_error_get_code (&vm->node_main, e);
ASSERT (ci < n->n_errors);
ci += n->error_heap_index;