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

wait_netifd_ready() {
	/bin/ubus -t 30 wait_for `/sbin/uci show network | sed '/=interface/!d;s/\(network\)\.\(.*\)=\(.*\)/\1.\3.\2/'`
	/bin/systemd-notify --ready --status="Processing requests..." --pid=`systemctl -p MainPID show netifd | sed s/^.*=//`
}

start() {
	wait_netifd_ready &
	/sbin/netifd
}

stop() {
	/sbin/ifdown -a
	sleep 5

	killall netifd
}
