summaryrefslogtreecommitdiffstats
path: root/src/plugins/urpf/urpf_dp.h
diff options
context:
space:
mode:
authorhedi bouattour <hedibouattour2010@gmail.com>2022-09-14 12:39:23 +0000
committerNeale Ranns <neale@graphiant.com>2022-10-07 04:18:54 +0000
commitb3605eab5ad6b8acb758caf7ce04c39d91f9e969 (patch)
tree4be488ba1f2f8c466f83b4f5f5aa35b98deeee07 /src/plugins/urpf/urpf_dp.h
parent9260b8861e62fb9bb0c9dfb5a89c9636ef9a05e2 (diff)
urpf: add mode for specific fib index lookup
this patch adds a mode to urpf in order to perform the lookup in a specified vrf instead of the interface vrf Type: feature Change-Id: Ieb91de6ccdfbf32b6939364f3bebeecd2d57af19 Signed-off-by: hedi bouattour <hedibouattour2010@gmail.com>
Diffstat (limited to 'src/plugins/urpf/urpf_dp.h')
-rw-r--r--src/plugins/urpf/urpf_dp.h22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/plugins/urpf/urpf_dp.h b/src/plugins/urpf/urpf_dp.h
index bfe1f659171..816d8b70b90 100644
--- a/src/plugins/urpf/urpf_dp.h
+++ b/src/plugins/urpf/urpf_dp.h
@@ -128,6 +128,11 @@ urpf_inline (vlib_main_t * vm,
h1 += vnet_buffer (b[1])->ip.save_rewrite_length;
}
+ fib_index0 =
+ urpf_cfgs[af][dir][vnet_buffer (b[0])->sw_if_index[dir]].fib_index;
+ fib_index1 =
+ urpf_cfgs[af][dir][vnet_buffer (b[1])->sw_if_index[dir]].fib_index;
+
if (AF_IP4 == af)
{
const ip4_header_t *ip0, *ip1;
@@ -135,11 +140,6 @@ urpf_inline (vlib_main_t * vm,
ip0 = (ip4_header_t *) h0;
ip1 = (ip4_header_t *) h1;
- fib_index0 = ip4_main.fib_index_by_sw_if_index
- [vnet_buffer (b[0])->sw_if_index[dir]];
- fib_index1 = ip4_main.fib_index_by_sw_if_index
- [vnet_buffer (b[1])->sw_if_index[dir]];
-
ip4_fib_forwarding_lookup_x2 (fib_index0,
fib_index1,
&ip0->src_address,
@@ -155,11 +155,6 @@ urpf_inline (vlib_main_t * vm,
{
const ip6_header_t *ip0, *ip1;
- fib_index0 = ip6_main.fib_index_by_sw_if_index
- [vnet_buffer (b[0])->sw_if_index[dir]];
- fib_index1 = ip6_main.fib_index_by_sw_if_index
- [vnet_buffer (b[1])->sw_if_index[dir]];
-
ip0 = (ip6_header_t *) h0;
ip1 = (ip6_header_t *) h1;
@@ -255,12 +250,13 @@ urpf_inline (vlib_main_t * vm,
if (VLIB_TX == dir)
h0 += vnet_buffer (b[0])->ip.save_rewrite_length;
+ fib_index0 =
+ urpf_cfgs[af][dir][vnet_buffer (b[0])->sw_if_index[dir]].fib_index;
+
if (AF_IP4 == af)
{
const ip4_header_t *ip0;
- fib_index0 = ip4_main.fib_index_by_sw_if_index
- [vnet_buffer (b[0])->sw_if_index[dir]];
ip0 = (ip4_header_t *) h0;
lb_index0 = ip4_fib_forwarding_lookup (fib_index0,
@@ -275,8 +271,6 @@ urpf_inline (vlib_main_t * vm,
const ip6_header_t *ip0;
ip0 = (ip6_header_t *) h0;
- fib_index0 = ip6_main.fib_index_by_sw_if_index
- [vnet_buffer (b[0])->sw_if_index[dir]];
lb_index0 = ip6_fib_table_fwding_lookup (fib_index0,
&ip0->src_address);