summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-01-27 20:49:04 +0000
committerSteven Barth <steven@midlink.org>2009-01-27 20:49:04 +0000
commitc56307acc36a03966b45c55e6857d978bbac7f8c (patch)
tree073e6856ff25a4470f4c6987fbc5127cf72de23f /modules
parentafd569dfcae999da3f241af4b9a226e2bd893e04 (diff)
Add MSS Clamping option for Essentials (closes #45)
Rename "MSS correction" to the correct term "MSS Clamping" in Firewall Automatically set "defaultroute" and "peerdns" when PPP is selected in Essentials
Diffstat (limited to 'modules')
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/network.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/network.lua b/modules/admin-mini/luasrc/model/cbi/mini/network.lua
index d03e6a777..508bac155 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/network.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/network.lua
@@ -109,6 +109,16 @@ p:value("dhcp", translate("automatic", "automatic"))
if has_pppoe then p:value("pppoe", "PPPoE") end
if has_pptp then p:value("pptp", "PPTP") end
+function p.write(self, section, value)
+ -- Always set defaultroute to PPP and use remote dns
+ -- Overwrite a bad variable behaviour in OpenWrt
+ if value == "pptp" or value == "pppoe" then
+ self.map:set(section, "peerdns", "1")
+ self.map:set(section, "defaultroute", "1")
+ end
+ return ListValue.write(self, section, value)
+end
+
if not ( has_pppoe and has_pptp ) then
p.description = translate("network_interface_prereq_mini")
end
@@ -137,6 +147,34 @@ pwd.password = true
pwd:depends("proto", "pppoe")
pwd:depends("proto", "pptp")
+
+-- Allow user to set MSS correction here if the UCI firewall is installed
+-- This cures some cancer for providers with pre-war routers
+if luci.fs.access("/etc/config/firewall") then
+ mssfix = s:option(Flag, "_mssfix",
+ translate("m_n_mssfix"), translate("m_n_mssfix_desc"))
+ mssfix.rmempty = false
+
+ function mssfix.cfgvalue(self)
+ local value
+ m.uci:foreach("firewall", "forwarding", function(s)
+ if s.src == "lan" and s.dest == "wan" then
+ value = s.mtu_fix
+ end
+ end)
+ return value
+ end
+
+ function mssfix.write(self, section, value)
+ m.uci:foreach("firewall", "forwarding", function(s)
+ if s.src == "lan" and s.dest == "wan" then
+ m.uci:set("firewall", s[".name"], "mtu_fix", value)
+ m:chain("firewall")
+ end
+ end)
+ end
+end
+
kea = s:option(Flag, "keepalive", translate("m_n_keepalive"))
kea:depends("proto", "pppoe")
kea:depends("proto", "pptp")