cmd/tailscaled, net/tstun: add build tags to omit BIRD and TAP

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I7a39f4eeeb583b73ecffaf4c5f086a38e3a53e2e
This commit is contained in:
Andrew Dunham 2022-11-07 10:33:23 -05:00
parent 036334e913
commit c2d7940ec0
5 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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 (

View File

@ -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

View File

@ -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) {