summaryrefslogtreecommitdiffstats
path: root/src/vnet/lawful-intercept
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-02-23 17:11:26 -0500
committerDave Barach <openvpp@barachs.net>2017-02-24 12:17:01 +0000
commit26cd8c129567b48ed0e3610293251ca78fa67103 (patch)
tree627830df91fa440ebbf4635a72848f80d1c85de9 /src/vnet/lawful-intercept
parent02767e9f2eaf7ccfc4079f83d467ad2d3faee203 (diff)
VPP-650: handle buffer failure in vlib_buffer_copy(...)
Change-Id: I6aac48d780fcd935818221044eae50067f225175 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/lawful-intercept')
-rw-r--r--src/vnet/lawful-intercept/node.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/vnet/lawful-intercept/node.c b/src/vnet/lawful-intercept/node.c
index ea0cd8efcdd..50c76ec5a7f 100644
--- a/src/vnet/lawful-intercept/node.c
+++ b/src/vnet/lawful-intercept/node.c
@@ -42,9 +42,10 @@ static u8 * format_li_hit_trace (u8 * s, va_list * args)
vlib_node_registration_t li_hit_node;
-#define foreach_li_hit_error \
-_(HITS, "LI packets processed") \
-_(NO_COLLECTOR, "No collector configured")
+#define foreach_li_hit_error \
+_(HITS, "LI packets processed") \
+_(NO_COLLECTOR, "No collector configured") \
+_(BUFFER_ALLOCATION_FAILURE, "Buffer allocation failure")
typedef enum {
#define _(sym,str) LI_HIT_ERROR_##sym,
@@ -197,8 +198,16 @@ li_hit_node_fn (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
if (PREDICT_TRUE(to_int_next != 0))
{
- /* Make an intercept copy */
+ /* Make an intercept copy. This can fail. */
c0 = vlib_buffer_copy (vm, b0);
+
+ if (PREDICT_FALSE (c0 == 0))
+ {
+ vlib_node_increment_counter
+ (vm, node->node_index,
+ LI_HIT_ERROR_BUFFER_ALLOCATION_FAILURE, 1);
+ goto skip;
+ }
vlib_buffer_advance(c0, -sizeof(*iu0));
@@ -225,6 +234,7 @@ li_hit_node_fn (vlib_main_t * vm,
to_int_next++;
}
+ skip:
if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
&& (b0->flags & VLIB_BUFFER_IS_TRACED)))
{