#!/bin/sh /etc/rc.common

START=20
STOP=90

SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1

start() {
	stop
	[ -e /proc/sys/kernel/core_pattern ] && {
		ulimit -c unlimited
		echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
	}
	service_start /sbin/netifd

	setup_switch() { return 0; }

	include /lib/network
	setup_switch

	sleep 5

	/sbin/wifi down
	/sbin/wifi up
}

restart() {
	ifdown -a
	sleep 1
	start
}

shutdown() {
	ifdown -a
	stop
}

stop() {
	service_stop /sbin/netifd
}

reload() {
	ubus call network reload
	/sbin/wifi down
	/sbin/wifi up
}
