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

Felix Fietkau nbd at nbd.name
Fri Mar 20 07:12:43 EDT 2020


On 2020-03-19 13:03, Florian Eckert wrote:
> In some situations it is useful to execute callback scripts when
> manually triggering an ifdown/ifup event via the CLI/LuCI.
> 
> In my case I have a monitoring for a cellular connection.
> If this fails the command `ubus call network.interface up` is execute to
> restart the connection if a config option in uci of the interface
> (keep_connected) flag is set.
> 
> But for me to disconnect correctly I need to know about a user
> interaction with performed with CLI/LuCI.
> 
> 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.
Is it enough for your use case to track that flag?
If not, please go into more detail, because I don't think hacking
hotplug-call invocations into the ifup script is a good solution.

- Felix

_______________________________________________
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