1 |
commit: 037b300dcab2261757850e19f8ccbfb355d32d3d |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 3 09:32:09 2019 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 3 09:32:28 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=037b300d |
7 |
|
8 |
net-proxy/tayga: adopt the package and support RFC 7757. |
9 |
|
10 |
Package-Manager: Portage-2.3.52, Repoman-2.3.12 |
11 |
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org> |
12 |
|
13 |
.../tayga/files/tayga-0.9.2-manpage-RFC.patch | 57 ++++++++++ |
14 |
.../files/tayga-0.9.2-release-reserved-addr.patch | 13 +++ |
15 |
net-proxy/tayga/files/tayga-0.9.2-static-EAM.patch | 119 +++++++++++++++++++++ |
16 |
net-proxy/tayga/metadata.xml | 5 +- |
17 |
net-proxy/tayga/tayga-0.9.2-r2.ebuild | 31 ++++++ |
18 |
5 files changed, 224 insertions(+), 1 deletion(-) |
19 |
|
20 |
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 |
21 |
new file mode 100644 |
22 |
index 00000000000..e38489f839c |
23 |
--- /dev/null |
24 |
+++ b/net-proxy/tayga/files/tayga-0.9.2-manpage-RFC.patch |
25 |
@@ -0,0 +1,57 @@ |
26 |
+--- a/tayga.8 |
27 |
++++ b/tayga.8 |
28 |
+@@ -1,4 +1,4 @@ |
29 |
+-.TH TAYGA "8" "June 2011" "TAYGA 0.9.2" "" |
30 |
++.TH TAYGA "8" "Dec 2018" "TAYGA 0.9.2" "" |
31 |
+ |
32 |
+ .SH NAME |
33 |
+ tayga \- stateless NAT64 daemon |
34 |
+@@ -19,10 +19,10 @@ |
35 |
+ translates them to the other protocol, and then sends the translated packets |
36 |
+ back to the host using the same TUN interface. |
37 |
+ .P |
38 |
+-Translation is compliant with IETF Internet-Draft |
39 |
+-draft-ietf-behave-v6v4-xlate-23, and address mapping is performed in |
40 |
+-accordance with RFC 6052. Optionally, TAYGA may be configured to dynamically |
41 |
+-map IPv6 hosts to addresses drawn from a configured IPv4 address pool. |
42 |
++Translation is compliant with IETF RFC 6145, and address mapping is |
43 |
++performed in accordance with RFC 6052 or RFC 7757. Optionally, TAYGA may be |
44 |
++configured to dynamically map IPv6 hosts to addresses drawn from a |
45 |
++configured IPv4 address pool. |
46 |
+ .P |
47 |
+ As a stateless NAT, TAYGA requires a one-to-one mapping between IPv4 addresses |
48 |
+ and IPv6 addresses. Mapping multiple IPv6 addresses onto a single IPv4 |
49 |
+--- a/tayga.conf.5 |
50 |
++++ b/tayga.conf.5 |
51 |
+@@ -1,4 +1,4 @@ |
52 |
+-.TH TAYGA.CONF "5" "June 2011" "TAYGA 0.9.2" "" |
53 |
++.TH TAYGA.CONF "5" "Dec 2018" "TAYGA 0.9.2" "" |
54 |
+ .SH NAME |
55 |
+ tayga.conf \- configuration file of the TAYGA stateless NAT64 daemon |
56 |
+ .SH DESCRIPTION |
57 |
+@@ -75,12 +75,21 @@ |
58 |
+ .B map |
59 |
+ directive. |
60 |
+ .TP |
61 |
+-.BI "map " "ipv4_address ipv6_address" |
62 |
+-Creates a static mapping between |
63 |
+-.I ipv4_address |
64 |
++.BI "map " "ipv4_address[/length] ipv6_address[/length]" |
65 |
++Creates a static mapping between RFC 7577 compliant hosts or subnets |
66 |
++.I ipv4_address[/length] |
67 |
+ and |
68 |
+-.I ipv6_address |
69 |
++.I ipv6_address[/length] |
70 |
+ to be used when translating IPv4 packets to IPv6 or IPv6 packets to IPv4. |
71 |
++If |
72 |
++.I /length |
73 |
++is not present, the |
74 |
++.I /length |
75 |
++after |
76 |
++.I ipv4_address |
77 |
++is treated as "/32" and that of |
78 |
++.I ipv6_address |
79 |
++as "/128". |
80 |
+ Multiple |
81 |
+ .B map |
82 |
+ directives are permitted in the tayga.conf file. |
83 |
|
84 |
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 |
85 |
new file mode 100644 |
86 |
index 00000000000..60b07e01d82 |
87 |
--- /dev/null |
88 |
+++ b/net-proxy/tayga/files/tayga-0.9.2-release-reserved-addr.patch |
89 |
@@ -0,0 +1,13 @@ |
90 |
+--- a/addrmap.c |
91 |
++++ b/addrmap.c |
92 |
+@@ -22,10 +22,6 @@ |
93 |
+ |
94 |
+ int validate_ip4_addr(const struct in_addr *a) |
95 |
+ { |
96 |
+- /* First octet == 0 */ |
97 |
+- if (!(a->s_addr & htonl(0xff000000))) |
98 |
+- return -1; |
99 |
+- |
100 |
+ /* First octet == 127 */ |
101 |
+ if ((a->s_addr & htonl(0xff000000)) == htonl(0x7f000000)) |
102 |
+ return -1; |
103 |
|
104 |
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 |
105 |
new file mode 100644 |
106 |
index 00000000000..cdf1e601194 |
107 |
--- /dev/null |
108 |
+++ b/net-proxy/tayga/files/tayga-0.9.2-static-EAM.patch |
109 |
@@ -0,0 +1,119 @@ |
110 |
+Description: Support SIIT-DC styled EAM static maps |
111 |
+ Introduce Explicit Address Mapping as defined in RFC7757. This extends the |
112 |
+ `map <ipv4> <ipv6>` into `map <ipv4 subnet> <ipv6 subnet>`. |
113 |
+ . |
114 |
+Author: Benda Xu <heroxbd@g.o> |
115 |
+Forwarded: Nathan Lutchansky <lutchann@××××××.org> |
116 |
+Last-Update: 2018-12-28 |
117 |
+ |
118 |
+--- a/conffile.c |
119 |
++++ b/conffile.c |
120 |
+@@ -217,16 +217,43 @@ |
121 |
+ |
122 |
+ m = alloc_map_static(ln); |
123 |
+ |
124 |
++ char *slash; |
125 |
++ slash = strchr(args[0], '/'); |
126 |
++ unsigned int prefix4 = 32; |
127 |
++ if (slash) { |
128 |
++ prefix4 = atoi(slash+1); |
129 |
++ slash[0] = NULL; |
130 |
++ } |
131 |
++ |
132 |
+ if (!inet_pton(AF_INET, args[0], &m->map4.addr)) { |
133 |
+- slog(LOG_CRIT, "Expected an IPv4 address but found \"%s\" on " |
134 |
++ slog(LOG_CRIT, "Expected an IPv4 subnet but found \"%s\" on " |
135 |
+ "line %d\n", args[0], ln); |
136 |
+ exit(1); |
137 |
+ } |
138 |
++ m->map4.prefix_len = prefix4; |
139 |
++ calc_ip4_mask(&m->map4.mask, NULL, prefix4); |
140 |
++ |
141 |
++ unsigned int prefix6 = 128; |
142 |
++ slash = strchr(args[1], '/'); |
143 |
++ if (slash) { |
144 |
++ prefix6 = atoi(slash+1); |
145 |
++ slash[0] = NULL; |
146 |
++ } |
147 |
++ |
148 |
++ if ((32 - prefix4) != (128 - prefix6)) { |
149 |
++ slog(LOG_CRIT, "IPv4 and IPv6 subnet must be of the same size, but found" |
150 |
++ " %s and %s on line %d\n", args[0], args[1], ln); |
151 |
++ exit(1); |
152 |
++ } |
153 |
++ |
154 |
+ if (!inet_pton(AF_INET6, args[1], &m->map6.addr)) { |
155 |
+- slog(LOG_CRIT, "Expected an IPv6 address but found \"%s\" on " |
156 |
++ slog(LOG_CRIT, "Expected an IPv6 subnet but found \"%s\" on " |
157 |
+ "line %d\n", args[1], ln); |
158 |
+ exit(1); |
159 |
+ } |
160 |
++ m->map6.prefix_len = prefix6; |
161 |
++ calc_ip6_mask(&m->map6.mask, NULL, prefix6); |
162 |
++ |
163 |
+ if (validate_ip4_addr(&m->map4.addr) < 0) { |
164 |
+ slog(LOG_CRIT, "Cannot use reserved address %s in map " |
165 |
+ "directive, aborting...\n", args[0]); |
166 |
+@@ -490,3 +517,10 @@ |
167 |
+ slog(LOG_CRIT, "Unable to allocate config memory\n"); |
168 |
+ exit(1); |
169 |
+ } |
170 |
++ |
171 |
++/* |
172 |
++Local Variables: |
173 |
++c-basic-offset: 8 |
174 |
++indent-tabs-mode: t |
175 |
++End: |
176 |
++*/ |
177 |
+--- a/addrmap.c |
178 |
++++ b/addrmap.c |
179 |
+@@ -97,7 +97,12 @@ |
180 |
+ |
181 |
+ int calc_ip4_mask(struct in_addr *mask, const struct in_addr *addr, int len) |
182 |
+ { |
183 |
+- mask->s_addr = htonl(~((1 << (32 - len)) - 1)); |
184 |
++ if (len) { |
185 |
++ mask->s_addr = htonl(~((1 << (32 - len)) - 1)); |
186 |
++ } else { |
187 |
++ /* len==0 */ |
188 |
++ mask->s_addr = 0; |
189 |
++ } |
190 |
+ if (addr && (addr->s_addr & ~mask->s_addr)) |
191 |
+ return -1; |
192 |
+ return 0; |
193 |
+@@ -422,6 +427,9 @@ |
194 |
+ case MAP_TYPE_STATIC: |
195 |
+ s = container_of(map4, struct map_static, map4); |
196 |
+ *addr6 = s->map6.addr; |
197 |
++ if (map4->prefix_len < 32) { |
198 |
++ addr6->s6_addr32[3] = s->map6.addr.s6_addr32[3] | (addr4->s_addr & ~map4->mask.s_addr); |
199 |
++ } |
200 |
+ break; |
201 |
+ case MAP_TYPE_RFC6052: |
202 |
+ s = container_of(map4, struct map_static, map4); |
203 |
+@@ -564,7 +572,13 @@ |
204 |
+ switch (map6->type) { |
205 |
+ case MAP_TYPE_STATIC: |
206 |
+ s = container_of(map6, struct map_static, map6); |
207 |
+- *addr4 = s->map4.addr; |
208 |
++ |
209 |
++ if (map6->prefix_len < 128) { |
210 |
++ addr4->s_addr = s->map4.addr.s_addr | (addr6->s6_addr32[3] & ~map6->mask.s6_addr32[3]); |
211 |
++ } else { |
212 |
++ *addr4 = s->map4.addr; |
213 |
++ } |
214 |
++ |
215 |
+ break; |
216 |
+ case MAP_TYPE_RFC6052: |
217 |
+ if (extract_from_prefix(addr4, addr6, map6->prefix_len) < 0) |
218 |
+@@ -629,3 +643,10 @@ |
219 |
+ } |
220 |
+ } |
221 |
+ } |
222 |
++ |
223 |
++/* |
224 |
++Local Variables: |
225 |
++c-basic-offset: 8 |
226 |
++indent-tabs-mode: t |
227 |
++End: |
228 |
++*/ |
229 |
|
230 |
diff --git a/net-proxy/tayga/metadata.xml b/net-proxy/tayga/metadata.xml |
231 |
index 6f49eba8f49..0779891bd14 100644 |
232 |
--- a/net-proxy/tayga/metadata.xml |
233 |
+++ b/net-proxy/tayga/metadata.xml |
234 |
@@ -1,5 +1,8 @@ |
235 |
<?xml version="1.0" encoding="UTF-8"?> |
236 |
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
237 |
<pkgmetadata> |
238 |
-<!-- maintainer-needed --> |
239 |
+<maintainer type="person"> |
240 |
+<email>heroxbd@g.o</email> |
241 |
+<name>Benda Xu</name> |
242 |
+</maintainer> |
243 |
</pkgmetadata> |
244 |
|
245 |
diff --git a/net-proxy/tayga/tayga-0.9.2-r2.ebuild b/net-proxy/tayga/tayga-0.9.2-r2.ebuild |
246 |
new file mode 100644 |
247 |
index 00000000000..46844c56a9c |
248 |
--- /dev/null |
249 |
+++ b/net-proxy/tayga/tayga-0.9.2-r2.ebuild |
250 |
@@ -0,0 +1,31 @@ |
251 |
+# Copyright 1999-2019 Gentoo Authors |
252 |
+# Distributed under the terms of the GNU General Public License v2 |
253 |
+ |
254 |
+EAPI="6" |
255 |
+ |
256 |
+inherit autotools |
257 |
+ |
258 |
+DESCRIPTION="out-of-kernel stateless NAT64 implementation based on TUN" |
259 |
+HOMEPAGE="http://www.litech.org/tayga/" |
260 |
+SRC_URI="http://www.litech.org/${PN}/${P}.tar.bz2" |
261 |
+ |
262 |
+LICENSE="GPL-2" |
263 |
+SLOT="0" |
264 |
+KEYWORDS="~amd64" |
265 |
+IUSE="" |
266 |
+ |
267 |
+DEPEND="" |
268 |
+RDEPEND="${DEPEND}" |
269 |
+ |
270 |
+PATCHES=( |
271 |
+ "${FILESDIR}"/${P}-static-EAM.patch |
272 |
+ "${FILESDIR}"/${P}-manpage-RFC.patch |
273 |
+ "${FILESDIR}"/${P}-release-reserved-addr.patch |
274 |
+) |
275 |
+ |
276 |
+src_prepare() { |
277 |
+ default |
278 |
+ sed -e '/^CFLAGS/d' \ |
279 |
+ -i configure.ac || die "sed failed" |
280 |
+ eautoreconf |
281 |
+} |