Upstream-Status: Backport From a7c2882461581747488e5aabf10d19b46b371a01 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 27 Feb 2013 07:26:17 -0800 Subject: [PATCH] ip: fix ipv6 ntable on ppc64 Add casts to handle printf format when sizeof(unsigned long long) != sizeof(__u64) --- ip/ipntable.c | 56 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/ip/ipntable.c b/ip/ipntable.c index 5751114..56ad001 100644 --- a/ip/ipntable.c +++ b/ip/ipntable.c @@ -432,7 +432,7 @@ int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) } if (tb[NDTA_GC_INTERVAL]) { __u64 gc_int = rta_getattr_u64(tb[NDTA_GC_INTERVAL]); - fprintf(fp, "gc_int %llu ", gc_int); + fprintf(fp, "gc_int %llu ", (unsigned long long) gc_int); } if (ret) @@ -485,15 +485,18 @@ int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) } if (tpb[NDTPA_REACHABLE_TIME]) { __u64 reachable = rta_getattr_u64(tpb[NDTPA_REACHABLE_TIME]); - fprintf(fp, "reachable %llu ", reachable); + fprintf(fp, "reachable %llu ", + (unsigned long long) reachable); } if (tpb[NDTPA_BASE_REACHABLE_TIME]) { __u64 breachable = rta_getattr_u64(tpb[NDTPA_BASE_REACHABLE_TIME]); - fprintf(fp, "base_reachable %llu ", breachable); + fprintf(fp, "base_reachable %llu ", + (unsigned long long) breachable); } if (tpb[NDTPA_RETRANS_TIME]) { __u64 retrans = rta_getattr_u64(tpb[NDTPA_RETRANS_TIME]); - fprintf(fp, "retrans %llu ", retrans); + fprintf(fp, "retrans %llu ", + (unsigned long long) retrans); } fprintf(fp, "%s", _SL_); @@ -502,11 +505,13 @@ int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) if (tpb[NDTPA_GC_STALETIME]) { __u64 gc_stale = rta_getattr_u64(tpb[NDTPA_GC_STALETIME]); - fprintf(fp, "gc_stale %llu ", gc_stale); + fprintf(fp, "gc_stale %llu ", + (unsigned long long) gc_stale); } if (tpb[NDTPA_DELAY_PROBE_TIME]) { __u64 delay_probe = rta_getattr_u64(tpb[NDTPA_DELAY_PROBE_TIME]); - fprintf(fp, "delay_probe %llu ", delay_probe); + fprintf(fp, "delay_probe %llu ", + (unsigned long long) delay_probe); } if (tpb[NDTPA_QUEUE_LEN]) { __u32 queue = rta_getattr_u32(tpb[NDTPA_QUEUE_LEN]); @@ -536,11 +541,13 @@ int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) if (tpb[NDTPA_ANYCAST_DELAY]) { __u64 anycast_delay = rta_getattr_u64(tpb[NDTPA_ANYCAST_DELAY]); - fprintf(fp, "anycast_delay %llu ", anycast_delay); + fprintf(fp, "anycast_delay %llu ", + (unsigned long long) anycast_delay); } if (tpb[NDTPA_PROXY_DELAY]) { __u64 proxy_delay = rta_getattr_u64(tpb[NDTPA_PROXY_DELAY]); - fprintf(fp, "proxy_delay %llu ", proxy_delay); + fprintf(fp, "proxy_delay %llu ", + (unsigned long long) proxy_delay); } if (tpb[NDTPA_PROXY_QLEN]) { __u32 pqueue = rta_getattr_u32(tpb[NDTPA_PROXY_QLEN]); @@ -548,7 +555,8 @@ int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) } if (tpb[NDTPA_LOCKTIME]) { __u64 locktime = rta_getattr_u64(tpb[NDTPA_LOCKTIME]); - fprintf(fp, "locktime %llu ", locktime); + fprintf(fp, "locktime %llu ", + (unsigned long long) locktime); } fprintf(fp, "%s", _SL_); @@ -560,28 +568,38 @@ int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) fprintf(fp, " "); fprintf(fp, "stats "); - fprintf(fp, "allocs %llu ", ndts->ndts_allocs); - fprintf(fp, "destroys %llu ", ndts->ndts_destroys); - fprintf(fp, "hash_grows %llu ", ndts->ndts_hash_grows); + fprintf(fp, "allocs %llu ", + (unsigned long long) ndts->ndts_allocs); + fprintf(fp, "destroys %llu ", + (unsigned long long) ndts->ndts_destroys); + fprintf(fp, "hash_grows %llu ", + (unsigned long long) ndts->ndts_hash_grows); fprintf(fp, "%s", _SL_); fprintf(fp, " "); - fprintf(fp, "res_failed %llu ", ndts->ndts_res_failed); - fprintf(fp, "lookups %llu ", ndts->ndts_lookups); - fprintf(fp, "hits %llu ", ndts->ndts_hits); + fprintf(fp, "res_failed %llu ", + (unsigned long long) ndts->ndts_res_failed); + fprintf(fp, "lookups %llu ", + (unsigned long long) ndts->ndts_lookups); + fprintf(fp, "hits %llu ", + (unsigned long long) ndts->ndts_hits); fprintf(fp, "%s", _SL_); fprintf(fp, " "); - fprintf(fp, "rcv_probes_mcast %llu ", ndts->ndts_rcv_probes_mcast); - fprintf(fp, "rcv_probes_ucast %llu ", ndts->ndts_rcv_probes_ucast); + fprintf(fp, "rcv_probes_mcast %llu ", + (unsigned long long) ndts->ndts_rcv_probes_mcast); + fprintf(fp, "rcv_probes_ucast %llu ", + (unsigned long long) ndts->ndts_rcv_probes_ucast); fprintf(fp, "%s", _SL_); fprintf(fp, " "); - fprintf(fp, "periodic_gc_runs %llu ", ndts->ndts_periodic_gc_runs); - fprintf(fp, "forced_gc_runs %llu ", ndts->ndts_forced_gc_runs); + fprintf(fp, "periodic_gc_runs %llu ", + (unsigned long long) ndts->ndts_periodic_gc_runs); + fprintf(fp, "forced_gc_runs %llu ", + (unsigned long long) ndts->ndts_forced_gc_runs); fprintf(fp, "%s", _SL_); } -- 1.7.9.7