aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ct6
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-03-07 16:18:55 -0500
committerFlorin Coras <florin.coras@gmail.com>2019-03-07 22:41:39 +0000
commit035ea679d54700aee9fb86a8de436330bc8e3bc2 (patch)
tree306fced4cd205856d5f88af4f0e2e6c3f351ced2 /src/plugins/ct6
parenteaea421e1fefedc47325f970475c5d48c899433c (diff)
parse ethernet header in ct6_in2out
fix a debug CLI scripting bug: cp_ip6_address_add_del_command_function ate any subsequent commands, yielding indigestion. Change-Id: Iaca7bed5687759da36ae91dc658e758549b71796 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/ct6')
-rw-r--r--src/plugins/ct6/ct6_in2out.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/ct6/ct6_in2out.c b/src/plugins/ct6/ct6_in2out.c
index b28d349dd29..4f2ebae60cf 100644
--- a/src/plugins/ct6/ct6_in2out.c
+++ b/src/plugins/ct6/ct6_in2out.c
@@ -235,7 +235,10 @@ ct6_in2out_inline (vlib_main_t * vm,
/*
* This is an output feature which runs at the last possible
- * moment. Assume an ethernet header.
+ * moment. Assume an ethernet header. Make sure the packet is
+ * actually ipv6 before we do anything else.
+ *
+ * Unfortunately, we have to re-parse the L2 header.
*/
e0 = vlib_buffer_get_current (b[0]);
@@ -245,6 +248,18 @@ ct6_in2out_inline (vlib_main_t * vm,
delta0 += (e0->type == clib_net_to_host_u16 (ETHERNET_TYPE_DOT1AD))
? 8 : 0;
+ if (PREDICT_TRUE (delta0 == sizeof (*e0)))
+ {
+ if (e0->type != clib_host_to_net_u16 (ETHERNET_TYPE_IP6))
+ goto trace0;
+ }
+ else
+ {
+ u16 *tagged_etype_ptr = vlib_buffer_get_current (b[0]) + delta0 - 2;
+ if (*tagged_etype_ptr != clib_host_to_net_u16 (ETHERNET_TYPE_IP6))
+ goto trace0;
+ }
+
ip0 = (ip6_header_t *) (vlib_buffer_get_current (b[0]) + delta0);
/*