diff options
author | 2017-02-23 17:11:26 -0500 | |
---|---|---|
committer | 2017-02-24 12:17:01 +0000 | |
commit | 26cd8c129567b48ed0e3610293251ca78fa67103 (patch) | |
tree | 627830df91fa440ebbf4635a72848f80d1c85de9 /src/vnet/span/node.c | |
parent | 02767e9f2eaf7ccfc4079f83d467ad2d3faee203 (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/span/node.c')
-rw-r--r-- | src/vnet/span/node.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vnet/span/node.c b/src/vnet/span/node.c index 50d642c2..5037c120 100644 --- a/src/vnet/span/node.c +++ b/src/vnet/span/node.c @@ -83,11 +83,15 @@ span_mirror (vlib_main_t * vm, span_interface_t * si0, vlib_buffer_t * b0, mirror_frames[i] = vnet_get_frame_to_sw_interface (vnm, i); to_mirror_next = vlib_frame_vector_args (mirror_frames[i]); to_mirror_next += mirror_frames[i]->n_vectors; + /* This can fail */ c0 = vlib_buffer_copy (vm, b0); - vnet_buffer (c0)->sw_if_index[VLIB_TX] = i; - c0->flags |= VNET_BUFFER_SPAN_CLONE; - to_mirror_next[0] = vlib_get_buffer_index (vm, c0); - mirror_frames[i]->n_vectors++; + if (PREDICT_TRUE(c0 != 0)) + { + vnet_buffer (c0)->sw_if_index[VLIB_TX] = i; + c0->flags |= VNET_BUFFER_SPAN_CLONE; + to_mirror_next[0] = vlib_get_buffer_index (vm, c0); + mirror_frames[i]->n_vectors++; + } })); /* *INDENT-ON* */ } |