Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-09-03 Thread Alexandre DERUMIER
>>Not sure if this is relevant here: An OVS bridge automatically adjusts
>>its MTU to the smallest MTU of all childs. This adjusting is done
>>whenever an interface/port is added or removed. Ie adding an interface
>>with small MTU automatically lowers the MTU of the OVS bridge.

Yes, this is the same with linux bridge.

Currently, when you add a vm or CT, proxmox set the same mtu on tap/veth 
interfaces than the bridge.


>>Hence, it actually does not make sense to set the MTU of a OVS bridge,
>>as the next time an port is added/removed it will be recalculated.

you have the case where you have bigger mtu on physical interfaces, and lower 
mtu on bridge.

auto eth0
iface eth0 inet manual
 mtu 9000

auto vmbr0
iface vmbr0 inet manual
 bridge_port eth0
 mtu 1500


(1 usecase is with vxlan encapsulation, where you need bigger mtu to going out)



- Mail original -
De: "Klaus Darilion" 
À: "pve-devel" 
Envoyé: Lundi 3 Septembre 2018 15:47:06
Objet: Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

Not sure if this is relevant here: An OVS bridge automatically adjusts 
its MTU to the smallest MTU of all childs. This adjusting is done 
whenever an interface/port is added or removed. Ie adding an interface 
with small MTU automatically lowers the MTU of the OVS bridge. 

Hence, it actually does not make sense to set the MTU of a OVS bridge, 
as the next time an port is added/removed it will be recalculated. 

Klaus 

Am 28.08.2018 um 12:02 schrieb Dennis Busch: 
> Hello Alexandre, 
> 
> this check is IMHO uneccessary as Debian inherites MTU from parent to 
> child interfaces. That is AFAIK officially documente behavior, so this 
> check makes it impossible to edit an interface that uses mtu definition 
> only on parent devices. 
> 
> Best regards 
> 
> Dennis 
> 
> stacktrace GmbH 
> Querstraße 3 | 96237 Ebersdorf 
> 
> Amtsgericht Coburg, HRB 5043 
> Geschäftsführer: Dennis Busch | Jürgen Haas 
> 
> Tel: +49 9562 78 48 010 
> Mobil: +49 171 12 62 761 
> E-Mail: dennis.bu...@stacktrace.de 
> De-Mail: dennis.bu...@gmx.de-mail.de 
> 
> Am 05.07.2018 um 02:56 schrieb Alexandre Derumier: 
>> also check if mtu value is lower than parent interface 
>> 
>> fixme: vxlan interface should be 50bytes lower than outgoing interface 
>> we need to find which interface is used (unicast/multicast/frr) 
>> --- 
>> src/PVE/INotify.pm | 22 
>> ++ 
>> test/etc_network_interfaces/t.create_network.pl | 10 ++ 
>> 2 files changed, 32 insertions(+) 
>> 
>> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm 
>> index f0f3144..5dd08c2 100644 
>> --- a/src/PVE/INotify.pm 
>> +++ b/src/PVE/INotify.pm 
>> @@ -753,6 +753,20 @@ my $extract_ovs_option = sub { 
>> return $v; 
>> }; 
>> +my $check_mtu = sub { 
>> + my ($ifaces, $parent, $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; 
>> + 
>> + die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu 
>> $cmtu\n" 
>> + if $pmtu gt $cmtu; 
>> + 
>> +}; 
>> + 
>> # config => { 
>> # ifaces => { 
>> # $ifname => { 
>> @@ -874,6 +888,7 @@ sub __read_etc_network_interfaces { 
>> $id = $options_alternatives->{$id} if 
>> $options_alternatives->{$id}; 
>> my $simple_options = { 
>> + 'mtu' => 1, 
>> 'ovs_type' => 1, 
>> 'ovs_options' => 1, 
>> 'ovs_bridge' => 1, 
>> @@ -1301,6 +1316,8 @@ sub __write_etc_network_interfaces { 
>> } else { 
>> die "interface '$p' is not defined as OVS port/bond\n"; 
>> } 
>> + 
>> + &$check_mtu($ifaces, $iface, $p); 
>> } 
>> } 
>> } 
>> @@ -1315,6 +1332,7 @@ sub __write_etc_network_interfaces { 
>> if !$n; 
>> die "OVS bond '$iface' - wrong interface type on slave '$p' " . 
>> "('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth'; 
>> + &$check_mtu($ifaces, $iface, $p); 
>> } 
>> } 
>> } 
>> @@ -1330,6 +1348,7 @@ sub __write_etc_network_interfaces { 
>> if !$n; 
>> die "bond '$iface' - wrong interface type on slave '$p' " . 
>> "('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth'; 
>> + &$check_mtu($ifaces, $iface, $p); 
>> } 
>> } 
>> } 
>> @

Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-09-03 Thread Klaus Darilion
Not sure if this is relevant here: An OVS bridge automatically adjusts
its MTU to the smallest MTU of all childs. This adjusting is done
whenever an interface/port is added or removed. Ie adding an interface
with small MTU automatically lowers the MTU of the OVS bridge.

Hence, it actually does not make sense to set the MTU of a OVS bridge,
as the next time an port is added/removed it will be recalculated.

Klaus

Am 28.08.2018 um 12:02 schrieb Dennis Busch:
> Hello Alexandre,
> 
> this check is IMHO uneccessary as Debian inherites MTU from parent to
> child interfaces. That is AFAIK officially documente behavior, so this
> check makes it impossible to edit an interface that uses mtu definition
> only on parent devices.
> 
> Best regards
> 
> Dennis
> 
> stacktrace GmbH
> Querstraße 3 | 96237 Ebersdorf
> 
> Amtsgericht Coburg, HRB 5043
> Geschäftsführer: Dennis Busch | Jürgen Haas
> 
> Tel: +49 9562 78 48 010
> Mobil:   +49 171  12 62 761
> E-Mail:  dennis.bu...@stacktrace.de
> De-Mail: dennis.bu...@gmx.de-mail.de
> 
> Am 05.07.2018 um 02:56 schrieb Alexandre Derumier:
>> also check if mtu value is lower than parent interface
>>
>> fixme: vxlan interface should be 50bytes lower than outgoing interface
>>     we need to find which interface is used (unicast/multicast/frr)
>> ---
>>   src/PVE/INotify.pm  | 22
>> ++
>>   test/etc_network_interfaces/t.create_network.pl | 10 ++
>>   2 files changed, 32 insertions(+)
>>
>> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
>> index f0f3144..5dd08c2 100644
>> --- a/src/PVE/INotify.pm
>> +++ b/src/PVE/INotify.pm
>> @@ -753,6 +753,20 @@ my $extract_ovs_option = sub {
>>   return $v;
>>   };
>>   +my $check_mtu = sub {
>> +   my ($ifaces, $parent, $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;
>> +
>> +   die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu
>> $cmtu\n"
>> +    if $pmtu gt $cmtu;
>> +
>> +};
>> +
>>   # config => {
>>   #   ifaces => {
>>   # $ifname => {
>> @@ -874,6 +888,7 @@ sub __read_etc_network_interfaces {
>>   $id = $options_alternatives->{$id} if
>> $options_alternatives->{$id};
>>     my $simple_options = {
>> +    'mtu' => 1,
>>   'ovs_type' => 1,
>>   'ovs_options' => 1,
>>   'ovs_bridge' => 1,
>> @@ -1301,6 +1316,8 @@ sub __write_etc_network_interfaces {
>>   } else {
>>   die "interface '$p' is not defined as OVS port/bond\n";
>>   }
>> +
>> +    &$check_mtu($ifaces, $iface, $p);
>>   }
>>   }
>>   }
>> @@ -1315,6 +1332,7 @@ sub __write_etc_network_interfaces {
>>   if !$n;
>>   die "OVS bond '$iface' - wrong interface type on slave '$p' " .
>>   "('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth';
>> +    &$check_mtu($ifaces, $iface, $p);
>>   }
>>   }
>>   }
>> @@ -1330,6 +1348,7 @@ sub __write_etc_network_interfaces {
>>   if !$n;
>>   die "bond '$iface' - wrong interface type on slave '$p' " .
>>   "('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth';
>> +    &$check_mtu($ifaces, $iface, $p);
>>   }
>>   }
>>   }
>> @@ -1356,6 +1375,7 @@ sub __write_etc_network_interfaces {
>>   if (defined($d->{'vxlan-svcnodeip'}) !=
>> defined($d->{'vxlan-physdev'})) {
>>   die "iface $iface : vxlan-svcnodeip and vxlan-physdev must
>> be define together\n";
>>   }
>> +    #fixme : check if vxlan mtu is lower than 50bytes than physical
>> interface where tunnel is going out
>>   }
>>     # check vlan
>> @@ -1374,6 +1394,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);
>>   }
>>   }
>>   @@ -1387,6 +1408,7 @@ sub __write_etc_network_interfaces {
>>   my $n = $ifaces->{$p};
>>   die "bridge '$iface' - unable to find bridge port '$p'\n"
>>   if !$n;
>> +    &$check_mtu($ifaces, $iface, $p);
>>   $bridgeports->{$p} = $iface;
>>   }
>>   $bridges->{$iface} = $d;
>> diff --git a/test/etc_network_interfaces/t.create_network.pl
>> b/test/etc_network_interfaces/t.create_network.pl
>> index fda7237..8f4974a 100644
>> --- a/test/etc_network_interfaces/t.create_network.pl
>> +++ b/test/etc_network_interfaces/t.create_network.pl
>> @@ -40,6 +40,7 @@ $config->{ifaces}->{eth3} = {
>>     $config->{ifaces}->{bond0} = {
>>   type => 'bond',
>> +    mtu => 1400,
>>   slaves => 'eth2 eth3',
>>   bond_mode 

Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-09-03 Thread Alexandre DERUMIER
>>mmm,ok. I didn't known that's could work. 
>>So setting mtu to bond device, force mtu to slaves too ? 


Ok I have tried with


iface bond0 inet manual 
   slaves eth0 eth1
   mtu 9000 


with ifupdown , indeed, the slaves mtu are equal to bond mtu

but with ifupdown2, the slave still have 1500 mtu.

I'll make a bug report to ifupdown2, and improve my pve-common mtu patch.




- Mail original -
De: "aderumier" 
À: "Dennis Busch" 
Cc: "pve-devel" 
Envoyé: Lundi 3 Septembre 2018 13:14:33
Objet: Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

>>Just every configuration, where you change /etc/network/interfaces in a 
>>way like: 
>> 
>> 
>>iface bond0 inet manual 
>>... 
>>slaves eno18 eno19 
>>mtu 9000 
>> 
>> 
>>without also writing the "mtu 9000" in the eno18 and eno19 sections. It 
>>will work, but every try of changing network configuration via GUI will 
>>fail with an error message. 


mmm,ok. I didn't known that's could work. 
So setting mtu to bond device, force mtu to slaves too ? 


----- Mail original ----- 
De: "Dennis Busch"  
À: "aderumier" , "pve-devel"  
Envoyé: Lundi 3 Septembre 2018 12:28:34 
Objet: Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option 

> 
> Currently, I think that I'm using check_mtu only on child interfaces 
> (bond,vlan,bridgeport). 
> @Denis : do you have a sample config where it's not working ? 
> 

Just every configuration, where you change /etc/network/interfaces in a 
way like: 

 
iface bond0 inet manual 
... 
slaves eno18 eno19 
mtu 9000 
 

without also writing the "mtu 9000" in the eno18 and eno19 sections. It 
will work, but every try of changing network configuration via GUI will 
fail with an error message. 

___ 
pve-devel mailing list 
pve-devel@pve.proxmox.com 
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-09-03 Thread Alexandre DERUMIER
>>Just every configuration, where you change /etc/network/interfaces in a 
>>way like: 
>>
>> 
>>iface bond0 inet manual 
>>... 
>>slaves eno18 eno19 
>>mtu 9000 
>> 
>>
>>without also writing the "mtu 9000" in the eno18 and eno19 sections. It 
>>will work, but every try of changing network configuration via GUI will 
>>fail with an error message. 


mmm,ok. I didn't known that's could work.
So setting mtu to bond device, force mtu to slaves too ?


- Mail original -
De: "Dennis Busch" 
À: "aderumier" , "pve-devel" 
Envoyé: Lundi 3 Septembre 2018 12:28:34
Objet: Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

> 
> Currently, I think that I'm using check_mtu only on child interfaces 
> (bond,vlan,bridgeport). 
> @Denis : do you have a sample config where it's not working ? 
> 

Just every configuration, where you change /etc/network/interfaces in a 
way like: 

 
iface bond0 inet manual 
... 
slaves eno18 eno19 
mtu 9000 
 

without also writing the "mtu 9000" in the eno18 and eno19 sections. It 
will work, but every try of changing network configuration via GUI will 
fail with an error message. 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-09-03 Thread Dennis Busch




Currently, I think that I'm using check_mtu only on child interfaces 
(bond,vlan,bridgeport).
@Denis : do you have a sample config where it's not working ?



Just every configuration, where you change /etc/network/interfaces in a 
way like:



iface bond0 inet manual
...
slaves eno18 eno19
mtu 9000


without also writing the "mtu 9000" in the eno18 and eno19 sections. It 
will work, but every try of changing network configuration via GUI will 
fail with an error message.



___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-08-28 Thread Alexandre DERUMIER
> 
> this check is IMHO uneccessary as Debian inherites MTU from parent to child 
> interfaces. That is AFAIK officially documente behavior, so this check makes 
> it impossible to edit an interface that uses mtu definition only on parent 
> devices. 

> > + 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; 

>>Might be enough to just remove the ternary and skip the check if 
>>$ifaces->{$child}->{mtu} is not defined. 

Currently, I think that I'm using check_mtu only on child interfaces 
(bond,vlan,bridgeport).
@Denis : do you have a sample config where it's not working ?

I'm seeing a case where parentmtu could be 1400, and childmtu not defined.

It should be
-my $cmtu = $ifaces->{$child}->{mtu} ? $ifaces->{$child}->{mtu} : 1500;  
+my $cmtu = $ifaces->{$child}->{mtu} ? $ifaces->{$child}->{mtu} : $pmtu; 

> > + 
> > + die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu 
> > $cmtu\n" 
> > + if $pmtu gt $cmtu; 

>>Also, apparently I missed the 'gt' here, that should be '>', ouch. 

you have already fixed it ;)

https://git.proxmox.com/?p=pve-common.git;a=blobdiff;f=src/PVE/INotify.pm;h=330085066f29f461329494084d7a654c0149e7a3;hp=201c97b1965a29650bc16f86619a2ebf407e49c9;hb=c27ef07ff57a0143ef9200ed8ee53401d46f727a;hpb=cebd1c85f0144628a24c61fa06f3602f78da3c61
- Mail original -----
De: "Wolfgang Bumiller" 
À: "Dennis Busch" 
Cc: "pve-devel" 
Envoyé: Mardi 28 Août 2018 12:17:37
Objet: Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

On Tue, Aug 28, 2018 at 12:02:27PM +0200, Dennis Busch wrote: 
> Hello Alexandre, 
> 
> this check is IMHO uneccessary as Debian inherites MTU from parent to child 
> interfaces. That is AFAIK officially documente behavior, so this check makes 
> it impossible to edit an interface that uses mtu definition only on parent 
> devices. 
> 
> Best regards 
> 
> Dennis 
> 
> stacktrace GmbH 
> Querstraße 3 | 96237 Ebersdorf 
> 
> Amtsgericht Coburg, HRB 5043 
> Geschäftsführer: Dennis Busch | Jürgen Haas 
> 
> Tel: +49 9562 78 48 010 
> Mobil: +49 171 12 62 761 
> E-Mail: dennis.bu...@stacktrace.de 
> De-Mail: dennis.bu...@gmx.de-mail.de 
> 
> Am 05.07.2018 um 02:56 schrieb Alexandre Derumier: 
> > also check if mtu value is lower than parent interface 
> > 
> > fixme: vxlan interface should be 50bytes lower than outgoing interface 
> > we need to find which interface is used (unicast/multicast/frr) 
> > --- 
> > src/PVE/INotify.pm | 22 ++ 
> > test/etc_network_interfaces/t.create_network.pl | 10 ++ 
> > 2 files changed, 32 insertions(+) 
> > 
> > diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm 
> > index f0f3144..5dd08c2 100644 
> > --- a/src/PVE/INotify.pm 
> > +++ b/src/PVE/INotify.pm 
> > @@ -753,6 +753,20 @@ my $extract_ovs_option = sub { 
> > return $v; 
> > }; 
> > +my $check_mtu = sub { 
> > + my ($ifaces, $parent, $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; 

Might be enough to just remove the ternary and skip the check if 
$ifaces->{$child}->{mtu} is not defined. 

> > + 
> > + die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu 
> > $cmtu\n" 
> > + if $pmtu gt $cmtu; 

Also, apparently I missed the 'gt' here, that should be '>', ouch. 

> > + 
> > +}; 

___ 
pve-devel mailing list 
pve-devel@pve.proxmox.com 
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-08-28 Thread Wolfgang Bumiller
On Tue, Aug 28, 2018 at 12:02:27PM +0200, Dennis Busch wrote:
> Hello Alexandre,
> 
> this check is IMHO uneccessary as Debian inherites MTU from parent to child
> interfaces. That is AFAIK officially documente behavior, so this check makes
> it impossible to edit an interface that uses mtu definition only on parent
> devices.
> 
> Best regards
> 
> Dennis
> 
> stacktrace GmbH
> Querstraße 3 | 96237 Ebersdorf
> 
> Amtsgericht Coburg, HRB 5043
> Geschäftsführer: Dennis Busch | Jürgen Haas
> 
> Tel: +49 9562 78 48 010
> Mobil:   +49 171  12 62 761
> E-Mail:  dennis.bu...@stacktrace.de
> De-Mail: dennis.bu...@gmx.de-mail.de
> 
> Am 05.07.2018 um 02:56 schrieb Alexandre Derumier:
> > also check if mtu value is lower than parent interface
> > 
> > fixme: vxlan interface should be 50bytes lower than outgoing interface
> > we need to find which interface is used (unicast/multicast/frr)
> > ---
> >   src/PVE/INotify.pm  | 22 
> > ++
> >   test/etc_network_interfaces/t.create_network.pl | 10 ++
> >   2 files changed, 32 insertions(+)
> > 
> > diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> > index f0f3144..5dd08c2 100644
> > --- a/src/PVE/INotify.pm
> > +++ b/src/PVE/INotify.pm
> > @@ -753,6 +753,20 @@ my $extract_ovs_option = sub {
> >   return $v;
> >   };
> > +my $check_mtu = sub {
> > +   my ($ifaces, $parent, $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;

Might be enough to just remove the ternary and skip the check if
$ifaces->{$child}->{mtu} is not defined.

> > +
> > +   die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu 
> > $cmtu\n"
> > +if $pmtu gt $cmtu;

Also, apparently I missed the 'gt' here, that should be '>', ouch.

> > +
> > +};

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH v3 pve-common 5/5] Inotify : add mtu option

2018-08-28 Thread Dennis Busch

Hello Alexandre,

this check is IMHO uneccessary as Debian inherites MTU from parent to 
child interfaces. That is AFAIK officially documente behavior, so this 
check makes it impossible to edit an interface that uses mtu definition 
only on parent devices.


Best regards

Dennis

stacktrace GmbH
Querstraße 3 | 96237 Ebersdorf

Amtsgericht Coburg, HRB 5043
Geschäftsführer: Dennis Busch | Jürgen Haas

Tel: +49 9562 78 48 010
Mobil:   +49 171  12 62 761
E-Mail:  dennis.bu...@stacktrace.de
De-Mail: dennis.bu...@gmx.de-mail.de

Am 05.07.2018 um 02:56 schrieb Alexandre Derumier:

also check if mtu value is lower than parent interface

fixme: vxlan interface should be 50bytes lower than outgoing interface
we need to find which interface is used (unicast/multicast/frr)
---
  src/PVE/INotify.pm  | 22 ++
  test/etc_network_interfaces/t.create_network.pl | 10 ++
  2 files changed, 32 insertions(+)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index f0f3144..5dd08c2 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -753,6 +753,20 @@ my $extract_ovs_option = sub {
  return $v;
  };
  
+my $check_mtu = sub {

+   my ($ifaces, $parent, $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;
+
+   die "interface '$parent' - mtu $pmtu is bigger than '$child' - mtu $cmtu\n"
+if $pmtu gt $cmtu;
+
+};
+
  # config => {
  #   ifaces => {
  # $ifname => {
@@ -874,6 +888,7 @@ sub __read_etc_network_interfaces {
$id = $options_alternatives->{$id} if 
$options_alternatives->{$id};
  
  		my $simple_options = {

+   'mtu' => 1,
'ovs_type' => 1,
'ovs_options' => 1,
'ovs_bridge' => 1,
@@ -1301,6 +1316,8 @@ sub __write_etc_network_interfaces {
} else {
die "interface '$p' is not defined as OVS port/bond\n";
}
+
+   &$check_mtu($ifaces, $iface, $p);
}
}
  }
@@ -1315,6 +1332,7 @@ sub __write_etc_network_interfaces {
if !$n;
die "OVS bond '$iface' - wrong interface type on slave '$p' " .
"('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth';
+   &$check_mtu($ifaces, $iface, $p);
}
}
  }
@@ -1330,6 +1348,7 @@ sub __write_etc_network_interfaces {
if !$n;
die "bond '$iface' - wrong interface type on slave '$p' " .
"('$n->{type}' != 'eth')\n" if $n->{type} ne 'eth';
+   &$check_mtu($ifaces, $iface, $p);
}
}
  }
@@ -1356,6 +1375,7 @@ sub __write_etc_network_interfaces {
if (defined($d->{'vxlan-svcnodeip'}) != defined($d->{'vxlan-physdev'})) 
{
die "iface $iface : vxlan-svcnodeip and vxlan-physdev must be define 
together\n";
}
+   #fixme : check if vxlan mtu is lower than 50bytes than physical 
interface where tunnel is going out
  }
  
  # check vlan

@@ -1374,6 +1394,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);
}
  }
  
@@ -1387,6 +1408,7 @@ sub __write_etc_network_interfaces {

my $n = $ifaces->{$p};
die "bridge '$iface' - unable to find bridge port '$p'\n"
if !$n;
+   &$check_mtu($ifaces, $iface, $p);
$bridgeports->{$p} = $iface;
}
$bridges->{$iface} = $d;
diff --git a/test/etc_network_interfaces/t.create_network.pl 
b/test/etc_network_interfaces/t.create_network.pl
index fda7237..8f4974a 100644
--- a/test/etc_network_interfaces/t.create_network.pl
+++ b/test/etc_network_interfaces/t.create_network.pl
@@ -40,6 +40,7 @@ $config->{ifaces}->{eth3} = {
  
  $config->{ifaces}->{bond0} = {

  type => 'bond',
+mtu => 1400,
  slaves => 'eth2 eth3',
  bond_mode => '802.3ad',
  bond_xmit_hash_policy => 'layer3+4',
@@ -50,6 +51,7 @@ $config->{ifaces}->{bond0} = {
  };
  
  $config->{ifaces}->{vmbr1} = {

+mtu => 1400,
  type => 'bridge',
  method => 'manual',
  families => ['inet'],
@@ -117,6 +119,7 @@ $config->{ifaces}->{vxlan3} = {
  
  $config->{ifaces}->{'vmbr1.100'} = {

  type => 'vlan',
+mtu => 1300,
  method => 'manual',
  families => ['inet'],
  autostart => 1
@@ -124,6 +127,7 @@ $config->{ifaces}->{'vmbr1.100'} = {
  
  $config->{ifaces}->{'bond0.100'} = {

  type => 'vlan',
+mtu => 1300,
  method =>