summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2018-10-07 23:59:01 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2018-10-10 00:36:38 +0200
commit441d4e2b70dc3c2b172b61faf0c6c8804d46318c (patch)
tree8b3e95fe58a5399b3d65075c581ec07f874b5c7d
parent701f6b0819a902e8c45e19c95aad7121f9c50145 (diff)
luci-proto-tayga: Add support for TAYGA NAT64tayga-old
TAYGA is an out-of-kernel stateless NAT64 implementation for Linux. It uses the TUN driver to exchange packets with the kernel, which is the same driver used by OpenVPN and QEMU/KVM. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
-rw-r--r--protocols/luci-proto-tayga/Makefile15
-rw-r--r--protocols/luci-proto-tayga/luasrc/model/cbi/admin_network/proto_tayga.lua31
-rw-r--r--protocols/luci-proto-tayga/luasrc/model/network/proto_tayga.lua27
3 files changed, 73 insertions, 0 deletions
diff --git a/protocols/luci-proto-tayga/Makefile b/protocols/luci-proto-tayga/Makefile
new file mode 100644
index 000000000..a4c4467e4
--- /dev/null
+++ b/protocols/luci-proto-tayga/Makefile
@@ -0,0 +1,15 @@
+#
+# This is free software, licensed under the Apache License, Version 2.0.
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=Support for NAT64 (TAYGA)
+LUCI_DEPENDS:=+tayga
+LUCI_PKGARCH:=all
+
+PKG_MAINTAINER:=
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/protocols/luci-proto-tayga/luasrc/model/cbi/admin_network/proto_tayga.lua b/protocols/luci-proto-tayga/luasrc/model/cbi/admin_network/proto_tayga.lua
new file mode 100644
index 000000000..862516d55
--- /dev/null
+++ b/protocols/luci-proto-tayga/luasrc/model/cbi/admin_network/proto_tayga.lua
@@ -0,0 +1,31 @@
+-- Licensed to the public under the Apache License 2.0.
+
+local map, section, net = ...
+
+local o = section:taboption("general", Value, "ipv4_addr",
+ translate("IPv4 address"))
+o.datatype = "ip4addr"
+o.rmempty = false
+
+o = section:taboption("general", Value, "dynamic_pool",
+ translate("IPv4 pool"))
+o.datatype = "ipmask4"
+o.rmempty = false
+
+o = section:taboption("general", Value, "prefix",
+ translate("Translation prefix"),
+ translate("Note: traffic between IPv6 hosts and private IPv4 addresses (i.e. to/from 64:ff9b::10.0.0.0/104, 64:ff9b::192.168.0.0/112, etc) will be dropped.\
+Use a translation prefix within your organization's IPv6 address space instead of 64:ff9b::/96 if you need your IPv6 hosts to communicate with private IPv4 addresses"))
+o.datatype = "ipmask6"
+o.default = "64:ff9b::/96"
+o.rmempty = false
+
+o = section:taboption("general", Value, "ipv6_addr",
+ translate("IPv6 address"))
+o.datatype = "ip6addr"
+o.rmempty = true
+
+o = section:taboption("general", Flag, "noroutes",
+ translate("No routes"), translate("Don't create routes for the IPv4 pool, IPv6 prefix and IPv6 address."))
+o.datatype = "boolean"
+
diff --git a/protocols/luci-proto-tayga/luasrc/model/network/proto_tayga.lua b/protocols/luci-proto-tayga/luasrc/model/network/proto_tayga.lua
new file mode 100644
index 000000000..9f6bb14c9
--- /dev/null
+++ b/protocols/luci-proto-tayga/luasrc/model/network/proto_tayga.lua
@@ -0,0 +1,27 @@
+-- Licensed to the public under the Apache License 2.0.
+
+local proto = luci.model.network:register_protocol("tayga")
+
+function proto.get_i18n(self)
+ return luci.i18n.translate("NAT64 (TAYGA)")
+end
+
+function proto.opkg_package(self)
+ return "tayga"
+end
+
+function proto.is_installed(self)
+ return nixio.fs.access("/lib/netifd/proto/tayga.sh")
+end
+
+function proto.is_floating(self)
+ return true
+end
+
+function proto.is_virtual(self)
+ return true
+end
+
+function proto.get_interfaces(self)
+ return nil
+end