On 5/15/19 9:56 AM, David Ahern wrote:
> You can add a 'cache' hook to ip/iproute.c to delete the cached routes
> and verify that it works. I seem to have misplaced my patch to do it.

found it.
From 7a328753a93321a07a5228fb32ed881d82d7a537 Mon Sep 17 00:00:00 2001
From: David Ahern <dsah...@gmail.com>
Date: Mon, 6 May 2019 08:09:01 -0700
Subject: [PATCH iproute2-next] route: Add cache keyword to iproute_modify

Kernel supports deleting cached routes (e.g., exceptions). Add cache
keyword to iproute_modify to set RTM_F_CLONED in the request.

Signed-off-by: David Ahern <dsah...@gmail.com>
---
 ip/iproute.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index 2b3dcc5dbd53..d7a812a39047 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -74,7 +74,7 @@ static void usage(void)
                "       ip route { add | del | change | append | replace } 
ROUTE\n"
                "SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX 
]\n"
                "            [ table TABLE_ID ] [ vrf NAME ] [ proto RTPROTO 
]\n"
-               "            [ type TYPE ] [ scope SCOPE ]\n"
+               "            [ type TYPE ] [ scope SCOPE ] [ cache ]\n"
                "ROUTE := NODE_SPEC [ INFO_SPEC ]\n"
                "NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]\n"
                "             [ table TABLE_ID ] [ proto RTPROTO ]\n"
@@ -1444,6 +1444,8 @@ static int iproute_modify(int cmd, unsigned int flags, 
int argc, char **argv)
                        if (fastopen_no_cookie != 1 && fastopen_no_cookie != 0)
                                invarg("\"fastopen_no_cookie\" value should be 
0 or 1\n", *argv);
                        rta_addattr32(mxrta, sizeof(mxbuf), 
RTAX_FASTOPEN_NO_COOKIE, fastopen_no_cookie);
+               } else if (!strcmp(*argv, "cache")) {
+                       req.r.rtm_flags |= RTM_F_CLONED;
                } else {
                        int type;
                        inet_prefix dst;
-- 
2.11.0

Reply via email to