Fix bridge handling for interfaces with arbitrary names

This small PR fixes deletion of bridges with arbitrary names, like vmbr0, by honoring the boot config bridge flag instead of relying only on name patterns.

It also makes the Debian config parser treat any interface with bridge_ports as a bridge, which previously caused bridge options to be lost on re-save.
This commit is contained in:
Ilia Ross
2026-08-20 04:53:02 +02:00
parent c171b6c27d
commit 5a101c405e
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -72,6 +72,8 @@ foreach $iface (@ifaces) {
$cfg->{'ether'} = $v[1];
}
elsif ($param eq 'bridge_ports') {
# An interface with bridge ports is a bridge
$cfg->{'bridge'} = 1;
$cfg->{'bridgeto'} = $value;
}
elsif ($param eq 'bridge_stp') {
+3 -1
View File
@@ -618,8 +618,10 @@ sub destroy_interface_device
{
my ($a) = @_;
my $name = $a->{'fullname'} || $a->{'name'};
# Check the bridge flag too, as bridges can have arbitrary names
if (&has_command("ip") && $a->{'virtual'} eq '' &&
&iface_type($name) =~ /(?:Bonded|VLAN|Bridge)$/) {
($a->{'bridge'} ||
&iface_type($name) =~ /(?:Bonded|VLAN|Bridge)$/)) {
my $out = &backquote_logged(
"ip link delete ".quotemeta($name)." 2>&1");
&error("Failed to delete virtual interface : $out") if ($?);