mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-26 11:31:53 +00:00
https://github.com/XTLS/Xray-core/pull/7460#issuecomment-7131171930 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
533 lines
17 KiB
Go
533 lines
17 KiB
Go
//go:build freebsd
|
|
|
|
package tun
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io/fs"
|
|
"net/netip"
|
|
"strings"
|
|
"testing"
|
|
|
|
"golang.org/x/net/route"
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func TestSelectFreeBSDGatewayDefault(t *testing.T) {
|
|
gateway, local, err := selectFreeBSDGateway(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if gateway != netip.MustParsePrefix(defaultFreeBSDGateway) {
|
|
t.Fatal("expected default gateway, got ", gateway)
|
|
}
|
|
if local != netip.MustParseAddr("169.254.10.2") {
|
|
t.Fatal("wrong local address: ", local)
|
|
}
|
|
}
|
|
|
|
func TestSelectFreeBSDGatewayPicksFirstIPv4(t *testing.T) {
|
|
gateway, local, err := selectFreeBSDGateway([]string{"fd00::1/64", "10.0.0.1/30", "10.9.9.9/24"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if gateway != netip.MustParsePrefix("10.0.0.1/30") {
|
|
t.Fatal("wrong gateway: ", gateway)
|
|
}
|
|
if local != netip.MustParseAddr("10.0.0.2") {
|
|
t.Fatal("wrong local address: ", local)
|
|
}
|
|
}
|
|
|
|
func TestSelectFreeBSDGatewayRequiresIPv4(t *testing.T) {
|
|
if _, _, err := selectFreeBSDGateway([]string{"fd00::1/64"}); err == nil {
|
|
t.Fatal("expected error when no IPv4 gateway is configured")
|
|
}
|
|
}
|
|
|
|
func TestSelectFreeBSDGatewayRejectsGarbage(t *testing.T) {
|
|
if _, _, err := selectFreeBSDGateway([]string{"not-a-prefix"}); err == nil {
|
|
t.Fatal("expected error for invalid gateway")
|
|
}
|
|
}
|
|
|
|
func TestSelectFreeBSDGatewayRejectsFullPrefix(t *testing.T) {
|
|
// 10.0.0.255/30: the "next" local address falls outside the prefix
|
|
if _, _, err := selectFreeBSDGateway([]string{"10.0.0.255/30"}); err == nil {
|
|
t.Fatal("expected error when no usable local address follows the gateway")
|
|
}
|
|
}
|
|
|
|
func TestNextLocalIPv4(t *testing.T) {
|
|
local, ok := nextLocalIPv4(netip.MustParsePrefix("169.254.10.1/30"))
|
|
if !ok || local != netip.MustParseAddr("169.254.10.2") {
|
|
t.Fatal("wrong local address: ", local)
|
|
}
|
|
}
|
|
|
|
func TestBuildSystemRoutesSplitsDefault(t *testing.T) {
|
|
routes, err := buildSystemRoutes([]string{"0.0.0.0/0"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
expected := []string{
|
|
"1.0.0.0/8", "2.0.0.0/7", "4.0.0.0/6", "8.0.0.0/5",
|
|
"16.0.0.0/4", "32.0.0.0/3", "64.0.0.0/2", "128.0.0.0/1",
|
|
}
|
|
if len(routes) != len(expected) {
|
|
t.Fatal("expected ", len(expected), " routes, got ", routes)
|
|
}
|
|
for i, want := range expected {
|
|
if routes[i] != netip.MustParsePrefix(want) {
|
|
t.Fatal("route ", i, ": expected ", want, ", got ", routes[i])
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestBuildSystemRoutesSplitsDefaultIPv6(t *testing.T) {
|
|
routes, err := buildSystemRoutes([]string{"::/0"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(routes) != 8 || routes[7] != netip.MustParsePrefix("8000::/1") {
|
|
t.Fatal("unexpected v6 split: ", routes)
|
|
}
|
|
}
|
|
|
|
func TestBuildSystemRoutesDeduplicates(t *testing.T) {
|
|
routes, err := buildSystemRoutes([]string{"10.0.0.0/8", "10.1.2.3/8", "0.0.0.0/0", "0.0.0.0/0"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(routes) != 9 { // 10.0.0.0/8 once + 8 splits once
|
|
t.Fatal("expected 9 routes, got ", routes)
|
|
}
|
|
}
|
|
|
|
func TestBuildSystemRoutesRejectsGarbage(t *testing.T) {
|
|
if _, err := buildSystemRoutes([]string{"10.0.0.0/33"}); err == nil {
|
|
t.Fatal("expected error for invalid route")
|
|
}
|
|
}
|
|
|
|
func routeMessage(dst, mask route.Addr) *route.RouteMessage {
|
|
addrs := make([]route.Addr, unix.RTAX_NETMASK+1)
|
|
addrs[unix.RTAX_DST] = dst
|
|
addrs[unix.RTAX_NETMASK] = mask
|
|
return &route.RouteMessage{Addrs: addrs}
|
|
}
|
|
|
|
func TestDefaultRouteFamilyMatchesIPv4Default(t *testing.T) {
|
|
family, ok := defaultRouteFamily(routeMessage(&route.Inet4Addr{}, &route.Inet4Addr{}))
|
|
if !ok || family != unix.AF_INET {
|
|
t.Fatal("expected IPv4 default route match")
|
|
}
|
|
}
|
|
|
|
func TestDefaultRouteFamilyMatchesIPv6Default(t *testing.T) {
|
|
family, ok := defaultRouteFamily(routeMessage(&route.Inet6Addr{}, &route.Inet6Addr{}))
|
|
if !ok || family != unix.AF_INET6 {
|
|
t.Fatal("expected IPv6 default route match")
|
|
}
|
|
}
|
|
|
|
func TestDefaultRouteFamilyRejectsNonDefault(t *testing.T) {
|
|
if _, ok := defaultRouteFamily(routeMessage(
|
|
&route.Inet4Addr{IP: [4]byte{10, 0, 0, 0}},
|
|
&route.Inet4Addr{IP: [4]byte{255, 0, 0, 0}},
|
|
)); ok {
|
|
t.Fatal("non-default destination must not match")
|
|
}
|
|
if _, ok := defaultRouteFamily(routeMessage(
|
|
&route.Inet4Addr{},
|
|
&route.Inet4Addr{IP: [4]byte{255, 0, 0, 0}},
|
|
)); ok {
|
|
t.Fatal("non-zero mask must not match")
|
|
}
|
|
}
|
|
|
|
func TestDefaultRouteFamilyRejectsShortAddrs(t *testing.T) {
|
|
if _, ok := defaultRouteFamily(&route.RouteMessage{}); ok {
|
|
t.Fatal("message without addresses must not match")
|
|
}
|
|
}
|
|
|
|
type probeCall struct {
|
|
inboundTag string
|
|
source string
|
|
address string
|
|
}
|
|
|
|
// stubDNSRouting replaces the routing probe for the duration of a test and
|
|
// records how it was called, so tests can assert the probe is representative.
|
|
func stubDNSRouting(t *testing.T, err error) *[]probeCall {
|
|
t.Helper()
|
|
original := verifyDNSRouting
|
|
calls := []probeCall{}
|
|
verifyDNSRouting = func(_ context.Context, inboundTag, source, address string) error {
|
|
calls = append(calls, probeCall{inboundTag, source, address})
|
|
return err
|
|
}
|
|
t.Cleanup(func() { verifyDNSRouting = original })
|
|
return &calls
|
|
}
|
|
|
|
// recorder installs a resolvconf stub for the duration of a test and returns
|
|
// the captured invocations, each as the arguments followed by the stdin in
|
|
// angle brackets when there was one. An empty failOn succeeds every call;
|
|
// otherwise the named subcommand fails.
|
|
func recorder(t *testing.T, failOn string) *[]string {
|
|
t.Helper()
|
|
original := resolvconfRunner
|
|
calls := []string{}
|
|
resolvconfRunner = func(stdin string, args ...string) ([]byte, error) {
|
|
call := strings.Join(args, " ")
|
|
if stdin != "" {
|
|
call += " <" + stdin + ">"
|
|
}
|
|
calls = append(calls, call)
|
|
if failOn != "" && len(args) > 0 && args[0] == failOn {
|
|
return nil, errors.New("boom")
|
|
}
|
|
return nil, nil
|
|
}
|
|
t.Cleanup(func() { resolvconfRunner = original })
|
|
return &calls
|
|
}
|
|
|
|
// files replaces the resolver files read by the applied check for the
|
|
// duration of a test. A path not in the map does not exist.
|
|
func files(t *testing.T, contents map[string]string) {
|
|
t.Helper()
|
|
original := readResolverFile
|
|
readResolverFile = func(path string) ([]byte, error) {
|
|
if data, ok := contents[path]; ok {
|
|
return []byte(data), nil
|
|
}
|
|
return nil, fs.ErrNotExist
|
|
}
|
|
t.Cleanup(func() { readResolverFile = original })
|
|
}
|
|
|
|
// takenOver is what the libc subscriber writes once the TUN's nameserver is
|
|
// the exclusive one.
|
|
const takenOver = "# Generated by resolvconf\nnameserver 192.168.100.1\n"
|
|
|
|
// untouched is the DHCP-supplied resolv.conf that resolvconf=NO leaves in
|
|
// place.
|
|
const untouched = "# Generated by resolvconf\nnameserver 10.0.0.1\n"
|
|
|
|
func optedInTun() *FreeBSDTun {
|
|
return &FreeBSDTun{
|
|
options: &Config{
|
|
Name: "tun7",
|
|
Gateway: []string{"192.168.100.1/30"},
|
|
AutoSystemDnsToGateway: true,
|
|
},
|
|
name: "tun7",
|
|
gateway: netip.MustParsePrefix("192.168.100.1/30"),
|
|
local: netip.MustParseAddr("192.168.100.2"),
|
|
}
|
|
}
|
|
|
|
func joined(calls []string) string {
|
|
return strings.Join(calls, " | ")
|
|
}
|
|
|
|
func TestConfigureSystemDNSDisabledByDefault(t *testing.T) {
|
|
probes := stubDNSRouting(t, nil)
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
t1.options.AutoSystemDnsToGateway = false
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if len(*calls) != 0 || len(*probes) != 0 {
|
|
t.Errorf("nothing may run when the option is off, got %q and %d probes", joined(*calls), len(*probes))
|
|
}
|
|
if t1.systemDNSSet {
|
|
t.Error("systemDNSSet must stay false when the option is off")
|
|
}
|
|
}
|
|
|
|
func TestConfigureSystemDNSLeavesOSDNSWhenNoRoute(t *testing.T) {
|
|
stubDNSRouting(t, errors.New("no route"))
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err == nil {
|
|
t.Fatal("expected an error when the probe fails")
|
|
}
|
|
if len(*calls) != 0 {
|
|
t.Errorf("resolvconf must not run when the probe fails, got %q", joined(*calls))
|
|
}
|
|
if t1.systemDNSSet {
|
|
t.Error("systemDNSSet must stay false when the probe fails")
|
|
}
|
|
}
|
|
|
|
// On FreeBSD the addresses are the other way round from Linux: the local
|
|
// address is the one after the gateway, and the gateway itself has no owner,
|
|
// so a packet to it is routed into the TUN. The probe has to carry that pair,
|
|
// and the resolver has to be pointed at the gateway.
|
|
func TestConfigureSystemDNSProbeCarriesFreeBSDPair(t *testing.T) {
|
|
probes := stubDNSRouting(t, nil)
|
|
recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if len(*probes) != 1 {
|
|
t.Fatalf("expected one probe, got %d", len(*probes))
|
|
}
|
|
want := probeCall{"tun", "192.168.100.2", "192.168.100.1"}
|
|
if (*probes)[0] != want {
|
|
t.Errorf("probe = %+v, want %+v", (*probes)[0], want)
|
|
}
|
|
}
|
|
|
|
func TestConfigureSystemDNSAppliesResolvconf(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if !t1.systemDNSSet {
|
|
t.Fatal("systemDNSSet should be true after a successful takeover")
|
|
}
|
|
|
|
want := "-a tun7 -x <nameserver 192.168.100.1\n>"
|
|
if got := joined(*calls); got != want {
|
|
t.Errorf("resolvconf calls = %q, want %q", got, want)
|
|
}
|
|
}
|
|
|
|
// resolvconf exits 0 with resolvconf=NO in resolvconf.conf, and still records
|
|
// the entry for the interface, but runs no subscriber, so success has to be
|
|
// confirmed in what the subscribers wrote.
|
|
func TestConfigureSystemDNSRefusesWhenResolvconfDidNotApply(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": untouched})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err == nil {
|
|
t.Fatal("expected an error when the nameserver did not reach a resolver")
|
|
}
|
|
if t1.systemDNSSet {
|
|
t.Error("systemDNSSet must stay false when the takeover did not take")
|
|
}
|
|
if !strings.HasSuffix(joined(*calls), "-d tun7") {
|
|
t.Errorf("expected a removal after the failed check, got %q", joined(*calls))
|
|
}
|
|
}
|
|
|
|
func TestConfigureSystemDNSIdempotent(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
before := len(*calls)
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if len(*calls) != before {
|
|
t.Errorf("second call must be a no-op, calls went %d -> %d", before, len(*calls))
|
|
}
|
|
}
|
|
|
|
func TestConfigureSystemDNSAddFailureIsNotDirty(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "-a")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err == nil {
|
|
t.Fatal("expected an error when resolvconf -a fails")
|
|
}
|
|
if t1.systemDNSSet || t1.systemDNSDirty {
|
|
t.Error("a failed add leaves nothing to clean up")
|
|
}
|
|
if len(*calls) != 1 {
|
|
t.Errorf("nothing else may run after a failed add, got %q", joined(*calls))
|
|
}
|
|
}
|
|
|
|
// If the removal after a failed check fails too, the entry may still be
|
|
// installed, so the state has to be remembered rather than silently dropped.
|
|
func TestConfigureSystemDNSRollbackFailureKeepsDirty(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
recorder(t, "-d")
|
|
files(t, map[string]string{"/etc/resolv.conf": untouched})
|
|
|
|
t1 := optedInTun()
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err == nil {
|
|
t.Fatal("expected an error when the check fails")
|
|
}
|
|
if !t1.systemDNSDirty {
|
|
t.Error("a failed removal must leave the resolver marked dirty")
|
|
}
|
|
if t1.systemDNSSet {
|
|
t.Error("systemDNSSet must stay false when the takeover did not complete")
|
|
}
|
|
}
|
|
|
|
// A dirty resolver is retried before anything new is applied.
|
|
func TestConfigureSystemDNSRetriesDirtyBeforeApplying(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
t1.systemDNSDirty = true
|
|
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
got := joined(*calls)
|
|
if !strings.HasPrefix(got, "-d tun7 | -a tun7") {
|
|
t.Errorf("expected the stale removal first, got %q", got)
|
|
}
|
|
if t1.systemDNSDirty {
|
|
t.Error("a successful retry should clear the dirty flag")
|
|
}
|
|
if !t1.systemDNSSet {
|
|
t.Error("the takeover should proceed once the retry succeeds")
|
|
}
|
|
}
|
|
|
|
func TestUnsetSystemDNSRemoves(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
if err := t1.ConfigureSystemDNS(context.Background(), "tun"); err != nil {
|
|
t.Fatalf("setup failed: %v", err)
|
|
}
|
|
*calls = nil
|
|
|
|
t1.unsetSystemDNS()
|
|
if t1.systemDNSSet {
|
|
t.Error("systemDNSSet should be false after unset")
|
|
}
|
|
if got := joined(*calls); got != "-d tun7" {
|
|
t.Errorf("unset calls = %q, want %q", got, "-d tun7")
|
|
}
|
|
|
|
t1.unsetSystemDNS()
|
|
if len(*calls) != 1 {
|
|
t.Errorf("unsetSystemDNS must be idempotent, got %q", joined(*calls))
|
|
}
|
|
}
|
|
|
|
func TestUnsetSystemDNSKeepsDirtyWhenRemoveFails(t *testing.T) {
|
|
stubDNSRouting(t, nil)
|
|
calls := recorder(t, "-d")
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
|
|
t1 := optedInTun()
|
|
t1.systemDNSSet = true
|
|
|
|
t1.unsetSystemDNS()
|
|
if !t1.systemDNSDirty {
|
|
t.Error("a failed removal during unset must be remembered")
|
|
}
|
|
if got := joined(*calls); got != "-d tun7" {
|
|
t.Errorf("expected a removal attempt, got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestResolvconfAppliedLibc(t *testing.T) {
|
|
files(t, map[string]string{"/etc/resolv.conf": takenOver})
|
|
if ok, err := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); err != nil || !ok {
|
|
t.Errorf("resolv.conf listing the nameserver must count as applied, got %v, %v", ok, err)
|
|
}
|
|
}
|
|
|
|
func TestResolvconfAppliedNotWhenUntouched(t *testing.T) {
|
|
files(t, map[string]string{"/etc/resolv.conf": untouched})
|
|
if ok, err := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); err != nil || ok {
|
|
t.Errorf("an unchanged resolv.conf and no resolvconf.conf must not count as applied, got %v, %v", ok, err)
|
|
}
|
|
}
|
|
|
|
// With inclusive_interfaces in resolvconf.conf the exclusive marking is
|
|
// ignored and the DHCP nameservers stay listed, so the system falls back to
|
|
// them; that is the leak the option exists to close, and it must not pass.
|
|
func TestResolvconfAppliedNotWhenOthersRemain(t *testing.T) {
|
|
files(t, map[string]string{"/etc/resolv.conf": "nameserver 192.168.100.1\nnameserver 10.0.0.1\n"})
|
|
if ok, _ := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); ok {
|
|
t.Error("another nameserver alongside the TUN's must not count as applied")
|
|
}
|
|
}
|
|
|
|
// A loopback nameserver alongside is a local resolver that resolvconf feeds
|
|
// (local_unbound with the libc subscriber left on), not a leak.
|
|
func TestResolvconfAppliedWithLoopbackAlongside(t *testing.T) {
|
|
files(t, map[string]string{"/etc/resolv.conf": "nameserver 127.0.0.1\nnameserver 192.168.100.1\n"})
|
|
if ok, err := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); err != nil || !ok {
|
|
t.Errorf("a loopback nameserver alongside must still count as applied, got %v, %v", ok, err)
|
|
}
|
|
}
|
|
|
|
func TestResolvconfAppliedIgnoresPrefixMatches(t *testing.T) {
|
|
files(t, map[string]string{"/etc/resolv.conf": "nameserver 192.168.100.10\n"})
|
|
if ok, _ := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); ok {
|
|
t.Error("192.168.100.10 must not match 192.168.100.1")
|
|
}
|
|
}
|
|
|
|
// local-unbound-setup turns the libc subscriber off and has resolvconf write
|
|
// unbound's forwarders instead; resolv.conf then stays pointed at loopback.
|
|
func TestResolvconfAppliedUnbound(t *testing.T) {
|
|
files(t, map[string]string{
|
|
"/etc/resolv.conf": "# Generated by resolvconf\nnameserver 127.0.0.1\noptions edns0\n",
|
|
"/etc/resolvconf.conf": "libc=\"NO\"\nunbound_conf=\"/var/unbound/forward.conf\"\n",
|
|
"/var/unbound/forward.conf": "forward-zone:\n\tname: .\n\tforward-addr: 192.168.100.1\n",
|
|
})
|
|
if ok, err := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); err != nil || !ok {
|
|
t.Errorf("the nameserver in unbound's forwarders must count as applied, got %v, %v", ok, err)
|
|
}
|
|
}
|
|
|
|
func TestResolvconfAppliedNotWhenUnboundUntouched(t *testing.T) {
|
|
files(t, map[string]string{
|
|
"/etc/resolv.conf": "nameserver 127.0.0.1\n",
|
|
"/etc/resolvconf.conf": "libc=\"NO\"\nunbound_conf=\"/var/unbound/forward.conf\"\n",
|
|
"/var/unbound/forward.conf": "forward-zone:\n\tname: .\n\tforward-addr: 10.0.0.1\n",
|
|
})
|
|
if ok, _ := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); ok {
|
|
t.Error("unbound still forwarding to the old server must not count as applied")
|
|
}
|
|
}
|
|
|
|
func TestResolvconfAppliedReportsUnreadableResolvConf(t *testing.T) {
|
|
files(t, map[string]string{})
|
|
if _, err := resolvconfApplied(netip.MustParseAddr("192.168.100.1")); err == nil {
|
|
t.Error("a missing resolv.conf is an error, not a verdict")
|
|
}
|
|
}
|