diff --git a/ip/iproute.c b/ip/iproute.c index 6a2ea05f..bf0f31bd 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -493,6 +493,8 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) mxlock = *(unsigned*)RTA_DATA(mxrta[RTAX_LOCK]); for (i=2; i<= RTAX_MAX; i++) { + unsigned val; + if (mxrta[i] == NULL) continue; if (!hz) @@ -505,21 +507,31 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) if (mxlock & (1<= hz) - fprintf(fp, " %llums", val/hz); + fprintf(fp, " %llums", + (unsigned long long) val / hz); else - fprintf(fp, " %.2fms", (float)val/hz); + fprintf(fp, " %.2fms", + (double)val / hz); } } }