Commit Graph
318 Commits
Author SHA1 Message Date
Nick Khyl 7c6e49dfb3 health: hide warnables while the backend is warming up
Since bfde8079a, the Tracker omits warnables with an unhealthy
dependency from CurrentState and Strings. But that only covered
Warnable.DependsOn. The implicit dependency on the warming-up warnable
was still only advertised via UnhealthyState.DependsOn and left to
clients to enforce. The macOS, iOS and Android clients did; the Windows
clients and the CLI did not, and showed warnings that disappeared once
the backend started.

Enforce it in the Tracker as well, so that all clients behave the same
and do not need to inspect DependsOn.

Updates tailscale/corp#44572
Updates #14796
Updates #14687

Signed-off-by: Nick Khyl <[email protected]>
2026-11-17 11:30:51 -08:00
Fran Bull f3a3382791 feature/routecheck,ipn,net/routecheck,tailcfg: Probe conn25 connectors
Add conn25 connectors to the targets for routecheck probing. Enables
conn25 clients to use the routecheck report to help decide which
connector to use.

Updates tailscale/corp#47251

Signed-off-by: Fran Bull <[email protected]>
2026-11-17 10:40:12 -08:00
Brad Fitzpatrick 203692da0a derp/derphttp, feature/derpwebsocket: add opt-in WebSocket fallback
Some HTTP proxies (as seen in ChatGPT Work's sandbox) intercept TLS and
refuse DERP's "Upgrade: DERP" request but allow WebSocket upgrades,
like browsers use. derphttp could already speak DERP over WebSockets,
but only on js/wasm or with the ts_debug_websockets build tag and an
envknob, and that path dials with its own http.Client, skipping the
DERP node selection, proxy CONNECT, and TLS logic of the normal path.

Add derphttp.HookUpgradeWebsocket. When it's set and a client's HTTP
upgrade to DERP fails after any TLS handshake succeeded, the client
redials and calls the hook to do a WebSocket handshake over the new
connection instead. Once that works, the client keeps using WebSockets
for its reconnects until they fail, so it doesn't pay for a refused
upgrade every time.

The new feature/derpwebsocket package sets the hook. Neither tailscaled
nor tsnet links it in; programs that want the fallback, like tailcat,
import it.

Updates #22412

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I20e4b29f1bca6e7e5e3b33f960ce9d331ec7dac9
2026-11-16 17:26:11 -08:00
Mazdak Nasab 04ed834b36 feature/conn25: resolve and count client flows atomically (#22288)
The datapath resolved a Magic IP to its Transit IP and then, in a second
lock acquisition, counted the new flow against the assignment holding
that Transit IP. A concurrent reserveAddresses could expire the
assignment in between and hand the Transit IP to an unrelated
destination, so the flow was installed DNATing to an address another
destination now owned, counted against that stranger's assignment.

Merge the two steps into ClientFlowCreatedForMagicIP, which resolves and
counts under one c.mu acquisition.

Fixes https://github.com/tailscale/corp/issues/44273

Change-Id: Iefae902267fd06a5d2c965a3570b6977921be76f

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-16 12:19:54 -07:00
chaosinthecrd a785baba6e feature/acme: test retrying renewal order without ARI replaces
Adds a test that issueACMECert, against tstest/acmetest, retries an
order naming "replaces" once without it when the CA rejects it, and
stores the cert from the retried order. It also checks that rate limits
and server errors are not retried, and that the error from the plain
order is returned if that is rejected too.

Updates #22042

Signed-off-by: chaosinthecrd <[email protected]>
2026-11-12 19:34:44 +00:00
chaosinthecrd 4fad6e5a3b feature/acme: retry renewal order without ARI replaces if rejected
When a previous cert exists, the renewal order names it in the ARI
"replaces" field. Let's Encrypt rejects that order if the current ACME
account did not issue the cert, which is the case once the account key
has been recreated but the cert kept (for example after
acme-account.key.pem is deleted), so renewal fails until the cert
expires or is deleted. This fixes this by retrying the order once
without "replaces" when the CA rejects it, unless it was rate limited.
The new cert belongs to the current account, so later renewals use
"replaces" again.

Fixes #22042

Signed-off-by: chaosinthecrd <[email protected]>
2026-11-12 19:34:44 +00:00
Brad FitzpatrickandFredrik Fornwall 501037640d tsnet: build with minimal feature tags, add test
tsnet called the serve LocalAPI client and LocalBackend methods
unconditionally, so it didn't build with ts_omit_serve, which every
minimal feature set includes. Make those methods return
feature.ErrUnavailable when serve is omitted, as ListenFunnel and
ListenService now do too.

Declare tsnet's minimum feature set (netstack) as
featuretags.TSNetMin, add cmd/featuretags --tsnet to keep it, and add
a test that type-checks tsnet with it and a few other small feature
sets.

Fixes #22282
Updates #22283

Change-Id: I866fa34d052bfd437b1c9d3309063999d7ebb02c
Co-Authored-By: Fredrik Fornwall <[email protected]>
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-11-10 10:17:13 -08:00
kari-ts f6eb3f9dc7 ipn, feature/guivisibility: send incremental gui visibility updates (#22067)
This moves HiddenNetworkDvice policy out of ipnlocal and into an optional ipnext.
This adds a per-session notification hook that uses each watcher's effective policy snapshot to populate NodeGUIVisibility.
A full visibility snapshot is sent on initialization and policy changes, and on subsequent peer updates, only changed peers are evaluated.
The extension populates Notify.NodeGUIVisibility with the hidden peers
among the nodes the Notify covers: all peers when it carries Policy
(initially and on policy change), or the PeersChanged peers otherwise.
Absent means visible, so a Policy-bearing Notify replaces the client's
visibility state and a peer-change Notify updates only the changed peers.
No NodeGUIVisibilityChanges/Removed fields and no per-session node state
are needed: removed peers simply leave the client's peer set, and full
netmap updates already resend every peer alongside SelfChange.

When the feature isn't linked, the hook slice is empty and the fast path
in notifyForSessionLocked is unchanged. When the policy isn't configured,
the hook costs a snapshot lookup per session per Notify and sends nothing.

Updates tailscale/corp#44104

Signed-off-by: kari <[email protected]>
Signed-off-by: Nick Khyl <[email protected]>
2026-11-10 10:05:32 -08:00
chaosinthecrd 408f0d2b36 ipn,feature/acme,client/local: add tests for the cert-status localapi endpoint
Tests that the localapi cert-status/ handler checks read access and returns
the status as JSON, that LocalBackend.CertStatus goes through the hook, and
that feature/acme's hook reports the same missing, valid and expired results
as the C2N /tls-cert-status handler. Also tests that Client.CertStatus
returns ErrCertStatusUnsupported for a 404 and not for other errors.

Updates tailscale/corp#38175

Signed-off-by: chaosinthecrd <[email protected]>
2026-11-10 17:37:53 +00:00
chaosinthecrd a986bbfac2 ipn,feature/acme,client/local: add a read-only cert-status localapi endpoint
The localapi cert/ endpoint fetches a cert when none is cached, so polling it
triggers issuance. feature/acme can already report a cached cert without
contacting the CA, but only over the C2N /tls-cert-status path. This moves
that check into an extension method and serves it as localapi cert-status/,
with a matching Client.CertStatus, reporting Missing on a cache miss instead
of issuing. Client.CertStatus returns ErrCertStatusUnsupported (wrapping
errors.ErrUnsupported) when tailscaled has no cert-status endpoint.

Updates tailscale/corp#38175

Signed-off-by: chaosinthecrd <[email protected]>
2026-11-10 17:37:53 +00:00
Mazdak Nasab ad8bad6114 feature/conn25: make client flow cleanups idempotent (#22280)
The cleanup returned by flowCreated decremented activeFlowCount on every
call, and its documented contract pushed the burden of calling it exactly
once onto the datapath. A caller that lost track and ran a cleanup twice
would undercount the flows still forwarding over the assignment, letting
popExpired reclaim both of its addresses back to the pools mid-connection,
or drive the count to -1, which can never again satisfy popExpired's
zero-flow test and so pins the assignment in the expiry heap and leaks
both addresses for the life of the process.

The cleanup now releases its hold at most once, guarded by a bool read and
written under c.mu alongside the decrement it protects. Repeat calls are
no-ops. The Conn25Datapath docs no longer ask callers to guarantee this.

No such double-call is reachable through FlowTable today: removeFlowLocked
deletes both cache entries, so NewFlow's second lookup misses, and the
capacity eviction takes lru.Back(), never the flow just pushed to the
front. This removes the class rather than a live bug.

Updates https://github.com/tailscale/corp/issues/50760

Change-Id: I1888f36eb8fdec9b219ccfd2d290dc4eb19c55a0

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-10 09:19:22 -07:00
Brad Fitzpatrick d566ac8ac9 ipn/ipnlocal, feature/acme: fix ts_omit_serve build with acme
feature/acme uses LocalBackend.ServeConfig to find hostnames needing
cert refresh, which broke builds with ts_omit_serve but not
ts_omit_acme. The serveConfig field it reads exists in all builds, so
move the method out of the serve-only file rather than making acme
depend on serve, and skip the refresh loop hook when serve is omitted
so the linker can drop it.

Updates #22283

Change-Id: I2cef6683cd6e6144306ddec95255d606f7a539ae
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-11-09 16:12:07 -08:00
Mazdak Nasab 7ed0138541 feature/conn25: match client flow removals to the assignment they counted (#22142)
flowRemoved identified an address assignment by transit IP alone, but a
transit IP does not identify an assignment for the lifetime of a flow.
An assignment can be dropped while a flow created against it is still in
the client flow table, and the pools then hand the same transit IP back
out to an unrelated assignment. The stale removal was charged to that
stranger, dropping its activeFlowCount while its own flows were still
forwarding, so popExpired reclaimed both of its addresses back to the
pools mid-connection. If the stranger had no flows of its own the count
went to -1, which can never again satisfy popExpired's zero-flow test,
pinning it in the expiry heap and leaking both addresses for the life of
the process.

flowCreated now returns a function, which the datapath calls on removal
to clean up the flow.

Fixes https://github.com/tailscale/corp/issues/50760

Change-Id: I3693c487b1031737763b5e49f8f8400c72848e8e

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-09 15:23:33 -07:00
Mazdak Nasab 6372b9a43a feature/conn25: shut the address assignment queue down from the sender side (#22269)
extension.Shutdown closed client.addrsCh, but the hooks that feed that
channel are still live at that point. LocalBackend.shutdown shuts the
extension host down before closing the engine, and nothing unregisters
what installHooks registered on the DNS manager and the tun device, so a
DNS response arriving during the shutdown window still reaches
mapDNSResponse -> rewriteDNSResponse -> reserveAddresses ->
enqueueAddressAssignment, and sends on the closed channel. That's a
panic, not a dropped assignment.

Every send already happens under c.mu, so the client can shut its own
queue down: client.shutdown takes the lock, sets a closed flag and
drains the queue, and enqueueAddressAssignment refuses with
errClientShutdown from then on.

A late DNS response now fails the reservation instead of queueing it for
a sendLoop that is gone. reserveAddresses rolls back, returning the
magic and transit IPs to their pools, and the query servfails rather
than being answered with a magic IP that no connector will ever hear
about.

Fixes https://github.com/tailscale/corp/issues/51235

Change-Id: I712ba8493e77b8176e133decc6097efb52b1b4ab

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-09 13:37:58 -07:00
Mazdak Nasab 3dbb215e57 feature/conn25: drop address assignments queued before a client.reset (#22210)
Give the client a generation counter, bump it in reset, and stamp each
assignment with it as it is queued. insertTransitConnMapping rejects
assignments from an older generation; because that check happens under
c.mu it is exclusive with reset, which is what actually closes the
window. handleAddressAssignment also checks before sending, so an
assignment invalidated while it was still queued doesn't reach a
connector at all.

Fixes https://github.com/tailscale/corp/issues/51125

Change-Id: Ib524324b6e8a196fdcb5b4cd307854f61c7a0f04

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-06 12:04:36 -07:00
Mazdak Nasab 8aa18b518f feature/conn25: drain the address assignment queue in client.reset (#22186)
client.reset clears the IP pools, assignments and byConnKey, but leaves
addrsCh alone. The channel is buffered, so assignments queued before the
reset are still delivered by sendLoop afterwards: each one POSTs to a
connector from the profile we just left, registering a transit IP this
client no longer knows about, and then fails in addTransitIPForConnector
because the assignment is gone from c.assignments.

Drain addrsCh at the end of reset. The drain is non-blocking, so holding
c.mu can't deadlock against reserveAddresses, which enqueues under the
same lock, or against sendLoop, which receives without it.

Fixes https://github.com/tailscale/tailscale/issues/22185

Change-Id: I579131bc54e82d2c797b4741ccaf6cbe7abfdc4a

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-05 12:16:06 -07:00
Mazdak Nasab 274a3f2023 feature/conn25: roll back the address assignment when the send queue is full (#22165)
reserveAddresses inserts the assignment into c.assignments before
enqueueing it, and leaves it there when the enqueue fails. The connector
never learns about such a mapping, and nothing tell it later.
Add addrAssignments.remove and use it to undo the insert and return both
addresses to their pools when enqueueAddressAssignment fails. The caller
still gets a SERVFAIL, but the next DNS query starts from a clean slate.

Fixes https://github.com/tailscale/corp/issues/50917

Change-Id: I5a387bdcf5a5e87e2dca44867e88ed6149678729

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-04 14:14:10 -07:00
Naman Sood 07915ae481 types/appctype: remove Conn25Attr type
This type was previously logically distinct from AppConnectorAttr
despite containing the same fields. It is now logically also the same,
so doesn't need to exist separately.

Fixes tailscale/corp#50897.

Signed-off-by: Naman Sood <[email protected]>
2026-11-03 14:54:57 -05:00
Naman Sood d8eae46481 appc,feature/conn25,tailcfg: read conn25 config from non-experimental nodeattr
Updates tailscale/corp#39984.

Signed-off-by: Naman Sood <[email protected]>
2026-11-03 12:30:26 -05:00
Mazdak Nasab 35d8212746 feature/conn25: block destinations inside the magic and transit IP pools (#22147)
Similar to b6fc02d for private destinations, a destination inside one of
the configured magic or transit IP pools is never somewhere an app can be
reached: the magic range is installed as a route towards Tailscale on
every configured node, and the transit range belongs to conn25's own
peer-to-connector mappings. Forwarding to one routes back into the
mapping layer instead of out to an app.

Updates https://github.com/tailscale/corp/issues/50118
Updates https://github.com/tailscale/corp/issues/46169

Change-Id: I8116543d4b7a02e1f4c3c6b882ee3ddec1ac4f97

Signed-off-by: Mazdak Nasab <[email protected]>
2026-11-02 14:30:42 -07:00
Fran Bull 0a88fa1ec6 feature/conn25: mint/verify TransitIPRequest tokens
Add functions to allow minting and verifying the tokens.

Updates tailscale/corp#46169

Signed-off-by: Fran Bull <[email protected]>
2026-11-02 13:23:31 -08:00
Michael Ben-Ami 49aa9c859c feature/conn25: store tokens from DNS response and pass them back in
TransitIPRequest to connector

Parse the tokens from the HTTP headers in the response. Determine which
node responded to the DNS request from the RequestURL passed in as
metadata to (*extension).mapDNSResponse. Store the token and connector
node alongside the TransitIP in the addrs struct. Then populate the new
Token field in TransitIPRequest with the stored token.

Updates tailscale/corp#46169

Signed-off-by: Michael Ben-Ami <[email protected]>
2026-10-31 15:22:34 -04:00
Fran Bull eb298524ee feature/conn25: create a secret for TransitIPRequest tokens
Create a secret that can be used for token minting and verification.

Updates tailscale/corp#46169

Signed-off-by: Fran Bull <[email protected]>
2026-10-30 09:36:17 -07:00
Mazdak Nasab b6fc02d501 feature/conn25: block private destinations (#22073)
Similar to 7304dd4 for host-scoped destinations, conn25 needs to
block private destinations: a connector forwards to app destinations,
and the packet filter only ever sees the transit IP, never the
destination, so a private destination would let a client reach into the
connector's own network.

Updates https://github.com/tailscale/corp/issues/50118
Updates https://github.com/tailscale/corp/issues/46169

Change-Id: I700b0b5a270723f5a77907e35c52d729f88c44b6

Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-30 08:55:05 -07:00
Adrian Dewhurst 7304dd42c1 feature/conn25, ipn/ipnlocal: use the new net/routelimits package for blocking host-scoped destinations
Similar to #20866 for 4via6, conn25 needs to block host-scoped
destinations. Due to the similarity between the two situations, the
matching is no longer in a 4via6-specific location. Since there is no
backwards compatibility to satisfy, there is no exception list for
conn25.

ipn/ipnlocal (for 4via6) and feature/conn25 now both use the new
package.

Updates tailscale/corp#50118
Updates tailscale/corp#46169

Change-Id: Ic3f9cccd2f5823a2ca48bd78607792b0fd6d7db9
Signed-off-by: Adrian Dewhurst <[email protected]>
2026-10-29 13:57:37 -04:00
Mazdak Nasab 3ad81d1908 feature/conn25: return pool addresses when reserveAddresses fails
Addresses handed out by ippool.next() are marked in use, and the only path
back to the pool is the popExpired loop in reserveAddresses, which can
only see an addrs once it's in the client's assignments. So a reservation
that fails after taking an address leaks it from the pool
for the lifetime of the process.

The leak is the result of interaction between the magic and transit pools.
First an address from magic pool is picked. Then another address from
the transit pool is picked. If an error happens during picking an address
from transit pool, the address from the magic pool needs to be returned,
otherwise that address is leaked, as the address in not in the client
assignments and won't be released.

Fixes https://github.com/tailscale/tailscale/pull/22019

Change-Id: I3d98282762576cc57c135761859902a1d0a63c31
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-29 09:10:47 -07:00
Michael Ben-Ami de7245d25b feature/conn25,net/dns{,/resolver}: thread PeerAPI DoH metadata in DNS
response when DNS request goes to PeerAPI DoH

To support feature/conn25 and other extensions or consumers needing to
know which PeerAPI node handled a DNS request, e.g. for app connectors
or exit nodes, and needing extra data from the server that can be
transmitted in the headers.

DNS responses from other upstream resolvers do not get any metadata
populated, even if those servers are DoH.

Add a new Response type in net/dns/resolver that includes the raw
response bytes and the optional metadata, and replace the bare bytes
with it in some places.

Pass this new type to to net/dns.ResponseMapper instead of the bare
bytes to the extensions can see the metadata.

Updates tailscale/corp#46169

Signed-off-by: Michael Ben-Ami <[email protected]>
2026-10-27 15:25:12 -04:00
Mazdak Nasab ce20d24a2b feature/conn25: add test coverage for DNS optional sections (#21782)
Additionals and authorities are two optional sections
in a DNS response. Conn25 treats DNS responses differently,
based on the response type. Adding test coverage for these
optional sections to assert the expected behavior.

Updates #cleanup

Change-Id: I778af5b368f53f6209fe2934aa98d9009c7fa395
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-26 16:44:37 -07:00
Brendan Creane a0a79982d4 feature/acme,tstest/acmetest: report the authorization error when an ACME order fails (#21790)
When validation fails, WaitOrder returns only the order's status, so
tailscale cert printed "acme: order ... status: invalid" with no reason.
The CA's reason is on the authorization's challenge. Wait on each
authorization before the order and return that error instead.

To test this, move natlab's fake ACME CA to tstest/acmetest, where unit
tests can import it, and teach it tls-alpn-01, a validation hook, and
the "invalid" state a CA reports when validation fails.

Updates #21759

Signed-off-by: Brendan Creane <[email protected]>
2026-10-15 07:45:30 -07:00
James Tucker fb79793d99 net/tstun,feature/conn25: test inbound replies against a full injection queue
Add regression guards for the inbound reply paths (TSMP pong, TSMP
connection reject, and the conn25 unmapped Transit IP reject) that were
made nonblocking via TryInjectOutbound: with the injection queue full
and its reader not draining (as when the reader is blocked behind
wireguard-go's device.peers lock held by RemovePeer), generating a
reply must drop rather than block, because the replying goroutine
must complete for the peer teardown to finish. A blocking injection
there deadlocks peer removal against inbound packet processing, as in
tailscale/corp#45544.

The tests run in synctest bubbles: the full queue is the only blocking
operation on these paths, so after synctest.Wait the reply either
completed or is provably stuck on the queue, and no timeout-based
failure is needed. A regressed, blocking sender is unblocked by
closing the Wrapper before the test fails, so the bubble settles.

Updates tailscale/corp#45544
Updates #21631

Signed-off-by: James Tucker <[email protected]>
2026-10-13 15:55:43 -07:00
James Tucker c606e83fb2 net/tstun,feature/conn25: make ErrInjectionQueueFull detectable as ENOBUFS
Export ErrInjectionQueueFull, returned by TryInjectOutbound when a full
injection queue forced a packet drop, and define it to wrap
syscall.ENOBUFS on platforms that define that errno. Callers can now
test for buffer exhaustion generically with errors.Is(err,
syscall.ENOBUFS) instead of knowing about tstun's error type. plan9 and
tamago have no ENOBUFS in their syscall packages, so there the error is
a plain sentinel; code that must build on those platforms (or on all
platforms, like feature/conn25) can still match the exported sentinel.

Also stop conn25 from logging queue-full TSMP rejections: those drops
are expected under saturation and are already counted as reason="queue_full"
in the outbound usermetric.

Signed-off-by: James Tucker <[email protected]>
2026-10-13 15:55:43 -07:00
James Tucker 3c0508fa28 net/tstun,wgengine/netstack: avoid deadlocks on full outbound queues
Make link queue writes nonblocking: gVisor can generate replies on the
reader needed to drain the queue. A full queue drops only the rejected
packet and reports ErrNoBufferSpace, which gVisor counts and TCP handles
by arming its retransmit timer. UDP sockets do not see the error unless
IP_RECVERR is set, matching Linux. Count WireGuard-bound drops as
reason="queue_full" in tailscaled_outbound_dropped_packets_total, and
per-queue drops in debug and client metrics.

Add Wrapper.TryInjectOutbound for best-effort replies generated while
processing packets (TSMP rejects and pongs, conn25 rejects, fake-mode
echo replies), so those paths drop instead of stalling behind the
injection queue's reader. Its drops are also counted as queue_full.

Make outbound injection waits cancellable and close link queues before
abort-generated replies. Stop the WireGuard injection pump on ErrClosed.
Release injected packets still queued at Close, outside closeOnce to
allow reentrant release callbacks; a sender whose send races with Close
releases the packet itself. Release temporary capture buffers.

Copy injected payload views directly into the WireGuard slab, avoiding
an intermediate allocation and copy.

Test queue saturation, multiqueue progress, cancellation, concurrent
shutdown, reference ownership, fragmented payloads, and GSO.

Performance versus the parent commit, on a 4-core Xeon 6975P-C:

  inject+read 64B / 1280B       245ns / 479ns -> 187ns / 195ns, 0 allocs
  4 injectors, 1 reader         843ns -> 451ns
  64KiB GSO inject+split        10.9us -> 4.4us, 64KiB/op -> 0
  link queue write+read         81.4ns -> 81.5ns
  tsnet TCP, 1 / 8 streams      448 / 580 MB/s -> 492 / 674 MB/s

BenchmarkTCPQueueBottleneck shows that dropping on full queues keeps
throughput at the bottleneck rate (117 MB/s at 100k packets/s, as with
blocking writes), at the cost of more retransmits with many streams.

Fixes #21631
Updates #21638
Updates #21632
Updates #21639

Signed-off-by: James Tucker <[email protected]>
2026-10-13 15:55:43 -07:00
Mazdak Nasab aaaaa97189 feature/conn25: lock mu in lookupTransitIPsByConnKey
Lock mutex in lookupTransitIPsByConnKey right
before critical section, rather than in the caller.

Updates #cleanup

Change-Id: I8ee8950dce056e1945d4356d82f0bffbc6688624
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-13 13:26:43 -07:00
Brendan Creane 3bb8a906c2 feature/acme: only refresh certs for HTTPS serve entries (#21736)
The cert refresh loop treated every Web entry in the ServeConfig as
HTTPS, so a node serving only plain HTTP fetched and renewed a Let's
Encrypt cert for its name. Check the port's TCP handler for HTTPS
before considering a Web entry, for node and Service entries alike.

Fixes #21693

Signed-off-by: Brendan Creane <[email protected]>
2026-10-10 09:53:11 -07:00
Mazdak Nasab 5b226c7d1d feature/conn25: write through email and voip related DNS responses
Write through email related DNS responses (MX and TXT),
and voip ones (SRV and NAPTR) as we try to not break them.

Fixes https://github.com/tailscale/corp/issues/39982

Change-Id: I920c4e4401f5a20bcdcad092e94fce8ffa0f12b5
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-09 14:00:58 -07:00
Alex Valiushko 76648a00fd net/tstun: implement independent injection queue (#21681)
Injected packets now arrive on a queue of their own rather than being
multiplexed onto queue 0. Wrapper.Read is deprecated. It still reads the
first kernel-backed queue, but from now on no single queue of a Wrapper
sees every packet.

Deletes the poll goroutine, the bufferConsumed token, the vectorOutbound
channel, tunVectorReadResult, a full-size slab, and the copy of every
accepted packet between the two slabs.

wireguard-go now runs an extra TUN reader goroutine, a net wash compared
to running our poll routine.

Measured on c8gn.2xlarge, Ubuntu 24.04, Kernel v6.14, tailscaled under
load from two peers, each running iperf3 -P8.

            tx mean   rx mean   cores
  main       7.00      8.84      3.49
  branch     8.94      8.86      3.95

Bumps wireguard-go pin to tailscale/wireguard-go@e61b6b7811.

Updates tailscale/corp#37878

Change-Id: Ide0e8a9f345371b2747fad59dd2bf963c8af5b63

Signed-off-by: Alex Valiushko <[email protected]>
2026-10-08 13:13:11 -07:00
Mazdak Nasab 417d3c00b0 feature/conn25: lock mutex right before shared resources in client
Lock shared resources right before access
for clarity and preventing bugs.

Updates #cleanup

Change-Id: I1f905a3e4ec8b9ede4e8846e84e7bc50d78c67f0
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-08 09:26:56 -07:00
Mazdak Nasab 3420967a5f feature/conn25: lock mutext in client resendTransitIPMapping
Lock mutext in resendTransitIPMapping before accessing
the shared resource to prevent data race.

Fixes https://github.com/tailscale/corp/issues/49568

Change-Id: I35b9e99428361732c9a785020d7609d29a99877e
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-08 09:26:56 -07:00
James Tucker 852c3d1f0a feature/exitnodehealth: refine exit node warnings based on responsiveness
Report when an active selected exit node has not answered disco messages for a minute. Include the node name and last response time in the warning.

Evaluate responsiveness from existing magicsock heartbeats and clear the warning when the peer becomes idle or responds. Use changes to nonzero WireGuard RX and TX counters to suppress warnings when traffic is working. Keep observation history and warning evaluation in the exitnodehealth feature. WireGuard-only peers are excluded.

Updates #tailscale/corp#33007

Signed-off-by: James Tucker <[email protected]>
2026-10-07 15:38:22 -07:00
Brad Fitzpatrick 92a64b306d ipn/{ipnext,ipnlocal},feature/conn25: add ExtraDNSRoutes hook for conn25 split DNS
dnsConfigForNetmap called appc.AppDNSRoutes directly to synthesize the
conn25 split DNS routes from the self node's capability map, which was
the one place node_backend.go depended on the appc package and was
marked with a TODO to make it a hook.

Add ipnext.Hooks.ExtraDNSRoutes, which returns extension-supplied split
DNS routes. authReconfigLocked calls it and passes the result into
dnsConfigForNetmap, which adds the routes alongside the netmap's own
routes with the same UseWithExitNode handling as before.

The hook takes no arguments: the conn25 extension computes the routes
in its OnSelfChange handler and clears them on a switch to a different
node, and it already tracks the AppConnector.Advertise pref from
ProfileStateChange. Both of those hooks fire before the reconfig that
consults ExtraDNSRoutes, so the state is current. The conditions are
unchanged: no routes when this node itself advertises as an app
connector, and none without the experimental capability.

Updates tailscale/corp#37125

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I6c2e9f4b8a1d3e7f5c0b2a9d8e6f4c3b1a7d5e9f
2026-10-05 10:14:23 -07:00
Alex Chan 9128778b65 types/key: rename NLPublic/Private to TLPublic/Private
The NL prefix is one of the last references to the "Network Lock" name
which we're cleaning up.

Updates tailscale/corp#37904

Change-Id: I751194e0b49447e97a65ed6975e3da680226ce85
Signed-off-by: Alex Chan <[email protected]>
2026-10-02 16:03:51 +01:00
Jonathan Nobels d8c7cafeda feature/exitnodehealth: warn when selected exit nodes are unavailable (#21017)
updates tailscale/corp#33007

When a selected exit node can't carry internet traffic due to a misconfiguration (wrong ID, node
deleted, routes removed, etc), blackhole default routes are installed and all internet traffic is dropped.
That is the correct behavior -- better to drop than leak to the local network -- but it was entirely silent:
the stable-ID lookup in nodeBackend.updateRouteManagerPrefs misses without a log line, and Status
leaves ExitNodeStatus nil. The user sees a healthy Tailscale with no internet. If an admin fat-fingers the
exit node name in an IT policy, for example, it's easy to break every node with zero feedback.

This adds an exit-node-unavailable health warning covering every way the selection can fail to carry
traffic (short of reachability which is a separate concern), reported via exitnodehealth.ArgExitNodeReason.

The warning names the exit node, caching its display name while it is still a peer so the name survives
its departure, and falls back to the stable ID or IP. When the selection is mandated by the ExitNodeID
or ExitNodeIP policy settings, the message tells the user to contact their network administrator instead
of suggesting they pick another exit node.

To test this, set a forced exit node policy with some random ip or node id. The warning has a 5 second
 threshold. It should clear as soon as you change to a proper exit node.

Signed-off-by: Jonathan Nobels <[email protected]>
2026-10-01 08:57:20 -04:00
Brad Fitzpatrick 654c105f8b tstest/natlab/vmtest, gokrazy, cmd/tailscale/cli: add minimal-build vmtests
Add vmtests that boot pairs of gokrazy VMs whose tailscale and tailscaled
are minimal builds and check that IP traffic flows between them over
WireGuard, so we notice if a minimal build stops doing its one job:
build_dist.sh --extra-small (direct path through NATs), that minus NAT
traversal (DERP across NATs, direct on a shared LAN), and DERP-only.

They found that "tailscale up" built with ts_omit_ipnbus returned before
calling Start or EditPrefs, making it a no-op. Fix that, and have it wait
for the Running state by polling tailscaled's status instead of watching
the IPN bus, so scripts can rely on it as with normal builds.

The extra-small feature list moves to featuretags.ExtraSmall so
build_dist.sh (via a new "featuretags --extra-small") and vmtest share
it. The gokrazy builder gains --output and --go-build-tags flags to build
the variant images, and natlabprep --gokrazy prebuilds them all for CI.

Updates #13038
Updates #12614

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I0caa2c7b3adf2399da09b6d07a942f1dc34e8486
2026-09-30 15:53:47 -07:00
Brad Fitzpatrick e987d72be2 feature/featuretags: add MinTags, use it in three places
cmd/featuretags --min, cmd/tsconnect/wasmbuild, and a cmd/tailscaled
test each computed "omit every feature except these" on their own.
Move that into featuretags.MinTags so other Go code (such as upcoming
natlab vmtests of minimal builds) can compute the tags without running
cmd/featuretags. No behavior change.

Updates #12614

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ie0a5faf1f1d3e4e035326572b16f20180671d1c4
2026-09-30 07:42:13 -07:00
Michael Ben-Ami (on Claude) a0e471a35b feature/conn25: split client and connector code into their own files
conn25.go had grown to hold the extension, the Conn25 type, the config,
the DNS rewriting, and both the client and connector implementations.
Move the client struct and its methods to client.go, and the connector
struct and its methods to connector.go.

appAddr, transitIPExpiryEntry, and connectorTransitIPExpiry are used
only by the connector, so they move to connector.go. addrs moves to
client.go because it is a client-side concept, even though the
extension's send path in conn25.go and addrAssignments.go also refer
to it. Everything else stays in conn25.go.

Test functions covering client and connector behavior move to
client_test.go and connector_test.go correspondingly.

This is a pure code move: no declaration is added, removed, or edited,
and the relative order of everything is unchanged.

Updates #cleanup

Signed-off-by: Michael Ben-Ami <[email protected]>
2026-09-29 10:21:45 -04:00
Brad Fitzpatrick fe91043315 wgengine/magicsock, net/netcheck, feature/featuretags: add udptransport and nattraversal features
Contining the trend of making everything be optional that could
possibly be optional, this makes the magicsock UDP underlay transport
be optional. (mostly replacing a bunch of GOOS != "js" checks in the process)

Omitting udptransport (ts_omit_udptransport) makes magicsock DERP-only: no
UDP sockets, no advertised endpoints, and netcheck measures DERP latency
over HTTPS. Omitting only nattraversal keeps disco ping/pong to peers'
advertised endpoints but drops STUN, call-me-maybe, the peer relay client,
the endpoint tracker, and UDP lifetime probing.

Both are plain linker dead-code elimination via buildfeatures
constants. (as oppposed to moving the code all over into feature
packages and indirecting through hooks) The minimal linux/amd64
tailscaled shrinks by 258 KB without nattraversal and 561 KB without
both.

Updates #12614

Change-Id: Ife10804b48a168d9481e4321c18ed8fc85fa71f1
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-09-29 06:09:17 -07:00
Mazdak Nasab ecedffff5b feature/conn25: unmap addresses in TransitIPRequest
Unmap both transit and destination IPs in
TransitIPRequest to prevent unpredictable mappings.

Fixes https://github.com/tailscale/corp/issues/48781

Change-Id: I5aea2bf4e5ff5240c66f20c71cfa1ceba1722622
Signed-off-by: Mazdak Nasab <[email protected]>
2026-09-28 11:11:52 -07:00
Mazdak Nasab 8a119e1ec0 feature/conn25: skip AAAA records with IPv4-in-IPv6 addresses
Skip destination IPs from AAAA records that are
in ipv4-in-ipv6 format.

Fixes https://github.com/tailscale/corp/issues/48781

Change-Id: I5eeaa9c998c79250d2e6a943fa9f26ed7feb5ec6
Signed-off-by: Mazdak Nasab <[email protected]>
2026-09-28 11:11:52 -07:00
Mazdak Nasab 72fa821ed4 feature/conn25: clean up formatting in conn25*.go files
Improving formatting in conn25.go and conn25_test.go.

Updates #cleanup

Change-Id: Ic597e8e3e9284d0cc244de538abd6a563f783f32
Signed-off-by: Mazdak Nasab <[email protected]>
2026-09-25 09:46:53 -07:00
Mazdak Nasab 5af313f0aa feature/conn25: validate ConnectorTransitIPRequest contains TransitIPs in the pool
Validate ConnectorTransitIPRequest messages contain
TransitIPs in the configured pool.

Fixes https://github.com/tailscale/corp/issues/46600

Change-Id: I35dfcaa95a08b4347b1164df905cc59de47e4d96
Signed-off-by: Mazdak Nasab <[email protected]>
2026-09-25 09:46:53 -07:00