libstore/linux/pasta: always list an IPv4 & IPv6 nameserver

Fixes #1014.

Address family detection is performed by Pasta, we influence Pasta into
enabling dual stack by listing both an IPv4 & IPv6.

Change-Id: I4121e0eae7d5185c287957106adc36edf3f82a40
Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
Raito Bezarius
2025-10-29 21:44:12 +00:00
parent 12b87538e3
commit 480c8e52b6
+2 -8
View File
@@ -900,15 +900,9 @@ std::string LinuxLocalDerivationGoal::rewriteResolvConf(std::string fromHost)
static constexpr auto flags = std::regex::ECMAScript | std::regex::multiline;
static auto lineRegex = regex::parse("^nameserver\\s.*$", flags);
static auto v4Regex = regex::parse("^nameserver\\s+\\d{1,3}\\.", flags);
static auto v6Regex = regex::parse("^nameserver.*:", flags);
std::string nsInSandbox = "\n";
if (std::regex_search(fromHost, v4Regex)) {
nsInSandbox += fmt("nameserver %s\n", PASTA_HOST_IPV4);
}
if (std::regex_search(fromHost, v6Regex)) {
nsInSandbox += fmt("nameserver %s\n", PASTA_HOST_IPV6);
}
nsInSandbox += fmt("nameserver %s\n", PASTA_HOST_IPV4);
nsInSandbox += fmt("nameserver %s\n", PASTA_HOST_IPV6);
return std::regex_replace(fromHost, lineRegex, "") + nsInSandbox;
}