proto_4x6.lua 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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.
  4. local netmod = luci.model.network
  5. local _, p
  6. for _, p in ipairs({"dslite"}) do
  7. local proto = netmod:register_protocol(p)
  8. function proto.get_i18n(self)
  9. if p == "dslite" then
  10. return luci.i18n.translate("Dual-Stack Lite (RFC6333)")
  11. end
  12. end
  13. function proto.ifname(self)
  14. return p .. "-" .. self.sid
  15. end
  16. function proto.opkg_package(self)
  17. if p == "dslite" then
  18. return "ds-lite"
  19. end
  20. end
  21. function proto.is_installed(self)
  22. return nixio.fs.access("/lib/netifd/proto/" .. p .. ".sh")
  23. end
  24. function proto.is_floating(self)
  25. return true
  26. end
  27. function proto.is_virtual(self)
  28. return true
  29. end
  30. function proto.get_interfaces(self)
  31. return nil
  32. end
  33. function proto.contains_interface(self, ifname)
  34. return (netmod:ifnameof(ifc) == self:ifname())
  35. end
  36. netmod:register_pattern_virtual("^%s-%%w" % p)
  37. end