From 7217dcdb54c8d66cec28ca71697b808099a7bd85 Mon Sep 17 00:00:00 2001 From: Maxime Peim Date: Mon, 19 Feb 2024 11:26:23 +0100 Subject: pg: fix stream pg interface When an other interface is specified to generate packets from, we should bind its sw_if_index to the pg interface to use. Fix if_index_by_sw_if_index variable name, and force to specify a pg interface to source traffic from. Type: fix Change-Id: Ib3e6dca92774b307def82926fc09945b7998267d Signed-off-by: Maxime Peim --- src/vnet/pg/input.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/vnet/pg/input.c') diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c index 6f38ed0869a..f376c7443e5 100644 --- a/src/vnet/pg/input.c +++ b/src/vnet/pg/input.c @@ -1639,8 +1639,8 @@ pg_generate_packets (vlib_node_runtime_t * node, pg_interface_t *pi; int i; - pi = pool_elt_at_index (pg->interfaces, - pg->if_id_by_sw_if_index[s->sw_if_index[VLIB_RX]]); + pi = pool_elt_at_index ( + pg->interfaces, pg->if_index_by_sw_if_index[s->sw_if_index[VLIB_RX]]); bi0 = s->buffer_indices; n_packets_in_fifo = pg_stream_fill (pg, s, n_packets_to_generate); @@ -1864,9 +1864,9 @@ VLIB_NODE_FN (pg_input_mac_filter) (vlib_main_t * vm, pg_interface_t *pi; mac_address_t in; - pi = pool_elt_at_index - (pg->interfaces, - pg->if_id_by_sw_if_index[vnet_buffer (b[0])->sw_if_index[VLIB_RX]]); + pi = pool_elt_at_index ( + pg->interfaces, + pg->if_index_by_sw_if_index[vnet_buffer (b[0])->sw_if_index[VLIB_RX]]); eth = vlib_buffer_get_current (b[0]); mac_address_from_bytes (&in, eth->dst_address); -- cgit 1.2.3-korg