[git commit] ip route: make cache printing a bit more similar to upstream

Denys Vlasenko vda.linux at googlemail.com
Tue Jul 1 10:54:00 UTC 2025


commit: https://git.busybox.net/busybox/commit/?id=58adc7b5278f1d68dca0d5e303fe48e015f7b7bd
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
print_route                                         1573    1565      -8

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/libiproute/iproute.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index cd77f642f..a30f070eb 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -302,24 +302,22 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
 		printf("notify ");
 	}
 
-	if (r->rtm_family == AF_INET6) {
-		struct rta_cacheinfo *ci = NULL;
-		if (tb[RTA_CACHEINFO]) {
-			ci = RTA_DATA(tb[RTA_CACHEINFO]);
-		}
-		if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) {
+	if (r->rtm_family == AF_INET || r->rtm_family == AF_INET6) {
+		if (r->rtm_family == AF_INET) {
 			if (r->rtm_flags & RTM_F_CLONED) {
 				printf("%c    cache ", _SL_);
+				/* upstream: print_cache_flags() prints more here */
 			}
+		}
+		if (tb[RTA_CACHEINFO]) {
+			struct rta_cacheinfo *ci = RTA_DATA(tb[RTA_CACHEINFO]);
 			if (ci->rta_expires) {
 				printf(" expires %dsec", ci->rta_expires / get_hz());
 			}
 			if (ci->rta_error != 0) {
 				printf(" error %d", ci->rta_error);
 			}
-		} else if (ci) {
-			if (ci->rta_error != 0)
-				printf(" error %d", ci->rta_error);
+			/* upstream: print_rta_cacheinfo() prints more here */
 		}
 	}
 	if (tb[RTA_IIF] && G_filter.iif == 0) {


More information about the busybox-cvs mailing list