Skip to content
Open
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
16 changes: 12 additions & 4 deletions src/providers/proxmoxve/cloudconfig.rs
Original file line number Diff line number Diff line change
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 on lines 201 to 213

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The changes to the kernel arguments format (appending :::off) will cause the existing unit tests in src/providers/proxmoxve/tests.rs to fail, as they still assert the old format without the :::off suffix. Please update test_network_kargs and test_network_kargs_no_gateway in src/providers/proxmoxve/tests.rs to match the new format.

}
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={}::{}:{}",
"ip={}::{}:{}:::off",
network.ip(),
gateway.gateway,
network.prefix()
));
} else {
kargs.push(format!("ip={}:::{}", network.ip(), network.prefix()));
kargs.push(format!(
"ip={}:::{}:::off",
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()
                                ));
                            }

}
}
Expand Down
6 changes: 3 additions & 3 deletions src/providers/proxmoxve/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ 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 +202,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