- 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_F_SPAN_CLONE;
+ if (sf == SPAN_FEAT_L2)
+ vnet_buffer (c0)->l2.feature_bitmap = L2OUTPUT_FEAT_OUTPUT;
+ to_mirror_next[0] = vlib_get_buffer_index (vm, c0);
+ mirror_frames[i]->n_vectors++;
+ if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
+ {
+ span_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
+ t->src_sw_if_index = sw_if_index0;
+ t->mirror_sw_if_index = i;
+#if 0
+ /* Enable this path to allow packet trace of SPAN packets.
+ Note that all SPAN packets will show up on the trace output
+ with the first SPAN packet (since they are in the same frame)
+ thus making trace output of the original packet confusing */
+ mirror_frames[i]->flags |= VLIB_FRAME_TRACE;
+ c0->flags |= VLIB_BUFFER_IS_TRACED;
+#endif
+ }
+ }