From 795d9a0aa5ca721291b16cb93f69866aef70ca9f Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 25 Jul 2019 09:24:45 +0200 Subject: [PATCH] Fix disable fast open checkbox --- .../luasrc/controller/openmptcprouter.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 7fa59699c..95f10b55b 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -536,10 +536,10 @@ function settings_add() -- Set tcp_fastopen local tcp_fastopen = luci.http.formvalue("tcp_fastopen") - local fastopen = luci.http.formvalue("disablefastopen") or "0" - if fastopen == "0" then + local disablefastopen = luci.http.formvalue("disablefastopen") or "0" + if disablefastopen == "1" then tcp_fastopen = "0" - elseif tcp_fastopen == "0" and fastopen == "1" then + elseif tcp_fastopen == "0" and disablefastopen == "0" then tcp_fastopen = "3" end luci.sys.exec("sysctl -w net.ipv4.tcp_fastopen=%s" % tcp_fastopen) @@ -560,7 +560,12 @@ function settings_add() ucic:commit("openmptcprouter") -- Enable/disable fast open - local fastopen = luci.http.formvalue("disablefastopen") or "0" + local disablefastopen = luci.http.formvalue("disablefastopen") or "0" + if disablefastopen == "0" then + fastopen = "1" + else + fastopen = "0" + end ucic:foreach("shadowsocks-libev", "ss_redir", function (section) ucic:set("shadowsocks-libev",section[".name"],"fast_open",fastopen) end)