]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/INotify.pm
inotify: network/interfaces: fix 'Use of uninitialized value' for netmask
[pve-common.git] / src / PVE / INotify.pm
index 11b672850c19d5cbe3ab3a4c359612472aff4a07..8b49f5a1a2061f89d6cc31564ae7ff25a6332925 100644 (file)
@@ -1106,7 +1106,7 @@ sub __read_etc_network_interfaces {
 
        # map address and netmask to cidr
        if ($d->{address}) {
-           if ($d->{netmask} =~ m/^\d+$/) { # e.g. netmask 20
+           if ($d->{netmask} && $d->{netmask} =~ m/^\d+$/) { # e.g. netmask 20
                $d->{cidr} = $d->{address} . "/" . $d->{netmask};
            } elsif ($d->{netmask} &&
                     (my $cidr = PVE::JSONSchema::get_netmask_bits($d->{netmask}))) { # e.g. netmask 255.255.255.0
@@ -1124,9 +1124,8 @@ sub __read_etc_network_interfaces {
        if ($d->{address6}) {
            $d->{cidr6} = $d->{address6};
            if ($d->{netmask6}) {
-               $d->{cidr6} .= "/" . $d->{netmask6} if $d->{netmask6};
+               $d->{cidr6} .= "/" . $d->{netmask6};
            } elsif ($d->{address6} =~ m!^(.*)/(\d+)$!) {
-               $d->{cidr6} = $d->{address6};
                $d->{address6} = $1;
                $d->{netmask6} = $2;
            }