fix #7329: api: avoid overwriting existing IPv6 config method

If the inet6 address family's cidr6/gatway6 values are not present, the
interface.method6 values is mutated with `NetworkConfigMethod::Manual`
even if the interface.method6 already has a value. For example, if
the config method is `auto` then it gets replaced by `Manual` config
method.

Later, when writing the config file to the interfaces.new file if the
config method is manual and if there are no IPv6 specific attributes
present, then the inet6 stanza gets skipped.

In order to fix the issue update the condition to only set the config
method to `::Manual` if there is no value present inside the `method6`
property of the interface object.

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7329
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Christian Ebner <c.ebner@proxmox.com>
Link: https://lore.proxmox.com/20260316152101.207406-3-s.shaji@proxmox.com
This commit is contained in:
Shan Shaji 2026-03-16 16:21:01 +01:00 committed by Thomas Lamprecht
parent 4de0763d12
commit dc680ea320

View File

@ -782,7 +782,7 @@ pub fn update_interface(
if interface.cidr6.is_some() || interface.gateway6.is_some() {
interface.method6 = Some(NetworkConfigMethod::Static);
} else {
} else if interface.method6.is_none() {
interface.method6 = Some(NetworkConfigMethod::Manual);
}