[pve-devel] applied: [PATCH pve-common V3] Inotify: fix mtu check

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Sep 11 10:55:05 CEST 2018


applied

On Tue, Sep 04, 2018 at 04:36:49PM +0200, Alexandre Derumier wrote:
> - 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)
> 
> ---
> 
> changelog: 
>   v2: bond with ifupdown2 is working like ifupdown
>   v3: cleanup code with wolfgang comments
> 
> 
>  src/PVE/INotify.pm | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> index 4cf8699..f936a91 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);
>  	}
>      }
>  
> -- 
> 2.11.0




More information about the pve-devel mailing list