aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/igmp
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-28 08:33:24 +0000
committerNeale Ranns <nranns@cisco.com>2019-06-28 08:33:24 +0000
commit4752b29cfe229806c1cb2ae852c188d36be4c7cf (patch)
tree7665d6f8d0b6ac83268fb377792e87be01e9dfb6 /src/plugins/igmp
parent4f731f829f29c5579257ecf1ef4b129a9d79fac8 (diff)
igmp: Trace more data form input packets
Type: feature Change-Id: I40ecc0da1281115f6e540064224538fe9472887e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/igmp')
-rw-r--r--src/plugins/igmp/igmp_error.h1
-rw-r--r--src/plugins/igmp/igmp_input.c22
2 files changed, 16 insertions, 7 deletions
diff --git a/src/plugins/igmp/igmp_error.h b/src/plugins/igmp/igmp_error.h
index fbd0dc434f0..d3b80f73169 100644
--- a/src/plugins/igmp/igmp_error.h
+++ b/src/plugins/igmp/igmp_error.h
@@ -23,6 +23,7 @@
_ (UNSPECIFIED, "unspecified error") \
_ (INVALID_PROTOCOL, "invalid ip4 protocol") \
_ (BAD_CHECKSUM, "bad checksum") \
+ _ (BAD_LENGTH, "bad length") \
_ (UNKNOWN_TYPE, "unknown igmp message type") \
_ (NOT_ENABLED, "IGMP not enabled on this interface") \
diff --git a/src/plugins/igmp/igmp_input.c b/src/plugins/igmp/igmp_input.c
index d5f714bc033..a49790fe119 100644
--- a/src/plugins/igmp/igmp_input.c
+++ b/src/plugins/igmp/igmp_input.c
@@ -61,7 +61,7 @@ typedef struct
{
u32 next_index;
u32 sw_if_index;
-
+ u32 len;
u8 packet_data[64];
} igmp_input_trace_t;
@@ -100,10 +100,12 @@ format_igmp_parse_query_trace (u8 * s, va_list * va)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *);
igmp_input_trace_t *t = va_arg (*va, igmp_input_trace_t *);
- s = format (s, "sw_if_index %u next-input %u",
- t->sw_if_index, t->next_index);
+ s = format (s, "sw_if_index %u next-input %u len %u",
+ t->sw_if_index, t->next_index, t->len);
s = format (s, "\n%U", format_igmp_query_v3, t->packet_data,
sizeof (t->packet_data));
+ s = format (s, "\n%U", format_hex_bytes,
+ t->packet_data, sizeof (t->packet_data));
return s;
}
@@ -203,6 +205,7 @@ igmp_input (vlib_main_t * vm, vlib_node_runtime_t * node,
tr = vlib_add_trace (vm, node, b, sizeof (*tr));
tr->next_index = next;
tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
+ tr->len = vlib_buffer_length_in_chain (vm, b);
clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b),
sizeof (tr->packet_data));
}
@@ -280,6 +283,7 @@ igmp_parse_query (vlib_main_t * vm, vlib_node_runtime_t * node,
tr = vlib_add_trace (vm, node, b, sizeof (*tr));
tr->next_index = next;
tr->sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX];
+ tr->len = vlib_buffer_length_in_chain (vm, b);
clib_memcpy_fast (tr->packet_data, vlib_buffer_get_current (b),
sizeof (tr->packet_data));
}
@@ -302,10 +306,14 @@ igmp_parse_query (vlib_main_t * vm, vlib_node_runtime_t * node,
vl_api_rpc_call_main_thread (igmp_handle_query,
(u8 *) args, sizeof (*args) + len);
}
- /*
- * else a packet that is reporting more or less sources
- * than it really has, bin it
- */
+ else
+ {
+ /*
+ * else a packet that is reporting more or less sources
+ * than it really has, bin it
+ */
+ b->error = node->errors[IGMP_ERROR_BAD_LENGTH];
+ }
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, bi, next);