diff --git a/build_dist.sh b/build_dist.sh index 0bf39e3cb..5b7370bda 100755 --- a/build_dist.sh +++ b/build_dist.sh @@ -54,7 +54,7 @@ while [ "$#" -gt 1 ]; do --extra-small) shift ldflags="$ldflags -w -s" - tags="${tags:+$tags,}ts_omit_aws" + tags="${tags:+$tags,}ts_omit_aws,ts_omit_bird,ts_omit_tap" ;; --box) shift diff --git a/cmd/tailscaled/tailscaled_bird.go b/cmd/tailscaled/tailscaled_bird.go index b871ca7c1..eb7753c2d 100644 --- a/cmd/tailscaled/tailscaled_bird.go +++ b/cmd/tailscaled/tailscaled_bird.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build go1.19 && (linux || darwin || freebsd || openbsd) +//go:build go1.19 && (linux || darwin || freebsd || openbsd) && !ts_omit_bird package main diff --git a/net/tstun/tap_linux.go b/net/tstun/tap_linux.go index 643e997eb..15995b1a6 100644 --- a/net/tstun/tap_linux.go +++ b/net/tstun/tap_linux.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !ts_omit_tap + package tstun import ( diff --git a/net/tstun/tap_unsupported.go b/net/tstun/tap_unsupported.go index 4b63d1883..2659e051e 100644 --- a/net/tstun/tap_unsupported.go +++ b/net/tstun/tap_unsupported.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !linux +//go:build !linux || ts_omit_tap package tstun diff --git a/net/tstun/tun.go b/net/tstun/tun.go index 9524dcd65..543f3ef67 100644 --- a/net/tstun/tun.go +++ b/net/tstun/tun.go @@ -31,6 +31,9 @@ func New(logf logger.Logf, tunName string) (tun.Device, string, error) { if runtime.GOOS != "linux" { return nil, "", errors.New("tap only works on Linux") } + if createTAP == nil { // if the ts_omit_tap tag is used + return nil, "", errors.New("tap is not supported in this build") + } f := strings.Split(tunName, ":") var tapName, bridgeName string switch len(f) {