Resolves: #1414765 - ifconfig inaccurately rounds exabytes

This commit is contained in:
Michal Ruprich 2017-01-24 12:44:34 +01:00
parent f53a2920b6
commit 7679752291
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,34 @@
diff --git a/lib/interface.c.old b/lib/interface.c
index c734c83..9c49a03 100644
--- a/lib/interface.c.old
+++ b/lib/interface.c
@@ -928,10 +928,10 @@ void ife_print_long(struct interface *ptr)
*/
rx = ptr->stats.rx_bytes;
short_rx = rx * 10;
- if (rx > 1125899906842624ull) {
- if (rx > (9223372036854775807ull / 10))
- short_rx = rx / 112589990684262ull;
- else
+ if (rx > 1152921504606846976ull) {
+ short_rx = rx / 115292150460684697ull;
+ Rext = "EiB";
+ } else if (rx > 1125899906842624ull) {
short_rx /= 1125899906842624ull;
Rext = "PiB";
} else if (rx > 1099511627776ull) {
@@ -949,10 +949,10 @@ void ife_print_long(struct interface *ptr)
}
tx = ptr->stats.tx_bytes;
short_tx = tx * 10;
- if (tx > 1125899906842624ull) {
- if (tx > (9223372036854775807ull / 10))
- short_tx = tx / 112589990684262ull;
- else
+ if (tx > 1152921504606846976ull) {
+ short_tx = tx / 115292150460684697ull;
+ Text = "EiB";
+ } else if (tx > 1125899906842624ull) {
short_tx /= 1125899906842624ull;
Text = "PiB";
} else if (tx > 1099511627776ull) {

View File

@ -3,7 +3,7 @@
Summary: Basic networking tools
Name: net-tools
Version: 2.0
Release: 0.40.%{checkout}%{?dist}
Release: 0.41.%{checkout}%{?dist}
License: GPLv2+
Group: System Environment/Base
URL: http://sourceforge.net/projects/net-tools/
@ -32,6 +32,9 @@ Patch3: net-tools-linux48.patch
# use all interfaces instead of default (#1003875)
Patch20: ether-wake-interfaces.patch
# use all interfaces instead of default (#1003875)
Patch21: net-tools-ifconfig-EiB.patch
BuildRequires: bluez-libs-devel
BuildRequires: gettext, libselinux
BuildRequires: libselinux-devel
@ -59,6 +62,7 @@ cp %SOURCE7 ./man/en_US
cp %SOURCE8 ./man/en_US
%patch20 -p1 -b .interfaces
%patch21 -p1 -b .ifconfig-EiB
touch ./config.h
@ -131,6 +135,9 @@ install -D -p -m 644 %{SOURCE9} %{buildroot}%{_unitdir}/arp-ethers.service
%attr(0644,root,root) %{_unitdir}/arp-ethers.service
%changelog
* Tue Jan 24 2017 Michal Ruprich <mruprich@redhat.com> - 2.0-0.41.20160912git
- Resolves: #1414765 - ifconfig inaccurately rounds exabytes
* Wed Oct 12 2016 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.40.20160912git
- fix build on linux-4.8