summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2021-05-11 15:24:37 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-05-11 15:30:39 -0700
commitebcd7ab89042fb660a96a75a360ce17140084435 (patch)
treebefc06a39c8ee15d37f8b1cf9a3d0bb45f978497
parentaacb2107aeb19a9e91627d6a9da267ad32db3759 (diff)
downloadtailscale-ebcd7ab89042fb660a96a75a360ce17140084435.tar.xz
tailscale-ebcd7ab89042fb660a96a75a360ce17140084435.zip
wgengine: remove wireguard-go DeviceOptions
We no longer need them. This also removes the 32 bytes of prefix junk before endpoints. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
-rw-r--r--wgengine/magicsock/magicsock.go6
-rw-r--r--wgengine/magicsock/magicsock_test.go10
-rw-r--r--wgengine/userspace.go4
3 files changed, 4 insertions, 16 deletions
diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go
index 575dc8ce5..4291e13d9 100644
--- a/wgengine/magicsock/magicsock.go
+++ b/wgengine/magicsock/magicsock.go
@@ -2737,15 +2737,9 @@ func packIPPort(ua netaddr.IPPort) []byte {
// ParseEndpoint is called by WireGuard to connect to an endpoint.
// endpointStr is a json-serialized wgcfg.Endpoints struct.
-// (It it currently prefixed by 32 bytes of junk, but that will change shortly.)
// If those Endpoints contain an active discovery key, ParseEndpoint returns a discoEndpoint.
// Otherwise it returns a legacy endpoint.
func (c *Conn) ParseEndpoint(endpointStr string) (conn.Endpoint, error) {
- // Our wireguard-go fork prepends the public key to endpointStr.
- // We don't need it; strip it off.
- // This code will be deleted soon.
- endpointStr = endpointStr[32:]
-
var endpoints wgcfg.Endpoints
err := json.Unmarshal([]byte(endpointStr), &endpoints)
if err != nil {
diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go
index 5b6dc2f8a..8545a39dc 100644
--- a/wgengine/magicsock/magicsock_test.go
+++ b/wgengine/magicsock/magicsock_test.go
@@ -168,7 +168,7 @@ func newMagicStack(t testing.TB, logf logger.Logf, l nettype.PacketListener, der
tsTun.SetFilter(filter.NewAllowAllForTest(logf))
wgLogger := wglog.NewLogger(logf)
- dev := device.NewDevice(tsTun, conn.Bind(), wgLogger.DeviceLogger, new(device.DeviceOptions))
+ dev := device.NewDevice(tsTun, conn.Bind(), wgLogger.DeviceLogger)
dev.Up()
// Wait for magicsock to connect up to DERP.
@@ -509,7 +509,7 @@ func TestDeviceStartStop(t *testing.T) {
tun := tuntest.NewChannelTUN()
wgLogger := wglog.NewLogger(t.Logf)
- dev := device.NewDevice(tun.TUN(), conn.Bind(), wgLogger.DeviceLogger, new(device.DeviceOptions))
+ dev := device.NewDevice(tun.TUN(), conn.Bind(), wgLogger.DeviceLogger)
dev.Up()
dev.Close()
}
@@ -1257,11 +1257,7 @@ func makeEndpoint(tb testing.TB, public tailcfg.NodeKey, disco tailcfg.DiscoKey)
if err != nil {
tb.Fatal(err)
}
- // Our wireguard-go fork prepends the public key when calling ParseEndpoint.
- // We no longer use it; add some junk there to emulate wireguard-go.
- // This will go away soon.
- junk := strings.Repeat(" ", 32)
- return junk + string(buf)
+ return string(buf)
}
// addTestEndpoint sets conn's network map to a single peer expected
diff --git a/wgengine/userspace.go b/wgengine/userspace.go
index c4f732d18..6e56bbd11 100644
--- a/wgengine/userspace.go
+++ b/wgengine/userspace.go
@@ -306,8 +306,6 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
}
e.wgLogger = wglog.NewLogger(logf)
- opts := &device.DeviceOptions{}
-
e.tundev.OnTSMPPongReceived = func(pong packet.TSMPPongReply) {
e.mu.Lock()
defer e.mu.Unlock()
@@ -320,7 +318,7 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
// wgdev takes ownership of tundev, will close it when closed.
e.logf("Creating wireguard device...")
- e.wgdev = device.NewDevice(e.tundev, e.magicConn.Bind(), e.wgLogger.DeviceLogger, opts)
+ e.wgdev = device.NewDevice(e.tundev, e.magicConn.Bind(), e.wgLogger.DeviceLogger)
closePool.addFunc(e.wgdev.Close)
closePool.addFunc(func() {
if err := e.magicConn.Close(); err != nil {