nested conditionals stretching over multiple lines are always a bit hard to
untangle, so let's make it explicit:
1. is the interface a bridge
2. if it is, are we looking for one?
3. is it something else that we are looking for?
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
for my $k (sort keys $ifaces->%*) {
my $type = $ifaces->{$k}->{type};
- my $match = ($tfilter eq $type) || (
- ($tfilter =~ /^any(_local)?_bridge$/) &&
- ($type eq 'bridge' || $type eq 'OVSBridge'));
+ my $is_bridge = $type eq 'bridge' || $type eq 'OVSBridge';
+ my $bridge_match = $is_bridge && $tfilter =~ /^any(_local)?_bridge$/;
+ my $match = $tfilter eq $type || $bridge_match;
delete $ifaces->{$k} if !$match;
}