From 48bcb85124b4e5b6187a4151be06b1d4bce0035f Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 10 Mar 2020 13:17:53 +0100 Subject: [PATCH] net/tayga: add interface commands to rc.conf (#1700) --- net/tayga/Makefile | 2 +- net/tayga/src/etc/rc.d/opnsense-tayga | 12 +++++++++++ .../OPNsense/Tayga/forms/general.xml | 20 +++++++++++++++---- .../mvc/app/models/OPNsense/Tayga/General.xml | 17 +++++++++++----- .../service/templates/OPNsense/Tayga/tayga | 5 +++++ 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/net/tayga/Makefile b/net/tayga/Makefile index b29b67d69..f57fd502f 100644 --- a/net/tayga/Makefile +++ b/net/tayga/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= tayga -PLUGIN_VERSION= 0.1 +PLUGIN_VERSION= 0.2 PLUGIN_DEVEL= yes PLUGIN_COMMENT= Tayga IPv6 64NAT PLUGIN_DEPENDS= tayga diff --git a/net/tayga/src/etc/rc.d/opnsense-tayga b/net/tayga/src/etc/rc.d/opnsense-tayga index 78ed736fc..0bc0834d7 100755 --- a/net/tayga/src/etc/rc.d/opnsense-tayga +++ b/net/tayga/src/etc/rc.d/opnsense-tayga @@ -11,6 +11,7 @@ name=tayga +start_cmd=tayga_start stop_cmd=tayga_stop rcvar=tayga_enable @@ -21,6 +22,17 @@ command_args="-p ${pidfile}" [ -z "$tayga_enable" ] && tayga_enable="NO" +tayga_start() +{ + echo "starting tayga" + ${command} ${command_args} + sleep 1 + ifconfig nat64 inet ${tayga_v4destination}/32 ${tayga_v4address} + ifconfig nat64 inet6 ${tayga_v6estination}/128 + route -6 add ${tayga_v6prefix} -interface nat64 + route -4 add ${tayga_v4pool} -interface nat64 +} + tayga_stop() { if [ -n "$rc_pid" ]; then diff --git a/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml index e75b05a16..14a6c5272 100644 --- a/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml +++ b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml @@ -9,24 +9,36 @@ general.v4address text - This is not your router's IPv4 address. Tayga requires its own address because it acts as an IPv4 and IPv6 router, and needs to be able to send ICMP messages. This address can safely be located inside the dynamic-pool prefix. + Should be located in Tayga's IPv4 pool. Tayga requires its own IPv4 address because it acts as a router and needs to be able to send ICMP messages. Tayga will also respond to ICMPv4 echo requests at this address. + + + general.v4destination + + text + IPv4 address of the NAT64 interface. Must not be located in Tayga's IPv4 pool. Only used for ICMP. general.v6address text - This is not your routers IPv6 address. Tayga requires its own address because it acts as an IPv4 and IPv6 router, and needs to be able to send ICMP messages. Tayga will also respond to ICMP echo requests (ping6) at this address. You can leave it unspecified and Tayga will construct its IPv6 address using IPv4 address and the NAT64 prefix. + If left unspecified, Tayga will construct its IPv6 address by using its IPv4 address and the IPv6 prefix (default). Tayga requires its own IPv6 address because it acts as a router and needs to be able to send ICMP messages. Tayga will also respond to ICMPv6 echo requests at this address. + + + general.v6destination + + text + IPv6 address of the NAT64 interface. Must not have Tayga's IPv6 prefix. Only used for ICMP. general.v6prefix text - This must be a prefix selected from your organizations IPv6 address space or the Well-Known Prefix 64:ff9b::/96. The IPv4 address space is mapped into the IPv6 address space by prepending this prefix to the IPv4 address. + This must be a /96 prefix selected from your organization's IPv6 address space or the Well-Known Prefix 64:ff9b::/96. The IPv4 address space is mapped into the IPv6 address space by prepending this prefix to the IPv4 address. general.v4pool text - Dynamic pool prefix. IPv6 hosts which send traffic through Tayga will be assigned an IPv4 address from the dynamic pool. + IPv6 hosts which send traffic through Tayga will be dynamically assigned an IPv4 address from this pool. Can be any size, but each IPv6 host requires one address. diff --git a/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/General.xml b/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/General.xml index 5f9ff3d26..63fdb0c3d 100644 --- a/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/General.xml +++ b/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/General.xml @@ -1,7 +1,7 @@ //OPNsense/tayga/general Tayga configuration - 0.0.2 + 0.0.4 0 @@ -9,19 +9,26 @@ 192.168.255.1 - N + Y + + 192.168.254.1 + Y + - 2001:db8:1::2 N + + 2001:db8:1:ffff::1 + Y + 2001:db8:1:ffff::/96 - N + Y 192.168.255.0/24 - N + Y diff --git a/net/tayga/src/opnsense/service/templates/OPNsense/Tayga/tayga b/net/tayga/src/opnsense/service/templates/OPNsense/Tayga/tayga index 45e40deac..cc5d8c68c 100644 --- a/net/tayga/src/opnsense/service/templates/OPNsense/Tayga/tayga +++ b/net/tayga/src/opnsense/service/templates/OPNsense/Tayga/tayga @@ -1,6 +1,11 @@ {% if helpers.exists('OPNsense.tayga.general.enabled') and OPNsense.tayga.general.enabled == '1' %} tayga_var_script="/usr/local/opnsense/scripts/OPNsense/Tayga/setup.sh" tayga_enable="YES" +tayga_v4address={{ OPNsense.tayga.general.v4address }} +tayga_v4destination={{ OPNsense.tayga.general.v4destination }} +tayga_v4pool={{ OPNsense.tayga.general.v4pool }} +tayga_v6prefix={{ OPNsense.tayga.general.v6prefix }} +tayga_v6address={{ OPNsense.tayga.general.v6address }} {% else %} tayga_enable="NO" {% endif %}