[PATCH iproute2] ip route: Add annotation for replaced routes

Subsystems: the rest

STALE3703d

3 messages, 2 authors, 2016-06-14 · open the first message on its own page

[PATCH iproute2] ip route: Add annotation for replaced routes

From: David Ahern <hidden>
Date: 2016-06-09 20:05:49

If NLM_F_REPLACE flag is set then a route is replacing an existing route.
Prepend "Replaced " to these routes similar to how "Deleted " is added
to deleted routes.

Signed-off-by: David Ahern <redacted>
---
 ip/iproute.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/ip/iproute.c b/ip/iproute.c
index 8224d7ffa94b..28b47bcb7312 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -363,6 +363,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 			return 0;
 	}
 
+	if (n->nlmsg_flags & NLM_F_REPLACE)
+		fprintf(fp, "Replaced ");
 	if (n->nlmsg_type == RTM_DELROUTE)
 		fprintf(fp, "Deleted ");
 	if ((r->rtm_type != RTN_UNICAST || show_details > 0) && !filter.type)
-- 
2.1.4

Re: [PATCH iproute2] ip route: Add annotation for replaced routes

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2016-06-14 21:34:13

On Thu,  9 Jun 2016 13:05:42 -0700
David Ahern [off-list ref] wrote:
If NLM_F_REPLACE flag is set then a route is replacing an existing route.
Prepend "Replaced " to these routes similar to how "Deleted " is added
to deleted routes.

Signed-off-by: David Ahern <redacted>
Why just routes, there are several other places where Replaced entries could
be returned?

Re: [PATCH iproute2] ip route: Add annotation for replaced routes

From: David Ahern <hidden>
Date: 2016-06-14 21:37:04

On 6/14/16 3:34 PM, Stephen Hemminger wrote:
On Thu,  9 Jun 2016 13:05:42 -0700
David Ahern [off-list ref] wrote:
quoted
If NLM_F_REPLACE flag is set then a route is replacing an existing route.
Prepend "Replaced " to these routes similar to how "Deleted " is added
to deleted routes.

Signed-off-by: David Ahern <redacted>
Why just routes, there are several other places where Replaced entries could
be returned?
b/c that's the use case I was investigating. :-)

Will add the others.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help