From: Adrian Pistol Date: Wed, 12 Apr 2023 16:03:50 +0000 (+0200) Subject: linux-cp: Handle RTA_VIA routes. X-Git-Tag: v23.10-rc0~86 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=8f78c935f8c3beb7042c1c19ccefaebcf784cecf;p=vpp.git linux-cp: Handle RTA_VIA routes. RTA_VIA allows routes to have a next-hop in a different address family. This commit makes linux-cp import those types of routes correctly, instead of importing the routes without a gateway. This uses rtnl_route_nh_get_gateway, which is available since libnl 3.4.0 (Oct. 9, 2017). Even Debian Stretch has it via backports. Type: fix Change-Id: I06297c700461ba7874eb8baf9355bd40990b3121 Signed-off-by: Adrian Pistol --- diff --git a/src/plugins/linux-cp/lcp_router.c b/src/plugins/linux-cp/lcp_router.c index 01eca9f2011..c5846cfca3c 100644 --- a/src/plugins/linux-cp/lcp_router.c +++ b/src/plugins/linux-cp/lcp_router.c @@ -1022,10 +1022,11 @@ lcp_router_route_path_parse (struct rtnl_nexthop *rnh, void *arg) path->frp_preference = ctx->preference; addr = rtnl_route_nh_get_gateway (rnh); + if (!addr) + addr = rtnl_route_nh_get_via (rnh); if (addr) - fproto = lcp_router_mk_addr46 (rtnl_route_nh_get_gateway (rnh), - &path->frp_addr); + fproto = lcp_router_mk_addr46 (addr, &path->frp_addr); else fproto = ctx->route_proto;