tayga: 0.9.5 -> 0.9.6 (#484615)

This commit is contained in:
Nick Cao
2026-05-25 12:33:08 +00:00
committed by GitHub
2 changed files with 39 additions and 28 deletions
+9 -13
View File
@@ -13,8 +13,8 @@
# +--|---
# | eth2 Address: 2001:db8::1/64
# Router |
# | nat64 Address: 64:ff9b::1/128
# | Route: 64:ff9b::/96
# | nat64 Address: fde7:6c52:047e::1/128
# | Route: fde7:6c52:047e::/96
# | Address: 192.0.2.0/32
# | Route: 192.0.2.0/24
# |
@@ -37,11 +37,7 @@
];
nodes = {
# The server is configured with static IPv4 addresses. RFC 6052 Section 3.1
# disallows the mapping of non-global IPv4 addresses like RFC 1918 into the
# Well-Known Prefix 64:ff9b::/96. TAYGA also does not allow the mapping of
# documentation space (RFC 5737). To circumvent this, 100.64.0.2/24 from
# RFC 6589 (Carrier Grade NAT) is used here.
# The server is configured with static IPv4 addresses.
# To reach the IPv4 address pool of the NAT64 gateway, there is a static
# route configured. In normal cases, where the router would also source NAT
# the pool addresses to one IPv4 addresses, this would not be needed.
@@ -73,7 +69,7 @@
# The router is configured with static IPv4 addresses towards the server
# and IPv6 addresses towards the client. DNS64 is exposed towards the
# client so clatd is able to auto-discover the PLAT prefix. For NAT64, the
# Well-Known prefix 64:ff9b::/96 is used. NAT64 is done with TAYGA which
# ULA prefix fde7:6c52:047e::/96 is used. NAT64 is done with TAYGA which
# provides the tun-interface nat64 and does the translation over it. The
# IPv6 packets are sent to this interfaces and received as IPv4 packets and
# vice versa. As TAYGA only translates IPv6 addresses to dedicated IPv4
@@ -121,7 +117,7 @@
systemd.network.networks."40-eth2" = {
networkConfig.IPv6SendRA = true;
ipv6Prefixes = [ { Prefix = "2001:db8::/64"; } ];
ipv6PREF64Prefixes = [ { Prefix = "64:ff9b::/96"; } ];
ipv6PREF64Prefixes = [ { Prefix = "fde7:6c52:047e::/96"; } ];
ipv6SendRAConfig = {
EmitDNS = true;
DNS = "_link_local";
@@ -141,7 +137,7 @@
.:53 {
bind ::
hosts /etc/hosts
dns64 64:ff9b::/96
dns64 fde7:6c52:047e::/96
}
'';
};
@@ -161,10 +157,10 @@
ipv6 = {
address = "2001:db8::1";
router = {
address = "64:ff9b::1";
address = "fde7:6c52:047e::1";
};
pool = {
address = "64:ff9b::";
address = "fde7:6c52:047e::";
prefixLength = 96;
};
};
@@ -221,7 +217,7 @@
with subtest("networkd exports PREF64 prefix"):
assert json.loads(client.succeed("networkctl status eth1 --json=short"))[
"NDisc"
]["PREF64"][0]["Prefix"] == [0x0, 0x64, 0xFF, 0x9B] + ([0] * 12)
]["PREF64"][0]["Prefix"] == [0xfd, 0xe7, 0x6c, 0x52, 0x04, 0x7e] + ([0] * 10)
with subtest("Test ICMP"):
client.wait_until_succeeds("ping -c3 100.64.0.2 >&2")
+30 -15
View File
@@ -2,40 +2,55 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch2,
nixosTests,
}:
stdenv.mkDerivation (finalAttrs: {
version = "0.9.5";
pname = "tayga";
version = "0.9.6";
src = fetchFromGitHub {
owner = "apalrd";
repo = "tayga";
tag = finalAttrs.version;
hash = "sha256-xOm4fetFq2UGuhOojrT8WOcX78c6MLTMVbDv+O62x2E=";
hash = "sha256-OsF2RqZzDvf8FMLHN6YAKvWfFgAIQfVkbBTC8hjf2dU=";
};
makeFlags = [ "CC=${lib.getExe stdenv.cc}" ];
patches = [
# nat64.c: call inet_ntop with properly sized buffers
# https://github.com/apalrd/tayga/pull/168
(fetchpatch2 {
url = "https://github.com/apalrd/tayga/commit/b41bd030846451d72b277854678b58370b1d5c8f.patch?full_index=1";
hash = "sha256-vFQTlZs9ghxdx4k/iODDOUBAglyll1OxUdTjzDtcwB0=";
})
];
makeFlags = [
"prefix=${placeholder "out"}"
];
installFlags = [
"WITH_SYSTEMD=1"
"sbindir=${placeholder "out"}/bin"
"sysconfdir=${placeholder "out"}/etc"
"servicedir=${placeholder "out"}/lib/systemd/system"
];
postInstall = ''
substituteInPlace "$out/lib/systemd/system/tayga@.service" \
--replace-fail "ExecSearchPath=/usr/local/sbin:/usr/sbin" "" \
--replace-fail "ExecStart=tayga" "ExecStart=$out/bin/tayga"
'';
env = lib.optionalAttrs stdenv.hostPlatform.is32bit {
NIX_CFLAGS_COMPILE = "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64";
};
preBuild = ''
echo "#define TAYGA_VERSION \"${finalAttrs.version}\"" > version.h
'';
installPhase = ''
install -Dm755 tayga $out/bin/tayga
install -D tayga.conf.5 $out/share/man/man5/tayga.conf.5
install -D tayga.8 $out/share/man/man8/tayga.8
cp -R docs $out/share/
cp tayga.conf.example $out/share/docs/
'';
passthru.tests.tayga = nixosTests.tayga;
doCheck = true;
meta = {
description = "Userland stateless NAT64 daemon";
longDescription = ''