netifd: return error status in reload_service
[openwrt/openwrt.git] / package / network / config / netifd / files / etc / init.d / network
index 8a7427bacd585a96ffa82c3c2a3670ce9572cd12..6cd167d19d221dead5e0dc28a518c21c8c120dbb 100755 (executable)
@@ -21,19 +21,23 @@ start_service() {
        procd_set_param watch network.interface
        [ -e /proc/sys/kernel/core_pattern ] && {
                procd_set_param limits core="unlimited"
-               echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
        }
        procd_close_instance
 }
 
 reload_service() {
+       local rv=0
+
        init_switch
-       ubus call network reload
+       ubus call network reload || rv=1
        /sbin/wifi reload_legacy
+       return $rv
 }
 
 stop_service() {
        /sbin/wifi down
+       ifdown -a
+       sleep 1
 }
 
 service_running() {
@@ -50,8 +54,6 @@ validate_atm_bridge_section()
                'atmdev:uinteger:0' \
                'encaps:or("llc", "vc"):llc' \
                'payload:or("bridged", "routed"):bridged'
-
-       return $?
 }
 
 validate_route_section()
@@ -64,8 +66,6 @@ validate_route_section()
                'metric:uinteger' \
                'mtu:uinteger' \
                'table:or(range(0,65535),string)'
-
-       return $?
 }
 
 validate_route6_section()
@@ -77,8 +77,6 @@ validate_route6_section()
                'metric:uinteger' \
                'mtu:uinteger' \
                'table:or(range(0,65535),string)'
-
-       return $?
 }
 
 validate_rule_section()
@@ -94,8 +92,6 @@ validate_rule_section()
                'lookup:or(range(0,65535),string)' \
                'goto:range(0,65535)' \
                'action:or("prohibit", "unreachable", "blackhole", "throw")'
-
-       return $?
 }
 
 validate_rule6_section()
@@ -111,8 +107,6 @@ validate_rule6_section()
                'lookup:or(range(0,65535),string)' \
                'goto:range(0,65535)' \
                'action:or("prohibit", "unreachable", "blackhole", "throw")'
-
-       return $?
 }
 
 validate_switch_section()
@@ -122,8 +116,6 @@ validate_switch_section()
                'enable:bool' \
                'enable_vlan:bool' \
                'reset:bool'
-
-       return $?
 }
 
 validate_switch_vlan()
@@ -132,8 +124,6 @@ validate_switch_vlan()
                'device:string' \
                'vlan:uinteger' \
                'ports:list(ports)'
-
-       return $?
 }
 
 service_triggers()
@@ -151,15 +141,7 @@ service_triggers()
        procd_close_validate
 }
 
-restart() {
-       ifdown -a
-       sleep 1
-       trap '' TERM
-       stop "$@"
-       start "$@"
-}
-
 shutdown() {
        ifdown -a
-       stop
+       sleep 1
 }