Hi, In my node processing function, I want some buffers to be cloned and sent to a specific host interface while also be sent to the "normal" interface resolved in the node. At the end, the node should be able to send the buffers to two different interfaces simultaneously. packet -> node -> interface 1 | V cloned packet to host interface
In my single loop where I process the buffers I added a call to this function: static inline void replicate_and_send_buffer(vnet_main_t *vnm, vlib_main_t > * vm, > vlib_node_runtime_t * node, > u32 bi0, > u16 sw_if_index) > { > u32 cbi0; > u16 n_cloned = vlib_buffer_clone (vm, bi0, &cbi0, 1, > VLIB_BUFFER_CLONE_HEAD_SIZE); > vnet_hw_interface_t * host_intf = vnet_get_sup_hw_interface (vnm, > sw_if_index); > u32 node_index = host_intf->tx_node_index; > vlib_frame_t *host_if_frame = vlib_get_frame_to_node(vm, > node_index); > host_if_frame->n_vectors = 1; > u32 *to_next = vlib_frame_vector_args (host_if_frame); > to_next[0] = cbi0; > vlib_put_frame_to_node (vm, node_index, host_if_frame); > } What is happening here is that I clone the original buffer and put it in a frame corresponding to the host interface node (in addition to the frame of the main loop pointing to a different node) Running this code leads me to double-free crash. I noticed that vlib_buffer_clone, when asked to create 1 clone, presented me with a new buffer index that has the same address as the original buffer, but the ref_count stays 1. Looking at the vlib_buffer_clone confirms that it only copies the packet for n_clones > 1, but still not updating the ref_count. So it looks like I'm missing something wrt how the cloning works. I changed the code to create 2 clones and tried to use the 2nd clone in the host interface frame. This resulted in the packet being sent only to the host interface, but not to both of the interfaces. I'm probably doing something wrong, how can I achieve the desired behavior? Thanks, David
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#19141): https://lists.fd.io/g/vpp-dev/message/19141 Mute This Topic: https://lists.fd.io/mt/81938105/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-