summaryrefslogtreecommitdiffstats
path: root/src/plugins/map/map.h
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-09-27 13:53:30 +0200
committerFlorin Coras <florin.coras@gmail.com>2018-09-27 20:00:26 +0000
commit0fb2cc65134d268d367678be32c50252ad4cd311 (patch)
tree4396afc309314a0aea8fcf6ed422af790035b037 /src/plugins/map/map.h
parentec11b13a21b2becc1d1bd746a04624d17b26583f (diff)
MAP: 64-bit DMR
Change-Id: I261e11f1006039e4a4019fec2fd3271763ae476a Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/map/map.h')
-rw-r--r--src/plugins/map/map.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h
index 45959f0d0e1..6587a8a455b 100644
--- a/src/plugins/map/map.h
+++ b/src/plugins/map/map.h
@@ -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