MAP: 64-bit DMR

Change-Id: I261e11f1006039e4a4019fec2fd3271763ae476a
Signed-off-by: Ole Troan <ot@cisco.com>
This commit is contained in:
Ole Troan
2018-09-27 13:53:30 +02:00
committed by Florin Coras
parent ec11b13a21
commit 0fb2cc6513
2 changed files with 15 additions and 17 deletions

View File

@ -55,7 +55,7 @@ map_main_t map_main;
/*
* This code supports MAP-T:
*
* With DMR prefix length equal to 96.
* With a DMR prefix length of 64 or 96 (RFC6052).
*
*/
@ -81,15 +81,9 @@ map_create_domain (ip4_address_t * ip4_prefix,
/* 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;
}
}
@ -2314,8 +2308,8 @@ map_init (vlib_main_t * vm)
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);

View File

@ -532,19 +532,23 @@ int map_ip6_reass_conf_buffers(u32 buffers);
static_always_inline void
ip4_map_t_embedded_address (map_domain_t *d,
ip6_address_t *ip6, const ip4_address_t *ip4)
ip6_address_t *ip6, const ip4_address_t *ip4)
{
ASSERT(d->ip6_src_len == 96); //No support for other lengths for now
ASSERT(d->ip6_src_len == 96 || d->ip6_src_len == 64); //No support for other lengths for now
u8 offset = d->ip6_src_len == 64 ? 9 : 12;
ip6->as_u64[0] = d->ip6_src.as_u64[0];
ip6->as_u32[2] = d->ip6_src.as_u32[2];
ip6->as_u32[3] = ip4->as_u32;
ip6->as_u64[1] = d->ip6_src.as_u64[1];
clib_memcpy(&ip6->as_u8[offset], ip4, 4);
}
static_always_inline u32
ip6_map_t_embedded_address (map_domain_t *d, ip6_address_t *addr)
{
ASSERT(d->ip6_src_len == 96); //No support for other lengths for now
return addr->as_u32[3];
ASSERT(d->ip6_src_len == 64 || d->ip6_src_len == 96);
u32 x;
u8 offset = d->ip6_src_len == 64 ? 9 : 12;
clib_memcpy(&x, &addr->as_u8[offset], 4);
return x;
}
static inline void