mirror of
https://github.com/openwrt/openwrt.git
synced 2025-03-21 03:25:22 +00:00
unetd: cli: add unet_create/update/delete hook calls
Useful for upcoming cli modules that store created interfaces separately Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
7c04fa0328
commit
2055b73ba4
@ -153,6 +153,7 @@ function network_sign_data(ctx, name, network, pw_file, upload)
|
||||
|
||||
function network_create_uci(model, name, iface)
|
||||
{
|
||||
model.run_hook("unet_create", name, iface);
|
||||
let cur = uci.cursor(null, null, "");
|
||||
cur.set("network", name, "interface");
|
||||
for (let key, val in iface)
|
||||
@ -361,6 +362,7 @@ function network_create(ctx, argv, named) {
|
||||
function network_delete(ctx, argv) {
|
||||
let name = argv[0];
|
||||
let cur = uci.cursor(null, null, "");
|
||||
model.run_hook("unet_delete", name);
|
||||
if (!cur.delete("network", name))
|
||||
return ctx.command_failed("Command failed");
|
||||
|
||||
@ -378,6 +380,7 @@ function network_iface_save(ctx)
|
||||
if (!netdata.iface_changed)
|
||||
return;
|
||||
|
||||
model.run_hook("unet_update", network, netdata.iface);
|
||||
let cur = uci.cursor(null, null, "");
|
||||
let iface_orig = cur.get_all("network", network);
|
||||
for (let name, val in netdata.iface) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user