1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Set IPv6 status using settings and fix wizard look

This commit is contained in:
Ycarus 2018-10-26 16:51:30 +02:00
parent 2a46f7ee4a
commit d30b6452dd
3 changed files with 36 additions and 7 deletions

View file

@ -141,9 +141,9 @@ function wizard_add()
ucic:set("network",intf,"netmask",netmask)
ucic:set("network",intf,"gateway",gateway)
local downloadspeed = luci.http.formvalue("cbid.sqm.%s.download" % intf) or ""
local uploadspeed = luci.http.formvalue("cbid.sqm.%s.upload" % intf) or ""
if downloadspeed ~= "" and uploadspeed ~= "" then
local downloadspeed = luci.http.formvalue("cbid.sqm.%s.download" % intf) or "0"
local uploadspeed = luci.http.formvalue("cbid.sqm.%s.upload" % intf) or "0"
if downloadspeed ~= "0" and uploadspeed ~= "0" then
ucic:set("sqm",intf,"download",downloadspeed)
ucic:set("sqm",intf,"upload",uploadspeed)
ucic:set("sqm",intf,"enabled","1")

View file

@ -198,7 +198,7 @@ end
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
<br />
<div class="cbi-value-description">
<%:Set value between 80-95% of max download speed link. Empty to disable.%>
<%:Set value between 80-95% of max download speed link. 0 to disable.%>
</div>
</div>
</div>
@ -207,9 +207,9 @@ end
<div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
<br />
</div>
<div class="cbi-value-description">
<%:Set value between 80-95% of max upload speed link. Empty to disable.%>
<div class="cbi-value-description">
<%:Set value between 80-95% of max upload speed link. 0 to disable.%>
</div>
</div>
</div>
</fieldset>

View file

@ -19,6 +19,31 @@ omr_intf_set() {
uci -q set openmptcprouter.$1=interface
}
set_ipv6_state() {
local disable_ipv6=$1
sysctl -w net.ipv6.conf.all.disable_ipv6=$disable_ipv6
sed -i 's:^net.ipv6.conf.all.disable_ipv6=[0-9]*:net.ipv6.conf.all.disable_ipv6=$disable_ipv6:' /etc/sysctl.d/zzz_openmptcprouter.conf
uci -q set firewall.@defaults[0].disable_ipv6=$disable_ipv6
uci -q commit firewall
if [ "$disable_ipv6" == "1" ]; then
uci -q set dhcp.lan.ra_default="0"
fi
if [ "$disable_ipv6" == "1" ]; then
uci -q del dhcp.lan.dhcpv6
uci -q del dhcp.lan.ra
uci -q del dhcp.lan.ra_default
uci -q set shadowsocks-libev.hi.local_address="0.0.0.0"
else
uci -q set shadowsocks-libev.hi.local_address="::"
fi
uci -q commit dhcp
if [ "$disable_ipv6" == "1" ]; then
/etc/init.d/odhcpd stop >/dev/null 2>&1
/etc/init.d/odhcpd disable >/dev/null 2>&1
fi
}
start_service() {
local scaling_min_freq scaling_max_freq
@ -46,6 +71,10 @@ start_service() {
echo $scaling_governor > $c/scaling_governor
done
}
config_get disable_ipv6 settings disable_ipv6 "0"
if [ "$(sysctl net.ipv6.conf.all.disable_ipv6 | tr -d '\n')" != "$disable_ipv6" ]; then
set_ipv6_state $disable_ipv6
fi
# 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