Skip to content

Conversation

raggi
Copy link
Member

@raggi raggi commented Sep 26, 2025

Fix regression introduced in 9c933a0.

Fixes tailscale/tailscale#16836

@raggi raggi requested a review from Copilot September 26, 2025 19:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a regression in interface address enumeration that was introduced in commit 9c933a0. The change updates the address parsing logic to use the more modern netip.ParsePrefix instead of net.ParseCIDR and converts the parsed prefix to a *net.IPAddr for proper storage in the AltAddrs field.

  • Replaces net.ParseCIDR with netip.ParsePrefix for parsing network addresses
  • Updates the address storage format from *net.IPNet to *net.IPAddr
  • Preserves zone information when converting parsed addresses

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@raggi raggi requested a review from jwhited September 26, 2025 19:22
@raggi raggi force-pushed the raggi/interfaceaddrs branch from be6a0d7 to 6956bb3 Compare September 26, 2025 19:22
Fix regression introduced in 9c933a0.

Fixes tailscale/tailscale#16836

Signed-off-by: James Tucker <james@tailscale.com>
@raggi raggi force-pushed the raggi/interfaceaddrs branch from 6956bb3 to 1b5e15a Compare September 26, 2025 19:24
Copy link

@sfllaw sfllaw left a comment

Choose a reason for hiding this comment

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

Approved.

I have one suggestion to simplify things.

I was also going to ask for a test case to prevent future breakage, but then I realized that there aren’t any Go tests in this repo?!?

Comment on lines +105 to +112
var ip net.IP
if pfx.Addr().Is4() {
v4 := pfx.Addr().As4()
ip = net.IP(v4[:])
} else {
v6 := pfx.Addr().As16()
ip = net.IP(v6[:])
}
Copy link

Choose a reason for hiding this comment

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

Suggestion (non-blocking): Is this a good place to use netip.Addr.AsSlice?

Suggested change
var ip net.IP
if pfx.Addr().Is4() {
v4 := pfx.Addr().As4()
ip = net.IP(v4[:])
} else {
v6 := pfx.Addr().As16()
ip = net.IP(v6[:])
}
ip := net.IP(pfx.Addr().AsSlice())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android reports wrong local endpoint addresses, degrading local connectivity between tailscale nodes
2 participants