Files
domenico c06fb25d1f
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Initial commit
2025-06-24 14:35:53 +02:00

71 lines
1.0 KiB
Bash

#!/bin/sh
. /usr/share/libubox/jshn.sh
dev_status() {
tc -s qdisc sh dev "$1" root
echo
}
common_status() {
json_get_vars ifname ingress egress
[ -n "$ifname" ] || return
[ "$egress" -gt 0 ] && {
echo "egress status:"
dev_status "$ifname"
}
[ "$ingress" -gt 0 ] && {
echo "ingress status:"
dev_status "$(printf %.16s "ifb-$ifname")"
}
}
is_active() {
json_get_vars active
[ "${active:-0}" -gt 0 ]
}
device_status() {
local name="$2"
json_select "$name"
if is_active; then
status="active"
else
status="not found"
fi
echo "===== device $name: $status ====="
is_active && common_status
json_select ..
}
interface_status() {
local name="$2"
json_select "$name"
if is_active; then
status="active"
elif ubus -S -t 0 wait_for "network.interface.$name"; then
status="down"
else
status="not found"
fi
echo "===== interface $name: $status ====="
is_active && common_status
json_select ..
}
json_load "$(ubus call qosify status)"
json_for_each_item device_status devices
json_for_each_item interface_status interfaces