+ vec_validate (msm->clones[thread_index], n_clones);
+
+ /*
+ * the header offset needs to be large enough to incorporate
+ * all the L3 headers that could be touched when doing BVI
+ * processing. So take the current l2 length plus 2 * IPv6
+ * headers (for tunnel encap)
+ */
+ n_cloned = vlib_buffer_clone (vm, bi0,
+ msm->clones[thread_index],
+ n_clones,
+ VLIB_BUFFER_CLONE_HEAD_SIZE);
+
+ vec_set_len (msm->clones[thread_index], n_cloned);
+
+ if (PREDICT_FALSE (n_cloned != n_clones))
+ {
+ b0->error = node->errors[L2FLOOD_ERROR_REPL_FAIL];
+ /* Worst-case, no clones, consume the original buf */
+ if (n_cloned == 0)
+ {
+ ci0 = bi0;
+ member = msm->members[thread_index][0];
+ goto use_original_buffer;
+ }
+ }