# Please do NOT modify this file directly, unless you know what
# you're doing.
#
-# If you want to manage part of the network configuration manually,
+# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
-# PVE will preserve these directives, but will NOT its network
+# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!
my $lookup_type_prio = sub {
my ($iface, $ifaces) = @_;
- my $child = 0;
- my $n = undef;
- my $i=1;
- for my $childiface (split(/(\.|:)/, $iface)) {
- if ($i > 1) {
- $child++;
- } else {
- $n = $ifaces->{$childiface};
- }
- $i++;
- }
+ my ($rootiface, @rest) = split(/[.:]/, $iface);
+ my $childlevel = scalar(@rest);
+ my $n = $ifaces->{$rootiface};
- my $pri = $if_type_hash->{$n->{type}} + $child
+ my $pri = $if_type_hash->{$n->{type}} + $childlevel
if $n->{type} && $n->{type} ne 'unknown';
return $pri;