From b3d33786662444a3750f9b647cd77c7369b171db Mon Sep 17 00:00:00 2001
From: Jakob Olsson <jakob.olsson@iopsys.eu>
Date: Wed, 4 Sep 2019 14:44:31 +0200
Subject: [PATCH] add rx/tx bytes to status output

---
 wifimngr.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/wifimngr.c b/wifimngr.c
index 887e9ac..9425921 100644
--- a/wifimngr.c
+++ b/wifimngr.c
@@ -230,6 +230,7 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
 	char cpr_buf[32] = {0};
 	struct bss b;
 	struct blob_buf bb;
+	struct wifi_ap_stats ap_stats;
 
 	memset(&bb, 0, sizeof(bb));
 	blobmsg_parse(wl_vif_policy, __WL_MAX, tb, blob_data(msg), blob_len(msg));
@@ -283,6 +284,12 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
 		blobmsg_add_u32(&bb, "bssload", b.load.utilization);
 	}
 
+	memset(&ap_stats, 0, sizeof(struct wifi_ap_stats));
+	wifi_get_ap_stats(wldev, &ap_stats);
+
+	blobmsg_add_u32(&bb, "rx_bytes", ap_stats.rx_bytes);
+	blobmsg_add_u32(&bb, "tx_bytes", ap_stats.tx_bytes);
+
 	ubus_send_reply(ctx, req, bb.head);
 	blob_buf_free(&bb);
 
-- 
GitLab