mirror of
git://git.proxmox.com/git/pve-common.git
synced 2024-12-22 21:33:47 +03:00
Inotify : add mtu option
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)
This commit is contained in:
parent
c4e564708b
commit
9b053d70de
@ -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;
|
||||
|
@ -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 => 'manual',
|
||||
families => ['inet'],
|
||||
autostart => 1
|
||||
@ -131,6 +135,7 @@ $config->{ifaces}->{'bond0.100'} = {
|
||||
|
||||
$config->{ifaces}->{'eth1.100'} = {
|
||||
type => 'vlan',
|
||||
mtu => 1400,
|
||||
method => 'manual',
|
||||
families => ['inet'],
|
||||
autostart => 1
|
||||
@ -155,6 +160,7 @@ iface eth3 inet manual
|
||||
|
||||
auto eth1.100
|
||||
iface eth1.100 inet manual
|
||||
mtu 1400
|
||||
|
||||
auto bond0
|
||||
iface bond0 inet manual
|
||||
@ -162,9 +168,11 @@ iface bond0 inet manual
|
||||
bond-miimon 100
|
||||
bond-mode 802.3ad
|
||||
bond-xmit-hash-policy layer3+4
|
||||
mtu 1400
|
||||
|
||||
auto bond0.100
|
||||
iface bond0.100 inet manual
|
||||
mtu 1300
|
||||
|
||||
auto vmbr0
|
||||
iface vmbr0 inet static
|
||||
@ -182,6 +190,7 @@ iface vmbr1 inet manual
|
||||
bridge-fd 0
|
||||
bridge-vlan-aware yes
|
||||
bridge-vids 2-4094
|
||||
mtu 1400
|
||||
|
||||
auto vmbr2
|
||||
iface vmbr2 inet manual
|
||||
@ -199,6 +208,7 @@ iface vmbr3 inet manual
|
||||
|
||||
auto vmbr1.100
|
||||
iface vmbr1.100 inet manual
|
||||
mtu 1300
|
||||
|
||||
auto vxlan1
|
||||
iface vxlan1 inet manual
|
||||
|
Loading…
Reference in New Issue
Block a user