diff mbox series

[rpcd] iwinfo: update byte counter to 64bit

Message ID 20230528070251.530747-1-thomas@t-8ch.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [rpcd] iwinfo: update byte counter to 64bit | expand

Commit Message

Thomas Weißschuh May 28, 2023, 7:02 a.m. UTC
This prevents overflows after 4GiB or 2GiB if the number is interpreted
as signed integer, for example in the blobmbsg json serialization.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>

---

The needs as prerequisite:

  [PATCH iwinfo] lib: report byte counters as 64 bit values

  https://lists.openwrt.org/pipermail/openwrt-devel/2023-May/041056.html
---
 iwinfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: d97883005ffb5be251872c3e4abe04f71732f9bd
diff mbox series

Patch

diff --git a/iwinfo.c b/iwinfo.c
index ad2ba0d9ca3a..f8dec8005889 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -535,7 +535,7 @@  rpc_iwinfo_assoclist(struct ubus_context *ctx, struct ubus_object *obj,
 			e = blobmsg_open_table(&buf, "rx");
 			blobmsg_add_u64(&buf, "drop_misc", a->rx_drop_misc);
 			blobmsg_add_u32(&buf, "packets", a->rx_packets);
-			blobmsg_add_u32(&buf, "bytes", a->rx_bytes);
+			blobmsg_add_u64(&buf, "bytes", a->rx_bytes);
 			rpc_iwinfo_add_rateinfo(&a->rx_rate);
 			blobmsg_close_table(&buf, e);
 
@@ -543,7 +543,7 @@  rpc_iwinfo_assoclist(struct ubus_context *ctx, struct ubus_object *obj,
 			blobmsg_add_u32(&buf, "failed", a->tx_failed);
 			blobmsg_add_u32(&buf, "retries", a->tx_retries);
 			blobmsg_add_u32(&buf, "packets", a->tx_packets);
-			blobmsg_add_u32(&buf, "bytes", a->tx_bytes);
+			blobmsg_add_u64(&buf, "bytes", a->tx_bytes);
 			rpc_iwinfo_add_rateinfo(&a->tx_rate);
 			blobmsg_close_table(&buf, e);