ClientPrepareNewFlowForMagicIP folded resolving a Magic IP and counting the
flow into one call, and the datapath dropped its own IsValid check on the
resolved Transit IP in favor of trusting the new ok return. That left the
validity requirement stated only in the Conn25Datapath doc comment, and an
implementation that violates it panics the packet path two different ways.
A zero Transit IP is neither Is4 nor Is6, so it slips past both of
checksum.UpdateDstAddr's family-mismatch panics and reaches As4, which
panics in turn; a valid Transit IP in the other family hits one of those
family-mismatch panics outright. Check for both, releasing the counted
reference since no flow is installed, so the packet passes through
unmodified as before.
Updates https://github.com/tailscale/corp/issues/44273
Change-Id: Ib0c0eaa92bc4f0470299da08d48c865e1d101849
Signed-off-by: Mazdak Nasab <[email protected]>
Add an optional auth-exchange-attempts flag to up that allows for
controlling the number of attempts made on transient errors (e.g, 5XX or
client-side deadline exceeded errors) during OAuth or workload identity
federation auth exchange operations.
This defaults to 1 (e.g., no retries). Specifying a larger number of
attempts enables retrying the auth exchange with exponential backoff
instead of the default of failing after a single try.
Updates https://github.com/tailscale/tailscale/issues/20339
Signed-off-by: Mario Minardi <[email protected]>
The hook was given (node ID, node key) pairs, but its result is keyed
by node ID, and its only implementation, conn25, now tracks connector
transit IPs by node ID too. Drop the node key from the sequence.
Updates tailscale/corp#51237
Signed-off-by: Michael Ben-Ami <[email protected]>
The client tracked which transit IPs belong to which connector in a
map keyed by the connector's node key. The ExtraWireGuardAllowedIPs
hook's results and the route manager are keyed by node ID, though, and
a node key can rotate while the node ID stays the same, which would
orphan a connector's transit IPs under the stale key.
Key the map by node ID instead, and rename byConnKey and
lookupTransitIPsByConnKey to match. addTransitIPForConnector now
rejects connectors with a zero node ID rather than a zero node key,
since the ID is what the mapping is keyed on.
Updates tailscale/corp#51237
Signed-off-by: Michael Ben-Ami <[email protected]>
The resolv.conf watcher needs one watch on one directory and a
blocking read. gonotify v3.0.2 has a bug where it loops forever
without advancing when a record's name length runs past the end of a
read. It also never closes its fd on cancel and allocates 32 KB per
Read. Use x/sys/unix directly, return an error on a malformed record,
and stop when the kernel removes the watch.
Fixes#16576
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: If2bc5e94f8aab2922ee9e07b3c2b75a76f4f9236
gonotify.NewDirWatcher registers IN_ALL_EVENTS on the directory and
every subdirectory below it, and applies the caller's mask only in
userspace. Watching /etc that way wakes tailscaled for every open or
read of any file under /etc, including /etc/ld.so.cache on each exec.
Under a busy exec or open loop tailscaled used 150-230% CPU.
Use a plain inotify watch on the directory itself with the events we
care about, so the kernel drops everything else. Call cb once at
startup, which NewDirWatcher's synthetic events for existing files
used to do.
Rework TestWatchFile to wait for the startup callback first, so it
still checks that a write triggers one, and add a test that reads and
writes to other files don't.
Fixes#21743
Updates #16576
Change-Id: Idf1b13a6dffde4191ce8744cbb0e24a74b7a5b82
Signed-off-by: Yerassyl Urazalin <[email protected]>
A Magic IP gets its address assignment when the DNS response is rewritten,
but the Transit IP it maps to only becomes usable later: handleAddressAssignment
registers it with the connector over PeerAPI, and only then does
addTransitIPForConnector put it in byConnKey, where extraWireGuardAllowedIPs
picks it up and hands it to WireGuard as an allowed IP for that peer.
Until then, transitIPForMagicIP would happily return the Transit IP, the
datapath would DNAT to it, and WireGuard would drop the packet because no
peer claims the address. The client application saw a black hole and hung.
That window stays open indefinitely when the registration never lands: a
failed PeerAPI request, a full assignment queue, or a reset that clears
byConnKey.
transitIPForMagicIP now checks that the Transit IP is registered under its
connector's node key, and returns the new ErrTransitIPNotRoutable if it
isn't. The datapath treats that like an unknown Magic IP and injects an
ICMP host unreachable, so the application fails fast instead of hanging.
Fixes https://github.com/tailscale/corp/issues/50405
Change-Id: Id232e27063f27278e65279d9b1adad5d67d3b6ef
Signed-off-by: Mazdak Nasab <[email protected]>
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]>
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]>
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
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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.
Fixestailscale/corp#50897.
Signed-off-by: Naman Sood <[email protected]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
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]>
Lock shared resources right before access
for clarity and preventing bugs.
Updates #cleanup
Change-Id: I1f905a3e4ec8b9ede4e8846e84e7bc50d78c67f0
Signed-off-by: Mazdak Nasab <[email protected]>
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]>
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
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]>
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]>