From 8beddaf5b435a872b844052b506366b7a474004c Mon Sep 17 00:00:00 2001 From: Artem Glazychev Date: Tue, 19 Dec 2023 14:31:48 +0700 Subject: af_packet: set next0 for AF_PACKET_IF_MODE_ETHERNET mode Normally af_packet sets next0 = next_index on each cycle. It works for the most cases. But if vlib_validate_buffer_enqueue_x1() changes the next_index (from NEXT_ETHERNET to NEXT_DROP for example) then the following next0 will have the wrong value, and the correct packet will be dropped. AF_PACKET_IF_MODE_IP handles this case, but AF_PACKET_IF_MODE_ETHERNET doesn't. Type: fix Signed-off-by: Artem Glazychev Change-Id: Ic742043e8b10a2abe56b314bb584277151a9c5eb --- src/plugins/af_packet/node.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/af_packet/node.c b/src/plugins/af_packet/node.c index d652a2d61c4..da01492a232 100644 --- a/src/plugins/af_packet/node.c +++ b/src/plugins/af_packet/node.c @@ -472,6 +472,9 @@ af_packet_v3_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, } else { + next0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; + if (PREDICT_FALSE (apif->per_interface_next_index != ~0)) + next0 = apif->per_interface_next_index; /* copy feature arc data from template */ first_b0->current_config_index = bt.current_config_index; vnet_buffer (first_b0)->feature_arc_index = @@ -733,6 +736,9 @@ af_packet_v2_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, } else { + next0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; + if (PREDICT_FALSE (apif->per_interface_next_index != ~0)) + next0 = apif->per_interface_next_index; /* copy feature arc data from template */ first_b0->current_config_index = bt.current_config_index; vnet_buffer (first_b0)->feature_arc_index = -- cgit 1.2.3-korg