-
Notifications
You must be signed in to change notification settings - Fork 5
feat: support OS DNS configurator & Router on darwin #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,7 @@ func (c *darwinConfigurator) SetDNS(cfg OSConfig) error { | |
| // Add a dummy file to /etc/resolver with a "search ..." directive if we have | ||
| // search suffixes to add. | ||
| if len(cfg.SearchDomains) > 0 { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't currently use search domains. |
||
| const searchFile = "search.tailscale" // fake DNS suffix+TLD to put our search | ||
| const searchFile = "search.coder" // fake DNS suffix+TLD to put our search | ||
| mak.Set(&keep, searchFile, true) | ||
| var sbuf bytes.Buffer | ||
| sbuf.WriteString(macResolverFileHeader) | ||
|
|
@@ -86,7 +86,7 @@ func (c *darwinConfigurator) GetBaseConfig() (OSConfig, error) { | |
| return OSConfig{}, ErrGetBaseConfigNotSupported | ||
| } | ||
|
|
||
| const macResolverFileHeader = "# Added by tailscaled\n" | ||
| const macResolverFileHeader = "# Added by Coder Desktop\n" | ||
|
|
||
| // removeResolverFiles deletes all files in /etc/resolver for which the shouldDelete | ||
| // func returns true. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -73,48 +73,37 @@ const ( | |||||||||||||||||||
| CoderServiceIPv6String = "fd60:627a:a42b::53" | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // These are all unfortunately Coder IP ranges, not Tailscale IP ranges. | ||||||||||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dean suggested not renaming to minimize the diff. |
||||||||||||||||||||
|
|
||||||||||||||||||||
| // IsTailscaleIP reports whether ip is an IP address in a range that | ||||||||||||||||||||
| // Tailscale assigns from. | ||||||||||||||||||||
| // Coder assigns from. | ||||||||||||||||||||
| func IsTailscaleIP(ip netip.Addr) bool { | ||||||||||||||||||||
| if ip.Is4() { | ||||||||||||||||||||
| return CGNATRange().Contains(ip) && !ChromeOSVMRange().Contains(ip) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| return TailscaleULARange().Contains(ip) | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // TailscaleULARange returns the IPv6 Unique Local Address range that | ||||||||||||||||||||
| // is the superset range that Tailscale assigns out of. | ||||||||||||||||||||
| // is the superset range that Coder assigns out of. | ||||||||||||||||||||
| func TailscaleULARange() netip.Prefix { | ||||||||||||||||||||
| tsUlaRange.Do(func() { mustPrefix(&tsUlaRange.v, "fd7a:115c:a1e0::/48") }) | ||||||||||||||||||||
| tsUlaRange.Do(func() { mustPrefix(&tsUlaRange.v, "fd60:627a:a42b::/48") }) | ||||||||||||||||||||
| return tsUlaRange.v | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
86
to
89
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to address: tailscale/wgengine/router/router_userspace_bsd.go Lines 143 to 151 in f14d20d
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| // TailscaleViaRange returns the IPv6 Unique Local Address subset range | ||||||||||||||||||||
| // TailscaleULARange that's used for IPv4 tunneling via IPv6. | ||||||||||||||||||||
| // Unused by Coder | ||||||||||||||||||||
| func TailscaleViaRange() netip.Prefix { | ||||||||||||||||||||
| // Mnemonic: "b1a" sounds like "via". | ||||||||||||||||||||
| tsViaRange.Do(func() { mustPrefix(&tsViaRange.v, "fd7a:115c:a1e0:b1a::/64") }) | ||||||||||||||||||||
| tsViaRange.Do(func() { mustPrefix(&tsViaRange.v, "fd60:627a:a42b::/128") }) | ||||||||||||||||||||
| return tsViaRange.v | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Tailscale4To6Range returns the subset of TailscaleULARange used for | ||||||||||||||||||||
| // auto-translated Tailscale ipv4 addresses. | ||||||||||||||||||||
| // Unused by Coder | ||||||||||||||||||||
| func Tailscale4To6Range() netip.Prefix { | ||||||||||||||||||||
| // This IP range has no significance, beyond being a subset of | ||||||||||||||||||||
| // TailscaleULARange. The bits from /48 to /104 were picked at | ||||||||||||||||||||
| // random. | ||||||||||||||||||||
| ula4To6Range.Do(func() { mustPrefix(&ula4To6Range.v, "fd7a:115c:a1e0:ab12:4843:cd96:6200::/104") }) | ||||||||||||||||||||
| // This needs to be a /104 prefix, so it can fit IPv4 addresses | ||||||||||||||||||||
| ula4To6Range.Do(func() { mustPrefix(&ula4To6Range.v, "fd60:627a:a42b::/104") }) | ||||||||||||||||||||
| return ula4To6Range.v | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // TailscaleEphemeral6Range returns the subset of TailscaleULARange | ||||||||||||||||||||
| // used for ephemeral IPv6-only Tailscale nodes. | ||||||||||||||||||||
| // Unused by Coder | ||||||||||||||||||||
| func TailscaleEphemeral6Range() netip.Prefix { | ||||||||||||||||||||
| // This IP range has no significance, beyond being a subset of | ||||||||||||||||||||
| // TailscaleULARange. The bits from /48 to /64 were picked at | ||||||||||||||||||||
| // random, with the only criterion being to not be the conflict | ||||||||||||||||||||
| // with the Tailscale4To6Range above. | ||||||||||||||||||||
| ulaEph6Range.Do(func() { mustPrefix(&ulaEph6Range.v, "fd7a:115c:a1e0:efe3::/64") }) | ||||||||||||||||||||
| ulaEph6Range.Do(func() { mustPrefix(&ulaEph6Range.v, "fd60:627a:a42b::/128") }) | ||||||||||||||||||||
| return ulaEph6Range.v | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import ( | |
| "tailscale.com/disco" | ||
| "tailscale.com/ipn/ipnstate" | ||
| "tailscale.com/net/stun" | ||
| "tailscale.com/net/tsaddr" | ||
| "tailscale.com/tailcfg" | ||
| "tailscale.com/tstime/mono" | ||
| "tailscale.com/types/key" | ||
|
|
@@ -1064,7 +1065,7 @@ func (de *endpoint) handleCallMeMaybe(m *disco.CallMeMaybe) { | |
| } | ||
| var newEPs []netip.AddrPort | ||
| for _, ep := range m.MyNumber { | ||
| if ep.Addr().Is6() && ep.Addr().IsLinkLocalUnicast() { | ||
| if (ep.Addr().Is6() && ep.Addr().IsLinkLocalUnicast()) || tsaddr.IsTailscaleIP(ep.Addr()) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so we don't discover Coder tailnet IPs as peer endpoints. |
||
| // We send these out, but ignore them for now. | ||
| // TODO: teach the ping code to ping on all interfaces | ||
| // for these. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we drop the network extension, we're going to start informing the OS of the magicDNS server by modifying
/etc/resolvers