mir3c/squashfs-root/etc/init.d/network

77 lines
1.1 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
START=20
STOP=90
SERVICE_DAEMONIZE=1
SERVICE_WRITE_PID=1
# longloopd must be shutdown prior to interface change
stop_longloop() {
[ -x /usr/bin/longloopd ] && /usr/bin/longloopd stop
}
start() {
stop
# ensure netifd alive during OOM
echo '-1000' > /proc/$$/oom_score_adj
service_start /sbin/netifd
# wait for netifd start up
ubus -t 30 wait_for network.interface
setup_switch() { return 0; }
include /lib/network
{
/sbin/wifi down >/dev/null 2>&1
/sbin/wifi up
}
logger -t network -p9 "try to setup_switch and restart interfaces."
setup_switch
#for mt7621, seperate 16Queues into 2GMAC-scheduler to enable 1G+1G rate in HWNAT
[ -f /usr/bin/qdma ] && {
for i in `seq 14 1 15`; do
qdma sch $i 1
done
}||:
return 0 # always return ok
}
restart() {
stop_longloop
ifdown -a
sleep 1
start
}
shutdown() {
stop_longloop
ifdown wan
# sleep to let PPPoE clean up its sesssion.
for i in `seq 1 10`; do
pidof pppd >/dev/null || break
sleep 1
done
wifi down
ifdown -a
stop
}
stop() {
stop_longloop
service_stop /sbin/netifd
}
reload() {
ubus call network reload
/sbin/wifi down
/sbin/wifi up
}