Skip to content

Commit 2a6c237

Browse files
stapelbergbradfitz
authored andcommitted
net/dns: overwrite /tmp/resolv.conf on gokrazy
Appliances built using https://gokrazy.org/ have a read-only root file system, including /etc/resolv.conf, which is a symlink to /tmp/resolv.conf. The system’s dhcp client overwrites /tmp/resolv.conf instead, so we need to use this path in Tailscale, too. related to gokrazy/gokrazy#209 fixes tailscale#8689 Signed-off-by: Michael Stapelberg <[email protected]>
1 parent 453620d commit 2a6c237

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

net/dns/direct.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ import (
2727
"tailscale.com/version/distro"
2828
)
2929

30-
const (
31-
backupConf = "/etc/resolv.pre-tailscale-backup.conf"
32-
resolvConf = "/etc/resolv.conf"
33-
)
34-
3530
// writeResolvConf writes DNS configuration in resolv.conf format to the given writer.
3631
func writeResolvConf(w io.Writer, servers []netip.Addr, domains []dnsname.FQDN) error {
3732
c := &resolvconffile.Config{

net/dns/resolvconfpath_default.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) Tailscale Inc & AUTHORS
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
//go:build !gokrazy
5+
6+
package dns
7+
8+
const (
9+
resolvConf = "/etc/resolv.conf"
10+
backupConf = "/etc/resolv.pre-tailscale-backup.conf"
11+
)

net/dns/resolvconfpath_gokrazy.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) Tailscale Inc & AUTHORS
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
//go:build gokrazy
5+
6+
package dns
7+
8+
const (
9+
resolvConf = "/tmp/resolv.conf"
10+
backupConf = "/tmp/resolv.pre-tailscale-backup.conf"
11+
)

0 commit comments

Comments
 (0)