Commit 654ae881 authored by Stephen Hemminger's avatar Stephen Hemminger

ip: fix format string when reading statistics

The tunnel code was doing sscanf(buf, "%ld", &x) where x was unsigned
long.
parent b08b5ff1
...@@ -354,7 +354,7 @@ static int do_tunnels_list(struct ip6_tnl_parm2 *p) ...@@ -354,7 +354,7 @@ static int do_tunnels_list(struct ip6_tnl_parm2 *p)
fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n"); fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
goto end; goto end;
} }
if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld", if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
&rx_bytes, &rx_packets, &rx_errs, &rx_drops, &rx_bytes, &rx_packets, &rx_errs, &rx_drops,
&rx_fifo, &rx_frame, &rx_multi, &rx_fifo, &rx_frame, &rx_multi,
&tx_bytes, &tx_packets, &tx_errs, &tx_drops, &tx_bytes, &tx_packets, &tx_errs, &tx_drops,
......
...@@ -419,7 +419,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p) ...@@ -419,7 +419,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p)
fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n"); fprintf(stderr, "Wrong format for /proc/net/dev. Giving up.\n");
goto end; goto end;
} }
if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld", if (sscanf(ptr, "%lu%lu%lu%lu%lu%lu%lu%*d%lu%lu%lu%lu%lu%lu%lu",
&rx_bytes, &rx_packets, &rx_errs, &rx_drops, &rx_bytes, &rx_packets, &rx_errs, &rx_drops,
&rx_fifo, &rx_frame, &rx_multi, &rx_fifo, &rx_frame, &rx_multi,
&tx_bytes, &tx_packets, &tx_errs, &tx_drops, &tx_bytes, &tx_packets, &tx_errs, &tx_drops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment