]> git.proxmox.com Git - pve-network.git/commitdiff
split declaration and initialization with post-if
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 1 Jul 2020 07:57:32 +0000 (09:57 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 1 Jul 2020 07:57:34 +0000 (09:57 +0200)
since combining them is undefined behaviour in perl and can cause
strange side-effects.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/Network/SDN/Controllers/EvpnPlugin.pm
PVE/Network/SDN/Zones/VxlanPlugin.pm

index 9321af1ba925e1329caf05c3a3ce4243916fca0a..d82de2a7d3df67bceb6b903e79b862a5c8e4ed36 100644 (file)
@@ -47,11 +47,13 @@ sub options {
 sub generate_controller_config {
     my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_;
 
-    my @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
+    my @peers;
+    @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
 
     my $asn = $plugin_config->{asn};
     my $gatewaynodes = $plugin_config->{'gateway-nodes'};
-    my @gatewaypeers = PVE::Tools::split_list($plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'};
+    my @gatewaypeers;
+    @gatewaypeers = PVE::Tools::split_list($plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'};
 
     return if !$asn;
 
index 5f17e15462dd25a8d4f514bc1e0f17b2e02b73f0..e8cf1bddd01089652319f12fc45b12018fe5af81 100644 (file)
@@ -50,7 +50,8 @@ sub generate_sdn_config {
     my $ipv6 = $vnet->{ipv6};
     my $mac = $vnet->{mac};
     my $multicastaddress = $plugin_config->{'multicast-address'};
-    my @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
+    my @peers;
+    @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
     my $vxlan_iface = "vxlan_$vnetid";
 
     die "missing vxlan tag" if !$tag;