net-tools/0003-Add-support-for-EiB-in-interface.c.patch

48 lines
1.4 KiB
Diff

From 1198aae1c5d434f6e9bc6a0af8060e82eed3a6c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
Date: Sat, 17 Jun 2017 22:21:34 +0200
Subject: [PATCH 3/7] Add support for EiB in interface.c
Taken from Fedora package
---
lib/interface.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/interface.c b/lib/interface.c
index 94e554b..7e326a0 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -864,10 +864,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) {
@@ -885,10 +885,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) {
--
2.13.1