]> git.proxmox.com Git - qemu-server.git/commitdiff
net devs: code cleanup new fdb mac add helper
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 13 Nov 2022 12:37:45 +0000 (13:37 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 13 Nov 2022 13:56:57 +0000 (14:56 +0100)
reduce a level of indentation and modernize slightly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm

index ed42bd95f352c787af6eb61b3aad8d35b70b8c4a..2733755f949e503c9843c5c3cbdb37c672ca4015 100644 (file)
@@ -8316,19 +8316,18 @@ sub check_volume_storage_type {
 sub add_nets_bridge_fdb {
     my ($conf, $vmid) = @_;
 
-    foreach my $opt (keys %$conf) {
-       if ($opt =~  m/^net(\d+)$/) {
-           my $net = parse_net($conf->{$opt});
-           next if !$net;
-           next if !$net->{macaddr};
+    for my $opt (keys %$conf) {
+       next if $opt !~ m/^net(\d+)$/;
+       my $iface = "tap${vmid}i$1";
+       my $net = parse_net($conf->{$opt}) or next;
+       my $mac = $net->{macaddr} or next;
 
-           my $iface = "tap${vmid}i$1";
-           if ($have_sdn) {
-               PVE::Network::SDN::Zones::add_bridge_fdb($iface, $net->{macaddr}, $net->{bridge}, $net->{firewall});
-           } else {
-               PVE::Network::add_bridge_fdb($iface, $net->{macaddr}, $net->{firewall});
-           }
+       if ($have_sdn) {
+           PVE::Network::SDN::Zones::add_bridge_fdb($iface, $mac, $net->{bridge}, $net->{firewall});
+       } else {
+           PVE::Network::add_bridge_fdb($iface, $mac, $net->{firewall});
        }
     }
 }
+
 1;