X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-mini%2Fluasrc%2Fmodel%2Fcbi%2Fmini%2Fnetwork.lua;h=508bac155cd2391cebe4964a8a581fbfa6e0c97a;hp=d03e6a77732e25a4b754b07b2568d36523d1eea5;hb=c56307acc36a03966b45c55e6857d978bbac7f8c;hpb=aa5c150f37acd749b2bd506257d0062e83811d22 diff --git a/modules/admin-mini/luasrc/model/cbi/mini/network.lua b/modules/admin-mini/luasrc/model/cbi/mini/network.lua index d03e6a7773..508bac155c 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")