summaryrefslogtreecommitdiffstats
path: root/src/plugins/linux-cp/lcp_nl.h
diff options
context:
space:
mode:
authorPim van Pelt <pim@ipng.nl>2023-05-21 08:35:26 +0200
committerMatthew Smith <mgsmith@netgate.com>2023-06-05 15:27:21 +0000
commitaf4fa965e909db69ecde9deb6b7f9a53553aeccb (patch)
tree588f5a34dc78cb8ee19db3a68e82b7a28b05b1d1 /src/plugins/linux-cp/lcp_nl.h
parentce93f125d043b4c15ecd8cd747092f7bc9c796be (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.h')
-rw-r--r--src/plugins/linux-cp/lcp_nl.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/linux-cp/lcp_nl.h b/src/plugins/linux-cp/lcp_nl.h
index 7b2fccc29cd..41757e9b983 100644
--- a/src/plugins/linux-cp/lcp_nl.h
+++ b/src/plugins/linux-cp/lcp_nl.h
@@ -26,7 +26,8 @@ typedef void (*nl_rt_addr_cb_t) (struct rtnl_addr *ra);
typedef void (*nl_rt_addr_sync_cb_t) (void);
typedef void (*nl_rt_neigh_cb_t) (struct rtnl_neigh *rr);
typedef void (*nl_rt_neigh_sync_cb_t) (void);
-typedef void (*nl_rt_route_cb_t) (struct rtnl_route *rn);
+typedef void (*nl_rt_route_add_cb_t) (struct rtnl_route *rn, int is_replace);
+typedef void (*nl_rt_route_del_cb_t) (struct rtnl_route *rn);
typedef void (*nl_rt_route_sync_cb_t) (void);
#define NL_RT_COMMON uword is_mp_safe
@@ -73,12 +74,19 @@ typedef struct nl_rt_neigh_sync_t_
nl_rt_neigh_sync_cb_t cb;
} nl_rt_neigh_sync_t;
-typedef struct nl_rt_route_t_
+typedef struct nl_rt_route_add_t_
{
NL_RT_COMMON;
- nl_rt_route_cb_t cb;
-} nl_rt_route_t;
+ nl_rt_route_add_cb_t cb;
+} nl_rt_route_add_t;
+
+typedef struct nl_rt_route_del_t_
+{
+ NL_RT_COMMON;
+
+ nl_rt_route_del_cb_t cb;
+} nl_rt_route_del_t;
typedef struct nl_rt_route_sync_t_
{
@@ -103,8 +111,8 @@ typedef struct nl_vft_t_
nl_rt_neigh_t nvl_rt_neigh_del;
nl_rt_neigh_sync_t nvl_rt_neigh_sync_begin;
nl_rt_neigh_sync_t nvl_rt_neigh_sync_end;
- nl_rt_route_t nvl_rt_route_add;
- nl_rt_route_t nvl_rt_route_del;
+ nl_rt_route_add_t nvl_rt_route_add;
+ nl_rt_route_del_t nvl_rt_route_del;
nl_rt_route_sync_t nvl_rt_route_sync_begin;
nl_rt_route_sync_t nvl_rt_route_sync_end;
} nl_vft_t;