summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/ip4_fib.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-04-02 15:02:16 +0000
committerOle Trøan <otroan@employees.org>2020-04-14 09:40:48 +0000
commitd724e4f43b1d143a3f35492bce72fdc3e8af553e (patch)
treeb458929e250006e18a7e0615a573e68b6e1a8178 /src/vnet/fib/ip4_fib.h
parentdc3e9664858df680accca7324299b633bf60397d (diff)
urpf: Unicast reverse Path Forwarding (plugin)
Type: feature - move the IP4 code to plugin - add ip6 support - add suport for uRPF on TX - add tests Change-Id: I074c2debc486d3e79c12fad4b8dbd72c41e841a0 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/ip4_fib.h')
-rw-r--r--src/vnet/fib/ip4_fib.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/fib/ip4_fib.h b/src/vnet/fib/ip4_fib.h
index ff00b4170c4..7d17baf2545 100644
--- a/src/vnet/fib/ip4_fib.h
+++ b/src/vnet/fib/ip4_fib.h
@@ -172,6 +172,30 @@ ip4_fib_forwarding_lookup (u32 fib_index,
return (ip4_fib_mtrie_leaf_get_adj_index(leaf));
}
+static_always_inline void
+ip4_fib_forwarding_lookup_x2 (u32 fib_index0,
+ u32 fib_index1,
+ const ip4_address_t * addr0,
+ const ip4_address_t * addr1,
+ index_t *lb0,
+ index_t *lb1)
+{
+ ip4_fib_mtrie_leaf_t leaf[2];
+ ip4_fib_mtrie_t * mtrie[2];
+
+ mtrie[0] = &ip4_fib_get(fib_index0)->mtrie;
+ mtrie[1] = &ip4_fib_get(fib_index1)->mtrie;
+
+ leaf[0] = ip4_fib_mtrie_lookup_step_one (mtrie[0], addr0);
+ leaf[1] = ip4_fib_mtrie_lookup_step_one (mtrie[1], addr1);
+ leaf[0] = ip4_fib_mtrie_lookup_step (mtrie[0], leaf[0], addr0, 2);
+ leaf[1] = ip4_fib_mtrie_lookup_step (mtrie[1], leaf[1], addr1, 2);
+ leaf[0] = ip4_fib_mtrie_lookup_step (mtrie[0], leaf[0], addr0, 3);
+ leaf[1] = ip4_fib_mtrie_lookup_step (mtrie[1], leaf[1], addr1, 3);
+
+ *lb0 = ip4_fib_mtrie_leaf_get_adj_index(leaf[0]);
+ *lb1 = ip4_fib_mtrie_leaf_get_adj_index(leaf[1]);
+}
#endif