Skip to content

Conversation

oromenahar
Copy link

@oromenahar oromenahar commented Apr 18, 2025

Hey folks,

I added support for IPv6 and IPv4 dual stack setups or IPv6 only setups. The commit messages explains a lot for that reason I just copy the message to the description. I hope I didn't miss anything necessary and the PR can be discussed and reviewed.

It first checks for a valid IPv6 or IPv4 and continues if it's not valid. After that it continues if the ip is part of linkLocalUnicat, Multicast or loopback. The first ip which doesn't match one of the following types will be returned as valid.
no IPv4 or IPv6 at all
SiteLocalUnicast: fec0::/10
multicast: ff00::/8
LinkLocalUnicat: fe80::/64

If the proxmox interface supports IPv4 and IPv6 the selected ip depends on the proxmox list sorting of the returned addresses. The first valid ip will be used which can change depending on the proxmox api.

related to #233
related to #10227
related to #10858

@oromenahar oromenahar requested a review from a team as a code owner April 18, 2025 14:19
Copy link

hashicorp-cla-app bot commented Apr 18, 2025

CLA assistant check
All committers have signed the CLA.

continue
}
if addr.To4() == nil {
} else if addr.IsLinkLocalUnicast() || addr.IsMulticast() || addr.IsLoopback() {
Copy link
Contributor

Choose a reason for hiding this comment

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

can't this be replaced with !addr.IsGlobalUnicast()?

also add || addr.IsUnspecified()?

Copy link
Author

@oromenahar oromenahar Sep 15, 2025

Choose a reason for hiding this comment

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

Added || addr.IsUnspecified()

I don't think we should change this to !addr.IsGlobalUnicast() because this misses the ULA. We could change it to !addr.IsGlobalUnicast() && !addr.IsPrivate()? This would inlcude 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7 and all public IPs.

It first checks for a valid IPv6 or IPv4 and continues if it's not
valid. After that it continues if the ip is part of linkLocalUnicat,
Multicast or loopback. The first ip which doesn't match one of the
following types will be returned as valid.
no IPv4 or IPv6 at all
SiteLocalUnicast: fec0::/10
multicast: ff00::/8
global Unicast ::/96
LinkLocalUnicat: fe80::/64

If the proxmox interface supports IPv4 and IPv6 the selected ip depends
on the proxmox list sorting of the returned addresses. The first
valid ip will be used which can change depending on the proxmox api.

related to hashicorp#233
related to #10227
related to #10858

Signed-off-by: oromenahar <github@mkwg.de>
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.

2 participants