mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 19:11:51 +00:00
56 lines
No EOL
1.7 KiB
Bash
Executable file
56 lines
No EOL
1.7 KiB
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
|
|
START=5
|
|
|
|
USE_PROCD=1
|
|
|
|
omr_intf_del() {
|
|
uci -q delete openmptcprouter.$1
|
|
}
|
|
omr_intf_set() {
|
|
config_get multipath "$1" multipath
|
|
config_get ifname "$1" ifname
|
|
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ -n "$(echo $ifname | grep usb)" ] && {
|
|
uci -q set openmptcprouter.settings.scaling_min_freq=800000
|
|
uci -q set openmptcprouter.settings.scaling_max_freq=800000
|
|
}
|
|
[ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "omrvpn" ] && [ "$1" != "glorytun" ] && return
|
|
uci -q set openmptcprouter.$1=interface
|
|
}
|
|
|
|
start_service() {
|
|
local scaling_min_freq scaling_max_freq
|
|
|
|
config_load openmptcprouter
|
|
config_foreach omr_intf_del interface
|
|
config_load network
|
|
config_foreach omr_intf_set interface
|
|
|
|
config_load openmptcprouter
|
|
config_get scaling_min_freq settings scaling_min_freq
|
|
[ -n "$scaling_min_freq" ] && {
|
|
for c in $(ls -d /sys/devices/system/cpu/cpufreq/policy[0-9]*); do
|
|
echo $scaling_min_freq > $c/scaling_min_freq
|
|
done
|
|
}
|
|
config_get scaling_max_freq settings scaling_max_freq
|
|
[ -n "$scaling_max_freq" ] && {
|
|
for c in $(ls -d /sys/devices/system/cpu/cpufreq/policy[0-9]*); do
|
|
echo $scaling_max_freq > $c/scaling_max_freq
|
|
done
|
|
}
|
|
config_get scaling_governor settings scaling_governor
|
|
[ -n "$scaling_governor" ] && {
|
|
for c in $(ls -d /sys/devices/system/cpu/cpufreq/policy[0-9]*); do
|
|
echo $scaling_governor > $c/scaling_governor
|
|
done
|
|
}
|
|
# remove sysctl already defined in /etc/sysctl.d/
|
|
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' /etc/sysctl.conf
|
|
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' /etc/sysctl.d/10-default.conf
|
|
}
|
|
|
|
reload_service() {
|
|
rc_procd start_service
|
|
return 0
|
|
} |