aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/ct6/ct6_in2out.c17
-rw-r--r--src/vnet/dhcp/dhcp6_pd_client_cp.c21
2 files changed, 30 insertions, 8 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);
/*
diff --git a/src/vnet/dhcp/dhcp6_pd_client_cp.c b/src/vnet/dhcp/dhcp6_pd_client_cp.c
index eb18ed2889a..a157b16d491 100644
--- a/src/vnet/dhcp/dhcp6_pd_client_cp.c
+++ b/src/vnet/dhcp/dhcp6_pd_client_cp.c
@@ -966,26 +966,33 @@ cp_ip6_address_add_del_command_function (vlib_main_t * vm,
u32 prefix_length;
u8 address_set = 0;
u8 add = 1;
+ unformat_input_t _line_input, *line_input = &_line_input;
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat
- (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index));
- else if (unformat (input, "prefix group %s", &prefix_group));
+ (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index));
+ else if (unformat (line_input, "prefix group %s", &prefix_group));
else
- if (unformat
- (input, "%U/%d", unformat_ip6_address, &address, &prefix_length))
+ if (unformat (line_input, "%U/%d", unformat_ip6_address,
+ &address, &prefix_length))
address_set = 1;
- else if (unformat (input, "del"))
+ else if (unformat (line_input, "del"))
add = 0;
else
{
error = clib_error_return (0, "unexpected input `%U'",
- format_unformat_error, input);
+ format_unformat_error, line_input);
+ unformat_free (line_input);
goto done;
}
}
+ unformat_free (line_input);
+
if (sw_if_index == ~0)
error = clib_error_return (0, "Missing sw_if_index");
else if (address_set == 0)