luci-proto-ipip: Add package
[project/luci.git] / protocols / luci-proto-ipip / luasrc / model / network / proto_ipip.lua
1 -- Copyright 2016 Roger Pueyo Centelles <roger.pueyo@guifi.net>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local netmod = luci.model.network
5 local interface = luci.model.network.interface
6 local proto = netmod:register_protocol("ipip")
7
8 function proto.get_i18n(self)
9         return luci.i18n.translate("IPv4-in-IPv4 (RFC2003)")
10 end
11
12 function proto.ifname(self)
13         return "ipip-" .. self.sid
14 end
15
16 function proto.opkg_package(self)
17         return "ipip"
18 end
19
20 function proto.is_installed(self)
21         return nixio.fs.access("/lib/netifd/proto/ipip.sh")
22 end
23
24 function proto.is_floating(self)
25         return true
26 end
27
28 function proto.is_virtual(self)
29         return true
30 end
31
32 function proto.get_interfaces(self)
33         return nil
34 end
35
36 function proto.contains_interface(self, ifc)
37          return (netmod:ifnameof(ifc) == self:ifname())
38 end
39
40 netmod:register_pattern_virtual("^ipip-%w")