diff options
author | Ole Troan <ot@cisco.com> | 2018-11-22 12:15:17 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2018-11-22 19:20:50 +0000 |
commit | fccd1b2b694146506e0efdeee6c23674550fc5d5 (patch) | |
tree | bf258d73903a8e83a47ffc9ccf5eaffec06d17a1 /src/plugins/map/ip6_map_t.c | |
parent | 94f509615eb97cebc9192e7290c84cf166518039 (diff) |
Revert "Add support for MAP-T CE (VPP-1058)"
This reverts commit 0ae15ed43aaa600a75ca4c154bc62478820c00b4.
Re-add MAP CE support later. This patch polluted the code
with too many if (ce) ...
Change-Id: Ia0ffd6fdb452aa5d30abec57772c17fc16fb0dbd
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/map/ip6_map_t.c')
-rw-r--r-- | src/plugins/map/ip6_map_t.c | 347 |
1 files changed, 106 insertions, 241 deletions
diff --git a/src/plugins/map/ip6_map_t.c b/src/plugins/map/ip6_map_t.c index aa4fa4dbd5c..577dbe57001 100644 --- a/src/plugins/map/ip6_map_t.c +++ b/src/plugins/map/ip6_map_t.c @@ -101,49 +101,27 @@ ip6_map_fragment_get (ip6_header_t * ip6, ip6_frag_hdr_t * frag, typedef struct { map_domain_t *d; - u16 id; + u16 sender_port; } icmp6_to_icmp_ctx_t; static int ip6_to_ip4_set_icmp_cb (ip6_header_t * ip6, ip4_header_t * ip4, void *arg) { icmp6_to_icmp_ctx_t *ctx = arg; - map_main_t *mm = &map_main; + u32 ip4_sadr; - if (mm->is_ce) - { - u32 ip4_dadr; - - //Security check - //Note that this prevents an intermediate IPv6 router from answering the request - ip4_dadr = map_get_ip4 (&ip6->dst_address, ctx->d->flags); - if (ip6->dst_address.as_u64[0] != - map_get_pfx_net (ctx->d, ip4_dadr, ctx->id) - || ip6->dst_address.as_u64[1] != map_get_sfx_net (ctx->d, ip4_dadr, - ctx->id)) - return -1; - - ip4->src_address.as_u32 = - ip6_map_t_embedded_address (ctx->d, &ip6->src_address); - ip4->dst_address.as_u32 = ip4_dadr; - } - else - { - u32 ip4_sadr; - - //Security check - //Note that this prevents an intermediate IPv6 router from answering the request - ip4_sadr = map_get_ip4 (&ip6->src_address, ctx->d->flags); - if (ip6->src_address.as_u64[0] != - map_get_pfx_net (ctx->d, ip4_sadr, ctx->id) - || ip6->src_address.as_u64[1] != map_get_sfx_net (ctx->d, ip4_sadr, - ctx->id)) - return -1; - - ip4->dst_address.as_u32 = - ip6_map_t_embedded_address (ctx->d, &ip6->dst_address); - ip4->src_address.as_u32 = ip4_sadr; - } + //Security check + //Note that this prevents an intermediate IPv6 router from answering the request + ip4_sadr = map_get_ip4 (&ip6->src_address, ctx->d->flags); + if (ip6->src_address.as_u64[0] != + map_get_pfx_net (ctx->d, ip4_sadr, ctx->sender_port) + || ip6->src_address.as_u64[1] != map_get_sfx_net (ctx->d, ip4_sadr, + ctx->sender_port)) + return -1; + + ip4->dst_address.as_u32 = + ip6_map_t_embedded_address (ctx->d, &ip6->dst_address); + ip4->src_address.as_u32 = ip4_sadr; return 0; } @@ -153,42 +131,20 @@ ip6_to_ip4_set_inner_icmp_cb (ip6_header_t * ip6, ip4_header_t * ip4, void *arg) { icmp6_to_icmp_ctx_t *ctx = arg; - map_main_t *mm = &map_main; + u32 inner_ip4_dadr; - if (mm->is_ce) - { - u32 inner_ip4_sadr; - - //Security check of inner packet - inner_ip4_sadr = map_get_ip4 (&ip6->src_address, ctx->d->flags); - if (ip6->src_address.as_u64[0] != - map_get_pfx_net (ctx->d, inner_ip4_sadr, ctx->id) - || ip6->src_address.as_u64[1] != map_get_sfx_net (ctx->d, - inner_ip4_sadr, - ctx->id)) - return -1; - - ip4->src_address.as_u32 = inner_ip4_sadr; - ip4->dst_address.as_u32 = - ip6_map_t_embedded_address (ctx->d, &ip6->dst_address); - } - else - { - u32 inner_ip4_dadr; - - //Security check of inner packet - inner_ip4_dadr = map_get_ip4 (&ip6->dst_address, ctx->d->flags); - if (ip6->dst_address.as_u64[0] != - map_get_pfx_net (ctx->d, inner_ip4_dadr, ctx->id) - || ip6->dst_address.as_u64[1] != map_get_sfx_net (ctx->d, - inner_ip4_dadr, - ctx->id)) - return -1; - - ip4->dst_address.as_u32 = inner_ip4_dadr; - ip4->src_address.as_u32 = - ip6_map_t_embedded_address (ctx->d, &ip6->src_address); - } + //Security check of inner packet + inner_ip4_dadr = map_get_ip4 (&ip6->dst_address, ctx->d->flags); + if (ip6->dst_address.as_u64[0] != + map_get_pfx_net (ctx->d, inner_ip4_dadr, ctx->sender_port) + || ip6->dst_address.as_u64[1] != map_get_sfx_net (ctx->d, + inner_ip4_dadr, + ctx->sender_port)) + return -1; + + ip4->dst_address.as_u32 = inner_ip4_dadr; + ip4->src_address.as_u32 = + ip6_map_t_embedded_address (ctx->d, &ip6->src_address); return 0; } @@ -220,7 +176,6 @@ ip6_map_t_icmp (vlib_main_t * vm, u16 len0; icmp6_to_icmp_ctx_t ctx0; ip6_header_t *ip60; - icmp46_header_t *icmp0; pi0 = to_next[0] = from[0]; from += 1; @@ -233,16 +188,12 @@ ip6_map_t_icmp (vlib_main_t * vm, p0 = vlib_get_buffer (vm, pi0); ip60 = vlib_buffer_get_current (p0); len0 = clib_net_to_host_u16 (ip60->payload_length); - icmp0 = (icmp46_header_t *) (ip60 + 1); d0 = pool_elt_at_index (map_main.domains, vnet_buffer (p0)->map_t.map_domain_index); - - ctx0.id = - ip6_get_port (ip60, icmp0->type == ICMP6_echo_request, - p0->current_length); + ctx0.sender_port = ip6_get_port (ip60, 0, p0->current_length); ctx0.d = d0; - if (ctx0.id == 0) + if (ctx0.sender_port == 0) { // In case of 1:1 mapping, we don't care about the port if (!(d0->ea_bits_len == 0 && d0->rules)) @@ -534,30 +485,22 @@ ip6_map_t_tcp_udp (vlib_main_t * vm, static_always_inline void ip6_map_t_classify (vlib_buffer_t * p0, ip6_header_t * ip60, - map_domain_t * d0, i32 * map_port0, + map_domain_t * d0, i32 * src_port0, u8 * error0, ip6_mapt_next_t * next0, u32 l4_len0, ip6_frag_hdr_t * frag0) { - map_main_t *mm = &map_main; - u32 port_offset; - - if (mm->is_ce) - port_offset = 2; - else - port_offset = 0; - if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset && ip6_frag_hdr_offset (frag0))) { *next0 = IP6_MAPT_NEXT_MAPT_FRAGMENTED; if (d0->ea_bits_len == 0 && d0->rules) { - *map_port0 = 0; + *src_port0 = 0; } else { - *map_port0 = ip6_map_fragment_get (ip60, frag0, d0); - *error0 = (*map_port0 != -1) ? *error0 : MAP_ERROR_FRAGMENT_DROPPED; + *src_port0 = ip6_map_fragment_get (ip60, frag0, d0); + *error0 = (*src_port0 != -1) ? *error0 : MAP_ERROR_FRAGMENT_DROPPED; } } else @@ -569,11 +512,9 @@ ip6_map_t_classify (vlib_buffer_t * p0, ip6_header_t * ip60, vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 16; *next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; - *map_port0 = + *src_port0 = (i32) * - ((u16 *) - u8_ptr_add (ip60, - vnet_buffer (p0)->map_t.v6.l4_offset + port_offset)); + ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset)); } else if (PREDICT_TRUE @@ -584,11 +525,9 @@ ip6_map_t_classify (vlib_buffer_t * p0, ip6_header_t * ip60, vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 6; *next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; - *map_port0 = + *src_port0 = (i32) * - ((u16 *) - u8_ptr_add (ip60, - vnet_buffer (p0)->map_t.v6.l4_offset + port_offset)); + ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset)); } else if (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_ICMP6) { @@ -597,7 +536,7 @@ ip6_map_t_classify (vlib_buffer_t * p0, ip6_header_t * ip60, *next0 = IP6_MAPT_NEXT_MAPT_ICMP; if (d0->ea_bits_len == 0 && d0->rules) { - *map_port0 = 0; + *src_port0 = 0; } else if (((icmp46_header_t *) @@ -609,7 +548,7 @@ ip6_map_t_classify (vlib_buffer_t * p0, ip6_header_t * ip60, vnet_buffer (p0)->map_t.v6.l4_offset))->code == ICMP6_echo_request) { - *map_port0 = + *src_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset + 6)); @@ -628,7 +567,6 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) u32 n_left_from, *from, next_index, *to_next, n_left_to_next; vlib_node_runtime_t *error_node = vlib_node_get_runtime (vm, ip6_map_t_node.index); - map_main_t *mm = &map_main; vlib_combined_counter_main_t *cm = map_main.domain_counters; u32 thread_index = vm->thread_index; @@ -648,9 +586,10 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) u8 error0, error1; ip6_mapt_next_t next0, next1; u32 l4_len0, l4_len1; - i32 map_port0, map_port1; + i32 src_port0, src_port1; map_domain_t *d0, *d1; ip6_frag_hdr_t *frag0, *frag1; + u32 saddr0, saddr1; next0 = next1 = 0; //Because compiler whines pi0 = to_next[0] = from[0]; @@ -668,67 +607,29 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) ip60 = vlib_buffer_get_current (p0); ip61 = vlib_buffer_get_current (p1); - if (mm->is_ce) - { - u32 daddr0, daddr1; - daddr0 = 0; /* TODO */ - daddr1 = 0; /* TODO */ - /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ - - daddr0 = map_get_ip4 (&ip60->dst_address, 0 /*TODO*/); - daddr1 = map_get_ip4 (&ip61->dst_address, 0 /*TODO*/); - d0 = - ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], - (ip4_address_t *) & daddr0, - &vnet_buffer (p0)->map_t.map_domain_index, - &error0); - d1 = - ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX], - (ip4_address_t *) & daddr1, - &vnet_buffer (p1)->map_t.map_domain_index, - &error1); - - daddr0 = map_get_ip4 (&ip60->dst_address, d0->flags); - daddr1 = map_get_ip4 (&ip61->dst_address, d1->flags); - - vnet_buffer (p0)->map_t.v6.daddr = daddr0; - vnet_buffer (p1)->map_t.v6.daddr = daddr1; - vnet_buffer (p0)->map_t.v6.saddr = - ip6_map_t_embedded_address (d0, &ip60->src_address); - vnet_buffer (p1)->map_t.v6.saddr = - ip6_map_t_embedded_address (d1, &ip61->src_address); - } - else - { - u32 saddr0, saddr1; - saddr0 = 0; /* TODO */ - saddr1 = 0; /* TODO */ - /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ - - saddr0 = map_get_ip4 (&ip60->src_address, 0 /*TODO*/); - saddr1 = map_get_ip4 (&ip61->src_address, 0 /*TODO*/); - d0 = - ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], - (ip4_address_t *) & saddr0, - &vnet_buffer (p0)->map_t.map_domain_index, - &error0); - d1 = - ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX], - (ip4_address_t *) & saddr1, - &vnet_buffer (p1)->map_t.map_domain_index, - &error1); - - saddr0 = map_get_ip4 (&ip60->src_address, d0->flags); - saddr1 = map_get_ip4 (&ip61->src_address, d1->flags); - - vnet_buffer (p0)->map_t.v6.saddr = saddr0; - vnet_buffer (p1)->map_t.v6.saddr = saddr1; - vnet_buffer (p0)->map_t.v6.daddr = - ip6_map_t_embedded_address (d0, &ip60->dst_address); - vnet_buffer (p1)->map_t.v6.daddr = - ip6_map_t_embedded_address (d1, &ip61->dst_address); - } - + saddr0 = 0; /* TODO */ + saddr1 = 0; /* TODO */ + /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ + + d0 = ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], + (ip4_address_t *) & saddr0, + &vnet_buffer (p0)->map_t.map_domain_index, + &error0); + d1 = + ip6_map_get_domain (vnet_buffer (p1)->ip.adj_index[VLIB_TX], + (ip4_address_t *) & saddr1, + &vnet_buffer (p1)->map_t.map_domain_index, + &error1); + + saddr0 = map_get_ip4 (&ip60->src_address, d0->flags); + saddr1 = map_get_ip4 (&ip61->src_address, d1->flags); + + vnet_buffer (p0)->map_t.v6.saddr = saddr0; + vnet_buffer (p1)->map_t.v6.saddr = saddr1; + vnet_buffer (p0)->map_t.v6.daddr = + ip6_map_t_embedded_address (d0, &ip60->dst_address); + vnet_buffer (p1)->map_t.v6.daddr = + ip6_map_t_embedded_address (d1, &ip61->dst_address); vnet_buffer (p0)->map_t.mtu = d0->mtu ? d0->mtu : ~0; vnet_buffer (p1)->map_t.mtu = d1->mtu ? d1->mtu : ~0; @@ -756,7 +657,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) next1 = IP6_MAPT_NEXT_DROP; } - map_port0 = map_port1 = -1; + src_port0 = src_port1 = -1; l4_len0 = (u32) clib_net_to_host_u16 (ip60->payload_length) + sizeof (*ip60) - vnet_buffer (p0)->map_t.v6.l4_offset; l4_len1 = (u32) clib_net_to_host_u16 (ip61->payload_length) + @@ -770,33 +671,33 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p1)->map_t. v6.frag_offset); - ip6_map_t_classify (p0, ip60, d0, &map_port0, &error0, &next0, + ip6_map_t_classify (p0, ip60, d0, &src_port0, &error0, &next0, l4_len0, frag0); - ip6_map_t_classify (p1, ip61, d1, &map_port1, &error1, &next1, + ip6_map_t_classify (p1, ip61, d1, &src_port1, &error1, &next1, l4_len1, frag1); if (PREDICT_FALSE - ((map_port0 != -1) + ((src_port0 != -1) && (ip60->src_address.as_u64[0] != map_get_pfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, - map_port0) + src_port0) || ip60->src_address.as_u64[1] != map_get_sfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, - map_port0)))) + src_port0)))) { error0 = MAP_ERROR_SEC_CHECK; } if (PREDICT_FALSE - ((map_port1 != -1) + ((src_port1 != -1) && (ip61->src_address.as_u64[0] != map_get_pfx_net (d1, vnet_buffer (p1)->map_t.v6.saddr, - map_port1) + src_port1) || ip61->src_address.as_u64[1] != map_get_sfx_net (d1, vnet_buffer (p1)->map_t.v6.saddr, - map_port1)))) + src_port1)))) { error1 = MAP_ERROR_SEC_CHECK; } @@ -807,7 +708,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p0)->map_t. v6.frag_offset))) - && (map_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules) + && (src_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules) && (error0 == MAP_ERROR_NONE)) { ip6_map_fragment_cache (ip60, @@ -815,7 +716,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p0)->map_t. v6.frag_offset), - d0, map_port0); + d0, src_port0); } if (PREDICT_FALSE (vnet_buffer (p1)->map_t.v6.frag_offset && @@ -824,7 +725,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p1)->map_t. v6.frag_offset))) - && (map_port1 != -1) && (d1->ea_bits_len != 0 || !d1->rules) + && (src_port1 != -1) && (d1->ea_bits_len != 0 || !d1->rules) && (error1 == MAP_ERROR_NONE)) { ip6_map_fragment_cache (ip61, @@ -832,7 +733,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p1)->map_t. v6.frag_offset), - d1, map_port1); + d1, src_port1); } if (PREDICT_TRUE @@ -874,11 +775,11 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) ip6_header_t *ip60; u8 error0; u32 l4_len0; - i32 map_port0; + i32 src_port0; map_domain_t *d0; ip6_frag_hdr_t *frag0; - u32 port_offset; ip6_mapt_next_t next0 = 0; + u32 saddr; pi0 = to_next[0] = from[0]; from += 1; @@ -890,53 +791,21 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) p0 = vlib_get_buffer (vm, pi0); ip60 = vlib_buffer_get_current (p0); - if (mm->is_ce) - { - u32 daddr; - //Save daddr in a different variable to not overwrite ip.adj_index - daddr = 0; /* TODO */ - /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ - - daddr = map_get_ip4 (&ip60->dst_address, 0 /*TODO*/); - d0 = - ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], - (ip4_address_t *) & daddr, - &vnet_buffer (p0)->map_t.map_domain_index, - &error0); - - daddr = map_get_ip4 (&ip60->dst_address, d0->flags); - - //FIXME: What if d0 is null - vnet_buffer (p0)->map_t.v6.daddr = daddr; - vnet_buffer (p0)->map_t.v6.saddr = - ip6_map_t_embedded_address (d0, &ip60->src_address); - - port_offset = 2; - } - else - { - u32 saddr; - //Save saddr in a different variable to not overwrite ip.adj_index - saddr = 0; /* TODO */ - /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ - - saddr = map_get_ip4 (&ip60->src_address, 0 /*TODO*/); - d0 = - ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], - (ip4_address_t *) & saddr, - &vnet_buffer (p0)->map_t.map_domain_index, - &error0); - - saddr = map_get_ip4 (&ip60->src_address, d0->flags); - - //FIXME: What if d0 is null - vnet_buffer (p0)->map_t.v6.saddr = saddr; - vnet_buffer (p0)->map_t.v6.daddr = - ip6_map_t_embedded_address (d0, &ip60->dst_address); - - port_offset = 0; - } + //Save saddr in a different variable to not overwrite ip.adj_index + saddr = 0; /* TODO */ + /* NOTE: ip6_map_get_domain currently doesn't utilize second argument */ + + d0 = ip6_map_get_domain (vnet_buffer (p0)->ip.adj_index[VLIB_TX], + (ip4_address_t *) & saddr, + &vnet_buffer (p0)->map_t.map_domain_index, + &error0); + + saddr = map_get_ip4 (&ip60->src_address, d0->flags); + //FIXME: What if d0 is null + vnet_buffer (p0)->map_t.v6.saddr = saddr; + vnet_buffer (p0)->map_t.v6.daddr = + ip6_map_t_embedded_address (d0, &ip60->dst_address); vnet_buffer (p0)->map_t.mtu = d0->mtu ? d0->mtu : ~0; if (PREDICT_FALSE (ip6_parse (ip60, p0->current_length, @@ -951,7 +820,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) next0 = IP6_MAPT_NEXT_DROP; } - map_port0 = -1; + src_port0 = -1; l4_len0 = (u32) clib_net_to_host_u16 (ip60->payload_length) + sizeof (*ip60) - vnet_buffer (p0)->map_t.v6.l4_offset; frag0 = @@ -963,8 +832,8 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) if (PREDICT_FALSE (vnet_buffer (p0)->map_t.v6.frag_offset && ip6_frag_hdr_offset (frag0))) { - map_port0 = ip6_map_fragment_get (ip60, frag0, d0); - error0 = (map_port0 != -1) ? error0 : MAP_ERROR_FRAGMENT_MEMORY; + src_port0 = ip6_map_fragment_get (ip60, frag0, d0); + error0 = (src_port0 != -1) ? error0 : MAP_ERROR_FRAGMENT_MEMORY; next0 = IP6_MAPT_NEXT_MAPT_FRAGMENTED; } else @@ -977,12 +846,10 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 16; next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; - map_port0 = + src_port0 = (i32) * ((u16 *) - u8_ptr_add (ip60, - vnet_buffer (p0)->map_t.v6.l4_offset + - port_offset)); + u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset)); } else if (PREDICT_TRUE @@ -994,12 +861,10 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p0)->map_t.checksum_offset = vnet_buffer (p0)->map_t.v6.l4_offset + 6; next0 = IP6_MAPT_NEXT_MAPT_TCP_UDP; - map_port0 = + src_port0 = (i32) * ((u16 *) - u8_ptr_add (ip60, - vnet_buffer (p0)->map_t.v6.l4_offset + - port_offset)); + u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6.l4_offset)); } else if (vnet_buffer (p0)->map_t.v6.l4_protocol == IP_PROTOCOL_ICMP6) @@ -1016,7 +881,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) u8_ptr_add (ip60, vnet_buffer (p0)->map_t.v6. l4_offset))->code == ICMP6_echo_request) - map_port0 = + src_port0 = (i32) * ((u16 *) u8_ptr_add (ip60, @@ -1030,14 +895,14 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) //Security check if (PREDICT_FALSE - ((!mm->is_ce) && (map_port0 != -1) + ((src_port0 != -1) && (ip60->src_address.as_u64[0] != map_get_pfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, - map_port0) + src_port0) || ip60->src_address.as_u64[1] != map_get_sfx_net (d0, vnet_buffer (p0)->map_t.v6.saddr, - map_port0)))) + src_port0)))) { //Security check when src_port0 is not zero (non-first fragment, UDP or TCP) error0 = MAP_ERROR_SEC_CHECK; @@ -1050,7 +915,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p0)->map_t. v6.frag_offset))) - && (map_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules) + && (src_port0 != -1) && (d0->ea_bits_len != 0 || !d0->rules) && (error0 == MAP_ERROR_NONE)) { ip6_map_fragment_cache (ip60, @@ -1058,7 +923,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) vnet_buffer (p0)->map_t. v6.frag_offset), - d0, map_port0); + d0, src_port0); } if (PREDICT_TRUE |