]> git.proxmox.com Git - pve-common.git/commitdiff
Inotify: fix mtu check
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 4 Sep 2018 14:36:49 +0000 (16:36 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 11 Sep 2018 08:53:58 +0000 (10:53 +0200)
- special check for bond, set parent mtu from slaves mtu if no defined.

- error if parent mtu is lower than child mtu (not bigger)

- return if child mtu is not defined

- fix vlan check (parent/child was inverted)

src/PVE/INotify.pm

index 6892b4c6bf25eb517a881874437aaf9e56e0e32f..e37b4af6b5994b02b060e04511e473f1ea00d5f2 100644 (file)
@@ -759,11 +759,16 @@ my $check_mtu = sub {
     die "check mtu - missing parent interface\n" if !$parent;
     die "check mtu - missing child interface\n" if !$child;
 
     die "check mtu - missing parent interface\n" if !$parent;
     die "check mtu - missing child interface\n" if !$child;
 
-    my $pmtu = $ifaces->{$parent}->{mtu} ? $ifaces->{$parent}->{mtu} : 1500;
-    my $cmtu = $ifaces->{$child}->{mtu} ? $ifaces->{$child}->{mtu} : 1500;
+    my $cmtu = $ifaces->{$child}->{mtu};
+    return if !$cmtu;
 
 
-    die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu $cmtu\n"
-       if $pmtu > $cmtu;
+    my $parentdata = $ifaces->{$parent};
+    my $pmtu = $parentdata->{mtu};
+    $pmtu = $cmtu if $parentdata->{type} eq 'bond' && !$pmtu;
+    $pmtu = 1500 if !$pmtu;
+
+    die "interface '$parent' - mtu $pmtu is lower than '$child' - mtu $cmtu\n"
+       if $pmtu < $cmtu;
 };
 
 # config => {
 };
 
 # config => {
@@ -1393,7 +1398,7 @@ sub __write_etc_network_interfaces {
                die "vlan '$iface' - wrong interface type on parent '$p' " .
                    "('$n->{type}' != 'eth|bond|bridge' )\n";
            }
                die "vlan '$iface' - wrong interface type on parent '$p' " .
                    "('$n->{type}' != 'eth|bond|bridge' )\n";
            }
-           &$check_mtu($ifaces, $iface, $p);
+           &$check_mtu($ifaces, $p, $iface);
        }
     }
 
        }
     }