Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Minor changes:
- Makefile: download `90-afterburn-authorized-keys-file.conf` for rpm building
- ProxmoxVE: Define DNS entries for every interface, not just the first
- Hetzner: Add the `HETZNER_PUBLIC_IPV6` attribute
- ProxmoxVE: Explicitely deactivate Dracut IP autoconf as the IP is statically set

Packaging changes:

Expand Down
22 changes: 15 additions & 7 deletions src/providers/proxmoxve/cloudconfig.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
network::{self, DhcpSetting, NetworkRoute},
network::{self, dracut_addr, DhcpSetting, NetworkRoute},
providers::MetadataProvider,
};
use anyhow::{Context, Result};
Expand Down Expand Up @@ -199,13 +199,17 @@ impl MetadataProvider for ProxmoxVECloudConfig {
.find(|r| r.destination.is_ipv4() && r.destination.prefix() == 0)
{
kargs.push(format!(
"ip={}::{}:{}",
"ip={}::{}:{}:::off",
network.ip(),
gateway.gateway,
network.mask()
));
} else {
kargs.push(format!("ip={}:::{}", network.ip(), network.mask()));
kargs.push(format!(
"ip={}:::{}:::off",
network.ip(),
network.mask()
));
}
Comment thread
Rolv-Apneseth marked this conversation as resolved.
}
IpNetwork::V6(network) => {
Expand All @@ -215,13 +219,17 @@ impl MetadataProvider for ProxmoxVECloudConfig {
.find(|r| r.destination.is_ipv6() && r.destination.prefix() == 0)
{
kargs.push(format!(
"ip={}::{}:{}",
network.ip(),
gateway.gateway,
"ip={}::{}:{}:::off",
dracut_addr(&IpAddr::V6(network.ip())),
dracut_addr(&gateway.gateway),
network.prefix()
));
} else {
kargs.push(format!("ip={}:::{}", network.ip(), network.prefix()));
kargs.push(format!(
"ip={}:::{}:::off",
dracut_addr(&IpAddr::V6(network.ip())),
network.prefix()
));
}
Comment on lines 221 to 233

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

For IPv6 addresses, dracut's colon-separated parser requires them to be enclosed in square brackets (e.g., [2001:db8::1]) so that the colons in the IPv6 address are not mistaken for field separators. Since you are modifying these lines, please use the helper network::dracut_addr to correctly format the IPv6 addresses.

                                kargs.push(format!(
                                    "ip={}::{}:{}:::off",
                                    network::dracut_addr(&IpAddr::V6(network.ip())),
                                    network::dracut_addr(&gateway.gateway),
                                    network.prefix()
                                ));
                            } else {
                                kargs.push(format!(
                                    "ip={}:::{}:::off",
                                    network::dracut_addr(&IpAddr::V6(network.ip())),
                                    network.prefix()
                                ));
                            }

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.

@tormath1 I think this is a valid bug, it looks like the KubeVirt provider already does this correctly (src/providers/kubevirt/cloudconfig.rs:204).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, this is now done and tests are updated as well.

}
}
Expand Down
8 changes: 5 additions & 3 deletions src/providers/proxmoxve/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ fn test_network_kargs() {
let kargs = kargs.unwrap();

// Check static IP configuration with gateway
assert!(kargs.contains("ip=192.168.1.1::192.168.1.254:255.255.255.0"));
assert!(kargs.contains("ip=2001:db8:85a3::8a2e:370:0::2001:db8:85a3::8a2e:370:9999:24"));
assert!(kargs.contains("ip=192.168.1.1::192.168.1.254:255.255.255.0:::off"));
assert!(
kargs.contains("ip=[2001:db8:85a3::8a2e:370:0]::[2001:db8:85a3::8a2e:370:9999]:24:::off")
);

// Check nameservers
assert!(kargs.contains("nameserver=1.1.1.1,8.8.8.8"));
Expand Down Expand Up @@ -202,7 +204,7 @@ fn test_network_kargs_no_gateway() {
let kargs = kargs.unwrap();

// Check static IP configuration without gateway
assert!(kargs.contains("ip=192.168.1.1:::255.255.255.0"));
assert!(kargs.contains("ip=192.168.1.1:::255.255.255.0:::off"));

// Check nameservers
assert!(kargs.contains("nameserver=1.1.1.1,8.8.8.8"));
Expand Down
Loading