mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 23:34:34 +04:00
protocols/core: fix defaultroute setting for DHCP interfaces
This commit is contained in:
@@ -14,7 +14,7 @@ local map, section, net = ...
|
|||||||
local ifc = net:get_interface()
|
local ifc = net:get_interface()
|
||||||
|
|
||||||
local hostname, accept_ra, send_rs
|
local hostname, accept_ra, send_rs
|
||||||
local bcast, no_gw, peerdns, dns, metric, clientid, vendorclass
|
local bcast, defaultroute, peerdns, dns, metric, clientid, vendorclass
|
||||||
|
|
||||||
|
|
||||||
hostname = section:taboption("general", Value, "hostname",
|
hostname = section:taboption("general", Value, "hostname",
|
||||||
@@ -43,23 +43,11 @@ bcast = section:taboption("advanced", Flag, "broadcast",
|
|||||||
bcast.default = bcast.disabled
|
bcast.default = bcast.disabled
|
||||||
|
|
||||||
|
|
||||||
no_gw = section:taboption("advanced", Flag, "gateway",
|
defaultroute = section:taboption("advanced", Flag, "gateway",
|
||||||
translate("Use default gateway"),
|
translate("Use default gateway"),
|
||||||
translate("If unchecked, no default route is configured"))
|
translate("If unchecked, no default route is configured"))
|
||||||
|
|
||||||
no_gw.default = no_gw.enabled
|
defaultroute.default = defaultroute.enabled
|
||||||
|
|
||||||
function no_gw.cfgvalue(...)
|
|
||||||
return Flag.cfgvalue(...) == "0.0.0.0" and "0" or "1"
|
|
||||||
end
|
|
||||||
|
|
||||||
function no_gw.write(self, section, value)
|
|
||||||
if value == "1" then
|
|
||||||
m:set(section, "gateway", nil)
|
|
||||||
else
|
|
||||||
m:set(section, "gateway", "0.0.0.0")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
peerdns = section:taboption("advanced", Flag, "peerdns",
|
peerdns = section:taboption("advanced", Flag, "peerdns",
|
||||||
|
|||||||
Reference in New Issue
Block a user