Hi Ofer, Actually, that is an “established” means of forcing the fib to do a lookup in a specific fib table, instead of using the fib table associated to the rx interface. So yes, vnet_buffer(b)->sw_if_index[VLIB_TX] should be set to a fib_index not a sw_if_index, if this type of buffer handling is needed.
Regards, Florin > On Jun 7, 2020, at 6:09 AM, Ofer Goren <[email protected]> wrote: > > Hi. > Working with multi-core, I hit the following code, and I have reason to > believe it has a bug in it. > The current function looks like this: > always_inline void > ip_lookup_set_buffer_fib_index (u32 * fib_index_by_sw_if_index, > vlib_buffer_t * b) > { > /* *INDENT-OFF* */ > vnet_buffer (b)->ip.fib_index = > vec_elt (fib_index_by_sw_if_index, vnet_buffer (b)->sw_if_index[VLIB_RX]); > vnet_buffer (b)->ip.fib_index = > ((vnet_buffer (b)->sw_if_index[VLIB_TX] == (u32) ~ 0) ? > vnet_buffer (b)->ip.fib_index : > vnet_buffer (b)->sw_if_index[VLIB_TX]); > /* *INDENT-ON* */ > } > > The last line is bugos. It is not an index in the vector. > > I believe the correct code should be like this (last line): > always_inline void > ip_lookup_set_buffer_fib_index (u32 * fib_index_by_sw_if_index, > vlib_buffer_t * b) > { > /* *INDENT-OFF* */ > vnet_buffer (b)->ip.fib_index = > vec_elt (fib_index_by_sw_if_index, vnet_buffer (b)->sw_if_index[VLIB_RX]); > > vnet_buffer (b)->ip.fib_index = > ((vnet_buffer (b)->sw_if_index[VLIB_TX] == (u32) ~ 0) ? > vnet_buffer (b)->ip.fib_index : > vec_elt (fib_index_by_sw_if_index, vnet_buffer > (b)->sw_if_index[VLIB_TX])); > /* *INDENT-ON* */ > } > > Any input will be welcomed. > Thank you, > Ofer >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#16683): https://lists.fd.io/g/vpp-dev/message/16683 Mute This Topic: https://lists.fd.io/mt/74730517/21656 Group Owner: [email protected] Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
