mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-31 05:23:14 +00:00
wgengine/router: correctly read IPv6 routes when diffing.
Fixes #1185. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
abfd73f569
commit
54d7070121
@ -662,13 +662,26 @@ func getInterfaceRoutes(ifc *winipcfg.IPAdapterAddresses, family winipcfg.Addres
|
|||||||
// syncRoutes incrementally sets multiples routes on an interface.
|
// syncRoutes incrementally sets multiples routes on an interface.
|
||||||
// This avoids a full ifc.FlushRoutes call.
|
// This avoids a full ifc.FlushRoutes call.
|
||||||
func syncRoutes(ifc *winipcfg.IPAdapterAddresses, want []*winipcfg.RouteData) error {
|
func syncRoutes(ifc *winipcfg.IPAdapterAddresses, want []*winipcfg.RouteData) error {
|
||||||
routes, err := getInterfaceRoutes(ifc, windows.AF_INET)
|
routes4, err := getInterfaceRoutes(ifc, windows.AF_INET)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
got := make([]*winipcfg.RouteData, 0, len(routes))
|
routes6, err := getInterfaceRoutes(ifc, windows.AF_INET6)
|
||||||
for _, r := range routes {
|
if err != nil {
|
||||||
|
// TODO: what if v6 unavailable?
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
got := make([]*winipcfg.RouteData, 0, len(routes4))
|
||||||
|
for _, r := range routes4 {
|
||||||
|
got = append(got, &winipcfg.RouteData{
|
||||||
|
Destination: r.DestinationPrefix.IPNet(),
|
||||||
|
NextHop: r.NextHop.IP(),
|
||||||
|
Metric: r.Metric,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for _, r := range routes6 {
|
||||||
got = append(got, &winipcfg.RouteData{
|
got = append(got, &winipcfg.RouteData{
|
||||||
Destination: r.DestinationPrefix.IPNet(),
|
Destination: r.DestinationPrefix.IPNet(),
|
||||||
NextHop: r.NextHop.IP(),
|
NextHop: r.NextHop.IP(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user