Hello, VPP developers.I can't understand how to write plugin to filter some packets and passing others.
I need to hook on some feature graph, check every packet and remove matched.
I bound required IP for interface, hooked arc "ip4-local" (it can also be "ip4-unicast") with my node "checker" and do not understand how to write node function. My node function work if I enable plugin for interface. If I use node with next nodes as created by extras/emacs/make-plugin.sh VLIB_REGISTER_NODE (checker_node) = { // ... .n_next_nodes = CHECKER_N_NEXT, .next_nodes = { [CHECKER_NEXT_DROP] = "error-drop", }, };I do not understand how to pass buffer to further nodes on arc in node function
- so all packets dropped because next[0] = 0;Also as I understand feature arc can have many features enabled and all packets will be processed by all nodes on arc, so I do not know which node on "ip4-local"
or "ip4-unicast" arc will be after my node to pass buffer there. So I do notunderstand what to write in .next_nodes except "error-drop" to pass unfiltered
packets to further processing.If I use .n_next_nodes = 0, all packets will pass to next node on feature arc,
but how to drop matched buffers? The best solution I found is to use vlib_buffer_free() or code like this vlib_node_t* drop_node = vlib_get_node_by_name (vm, (u8 *)"error-drop"); vlib_frame_t* f = vlib_get_frame_to_node (vm, drop_node->index ); f->n_vectors = 1; u32* to_next = vlib_frame_vector_args( f ); to_next[0] = buffer_index; vlib_put_frame_to_node( vm, drop_node->index, f ); and remove matched buffer indexes from vlib_buffer_enqueue_to_next().(I know vlib_get_node_by_name() can be moved out of loop - this is not important.) But this solution will break batch processing architecture of vpp and I think
there is better way (this looks like hack).As I understand I just need to assign some index to next[0] which is nexts for
vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors) but I do not understand how to get it.Please help to write node function which will drop matched packets and pass to
next node on arc unmatched. What do I need to write in .next_nodes of VLIB_REGISTER_NODEand how to drop matched buffers and pass others to next nodes on feature arc in node function.
Alex
OpenPGP_0x8C4121F027D4C2A9.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#19404): https://lists.fd.io/g/vpp-dev/message/19404 Mute This Topic: https://lists.fd.io/mt/82921204/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-