From 3d5ef74f26703c0c8c9804104d9609805eadbb8a Mon Sep 17 00:00:00 2001 From: Martin Baillie Date: Wed, 12 Feb 2020 18:09:24 +1100 Subject: [PATCH] tailscaled: add tunnel name and port flags OpenBSD tunnel names are prefixed with `tun`. Controlling the port allows for deterministic configuration of firewall rules (using `pf` in this case). Signed-off-by: Martin Baillie --- cmd/tailscaled/ipnd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/tailscaled/ipnd.go b/cmd/tailscaled/ipnd.go index 466c074b2..8d2b68b77 100644 --- a/cmd/tailscaled/ipnd.go +++ b/cmd/tailscaled/ipnd.go @@ -20,11 +20,14 @@ import ( "tailscale.com/ipn/ipnserver" "tailscale.com/logpolicy" "tailscale.com/wgengine" + "tailscale.com/wgengine/magicsock" ) func main() { fake := getopt.BoolLong("fake", 0, "fake tunnel+routing instead of tuntap") debug := getopt.StringLong("debug", 0, "", "Address of debug server") + tunname := getopt.StringLong("tun", 0, "ts0", "tunnel interface name") + listenport := getopt.Uint16Long("port", 'p', magicsock.DefaultPort, "WireGuard port (0=autoselect)") logf := wgengine.RusagePrefixLog(log.Printf) @@ -47,7 +50,7 @@ func main() { if *fake { e, err = wgengine.NewFakeUserspaceEngine(logf, 0, false) } else { - e, err = wgengine.NewUserspaceEngine(logf, "ts0", 0, false) + e, err = wgengine.NewUserspaceEngine(logf, *tunname, *listenport, false) } if err != nil { log.Fatalf("wgengine.New: %v\n", err)