From cb630ff691264f7ea4a0f52cc6faa87fcdaa1a40 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 14 Dec 2016 13:31:29 +0100 Subject: Ping response in a VRF context uses correct FIB for response Change-Id: I3b626a1fb9d74ebc609ded14c16c5e3d5a1655ab Signed-off-by: Neale Ranns --- vnet/vnet/dpo/lookup_dpo.c | 10 ++++++++++ vnet/vnet/ip/ip4_forward.c | 7 +++++++ 2 files changed, 17 insertions(+) (limited to 'vnet') diff --git a/vnet/vnet/dpo/lookup_dpo.c b/vnet/vnet/dpo/lookup_dpo.c index e5043663960..96fedd27ce9 100644 --- a/vnet/vnet/dpo/lookup_dpo.c +++ b/vnet/vnet/dpo/lookup_dpo.c @@ -385,6 +385,9 @@ lookup_dpo_ip4_inline (vlib_main_t * vm, lb0 = load_balance_get(lbi0); lb1 = load_balance_get(lbi1); + vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0; + vnet_buffer(b1)->sw_if_index[VLIB_TX] = fib_index1; + /* Use flow hash to compute multipath adjacency. */ hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0; hash_c1 = vnet_buffer (b1)->ip.flow_hash = 0; @@ -500,6 +503,8 @@ lookup_dpo_ip4_inline (vlib_main_t * vm, ip4_src_fib_lookup_one (fib_index0, input_addr, &lbi0); lb0 = load_balance_get(lbi0); + vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0; + /* Use flow hash to compute multipath adjacency. */ hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0; @@ -722,6 +727,9 @@ lookup_dpo_ip6_inline (vlib_main_t * vm, lb0 = load_balance_get(lbi0); lb1 = load_balance_get(lbi1); + vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0; + vnet_buffer(b1)->sw_if_index[VLIB_TX] = fib_index1; + /* Use flow hash to compute multipath adjacency. */ hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0; hash_c1 = vnet_buffer (b1)->ip.flow_hash = 0; @@ -837,6 +845,8 @@ lookup_dpo_ip6_inline (vlib_main_t * vm, input_addr0); lb0 = load_balance_get(lbi0); + vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0; + /* Use flow hash to compute multipath adjacency. */ hash_c0 = vnet_buffer (b0)->ip.flow_hash = 0; diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c index 6a9e066027c..6e91b9e91e1 100644 --- a/vnet/vnet/ip/ip4_forward.c +++ b/vnet/vnet/ip/ip4_forward.c @@ -1500,8 +1500,13 @@ ip4_local (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) fib_index0 = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer (p0)->sw_if_index[VLIB_RX]); + fib_index0 = (vnet_buffer (p0)->sw_if_index[VLIB_TX] == (u32) ~ 0) ? + fib_index0 : vnet_buffer (p0)->sw_if_index[VLIB_TX]; + fib_index1 = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer (p1)->sw_if_index[VLIB_RX]); + fib_index1 = (vnet_buffer (p1)->sw_if_index[VLIB_TX] == (u32) ~ 0) ? + fib_index1 : vnet_buffer (p1)->sw_if_index[VLIB_TX]; mtrie0 = &ip4_fib_get (fib_index0)->mtrie; mtrie1 = &ip4_fib_get (fib_index1)->mtrie; @@ -1721,6 +1726,8 @@ ip4_local (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) fib_index0 = vec_elt (im->fib_index_by_sw_if_index, vnet_buffer (p0)->sw_if_index[VLIB_RX]); + fib_index0 = (vnet_buffer (p0)->sw_if_index[VLIB_TX] == (u32) ~ 0) ? + fib_index0 : vnet_buffer (p0)->sw_if_index[VLIB_TX]; mtrie0 = &ip4_fib_get (fib_index0)->mtrie; -- cgit 1.2.3-korg