netifd: add support for the new ar8xxx MIB counters settings
[openwrt/staging/jogo.git] / package / network / config / netifd / files / etc / init.d / network
index 8a65f05b410cd4f61376ca8cf9a5b171d48e8943..2321a309a5ceabea034cf567d8b80850ff4f3b59 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()
@@ -121,9 +115,9 @@ validate_switch_section()
                'name:string' \
                'enable:bool' \
                'enable_vlan:bool' \
-               'reset:bool'
-
-       return $?
+               'reset:bool' \
+               'ar8xxx_mib_poll_interval:uinteger' \
+               'ar8xxx_mib_type:range(0,1)'
 }
 
 validate_switch_vlan()
@@ -132,37 +126,24 @@ validate_switch_vlan()
                'device:string' \
                'vlan:uinteger' \
                'ports:list(ports)'
-
-       return $?
 }
 
 service_triggers()
 {
-       procd_open_trigger
-       procd_add_config_trigger "config.change" "network" /etc/init.d/network reload
-       procd_add_config_trigger "config.change" "wireless" /etc/init.d/network reload
-       procd_close_trigger
+       procd_add_reload_trigger network wireless
 
        procd_open_validate
        validate_atm_bridge_section
        validate_route_section
-       validate_route6_section
+       [ -e /proc/sys/net/ipv6 ] && validate_route6_section
        validate_rule_section
-       validate_rule6_section
+       [ -e /proc/sys/net/ipv6 ] && validate_rule6_section
        validate_switch_section
        validate_switch_vlan
        procd_close_validate
 }
 
-restart() {
-       ifdown -a
-       sleep 1
-       trap '' TERM
-       stop "$@"
-       start "$@"
-}
-
 shutdown() {
        ifdown -a
-       stop
+       sleep 1
 }