aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Valter <d-valter@yandex-team.com>2023-12-20 10:47:35 +0000
committerNeale Ranns <neale@graphiant.com>2024-06-19 00:50:49 +0000
commite95687b0d6f692ed0b27e0ff0876fbe61be6c4a3 (patch)
treefac96a485bbfafec378ff3c0202d85aa359044a7
parentdd6fb60f1794fc08ec40598a67dc70f942c200d1 (diff)
fib: fix ip drop path crashes
Do not mark drop paths as imported to avoid crashes on invalid table lookup. ``` vpp[8478]: /build/Vpp2310/source/src/vnet/fib/fib_table.c:35 (fib_table_get) assertion `! pool_is_free (ip4_main.fibs, _e)' fails #9 0x00007ff21785da1d in _clib_error () from /lib/x86_64-linux-gnu/libvppinfra.so.23.10 #10 0x00007ff218087698 in fib_table_get (index=4294967295, proto=FIB_PROTOCOL_IP4) at /build/Vpp2310/source/src/vnet/fib/fib_table.c:35 #11 0x00007ff218087a37 in fib_table_lookup_exact_match (fib_index=4294967295, prefix=0x7ff0eae0d354) at /build/Vpp2310/source/src/vnet/fib/fib_table.c:100 #12 0x00007ff2180bc938 in fib_attached_export_import (fib_entry=0x7ff0eceac3e0, export_fib=4294967295) at /build/Vpp2310/source/src/vnet/fib/fib_attached_export.c:264 #13 0x00007ff218098ade in fib_entry_post_flag_update_actions (fib_entry=0x7ff0eceac3e0, old_flags=FIB_ENTRY_FLAG_NONE, new_fib_index=4294967295) at /build/Vpp2310/source/src/vnet/fib/fib_entry.c:624 #14 0x00007ff218098b90 in fib_entry_post_install_actions (fib_entry=0x7ff0eceac3e0, source=FIB_SOURCE_API, old_flags=FIB_ENTRY_FLAG_NONE) at /build/Vpp2310/source/src/vnet/fib/fib_entry.c:674 #15 0x00007ff218098cce in fib_entry_create (fib_index=1, prefix=0x7ff0d3244d80, source=FIB_SOURCE_API, flags=FIB_ENTRY_FLAG_NONE, paths=0x7ff0eac15ab8) at /build/Vpp2310/source/src/vnet/fib/fib_entry.c:712 #16 0x00007ff218088db4 in fib_table_entry_update (fib_index=1, prefix=0x7ff0d3244d80, source=FIB_SOURCE_API, flags=FIB_ENTRY_FLAG_NONE, paths=0x7ff0eac15ab8) at /build/Vpp2310/source/src/vnet/fib/fib_table.c:799 #17 0x00007ff2180c026c in fib_api_route_add_del (is_add=1 '\001', is_multipath=0 '\000', fib_index=1, prefix=0x7ff0d3244d80, src=FIB_SOURCE_API, entry_flags=FIB_ENTRY_FLAG_NONE, rpaths=0x7ff0eac15ab8) at /build/Vpp2310/source/src/vnet/fib/fib_api.c:485 #18 0x00007ff217d4b6dd in ip_route_add_del_t_handler (mp=0x7ff0eb08b998, stats_index=0x7ff0d3244dc8) at /build/Vpp2310/source/src/vnet/ip/ip_api.c:718 #19 0x00007ff217d4b986 in vl_api_ip_route_add_del_t_handler (mp=0x7ff0eb08b998) at /build/Vpp2310/source/src/vnet/ip/ip_api.c:789 ``` Type: fix Fixes: 4b08632748727486e7ebfdcf4d992743595bc500 Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Change-Id: I647899533771c35f44c9ecde517a30f111b36ad9
-rw-r--r--src/vnet/fib/fib_entry_src.c4
-rw-r--r--test/test_ip4.py13
2 files changed, 17 insertions, 0 deletions
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index c79b745b5b5..8ddb967a328 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -1538,6 +1538,10 @@ fib_entry_flags_update (const fib_entry_t *fib_entry,
{
esrc->fes_entry_flags |= FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT;
}
+ if (rpath->frp_flags & FIB_ROUTE_PATH_DROP)
+ {
+ esrc->fes_entry_flags |= FIB_ENTRY_FLAG_NO_ATTACHED_EXPORT;
+ }
}
if (fib_route_attached_cross_table(fib_entry, rpath) &&
!(esrc->fes_entry_flags & FIB_ENTRY_FLAG_NO_ATTACHED_EXPORT))
diff --git a/test/test_ip4.py b/test/test_ip4.py
index a183b0ca0ba..5dd82f4aeeb 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -972,6 +972,19 @@ class TestIPNull(VppTestCase):
r2.remove_vpp_config()
rx = self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg1)
+ t = VppIpTable(self, 2, False)
+ t.add_vpp_config()
+ r3 = VppIpRoute(
+ self,
+ "1.1.1.0",
+ 31,
+ [VppRoutePath("0.0.0.0", 0xFFFFFFFF, type=FibPathType.FIB_PATH_TYPE_DROP)],
+ table_id=2,
+ )
+ r3.add_vpp_config()
+ r3.remove_vpp_config()
+ t.remove_vpp_config()
+
class TestIPDisabled(VppTestCase):
"""IPv4 disabled"""