From: Thomas Lamprecht Date: Wed, 31 Aug 2022 08:56:27 +0000 (+0200) Subject: evpn controller: avoid declaration in conditional statement X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=be39cee9ac518ba2268ef999076c4e946ac6356b;p=matthieu%2Fpve-network.git evpn controller: avoid declaration in conditional statement those are quite dangerous, as the variable will keep the value from last time the evaluation was true and still evaluate to that old, out of date value the next time, if the condition is false then. Signed-off-by: Thomas Lamprecht --- diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 08edbd9..74ec018 100644 --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -124,10 +124,12 @@ sub generate_controller_zone_config { my $exitnodes_primary = $plugin_config->{'exitnodes-primary'}; my $advertisesubnets = $plugin_config->{'advertise-subnets'}; my $exitnodes_local_routing = $plugin_config->{'exitnodes-local-routing'}; - my $rt_import = [PVE::Tools::split_list($plugin_config->{'rt-import'})] if $plugin_config->{'rt-import'}; + my $rt_import; + $rt_import = [PVE::Tools::split_list($plugin_config->{'rt-import'})] if $plugin_config->{'rt-import'}; my $asn = $controller->{asn}; - my @peers = PVE::Tools::split_list($controller->{'peers'}) if $controller->{'peers'}; + my @peers; + @peers = PVE::Tools::split_list($controller->{'peers'}) if $controller->{'peers'}; my $ebgp = undef; my $loopback = undef; my $autortas = undef;