proto_ipip.lua 844 B

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