Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/srv/desktop/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,16 @@ func (s *WindowsService) lookupDesktop(ctx context.Context, hostname string) ([]
hostname, resolverName, err)
}

ch <- addrs
// even though we requested "ip4" it's possible to get IPv4
// addresses mapped to IPv6 addresses, so we unmap them here
result := make([]netip.Addr, 0, len(addrs))
for _, addr := range addrs {
if addr.Is4() || addr.Is4In6() {
result = append(result, addr.Unmap())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we worried about actual ipv6 addresses being returned here? We could just do addrs[i] = addrs[i].Unmap() if that's not the case, Unmap is a noop for ipv4 addresses.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't worried about them showing up before and then we ran in to this bug, so I'd rather be extra defensive.

}
}

ch <- result
}()
return ch
}
Expand Down