From: Alexandre Derumier Date: Tue, 4 Sep 2018 14:36:49 +0000 (+0200) Subject: Inotify: fix mtu check X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=000e32bc4afaadb80ddeae9e1ef6bf567331195d Inotify: fix mtu check - 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) --- diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 6892b4c..e37b4af 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -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; - 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 => { @@ -1393,7 +1398,7 @@ sub __write_etc_network_interfaces { 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); } }