mirror of
git://git.proxmox.com/git/pve-common.git
synced 2024-12-22 21:33:47 +03:00
INotify : check_bridge : fix bridge-ports with vlan tagged interface
Currently with strip vlan tag, that's wrong because mtu && others check are done the main interface.
This commit is contained in:
parent
dd3004e266
commit
a70e9925ae
@ -1,7 +1,6 @@
|
||||
package PVE::INotify;
|
||||
|
||||
# todo: maybe we do not need update_file() ?
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -1554,18 +1553,26 @@ sub __write_etc_network_interfaces {
|
||||
# check bridgeport option
|
||||
my $bridgeports = {};
|
||||
my $bridges = {};
|
||||
foreach my $iface (keys %$ifaces) {
|
||||
my $d = $ifaces->{$iface};
|
||||
my $ifaces_copy = { %$ifaces };
|
||||
foreach my $iface (keys %$ifaces_copy) {
|
||||
my $d = $ifaces_copy->{$iface};
|
||||
if ($d->{type} eq 'bridge') {
|
||||
foreach my $p (split (/\s+/, $d->{bridge_ports})) {
|
||||
$p =~ s/\.\d+$//;
|
||||
my $n = $ifaces->{$p};
|
||||
if($p =~ m/(\S+)\.(\d+)$/) {
|
||||
my $vlanparent = $1;
|
||||
if (!defined($ifaces_copy->{$p})) {
|
||||
$ifaces_copy->{$p}->{type} = 'vlan';
|
||||
$ifaces_copy->{$p}->{method} = 'manual';
|
||||
$ifaces_copy->{$p}->{method6} = 'manual';
|
||||
$ifaces_copy->{$p}->{mtu} = $ifaces_copy->{$vlanparent}->{mtu} if defined($ifaces_copy->{$1}->{mtu});
|
||||
}
|
||||
}
|
||||
my $n = $ifaces_copy->{$p};
|
||||
die "bridge '$iface' - unable to find bridge port '$p'\n" if !$n;
|
||||
die "iface $p - ip address can't be set on interface if bridged in $iface\n"
|
||||
if ($n->{method} && $n->{method} eq 'static' && $n->{address} ne '0.0.0.0') ||
|
||||
($n->{method6} && $n->{method6} eq 'static' && $n->{address} ne '::');
|
||||
|
||||
&$check_mtu($ifaces, $p, $iface);
|
||||
&$check_mtu($ifaces_copy, $p, $iface);
|
||||
$bridgeports->{$p} = $iface;
|
||||
}
|
||||
$bridges->{$iface} = $d;
|
||||
|
@ -205,7 +205,7 @@ $config->{ifaces}->{vmbr3} = {
|
||||
families => ['inet'],
|
||||
bridge_stp => 'off',
|
||||
bridge_fd => 0,
|
||||
bridge_ports => 'vxlan3.50',
|
||||
bridge_ports => 'vxlan3',
|
||||
bridge_vlan_aware => 'yes',
|
||||
bridge_vids => '2-10',
|
||||
autostart => 1
|
||||
@ -229,7 +229,7 @@ iface vmbr2 inet manual
|
||||
|
||||
auto vmbr3
|
||||
iface vmbr3 inet manual
|
||||
bridge-ports vxlan3.50
|
||||
bridge-ports vxlan3
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
bridge-vlan-aware yes
|
||||
@ -336,6 +336,17 @@ $config->{ifaces}->{'vmbr4'} = {
|
||||
autostart => 1
|
||||
};
|
||||
|
||||
$config->{ifaces}->{'vmbr5'} = {
|
||||
mtu => 1100,
|
||||
type => 'bridge',
|
||||
method => 'manual',
|
||||
families => ['inet'],
|
||||
bridge_stp => 'off',
|
||||
bridge_fd => 0,
|
||||
bridge_ports => 'vmbr4.99',
|
||||
autostart => 1
|
||||
};
|
||||
|
||||
expect load('loopback') . <<"CHECK";
|
||||
source-directory interfaces.d
|
||||
|
||||
@ -373,6 +384,13 @@ iface vmbr4 inet manual
|
||||
bridge-fd 0
|
||||
mtu 1200
|
||||
|
||||
auto vmbr5
|
||||
iface vmbr5 inet manual
|
||||
bridge-ports vmbr4.99
|
||||
bridge-stp off
|
||||
bridge-fd 0
|
||||
mtu 1100
|
||||
|
||||
auto vmbr1.100
|
||||
iface vmbr1.100 inet manual
|
||||
mtu 1300
|
||||
|
Loading…
Reference in New Issue
Block a user