]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ip route: print RTA_CACHEINFO if it exists
authorDavid Ahern <dsahern@gmail.com>
Wed, 30 May 2018 15:30:09 +0000 (08:30 -0700)
committerDavid Ahern <dsahern@gmail.com>
Fri, 1 Jun 2018 15:18:31 +0000 (08:18 -0700)
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>
ip/iproute.c

index cbc43e2b691ac8d8e8c5d0dec67649b2f790fb14..78c8085b473a6fd34415248f7f6a8bfa625aeca7 100644 (file)
@@ -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])