summaryrefslogtreecommitdiffstats
path: root/src/plugins/map/ip6_map_t.c
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2019-12-04 15:02:46 -0600
committerMatthew Smith <mgsmith@netgate.com>2019-12-05 10:24:41 -0600
commit9f3569615eaadcf24a880d8d5547df9ad7a1d35f (patch)
tree600e092bcbdea0338f1f26336c1904a5ae1bd2c0 /src/plugins/map/ip6_map_t.c
parent1063f2ae80666d355407d58e0fda35fbd5292d9b (diff)
map: fix MAP-T ip6 port check
Type: fix Ticket: VPP-1804 Fix a regression introduced by 640edcd90. The port set ID on received IPv6 packets for MAP-T was being checked against the destination port. It should be checked against the source port. Added a new unit test to verify that a v6 packet with a good source port is translated and forwarded and a v6 packet with a bad source port is dropped. The important part of the test which will prevent similar future regressions is that the source port and destination port are not equal. The existing unit test used the same source and destination port which is why it did not fail when the regression was introduced. Change-Id: Idc144ea509722bb9e0f80b3887d220384a04e6d6 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/plugins/map/ip6_map_t.c')
-rw-r--r--src/plugins/map/ip6_map_t.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/map/ip6_map_t.c b/src/plugins/map/ip6_map_t.c
index ef7b91349e5..7999507618a 100644
--- a/src/plugins/map/ip6_map_t.c
+++ b/src/plugins/map/ip6_map_t.c
@@ -491,7 +491,7 @@ ip6_map_t (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
n_left_to_next -= 1;
error0 = MAP_ERROR_NONE;
p0 = vlib_get_buffer (vm, pi0);
- u16 l4_dst_port = vnet_buffer (p0)->ip.reass.l4_dst_port;
+ u16 l4_src_port = vnet_buffer (p0)->ip.reass.l4_src_port;
ip60 = vlib_buffer_get_current (p0);
@@ -534,7 +534,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
&& ip6_frag_hdr_offset (frag0)))
{
- map_port0 = l4_dst_port;
+ map_port0 = l4_src_port;
next0 = IP6_MAPT_NEXT_MAPT_FRAGMENTED;
}
else
@@ -547,7 +547,7 @@ 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 = l4_dst_port;
+ map_port0 = l4_src_port;
}
else
if (PREDICT_TRUE
@@ -559,7 +559,7 @@ 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 = l4_dst_port;
+ map_port0 = l4_src_port;
}
else if (vnet_buffer (p0)->map_t.v6.l4_protocol ==
IP_PROTOCOL_ICMP6)
@@ -576,7 +576,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 = l4_dst_port;
+ map_port0 = l4_src_port;
}
else
{