diff mbox series

[v2,iproute2-next] ip route: print RTA_CACHEINFO if it exists

Message ID 20180530153009.4409-1-dsahern@kernel.org
State Accepted, archived
Delegated to: David Ahern
Headers show
Series [v2,iproute2-next] ip route: print RTA_CACHEINFO if it exists | expand

Commit Message

David Ahern May 30, 2018, 3:30 p.m. UTC
From: David Ahern <dsahern@gmail.com>

RTA_CACHEINFO can be sent for non-cloned routes. If the attribute is
present print it. Allows route dumps to print expires times for example
which can exist on FIB entries.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
v2
- leave print_cache_flags under r->rtm_flags & RTM_F_CLONED check

 ip/iproute.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Stephen Hemminger June 1, 2018, 8 p.m. UTC | #1
On Wed, 30 May 2018 08:30:09 -0700
dsahern@kernel.org wrote:

> From: David Ahern <dsahern@gmail.com>
> 
> RTA_CACHEINFO can be sent for non-cloned routes. If the attribute is
> present print it. Allows route dumps to print expires times for example
> which can exist on FIB entries.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
diff mbox series

Patch

diff --git a/ip/iproute.c b/ip/iproute.c
index 56dd9f25e38e..254d7abd2abf 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -899,17 +899,14 @@  int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 			   rta_getattr_u32(tb[RTA_UID]));
 
 	if (r->rtm_family == AF_INET) {
-		if (r->rtm_flags & RTM_F_CLONED) {
+		if (r->rtm_flags & RTM_F_CLONED)
 			print_cache_flags(fp, r->rtm_flags);
 
-			if (tb[RTA_CACHEINFO])
-				print_rta_cacheinfo(fp, RTA_DATA(tb[RTA_CACHEINFO]));
-		}
+		if (tb[RTA_CACHEINFO])
+			print_rta_cacheinfo(fp, RTA_DATA(tb[RTA_CACHEINFO]));
 	} else if (r->rtm_family == AF_INET6) {
-		if (r->rtm_flags & RTM_F_CLONED) {
-			if (tb[RTA_CACHEINFO])
-				print_rta_cacheinfo(fp, RTA_DATA(tb[RTA_CACHEINFO]));
-		}
+		if (tb[RTA_CACHEINFO])
+			print_rta_cacheinfo(fp, RTA_DATA(tb[RTA_CACHEINFO]));
 	}
 
 	if (tb[RTA_METRICS])