modules/admin-full: fix default state and handling of the defaultroute and peerdns...
[oweals/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / ifaces.lua
index 4ab32693eba3577947bbf6ccd46f971387b9d017..0530b5d57a871308ac81539bfefc8ce9dadf7fba 100644 (file)
@@ -41,6 +41,7 @@ if has_pppoe then p:value("pppoe", "PPPoE")   end
 if has_pppoa then p:value("pppoa", "PPPoA")   end
 if has_3g    then p:value("3g",    "UMTS/3G") end
 if has_pptp  then p:value("pptp",  "PPTP")    end
+p:value("none", translate("none"))
 
 if not ( has_pppd and has_pppoe and has_pppoa and has_3g and has_pptp ) then
        p.description = translate("network_interface_prereq")
@@ -215,12 +216,20 @@ if has_pppd or has_3g then
        )
        defaultroute:depends("proto", "ppp")
        defaultroute:depends("proto", "3g")
+       defaultroute.rmempty = false
+       function defaultroute.cfgvalue(...)
+               return ( AbstractValue.cfgvalue(...) or '1' )
+       end
 
        peerdns = s:option(Flag, "peerdns",
         translate("network_interface_peerdns"),
         translate("network_interface_peerdns_desc")
        )
        peerdns:depends("proto", "ppp")
+       peerdns.rmempty = false
+       function peerdns.cfgvalue(...)
+               return ( AbstractValue.cfgvalue(...) or '1' )
+       end
 
        ipv6 = s:option(Flag, "ipv6", translate("network_interface_ipv6") )
        ipv6:depends("proto", "ppp")