mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
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]>
25 lines
747 B
Go
25 lines
747 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !plan9 && !tamago
|
|
|
|
package tstun
|
|
|
|
import (
|
|
"fmt"
|
|
"syscall"
|
|
)
|
|
|
|
// ErrInjectionQueueFull is returned when a full injection queue forced a
|
|
// best-effort packet to be dropped rather than queued. It wraps
|
|
// syscall.ENOBUFS, the platform's "no buffer space available" errno, so
|
|
// callers can test for buffer exhaustion without knowing this package's
|
|
// type:
|
|
//
|
|
// errors.Is(err, syscall.ENOBUFS)
|
|
//
|
|
// Dropped packets are already counted as reason="queue_full" in the
|
|
// tailscaled_outbound_dropped_packets_total usermetric, so callers need not
|
|
// log this error.
|
|
var ErrInjectionQueueFull = fmt.Errorf("injection queue full: %w", syscall.ENOBUFS)
|