[OpenWrt-Devel] 答复: [RFC] netifd: Crash when netifd reload is handled during netifd startup

陈维扬 chenweiyang at xiaomi.com
Tue Jun 24 07:31:54 EDT 2014


Hi,

That commit was intended to fix a bug report by me. I also attached a patch with my issue:

diff --git a/package/netifd/files/sbin/ifup b/package/netifd/files/sbin/ifup
index af3aaa8..15c0c8e 100755
--- a/package/netifd/files/sbin/ifup
+++ b/package/netifd/files/sbin/ifup
@@ -35,7 +35,7 @@ while :; do
-[ "$modes" = "down up" ] && ubus call network reload
+[ "$modes" = "down up" ] && ubus call network reload && sleep 1
 if [ -n "$ifup_all" ]; then
        for interface in `ubus -S list 'network.interface.*'`; do
                if_call "${interface##network.interface.}"

This will fix the ifup script and leave netifd's deferred reload untouched. 


________________________________________
发件人: openwrt-devel [openwrt-devel-bounces at lists.openwrt.org] 代表 Hans Dedecker [dedeckeh at gmail.com]
发送时间: 2014年6月24日 18:46
收件人: openwrt-devel at lists.openwrt.org
主题: [OpenWrt-Devel] [RFC] netifd: Crash when netifd reload is handled   during netifd startup

Netifd is crashing when when a network reload (ubus call network reload) is handled during the parsing of the network config in the function config_init_all (called from main) at startup.
As an ubus_invoke function call is issued when the interfaces are created; ubus will also process the pending ubus calls in this case the network reload during the invoke.
As netifd_reload calls again config_init_all network config will be parsed again; on return from netifd_reload the original config_init_all function call will continue but will crash as references hold to interface/device/etc ... lists are not correct anymore.
This potential problem has always been present but due to netifd_reload timing behavior change in netifd commit 5db02763d61785529bef538f196c180e968b7c26 this problem can easily be triggered.
To solve the issue I was thinking about deferring the network reload when the function config_init_all is parsing the config.
Any opinion if this is the correct way to go or any other alternatives ?
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list