1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Add TCP Fast Open settings in OMR interface

This commit is contained in:
Ycarus 2019-01-17 20:43:53 +01:00
parent 9712f9219f
commit ac9b6cc681
5 changed files with 17 additions and 5 deletions

View file

@ -499,6 +499,11 @@ function settings_add()
luci.sys.exec("sysctl -w net.ipv4.tcp_syn_retries=%s" % tcp_syn_retries)
luci.sys.exec("sed -i 's:^net.ipv4.tcp_syn_retries=[0-9]*:net.ipv4.tcp_syn_retries=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_syn_retries)
-- Set tcp_fastopen
local tcp_fastopen = luci.http.formvalue("tcp_fastopen")
luci.sys.exec("sysctl -w net.ipv4.tcp_fastopen=%s" % tcp_fastopen)
luci.sys.exec("sed -i 's:^net.ipv4.tcp_fastopen=[0-3]*:net.ipv4.tcp_fastopen=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_fastopen)
-- Disable IPv6
local disable_ipv6 = luci.http.formvalue("disable_ipv6") or 0
set_ipv6_state(disable_ipv6)

View file

@ -89,10 +89,16 @@
<input type="text" name="tcp_syn_retries" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_syn_retries")):match(" %d+"))%>">
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:IPv4 TCP Fast Open%></label>
<div class="cbi-value-field">
<input type="text" name="tcp_fastopen" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_fastopen")):match(" %d+"))%>">
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Disable IPv6%></label>
<div class="cbi-value-field">
<input type="checkbox" name="disable_ipv6" class="cbi-input-checkbox" value="1" <% if tonumber((luci.sys.exec("sysctl net.ipv6.conf.all.disable_ipv6")):match(" %d+")) == 1 then %>checked<% end %>>
<input type="checkbox" name="disable_ipv6" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","disable_ipv6") == 1 then %>checked<% end %>>
</div>
</div>
<div class="cbi-value">

View file

@ -82,8 +82,8 @@ start_service() {
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' -e '/tcp_syn_retries/d' /etc/sysctl.conf
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' /etc/sysctl.d/10-default.conf
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' /etc/sysctl.conf
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' /etc/sysctl.d/10-default.conf
}
reload_service() {

View file

@ -1,4 +1,5 @@
net.ipv4.tcp_keepalive_time=7200
net.ipv6.conf.all.disable_ipv6=0
net.ipv4.tcp_fin_timeout=40
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_fastopen=3

View file

@ -31,7 +31,7 @@ net.ipv4.tcp_max_syn_backlog = 10240
# max timewait sockets held by system simultaneously
net.ipv4.tcp_max_tw_buckets = 10000
# turn on TCP Fast Open on both client and server side
net.ipv4.tcp_fastopen = 3
#net.ipv4.tcp_fastopen = 3
# TCP receive buffer
net.ipv4.tcp_rmem = 4096 87380 134217728
# TCP write buffer