diff options
Diffstat (limited to 'modules/admin-mini')
-rw-r--r-- | modules/admin-mini/luasrc/model/cbi/mini/network.lua | 38 |
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") |