qos-scripts: fix uci callback handling

The previous callback code was fragile, dependent on some UCI callback
bugs and side-effects now fixed in master commit 73d8a6ab.

Update scripts to use callbacks where appropriate and necessary, while
using normal UCI config parsing for all else. This results in smaller,
simpler, more robust code. Use callbacks in generate.sh to only process
'interface' defaults and the varying entries for 'reclassify', 'default'
and 'classify' sections. Also switch qos-stat to use non-callback UCI
handling.

The current changes work independently of 73d8a6ab (i.e. both before and
after), and are consistent with UCI config parsing documentation.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
This commit is contained in:
Tony Ambardar
2018-06-08 04:34:00 -07:00
committed by Hans Dedecker
parent 7b74b40fe9
commit b701d78105
3 changed files with 29 additions and 29 deletions

View File

@@ -14,16 +14,17 @@ get_ifname() {
[ "$cfgt" = "interface" ] && config_get "$interface" ifname
}
config_cb() {
config_get TYPE "$CONFIG_SECTION" TYPE
qos_set_device() {
config_get TYPE "$1" TYPE
[ "interface" = "$TYPE" ] && {
config_get device "$CONFIG_SECTION" ifname
[ -z "$device" ] && device="$(get_ifname ${CONFIG_SECTION})"
config_set "$CONFIG_SECTION" device "$device"
config_get device "$1" ifname
[ -z "$device" ] && device="$(get_ifname $1)"
config_set "$1" device "$device"
}
}
config_load qos
config_foreach qos_set_device
print_comments() {
echo ''