2 LuCI - Network model - 6to4, 6in4 & 6rd protocol extensions
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
20 local netmod = luci.model.network
23 for _, p in ipairs({"6in4", "6to4", "6rd"}) do
25 local proto = netmod:register_protocol(p)
27 function proto.get_i18n(self)
29 return luci.i18n.translate("IPv6-in-IPv4 (RFC4213)")
30 elseif p == "6to4" then
31 return luci.i18n.translate("IPv6-over-IPv4 (6to4)")
32 elseif p == "6rd" then
33 return luci.i18n.translate("IPv6-over-IPv4 (6rd)")
37 function proto.ifname(self)
38 return p .. "-" .. self.sid
41 function proto.opkg_package(self)
45 function proto.is_installed(self)
46 return nixio.fs.access("/lib/netifd/proto/" .. p .. ".sh")
49 function proto.is_floating(self)
53 function proto.is_virtual(self)
57 function proto.get_interfaces(self)
61 function proto.contains_interface(self, ifname)
62 return (netmod:ifnameof(ifc) == self:ifname())
65 netmod:register_pattern_virtual("^%s-%%w" % p)