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]>
21 lines
529 B
Go
21 lines
529 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !plan9 && !tamago
|
|
|
|
package tstun
|
|
|
|
import (
|
|
"errors"
|
|
"syscall"
|
|
"testing"
|
|
)
|
|
|
|
// ErrInjectionQueueFull must match the platform ENOBUFS errno, so callers
|
|
// can test for buffer exhaustion without knowing this package's type.
|
|
func TestErrInjectionQueueFullMatchesENOBUFS(t *testing.T) {
|
|
if !errors.Is(ErrInjectionQueueFull, syscall.ENOBUFS) {
|
|
t.Errorf("errors.Is(ErrInjectionQueueFull, syscall.ENOBUFS) = false, want true")
|
|
}
|
|
}
|