aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/map/map.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2017-11-08 11:10:54 +0100
committerOle Trøan <otroan@employees.org>2018-01-05 10:18:08 +0000
commite31d956d90882186070c174f987abc642b73d54e (patch)
tree904b6b0f75ebc366d164c56e7a37bf54952011e5 /src/vnet/map/map.c
parentd3638337422575c414c4bd793c0dbac39f297040 (diff)
MAP: Add RFC6052 mapping to MAP-T
Change-Id: I2e311f8b7f50133678b9172e8d071826af491609 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'src/vnet/map/map.c')
-rw-r--r--src/vnet/map/map.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/vnet/map/map.c b/src/vnet/map/map.c
index e3886d7e7e6..b2eefee9bb2 100644
--- a/src/vnet/map/map.c
+++ b/src/vnet/map/map.c
@@ -85,6 +85,12 @@ map_create_domain (ip4_address_t * ip4_prefix,
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");
+ return -1;
+ }
}
else
{
@@ -586,6 +592,8 @@ map_add_domain_command_fn (vlib_main_t * vm,
num_m_args++;
else if (unformat (line_input, "map-t"))
flags |= MAP_DOMAIN_TRANSLATION;
+ else if (unformat (line_input, "rfc6052"))
+ flags |= (MAP_DOMAIN_TRANSLATION | MAP_DOMAIN_RFC6052);
else
{
error = clib_error_return (0, "unknown input `%U'",
@@ -919,6 +927,18 @@ done:
return error;
}
+static char *
+map_flags_to_string (u32 flags)
+{
+ if (flags & MAP_DOMAIN_RFC6052)
+ return "rfc6052";
+ if (flags & MAP_DOMAIN_PREFIX)
+ return "prefix";
+ if (flags & MAP_DOMAIN_TRANSLATION)
+ return "map-t";
+ return "";
+}
+
static u8 *
format_map_domain (u8 * s, va_list * args)
{
@@ -933,13 +953,14 @@ format_map_domain (u8 * s, va_list * args)
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 psid-offset %d psid-len %d mtu %d %s",
+ "[%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,
format_ip6_address, &ip6_prefix, d->ip6_prefix_len,
format_ip6_address, &d->ip6_src, d->ip6_src_len,
d->ea_bits_len, d->psid_offset, d->psid_length, d->mtu,
- (d->flags & MAP_DOMAIN_TRANSLATION) ? "map-t" : "");
+ map_flags_to_string (d->flags));
if (counters)
{