summaryrefslogtreecommitdiff
path: root/net-proxy/tayga
diff options
context:
space:
mode:
Diffstat (limited to 'net-proxy/tayga')
-rw-r--r--net-proxy/tayga/Manifest6
-rw-r--r--net-proxy/tayga/files/tayga-0.9.2-manpage-RFC.patch57
-rw-r--r--net-proxy/tayga/files/tayga-0.9.2-release-reserved-addr.patch13
-rw-r--r--net-proxy/tayga/files/tayga-0.9.2-static-EAM.patch119
-rw-r--r--net-proxy/tayga/metadata.xml5
-rw-r--r--net-proxy/tayga/tayga-0.9.2-r2.ebuild31
6 files changed, 229 insertions, 2 deletions
diff --git a/net-proxy/tayga/Manifest b/net-proxy/tayga/Manifest
index c97a4ff48156..6619d3273b99 100644
--- a/net-proxy/tayga/Manifest
+++ b/net-proxy/tayga/Manifest
@@ -1,3 +1,7 @@
+AUX tayga-0.9.2-manpage-RFC.patch 1865 BLAKE2B 337cbafecb8895af9093d5ab059710bec9e9021ccd776820430dd6536d038fc423ce8fb85ac7379b67ed10522f78c3231433848cd4f6150d0478df04bce89360 SHA512 0d5653621821cd373d49989115ee0e5076f83f14aae04e4fa6ab7b64799f09bc1892920abe7ef649e9ac315cbc1a1604b7eec37eebdd9dd87635a428e35b9cf0
+AUX tayga-0.9.2-release-reserved-addr.patch 286 BLAKE2B ad7d3099a396a7c49ccf2864051b4c30402df2063103acb4ace8159bef579a09b6bccccbabcc95e08d7f944b387719fa5ea5d91078640fab3da6a0562b9e2e3a SHA512 80ea05d6724da3feaf14d7d394e2ee2a2591bd77a72dc1e3689c5a46f3b91b78de87bfd1a5c74c18427fc993bf4664204cce7a6895e42449d698cfc03f1ae0c8
+AUX tayga-0.9.2-static-EAM.patch 3050 BLAKE2B 23b802862d17f77db42edcf1eae5127801d30def863ddee1ac7324823d48c1d67fa0061a1330d9e9dd330489dc92044ffb1172b91a5d97b3054848246d9f77d5 SHA512 e47a7d7a88e6aefb58f13df491fecff8e705c7e129d1fcb39a0f2f25ce8fc3acd4e6be6505dc8fecaadad7626fb98932cb539c8576bf6faf14d9d51933c52394
DIST tayga-0.9.2.tar.bz2 86022 BLAKE2B 9658960e0a8a4a419851a50f131a7dfb0790d0d188ad95ed5078033bd3a19180964a072dc177616b3451bc23dfa2b998058d73cc6aacfbb4b59c0b9173764440 SHA512 a7a81cccb7c3e32f00f142b1bac598b732dd748772b307561239d695418ada5302182d487e51d1cf95ed736c0180c01db2f33409d0b9343d6587b76cbb3bc573
EBUILD tayga-0.9.2-r1.ebuild 484 BLAKE2B 2987bf7006a153dde6e5db99d4c2e871b504b4eafa3a39faec03623d6f3b42e94c7de837406baa40491ece824f91da95fa59b4f947145fb3d1e6b05ea5189d0d SHA512 65cbdda9b3f612e25456711c9d0614778b64cddc3264ef9dcf2c314fe57cf73439071296e7fd5e184ac95c0c8e3db7299f3447e73b078ca460700e619a5505cb
-MISC metadata.xml 166 BLAKE2B c254f1fb642881aba57637be14fb0a89b10384f91a128feaec3a8c870d76efc2cbacb92caccc0dee2dd19a5ac5eaf8643080dafa05c4e2ac96a68568927e5afd SHA512 a56648c974a1d14dd4c18237532773c72057a13ab90c58b5da04f185e3c12a8bd8d5c21fb06053507f31766291a82dc7d87b34cd65fd94cfe2af7295c813ef84
+EBUILD tayga-0.9.2-r2.ebuild 618 BLAKE2B 13c8fb4c43e2959a86057e95ef46317019e5efd5aa6ea33d237f776f30087d93b107d09901f14565a03ad6d1824a687d8e236bf6ef081b109252e3ee8c2a5ecf SHA512 a19ba144f2042b3f76b6e012f698552ef2633d181eaf4fc37100816dc69c92eb394acbd89d5b33f9908889260a4b93275ab8f2fcf06029464030662c08bc32cb
+MISC metadata.xml 236 BLAKE2B 7ba65ccb8874d2a0e4b90d90a6b9b038651fa6655b80f493e13543ba816d44973502dad3853c9a28b615888f73d1d515cede7ccae90730b0858fbac655647c12 SHA512 0c85fb2c4ddc9049999107c26a22bb29fbeff328b17ed430860a1bc5d86fe05ae8439a592bd46551eb6e37cf0e17c8c57bbb6cd71bac6df1e756c6f175abe1b6
diff --git a/net-proxy/tayga/files/tayga-0.9.2-manpage-RFC.patch b/net-proxy/tayga/files/tayga-0.9.2-manpage-RFC.patch
new file mode 100644
index 000000000000..e38489f839cf
--- /dev/null
+++ b/net-proxy/tayga/files/tayga-0.9.2-manpage-RFC.patch
@@ -0,0 +1,57 @@
+--- a/tayga.8
++++ b/tayga.8
+@@ -1,4 +1,4 @@
+-.TH TAYGA "8" "June 2011" "TAYGA 0.9.2" ""
++.TH TAYGA "8" "Dec 2018" "TAYGA 0.9.2" ""
+
+ .SH NAME
+ tayga \- stateless NAT64 daemon
+@@ -19,10 +19,10 @@
+ translates them to the other protocol, and then sends the translated packets
+ back to the host using the same TUN interface.
+ .P
+-Translation is compliant with IETF Internet-Draft
+-draft-ietf-behave-v6v4-xlate-23, and address mapping is performed in
+-accordance with RFC 6052. Optionally, TAYGA may be configured to dynamically
+-map IPv6 hosts to addresses drawn from a configured IPv4 address pool.
++Translation is compliant with IETF RFC 6145, and address mapping is
++performed in accordance with RFC 6052 or RFC 7757. Optionally, TAYGA may be
++configured to dynamically map IPv6 hosts to addresses drawn from a
++configured IPv4 address pool.
+ .P
+ As a stateless NAT, TAYGA requires a one-to-one mapping between IPv4 addresses
+ and IPv6 addresses. Mapping multiple IPv6 addresses onto a single IPv4
+--- a/tayga.conf.5
++++ b/tayga.conf.5
+@@ -1,4 +1,4 @@
+-.TH TAYGA.CONF "5" "June 2011" "TAYGA 0.9.2" ""
++.TH TAYGA.CONF "5" "Dec 2018" "TAYGA 0.9.2" ""
+ .SH NAME
+ tayga.conf \- configuration file of the TAYGA stateless NAT64 daemon
+ .SH DESCRIPTION
+@@ -75,12 +75,21 @@
+ .B map
+ directive.
+ .TP
+-.BI "map " "ipv4_address ipv6_address"
+-Creates a static mapping between
+-.I ipv4_address
++.BI "map " "ipv4_address[/length] ipv6_address[/length]"
++Creates a static mapping between RFC 7577 compliant hosts or subnets
++.I ipv4_address[/length]
+ and
+-.I ipv6_address
++.I ipv6_address[/length]
+ to be used when translating IPv4 packets to IPv6 or IPv6 packets to IPv4.
++If
++.I /length
++is not present, the
++.I /length
++after
++.I ipv4_address
++is treated as "/32" and that of
++.I ipv6_address
++as "/128".
+ Multiple
+ .B map
+ directives are permitted in the tayga.conf file.
diff --git a/net-proxy/tayga/files/tayga-0.9.2-release-reserved-addr.patch b/net-proxy/tayga/files/tayga-0.9.2-release-reserved-addr.patch
new file mode 100644
index 000000000000..60b07e01d826
--- /dev/null
+++ b/net-proxy/tayga/files/tayga-0.9.2-release-reserved-addr.patch
@@ -0,0 +1,13 @@
+--- a/addrmap.c
++++ b/addrmap.c
+@@ -22,10 +22,6 @@
+
+ int validate_ip4_addr(const struct in_addr *a)
+ {
+- /* First octet == 0 */
+- if (!(a->s_addr & htonl(0xff000000)))
+- return -1;
+-
+ /* First octet == 127 */
+ if ((a->s_addr & htonl(0xff000000)) == htonl(0x7f000000))
+ return -1;
diff --git a/net-proxy/tayga/files/tayga-0.9.2-static-EAM.patch b/net-proxy/tayga/files/tayga-0.9.2-static-EAM.patch
new file mode 100644
index 000000000000..cdf1e601194b
--- /dev/null
+++ b/net-proxy/tayga/files/tayga-0.9.2-static-EAM.patch
@@ -0,0 +1,119 @@
+Description: Support SIIT-DC styled EAM static maps
+ Introduce Explicit Address Mapping as defined in RFC7757. This extends the
+ `map <ipv4> <ipv6>` into `map <ipv4 subnet> <ipv6 subnet>`.
+ .
+Author: Benda Xu <heroxbd@gentoo.org>
+Forwarded: Nathan Lutchansky <lutchann@litech.org>
+Last-Update: 2018-12-28
+
+--- a/conffile.c
++++ b/conffile.c
+@@ -217,16 +217,43 @@
+
+ m = alloc_map_static(ln);
+
++ char *slash;
++ slash = strchr(args[0], '/');
++ unsigned int prefix4 = 32;
++ if (slash) {
++ prefix4 = atoi(slash+1);
++ slash[0] = NULL;
++ }
++
+ if (!inet_pton(AF_INET, args[0], &m->map4.addr)) {
+- slog(LOG_CRIT, "Expected an IPv4 address but found \"%s\" on "
++ slog(LOG_CRIT, "Expected an IPv4 subnet but found \"%s\" on "
+ "line %d\n", args[0], ln);
+ exit(1);
+ }
++ m->map4.prefix_len = prefix4;
++ calc_ip4_mask(&m->map4.mask, NULL, prefix4);
++
++ unsigned int prefix6 = 128;
++ slash = strchr(args[1], '/');
++ if (slash) {
++ prefix6 = atoi(slash+1);
++ slash[0] = NULL;
++ }
++
++ if ((32 - prefix4) != (128 - prefix6)) {
++ slog(LOG_CRIT, "IPv4 and IPv6 subnet must be of the same size, but found"
++ " %s and %s on line %d\n", args[0], args[1], ln);
++ exit(1);
++ }
++
+ if (!inet_pton(AF_INET6, args[1], &m->map6.addr)) {
+- slog(LOG_CRIT, "Expected an IPv6 address but found \"%s\" on "
++ slog(LOG_CRIT, "Expected an IPv6 subnet but found \"%s\" on "
+ "line %d\n", args[1], ln);
+ exit(1);
+ }
++ m->map6.prefix_len = prefix6;
++ calc_ip6_mask(&m->map6.mask, NULL, prefix6);
++
+ if (validate_ip4_addr(&m->map4.addr) < 0) {
+ slog(LOG_CRIT, "Cannot use reserved address %s in map "
+ "directive, aborting...\n", args[0]);
+@@ -490,3 +517,10 @@
+ slog(LOG_CRIT, "Unable to allocate config memory\n");
+ exit(1);
+ }
++
++/*
++Local Variables:
++c-basic-offset: 8
++indent-tabs-mode: t
++End:
++*/
+--- a/addrmap.c
++++ b/addrmap.c
+@@ -97,7 +97,12 @@
+
+ int calc_ip4_mask(struct in_addr *mask, const struct in_addr *addr, int len)
+ {
+- mask->s_addr = htonl(~((1 << (32 - len)) - 1));
++ if (len) {
++ mask->s_addr = htonl(~((1 << (32 - len)) - 1));
++ } else {
++ /* len==0 */
++ mask->s_addr = 0;
++ }
+ if (addr && (addr->s_addr & ~mask->s_addr))
+ return -1;
+ return 0;
+@@ -422,6 +427,9 @@
+ case MAP_TYPE_STATIC:
+ s = container_of(map4, struct map_static, map4);
+ *addr6 = s->map6.addr;
++ if (map4->prefix_len < 32) {
++ addr6->s6_addr32[3] = s->map6.addr.s6_addr32[3] | (addr4->s_addr & ~map4->mask.s_addr);
++ }
+ break;
+ case MAP_TYPE_RFC6052:
+ s = container_of(map4, struct map_static, map4);
+@@ -564,7 +572,13 @@
+ switch (map6->type) {
+ case MAP_TYPE_STATIC:
+ s = container_of(map6, struct map_static, map6);
+- *addr4 = s->map4.addr;
++
++ if (map6->prefix_len < 128) {
++ addr4->s_addr = s->map4.addr.s_addr | (addr6->s6_addr32[3] & ~map6->mask.s6_addr32[3]);
++ } else {
++ *addr4 = s->map4.addr;
++ }
++
+ break;
+ case MAP_TYPE_RFC6052:
+ if (extract_from_prefix(addr4, addr6, map6->prefix_len) < 0)
+@@ -629,3 +643,10 @@
+ }
+ }
+ }
++
++/*
++Local Variables:
++c-basic-offset: 8
++indent-tabs-mode: t
++End:
++*/
diff --git a/net-proxy/tayga/metadata.xml b/net-proxy/tayga/metadata.xml
index 6f49eba8f496..0779891bd146 100644
--- a/net-proxy/tayga/metadata.xml
+++ b/net-proxy/tayga/metadata.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
-<!-- maintainer-needed -->
+<maintainer type="person">
+<email>heroxbd@gentoo.org</email>
+<name>Benda Xu</name>
+</maintainer>
</pkgmetadata>
diff --git a/net-proxy/tayga/tayga-0.9.2-r2.ebuild b/net-proxy/tayga/tayga-0.9.2-r2.ebuild
new file mode 100644
index 000000000000..46844c56a9c1
--- /dev/null
+++ b/net-proxy/tayga/tayga-0.9.2-r2.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit autotools
+
+DESCRIPTION="out-of-kernel stateless NAT64 implementation based on TUN"
+HOMEPAGE="http://www.litech.org/tayga/"
+SRC_URI="http://www.litech.org/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-static-EAM.patch
+ "${FILESDIR}"/${P}-manpage-RFC.patch
+ "${FILESDIR}"/${P}-release-reserved-addr.patch
+)
+
+src_prepare() {
+ default
+ sed -e '/^CFLAGS/d' \
+ -i configure.ac || die "sed failed"
+ eautoreconf
+}