mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 21:43:56 +08:00
🌈 Sync 2026-09-29 11:54:37
This commit is contained in:
1 parent
eb664281f6
commit
7eac2a209f
44 files changed
+1356
-869
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rpcd-mod-luci
|
||||
PKG_VERSION:=20240305
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
@@ -747,6 +747,19 @@ static int get_rates(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
}
|
||||
blobmsg_close_table(&result, totals);
|
||||
|
||||
void *traffic = blobmsg_open_table(&result, "traffic");
|
||||
avl_for_each_element(&hosts, host, avl) {
|
||||
if (!host->available && !sampled) continue;
|
||||
char mac[18];
|
||||
snprintf(mac, sizeof(mac), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
host->mac[0], host->mac[1], host->mac[2], host->mac[3], host->mac[4], host->mac[5]);
|
||||
void *entry = blobmsg_open_table(&result, mac);
|
||||
blobmsg_add_u64(&result, "upload", host->total[0]);
|
||||
blobmsg_add_u64(&result, "download", host->total[1]);
|
||||
blobmsg_close_table(&result, entry);
|
||||
}
|
||||
blobmsg_close_table(&result, traffic);
|
||||
|
||||
void *connections = blobmsg_open_table(&result, "connections");
|
||||
if (sampled && !failure && now - sampled < 3 * SAMPLE_MS) {
|
||||
avl_for_each_element(&hosts, host, avl) {
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
`luci.client-rates get` accepts up to 1024 IP addresses and returns cached upload
|
||||
and download bytes/second for each address, plus cumulative upload + download
|
||||
bytes keyed by MAC in `totals`. It reads `NETLINK_NETFILTER` connection
|
||||
bytes keyed by MAC in `totals`. The `traffic` table also exposes cumulative
|
||||
`upload` and `download` bytes per MAC, each combining IPv4 and IPv6. The homepage
|
||||
displays upload / download and sorts by their sum. It reads `NETLINK_NETFILTER` connection
|
||||
counters; it never installs packet-filter rules or resets kernel counters.
|
||||
|
||||
On QSDK, ECM's NSS/SFE/PPE statistics synchronization updates these conntrack
|
||||
|
||||
@@ -33,6 +33,13 @@ assert.equal(view.rateValue(view.clientAddresses(lease,hints),totals,'total',mac
|
||||
assert.equal(view.rateValue(['192.168.0.2'],totals,'total',mac)[0],123456);
|
||||
assert.equal(view.rateValue([],totals,'total',mac.toLowerCase())[0],123456);
|
||||
assert.equal(view.rateValue([],{},'total',mac)[1],'-');
|
||||
const split = {traffic:{[mac]:{upload:1200,download:12200}}};
|
||||
assert.deepEqual(view.rateValue([], split, 'total', mac.toLowerCase()),
|
||||
[13400, '%1024.2mB'.format(1200) + ' / ' + '%1024.2mB'.format(12200)]);
|
||||
assert.equal(view.rateValue([], {traffic:{[mac]:{upload:0,download:0}}}, 'total', mac)[0], 0);
|
||||
assert.equal(view.rateValue([], {traffic:{[mac]:{upload:0,download:50}}}, 'total', mac)[1],
|
||||
'%1024.2mB'.format(0) + ' / ' + '%1024.2mB'.format(50));
|
||||
|
||||
assert.equal(view.rateValue([], {totals:{[mac]:0}}, 'total',mac)[0],0);
|
||||
assert.deepEqual(view.rateValue([], {connections:{[mac]:12}}, 'connections', mac), [12,'12']);
|
||||
assert.deepEqual(view.rateValue([], {connections:{[mac]:0}}, 'connections', mac), [0,'0']);
|
||||
|
||||
Reference in new issue
Block a user