Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
return '' if !($d && $d->{"method$suffix"});
return '' if !($d && $d->{"method$suffix"});
- my $raw = '';
-
- $raw .= "iface $iface $family " . $d->{"method$suffix"} . "\n";
+ my $raw = "iface $iface $family " . $d->{"method$suffix"} . "\n";
if (my $addr = $d->{"address$suffix"}) {
if (my $addr = $d->{"address$suffix"}) {
if ($addr !~ /\/\d+$/ && $d->{"netmask$suffix"}) {
if ($d->{"netmask$suffix"} =~ m/^\d+$/) {
$addr .= "/" . $d->{"netmask$suffix"};
if ($addr !~ /\/\d+$/ && $d->{"netmask$suffix"}) {
if ($d->{"netmask$suffix"} =~ m/^\d+$/) {
$addr .= "/" . $d->{"netmask$suffix"};
$addr .= "/" . $mask;
}
}
$addr .= "/" . $mask;
}
}
-
- $raw .= "\taddress " . $addr . "\n";
+ $raw .= "\taddress ${addr}\n";
}
$raw .= "\tgateway " . $d->{"gateway$suffix"} . "\n" if $d->{"gateway$suffix"};
}
$raw .= "\tgateway " . $d->{"gateway$suffix"} . "\n" if $d->{"gateway$suffix"};
$raw .= "\tbridge-ports $ports\n";
$done->{bridge_ports} = 1;
$raw .= "\tbridge-ports $ports\n";
$done->{bridge_ports} = 1;
- my $v = defined($d->{bridge_stp}) ? $d->{bridge_stp} : 'off';
- my $no_stp = $v eq 'off';
+ my $br_stp = defined($d->{bridge_stp}) ? $d->{bridge_stp} : 'off';
+ my $no_stp = $br_stp eq 'off';
- $raw .= "\tbridge-stp $v\n";
+ $raw .= "\tbridge-stp $br_stp\n";
- $v = defined($d->{bridge_fd}) ? $d->{bridge_fd} : 0;
+ my $br_fd = defined($d->{bridge_fd}) ? $d->{bridge_fd} : 0;
# 0 is only allowed when STP is disabled
# 0 is only allowed when STP is disabled
- if ($no_stp || ($v >= 2 && $v <= 30)) {
- $raw .= "\tbridge-fd $v\n";
+ if ($no_stp || ($br_fd >= 2 && $br_fd <= 30)) {
+ $raw .= "\tbridge-fd $br_fd\n";
- warn "'$iface': not setting 'bridge_fd' to value '$v' outside of allowed range 2-30\n";
+ warn "'$iface': ignoring 'bridge_fd' value '$br_fd', outside of allowed range 2-30\n";
}
$done->{bridge_fd} = 1;
if( defined($d->{bridge_vlan_aware})) {
$raw .= "\tbridge-vlan-aware yes\n";
}
$done->{bridge_fd} = 1;
if( defined($d->{bridge_vlan_aware})) {
$raw .= "\tbridge-vlan-aware yes\n";
- $v = defined($d->{bridge_vids}) ? $d->{bridge_vids} : "2-4094";
- $raw .= "\tbridge-vids $v\n";
+ my $vlans = defined($d->{bridge_vids}) ? $d->{bridge_vids} : "2-4094";
+ $raw .= "\tbridge-vids $vlans\n";
}
$done->{bridge_vlan_aware} = 1;
$done->{bridge_vids} = 1;
}
$done->{bridge_vlan_aware} = 1;
$done->{bridge_vids} = 1;