From 639beb91f6e80192977f12f56614ff1254431cc9 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 12 May 2023 16:58:44 -0700 Subject: ip: allow overriding fib index in reass Type: improvement Signed-off-by: Florin Coras Change-Id: Ic28da52b9c8286f71e472ef6c3afc23d464f85b0 --- src/vnet/ip/reass/ip4_full_reass.c | 6 ++++-- src/vnet/ip/reass/ip6_full_reass.c | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/vnet/ip') diff --git a/src/vnet/ip/reass/ip4_full_reass.c b/src/vnet/ip/reass/ip4_full_reass.c index 5e5969e9226..c65f349e5b0 100644 --- a/src/vnet/ip/reass/ip4_full_reass.c +++ b/src/vnet/ip/reass/ip4_full_reass.c @@ -1222,8 +1222,10 @@ ip4_full_reass_inline (vlib_main_t *vm, vlib_node_runtime_t *node, goto packet_enqueue; } - u32 fib_index = vec_elt (ip4_main.fib_index_by_sw_if_index, - vnet_buffer (b0)->sw_if_index[VLIB_RX]); + u32 fib_index = (vnet_buffer (b0)->sw_if_index[VLIB_TX] == (u32) ~0) ? + vec_elt (ip4_main.fib_index_by_sw_if_index, + vnet_buffer (b0)->sw_if_index[VLIB_RX]) : + vnet_buffer (b0)->sw_if_index[VLIB_TX]; ip4_full_reass_kv_t kv = { .k.fib_index = fib_index, .k.src.as_u32 = ip0->src_address.as_u32, diff --git a/src/vnet/ip/reass/ip6_full_reass.c b/src/vnet/ip/reass/ip6_full_reass.c index 582dbf60679..f14083d09cb 100644 --- a/src/vnet/ip/reass/ip6_full_reass.c +++ b/src/vnet/ip/reass/ip6_full_reass.c @@ -1279,15 +1279,17 @@ ip6_full_reassembly_inline (vlib_main_t *vm, vlib_node_runtime_t *node, } else { + u32 fib_index = + (vnet_buffer (b0)->sw_if_index[VLIB_TX] == (u32) ~0) ? + vec_elt (ip6_main.fib_index_by_sw_if_index, + vnet_buffer (b0)->sw_if_index[VLIB_RX]) : + vnet_buffer (b0)->sw_if_index[VLIB_TX]; kv.k.as_u64[0] = ip0->src_address.as_u64[0]; kv.k.as_u64[1] = ip0->src_address.as_u64[1]; kv.k.as_u64[2] = ip0->dst_address.as_u64[0]; kv.k.as_u64[3] = ip0->dst_address.as_u64[1]; kv.k.as_u64[4] = - ((u64) vec_elt (ip6_main.fib_index_by_sw_if_index, - vnet_buffer (b0)->sw_if_index[VLIB_RX])) - << 32 | - (u64) frag_hdr->identification; + ((u64) fib_index) << 32 | (u64) frag_hdr->identification; /* RFC 8200: The Next Header values in the Fragment headers of * different fragments of the same original packet may differ. * Only the value from the Offset zero fragment packet is used -- cgit 1.2.3-korg