+
+if not cursor:get("network", "wan") then
+ cursor:section("network", "interface", "wan", {proto = "none"})
+ cursor:save("network")
+end
+
+local function deviceroute(self)
+ cursor:unload("network")
+ local wd = cursor:get("network", "wan", "_wandev") or ""
+
+ if wd == "none" then
+ cursor:set("network", "wan", "proto", "none")
+ end
+
+ if wd:find("ethernet:") == 1 then
+ cursor:set("network", "wan", "defaultroute", "1")
+ cursor:set("network", "wan", "ifname", wd:sub(10))
+ self:set_route("etherwan")
+ else
+ cursor:delete("network", "wan", "ifname")
+ end
+
+ if wd:find("wlan:") == 1 then
+
+ else
+ cursor:delete_all("wireless", "wifi-iface", {network = "wan"})
+ end
+
+ cursor:save("wireless")
+ cursor:save("network")
+end
+
+