]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/INotify.pm
half-revert: remove autostart property from bridge ports
[pve-common.git] / src / PVE / INotify.pm
index 1c364ba89482b1a788f9d1d4740ca5beac5c80b3..60610ce507f467d20d66ea30a4e4ec6a38b1dbf1 100644 (file)
@@ -540,7 +540,7 @@ sub read_etc_resolv_conf {
        chomp $line;
        if ($line =~ m/^(search|domain)\s+(\S+)\s*/) {
            $res->{search} = $2;
-       } elsif ($line =~ m/^nameserver\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s*/) {
+       } elsif ($line =~ m/^\s*nameserver\s+($PVE::Tools::IPRE)\s*/) {
            $nscount++;
            if ($nscount <= 3) {
                $res->{"dns$nscount"} = $1;
@@ -1245,19 +1245,6 @@ sub __write_etc_network_interfaces {
        }
     }
 
-    # Remove autostart from linux bridge ports
-    foreach my $iface (keys %$ifaces) {
-       my $d = $ifaces->{$iface};
-       if ($d->{type} eq 'bridge' && $d->{bridge_ports}) {
-           foreach my $p (split (/\s+/, $d->{bridge_ports})) {
-               my $n = $ifaces->{$p};
-               die "bridge '$iface' - unable to find port '$p'\n"
-                   if !$n;
-               $n->{autostart} = 0;
-           }
-       }
-    }
-
     # check OVS bond ports
     foreach my $iface (keys %$ifaces) {
        my $d = $ifaces->{$iface};
@@ -1289,7 +1276,6 @@ NETWORKDOC
     my $printed = {};
 
     my $if_type_hash = {
-       unknown => 0,
        loopback => 100000,
        eth => 200000,
        bond => 300000,
@@ -1316,17 +1302,21 @@ NETWORKDOC
            $pri = $if_type_hash->{bridge} + $child;
        }
 
-       return $pri || ($if_type_hash->{unknown} + $child);
+       return $pri;
     };
 
     foreach my $iface (sort {
        my $ref1 = $ifaces->{$a};
        my $ref2 = $ifaces->{$b};
-       my $p1 = &$lookup_type_prio($a);
-       my $p2 = &$lookup_type_prio($b);
+       my $tp1 = &$lookup_type_prio($a);
+       my $tp2 = &$lookup_type_prio($b);
+
+       # Only recognized types are in relation to each other. If one type
+       # is unknown then only consider the interfaces' priority attributes.
+       $tp1 = $tp2 = 0 if !defined($tp1) || !defined($tp2);
 
-       $p1 += $ref1->{priority} // 50000;
-       $p2 += $ref2->{priority} // 50000;
+       my $p1 = $tp1 + ($ref1->{priority} // 50000);
+       my $p2 = $tp2 + ($ref2->{priority} // 50000);
 
        return $p1 <=> $p2 if $p1 != $p2;