1 -- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
2 -- Copyright 2013 Steven Barth <steven@midlink.org>
3 -- Licensed to the public under the Apache License 2.0.
5 local netmod = luci.model.network
8 for _, p in ipairs({"dslite", "map", "464xlat"}) do
10 local proto = netmod:register_protocol(p)
12 function proto.get_i18n(self)
14 return luci.i18n.translate("Dual-Stack Lite (RFC6333)")
15 elseif p == "map" then
16 return luci.i18n.translate("MAP / LW4over6")
17 elseif p == "464xlat" then
18 return luci.i18n.translate("464XLAT (CLAT)")
22 function proto.ifname(self)
23 return p .. "-" .. self.sid
26 function proto.opkg_package(self)
29 elseif p == "map" then
31 elseif p == "464xlat" then
36 function proto.is_installed(self)
37 return nixio.fs.access("/lib/netifd/proto/" .. p .. ".sh")
40 function proto.is_floating(self)
44 function proto.is_virtual(self)
48 function proto.get_interfaces(self)
52 function proto.contains_interface(self, ifname)
53 return (netmod:ifnameof(ifc) == self:ifname())
57 netmod:register_pattern_virtual("^464%-%w")
58 netmod:register_pattern_virtual("^ds%-%w")
59 netmod:register_pattern_virtual("^map%-%w")
61 netmod:register_error_code("AFTR_DNS_FAIL", luci.i18n.translate("Unable to resolve AFTR host name"))
62 netmod:register_error_code("INVALID_MAP_RULE", luci.i18n.translate("MAP rule is invalid"))
63 netmod:register_error_code("NO_MATCHING_PD", luci.i18n.translate("No matching prefix delegation"))
64 netmod:register_error_code("UNSUPPORTED_TYPE", luci.i18n.translate("Unsupported MAP type"))