/*
* This code supports MAP-T:
*
- * With DMR prefix length equal to 96.
+ * With a DMR prefix length of 64 or 96 (RFC6052).
*
*/
/* Sanity check on the src prefix length */
if (flags & MAP_DOMAIN_TRANSLATION)
{
- if (ip6_src_len != 96)
+ if (ip6_src_len != 96 && ip6_src_len != 64)
{
- clib_warning ("MAP-T only supports ip6_src_len = 96 for now.");
- return -1;
- }
- if ((flags & MAP_DOMAIN_RFC6052) && ip6_prefix_len != 96)
- {
- clib_warning ("RFC6052 translation only supports ip6_prefix_len = "
- "96 for now");
+ clib_warning ("MAP-T only supports prefix lengths of 64 and 96.");
return -1;
}
}
/* Get domain index */
pool_get_aligned (mm->domains, d, CLIB_CACHE_LINE_BYTES);
- memset (d, 0, sizeof (*d));
+ clib_memset (d, 0, sizeof (*d));
*map_domain_index = d - mm->domains;
/* Init domain struct */
d->rules = clib_mem_alloc_aligned (l, CLIB_CACHE_LINE_BYTES);
if (!d->rules)
return -1;
- memset (d->rules, 0, l);
+ clib_memset (d->rules, 0, l);
}
if (psid >= (0x1 << d->psid_length))
}
else
{
- memset (&d->rules[psid], 0, sizeof (ip6_address_t));
+ clib_memset (&d->rules[psid], 0, sizeof (ip6_address_t));
}
return 0;
}
if (FIB_NODE_INDEX_INVALID != pr->fei)
{
- fib_prefix_t pfx;
+ const fib_prefix_t *pfx;
- fib_entry_get_prefix (pr->fei, &pfx);
+ pfx = fib_entry_get_prefix (pr->fei);
return (format (s, "%U (%u)",
- format_ip46_address, &pfx.fp_addr, IP46_TYPE_ANY,
+ format_ip46_address, &pfx->fp_addr, IP46_TYPE_ANY,
pr->dpo.dpoi_index));
}
else
clib_error_t *error = NULL;
int is_del = 0;
- memset (&ip4nh, 0, sizeof (ip4nh));
- memset (&ip6nh, 0, sizeof (ip6nh));
+ clib_memset (&ip4nh, 0, sizeof (ip4nh));
+ clib_memset (&ip6nh, 0, sizeof (ip6nh));
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
ip6_address_t ip6_prefix;
if (d->rules)
- memset (&ip6_prefix, 0, sizeof (ip6_prefix));
+ clib_memset (&ip6_prefix, 0, sizeof (ip6_prefix));
else
ip6_prefix = d->ip6_prefix;
s = format (s,
- "[%d] ip4-pfx %U/%d ip6-pfx %U/%d ip6-src %U/%d ea_bits_len %d "
+ "[%d] 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",
d - mm->domains,
format_ip4_address, &d->ip4_prefix, d->ip4_prefix_len,
int which, i;
vlib_counter_t v;
- memset (total_pkts, 0, sizeof (total_pkts));
- memset (total_bytes, 0, sizeof (total_bytes));
+ clib_memset (total_pkts, 0, sizeof (total_pkts));
+ clib_memset (total_bytes, 0, sizeof (total_bytes));
map_domain_counter_lock (mm);
vec_foreach (cm, mm->domain_counters)
if (!prev_f)
return -1;
- clib_memcpy (prev_f->next_data, data_start, copied_len);
+ clib_memcpy_fast (prev_f->next_data, data_start, copied_len);
prev_f->next_data_len = copied_len;
prev_f->next_data_offset = data_offset;
}
return -1;
if (r->ip4_header.ip_version_and_header_length == 0)
- clib_memcpy (&r->ip4_header, data_start, sizeof (ip4_header_t));
+ clib_memcpy_fast (&r->ip4_header, data_start, sizeof (ip4_header_t));
}
if (data_len > 20)
mm->frag_ignore_df = false;
vec_validate (mm->domain_counters, MAP_N_DOMAIN_COUNTER - 1);
- mm->domain_counters[MAP_DOMAIN_COUNTER_RX].name = "rx";
- mm->domain_counters[MAP_DOMAIN_COUNTER_TX].name = "tx";
+ mm->domain_counters[MAP_DOMAIN_COUNTER_RX].name = "/map/rx";
+ mm->domain_counters[MAP_DOMAIN_COUNTER_TX].name = "/map/tx";
vlib_validate_simple_counter (&mm->icmp_relayed, 0);
vlib_zero_simple_counter (&mm->icmp_relayed, 0);