inotify: read interfaces: avoid uninitialized value access
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Mar 2020 10:28:21 +0000 (11:28 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 9 Mar 2020 10:28:38 +0000 (11:28 +0100)
check if 'ovs_type' is defined first

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

index d0d9ba6..391b9d2 100644 (file)
@@ -1097,10 +1097,12 @@ sub __read_etc_network_interfaces {
        } else {
            if ($d->{'vxlan-id'}) {
                $d->{type} = 'vxlan';
-           } elsif ($d->{ovs_type} eq 'OVSIntPort') {
-               $d->{type} = $d->{ovs_type};
-               my $tag = &$extract_ovs_option($d, 'tag');
-               $d->{ovs_tag} = $tag if defined($tag);
+           } elsif (defined($d->{ovs_type})) {
+               if ($d->{ovs_type} eq 'OVSIntPort') {
+                   $d->{type} = $d->{ovs_type};
+                   my $tag = &$extract_ovs_option($d, 'tag');
+                   $d->{ovs_tag} = $tag if defined($tag);
+               }
            }
        }