push @{$d->{families}}, $family;
while (defined ($line = <$fh>)) {
- chomp $line;
+ $line =~ s/\s+$//; # drop trailing whitespaces
+
if ($line =~ m/^\s*#(.*?)\s*$/) {
$f->{comments} = '' if !$f->{comments};
my $comment = decode('UTF-8', $1);
# not printing out options
} elsif ($d->{type} eq 'bridge') {
- $d->{bridge_ports} =~ s/[;,\s]+/ /g;
my $ports = $d->{bridge_ports} || 'none';
+ $ports =~ s/[;,\s]+/ /g;
$raw .= "\tbridge-ports $ports\n";
$done->{bridge_ports} = 1;
foreach my $iface (keys %$ifaces) {
my $d = $ifaces->{$iface};
- delete $d->{cidr};
- delete $d->{cidr6};
+ my ($cidr, $cidr6) = (delete $d->{cidr}, delete $d->{cidr6});
+ $d->{address} //= $cidr;
+ $d->{address6} //= $cidr6;
my $ports = '';
foreach my $k (qw(bridge_ports ovs_ports slaves ovs_bonds)) {
if ($d->{type} eq 'OVSBond' && $d->{ovs_bonds}) {
foreach my $p (split (/\s+/, $d->{ovs_bonds})) {
my $n = $ifaces->{$p};
+ $n->{autostart} = 1;
die "OVS bond '$iface' - unable to find slave '$p'\n"
if !$n;
die "OVS bond '$iface' - wrong interface type on slave '$p' " .
my $bond_primary_is_slave = undef;
foreach my $p (split (/\s+/, $d->{slaves})) {
my $n = $ifaces->{$p};
+ $n->{autostart} = 1;
die "bond '$iface' - unable to find slave '$p'\n"
if !$n;
foreach my $iface (keys %$ifaces_copy) {
my $d = $ifaces_copy->{$iface};
if ($d->{type} eq 'bridge') {
- foreach my $p (split (/\s+/, $d->{bridge_ports})) {
+ foreach my $p (split (/\s+/, $d->{bridge_ports} // '')) {
if($p =~ m/(\S+)\.(\d+)$/) {
my $vlanparent = $1;
if (!defined($ifaces_copy->{$p})) {