Add sonic_fib_init plugin#232
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
hi @lolyu , is it too much to use a plugin to remove a route? is there a light weight option? For example, can we remove the route from vpp sai? Or can we add binary AP for fib_table_entry_special_remove? |
Hi @yue-fred-gao,
Actually there are three options in my mind:
The main reason to choose option 1 is 2 and 3 requires touching the upstream vpp codes, this is a specific sonic domain requirement to clean up the fib. |
|
I think we should take an approach that is generic and can be upstreamed to fdio. I know there are extra steps but in the long run it is worth it with lower maintenance cost and can benefit the community. |
sonic_fib_init: new VPP plugin to strip built-in 240.0.0.0/4 SPECIAL drop
VPP installs a FIB_SOURCE_SPECIAL drop entry for 240.0.0.0/4 (class E
reserved) into every IPv4 FIB at table creation time (see
ip4_fib_hash_load_specials). FIB_SOURCE_SPECIAL is the highest-priority
source in the FIB, so any route SONiC programs that covers this range
(e.g. an IP-in-IP decap tunnel destination, or a default route) is
silently pre-empted by the drop and the traffic is black-holed. This
breaks decap test cases that target 240.0.0.0/4.
fib_table_entry_special_remove()is the supported way to remove theentry, but it is a C-only API with no .api binding, so it cannot be
invoked from the SAI shim directly.
This plugin bridges that gap:
VLIB_MAIN_LOOP_ENTER_FUNCTION strips 240/4 from fib 0 (the default
VRF, created during VPP startup) exactly once, after all
VLIB_INIT_FUNCTIONs have run and before the main packet poll loop
begins.
sonic_fib_strip_specials { vrf_id }binary API lets the SAI shimrequest the same cleanup for VRFs created at runtime
(SAI virtual_router create -> ip_table_add_del). The handler
resolves vrf_id -> fib_index via fib_table_find() and applies the
strip; missing tables are reported via the autoreply status.
Plugin layout:
vppbld/plugins/sonic_fib_init/
sonic_fib_init.c - init + main-loop-enter hooks, API handler
sonic_fib_init.h - sonic_fib_init_main_t (msg_id_base)
sonic_fib_init.api - sonic_fib_strip_specials autoreply
CMakeLists.txt - add_vpp_plugin(sonic_fib_init ...)
FEATURE.yaml - feature documentation
Both startup.conf templates (docker-sonic-vpp, docker-syncd-vpp) are
updated to load sonic_fib_init_plugin.so.
Verification: