diff options
author | Pim van Pelt <pim@ipng.nl> | 2023-05-21 08:35:26 +0200 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2023-06-05 15:27:21 +0000 |
commit | af4fa965e909db69ecde9deb6b7f9a53553aeccb (patch) | |
tree | 588f5a34dc78cb8ee19db3a68e82b7a28b05b1d1 /src/plugins/linux-cp/lcp_nl.c | |
parent | ce93f125d043b4c15ecd8cd747092f7bc9c796be (diff) |
linux-cp: Fix add vs update on routes
Linux uses NLM_F_REPLACE in the netlink message to signal a FIB update
The code invariably does a FIB update for IPv4 and a addition for IPv6.
Without this fix, the following:
ip route add 2001:db8::/48 via 2001:db8::1
ip route replace 2001:db8::/48 via 2001:db8::2
ends up as two separate FIB entries in VPP. With the fix, there will be one FIB entry (the second one with nexthop ::2).
Type: fix
Change-Id: I8f98d6ded52ae0c60bfddaa7fc39acbbaa19d34a
Signed-off-by: Pim van Pelt <pim@ipng.nl>
Diffstat (limited to 'src/plugins/linux-cp/lcp_nl.c')
-rw-r--r-- | src/plugins/linux-cp/lcp_nl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/linux-cp/lcp_nl.c b/src/plugins/linux-cp/lcp_nl.c index 8f2bffd6e99..b4fef7e0b40 100644 --- a/src/plugins/linux-cp/lcp_nl.c +++ b/src/plugins/linux-cp/lcp_nl.c @@ -205,7 +205,10 @@ nl_route_del (struct rtnl_route *rr, void *arg) static void nl_route_add (struct rtnl_route *rr, void *arg) { - FOREACH_VFT (nvl_rt_route_add, rr); + nl_msg_info_t *msg_info = (nl_msg_info_t *) arg; + struct nlmsghdr *nlh = nlmsg_hdr (msg_info->msg); + + FOREACH_VFT_CTX (nvl_rt_route_add, rr, (nlh->nlmsg_flags & NLM_F_REPLACE)); } static void |