Skip to content

Commit

Permalink
wgengine/windows: use new winipcfg.Sync{Addresses,Routes} functions.
Browse files Browse the repository at this point in the history
This avoids flushing and reloading the whole list of addresses and
routes whenever remote node information changes.
  • Loading branch information
apenwarr committed Apr 13, 2020
1 parent adf74c7 commit dc9b39e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion go.mod
Expand Up @@ -17,7 +17,7 @@ require (
github.com/mdlayher/netlink v1.1.0
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
github.com/peterbourgon/ff/v2 v2.0.0
github.com/tailscale/winipcfg-go v0.0.0-20200213045944-185b07f8233f
github.com/tailscale/winipcfg-go v0.0.0-20200413171540-609dcf2df55f
github.com/tailscale/wireguard-go v0.0.0-20200407164751-7f0c43dd1145
github.com/toqueteos/webbrowser v1.2.0
go4.org/mem v0.0.0-20200411205429-f77f31c81751
Expand All @@ -30,3 +30,4 @@ require (
gortc.io/stun v1.22.1
rsc.io/goversion v1.2.0
)

2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -79,6 +79,8 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tailscale/winipcfg-go v0.0.0-20200213045944-185b07f8233f h1:q2ynfOHxHaaMnkZ1YHswWeO6wEk7IyOnkFozytZ1ztc=
github.com/tailscale/winipcfg-go v0.0.0-20200213045944-185b07f8233f/go.mod h1:x880GWw5fvrl2DVTQ04ttXQD4DuppTt1Yz6wLibbjNE=
github.com/tailscale/winipcfg-go v0.0.0-20200413171540-609dcf2df55f h1:uFj5bslHsMzxIM8UTjAhq4VXeo6GfNW91rpoh/WMJaY=
github.com/tailscale/winipcfg-go v0.0.0-20200413171540-609dcf2df55f/go.mod h1:x880GWw5fvrl2DVTQ04ttXQD4DuppTt1Yz6wLibbjNE=
github.com/tailscale/wireguard-go v0.0.0-20200407164751-7f0c43dd1145 h1:n/ErEski7q1+ew00eaoiCmyx/5Wtf9nKBhWYLsmID/U=
github.com/tailscale/wireguard-go v0.0.0-20200407164751-7f0c43dd1145/go.mod h1:JPm5cTfu1K+qDFRbiHy0sOlHUylYQbpl356sdYFD8V4=
github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ=
Expand Down
4 changes: 2 additions & 2 deletions wgengine/ifconfig_windows.go
Expand Up @@ -326,7 +326,7 @@ func configureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []wgcfg.IP, dns
}
}

err = iface.SetAddresses(addresses)
err = iface.SyncAddresses(addresses)
if err != nil {
return err
}
Expand Down Expand Up @@ -355,7 +355,7 @@ func configureInterface(m *wgcfg.Config, tun *tun.NativeTun, dns []wgcfg.IP, dns
log.Printf("routes: %v\n", routes)

var errAcc error
err = iface.SetRoutes(deduplicatedRoutes)
err = iface.SyncRoutes(deduplicatedRoutes)
if err != nil && errAcc == nil {
log.Printf("setroutes: %v\n", err)
errAcc = err
Expand Down

0 comments on commit dc9b39e

Please sign in to comment.