udevstats: add support for dynamic vlans

Fixes: WIFI-12582
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-05-16 10:30:09 +02:00
parent 4688ba6996
commit e91f49bdbd
2 changed files with 16 additions and 0 deletions

View File

@@ -215,6 +215,21 @@ function run_service() {
},
args: {}
},
add_device: {
call: function(req) {
if (!req.args.device || !req.args.vlan)
return ubus.STATUS_INVALID_ARGUMENT;
if (!vlan_config[req.args.device])
vlan_config[req.args.device] = [];
push(vlan_config[req.args.device], [ req.args.vlan, "rx", "tx"]);
vlan_set_config(vlan_config);
return 0;
},
args: {
"device": "wlan0",
"vlan": 100,
}
},
reset: {
call: function(req) {
let old_config = vlan_config;