[OpenWrt-Devel] [PATCH 1/1] netifd: add pre-up/down post-up/down callback handling

Florian Eckert fe at dev.tdt.de
Fri Mar 20 10:21:00 EDT 2020


network
>> With this change we can decide if this is a user interaction with 
>> CLI/LuCI,
>> because with the new callback mechanism I can set/delete a uci config 
>> flag so
>> that the connection should really disconnected. And so does not 
>> restart on a
>> failed connetion tracking again because the uci config flag is not 
>> set.
>> 
>> Signed-off-by: Florian Eckert <fe at dev.tdt.de>
> netifd already tracks for every interface if the user requested it to 
> be
> enabled or not via the 'autostart' flag, which you can query via ubus.

I know this is done wit the uci option auto for this interface.
But if I disable this flag, then on the next boot this interface does 
not start
on boot anymore. I have to start this manual. So I think this is not an 
option.

> Is it enough for your use case to track that flag?

As far as I can tell at this point, it's not an option to use this flag.

> If not, please go into more detail, because I don't think hacking

In the LuCI and in the CLI the command ifup/ifdown is used, if the
user wants to start/stop this interface explicitly manual.
The auto option is not touched.

The ifup/ifdown script executes an ubus call to set the interface 
up/down [1].
After the execution is preformed by netifd (proto) then the hotplug 
scripts are
execute with different ACTION (up/down/ifup-failed.

If I want to know if the Command is execute by an
user interaction by the CLI (ifup/ifdown) or LuCI [2][3] the only 
possibility
I have is to hook into the ifup/ifdown command.

I would also like to point out that debian also has this possibility [4] 
in the
network configuration.

- Florian

[1] 
https://github.com/openwrt/openwrt/blob/master/package/network/config/netifd/files/sbin/ifup#L9
[2] 
https://github.com/openwrt/luci/blob/6c167ea880bd29c69730d802c48ebc2c0253b905/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js#L991
[3] 
https://github.com/openwrt/luci/blob/6c167ea880bd29c69730d802c48ebc2c0253b905/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js#L997
[4] https://wiki.debian.org/NetworkConfiguration

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list