+function get_wannet(self)
+ local net = self:get_status_by_route("0.0.0.0", 0)
+ return net and network(net)
+end
+
+function get_wandev(self)
+ local _, stat = self:get_status_by_route("0.0.0.0", 0)
+ return stat and interface(stat.l3_device or stat.device)
+end
+
+function get_wan6net(self)
+ local net = self:get_status_by_route("::", 0)
+ return net and network(net)
+end
+
+function get_wan6dev(self)
+ local _, stat = self:get_status_by_route("::", 0)
+ return stat and interface(stat.l3_device or stat.device)
+end
+
+
+function network(name, proto)
+ if name then
+ local p = proto or _uci_real:get("network", name, "proto")
+ local c = p and _protocols[p] or protocol
+ return c(name)
+ end
+end