]> git.puffer.fish Git - mirror/pve-network.git/commitdiff
sdn: fix comparison of pending configuration values
authorStefan Hanreich <s.hanreich@proxmox.com>
Fri, 7 Feb 2025 13:40:37 +0000 (14:40 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Feb 2025 20:24:28 +0000 (21:24 +0100)
The conditional assignment caused falsy values to be converted to
undef when comparing them. This led to the behavior that configuration
values that are interpreted by perl as falsy would get wrongly
compared and always show up as pending changes.

As an example the 'bgp-multipath-as-path-relax' or 'ebgp' keys of the
bgp controller configuration are booleans and get stored as 0 in the
controller configuration when they're turned off. They always showed
up as a pending change, because of the behavior described above.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
src/PVE/Network/SDN.pm

index c7dccfa89fcf438ca52c04eeae1d1b2a67684e3a..4ac9720bf2b5ae5bf4d8883ab5a54ca9ca8dd7aa 100644 (file)
@@ -115,8 +115,8 @@ sub pending_config {
        my $config_object = $config_objects->{$id};
 
        foreach my $key (sort keys %{$config_object}) {
-           my $config_value = PVE::Network::SDN::encode_value(undef, $key, $config_object->{$key}) if $config_object->{$key};
-           my $running_value = PVE::Network::SDN::encode_value(undef, $key, $running_object->{$key}) if $running_object->{$key};
+           my $config_value = PVE::Network::SDN::encode_value(undef, $key, $config_object->{$key});
+           my $running_value = PVE::Network::SDN::encode_value(undef, $key, $running_object->{$key});
            if($key eq 'type' || $key eq 'vnet') {
                $pending->{$id}->{$key} = $config_value;
            } else {