Skip to content
Open
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
11 changes: 8 additions & 3 deletions builder/proxmox/common/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,15 @@ func getVMIP(state multistep.StateBag) (string, error) {

for _, iface := range ifs {
for _, addr := range iface.IpAddresses {
if addr.IsLoopback() {
if addr.To4() == nil && addr.To16() == nil {
// no IPv4 or IPv6 at all
continue
}
if addr.To4() == nil {
} else if addr.IsLinkLocalUnicast() || addr.IsMulticast() || addr.IsLoopback() || addr.IsUnspecified() {

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.

Can we add focused tests for the address selection behavior here? We should cover IPv4-only, IPv6-only, and dual-stack ordering so this change is pinned down before merge.

// can not be replaced by !addr.IsGlobalUnicast() because it just returns ips wich are globally routable,
// but Unique Local Addresses: fc00::/7 can be used as well for IPv6 setups.
// SiteLocalUnicast: fec0::/10
// multicast: ff00::/8
// LinkLocalUnicat: fe80::/64

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.

This changes the default communicator host selection from IPv4-only to the first usable IPv4 or IPv6 address. On dual-stack guests, that can silently switch existing builds to IPv6 if the guest agent reports it first. Can we preserve current behavior by preferring IPv4 and only falling back to IPv6 when no usable IPv4 exists?

continue
}
return addr.String(), nil
Expand Down