# noclone flag for large read-only data chunks like aplinfo
$ccinfo->{$opt} = $v;
} elsif ($opt eq 'always_call_parser') {
- # when set, we call parser even when the file does not exists.
+ # when set, we call parser even when the file does not exist.
# this allows the parser to return some default
$ccinfo->{$opt} = $v;
} else {
SECTION: while (defined ($line = <$fh>)) {
chomp ($line);
next if $line =~ m/^\s*#/;
+ next if $line =~ m/^\s*(allow-hotplug)\s+(.*)$/;
- if ($line =~ m/^\s*auto\s+(.*)$/) {
- my @aa = split (/\s+/, $1);
+ if ($line =~ m/^\s*(auto|allow-ovs)\s+(.*)$/) {
+ my @aa = split (/\s+/, $2);
foreach my $a (@aa) {
$ifaces->{$a}->{autostart} = 1;
$raw .= "\tovs_type $d->{type}\n";
$done->{ovs_type} = 1;
- if ($d->{ovs_bridge}) {
-
- $raw = "allow-$d->{ovs_bridge} $iface\n$raw";
- $raw .= "\tovs_bridge $d->{ovs_bridge}\n";
+ if (my $bridge = $d->{ovs_bridge}) {
+ $raw = "allow-$bridge $iface\n$raw";
+ $raw .= "\tovs_bridge $bridge\n";
$done->{ovs_bridge} = 1;
}
}
die "vlan '$iface' - unable to find parent '$p'\n"
if !$n;
- if ($n->{type} eq 'bridge' && !$n->{bridge_vlan_aware}) {
- die "vlan '$iface' - bridge vlan aware is not enabled on parent '$p'\n";
- } elsif ($n->{type} ne 'eth' && $n->{type} ne 'bridge' && $n->{type} ne 'bond' && $n->{type} ne 'vlan') {
+ if ($n->{type} ne 'eth' && $n->{type} ne 'bridge' && $n->{type} ne 'bond' && $n->{type} ne 'vlan') {
die "vlan '$iface' - wrong interface type on parent '$p' " .
"('$n->{type}' != 'eth|bond|bridge|vlan' )\n";
}
my $n = $ifaces->{$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} eq 'static' && $n->{address} ne '0.0.0.0') ||
+ ($n->{method6} eq 'static' && $n->{address} ne "\:\:");
+
&$check_mtu($ifaces, $iface, $p);
$bridgeports->{$p} = $iface;
}
}
$printed->{$iface} = 1;
- if ($d->{type} eq 'OVSBridge') {
- $raw .= "allow-ovs $iface\n";
- } elsif ($d->{autostart}) {
- $raw .= "auto $iface\n" if $d->{autostart};
+ if ($d->{autostart}) {
+ if ($d->{type} eq 'OVSBridge') {
+ # cannot use 'auto' for OVS, would add race with systemd ifup@.service
+ $raw .= "allow-ovs $iface\n";
+ } else {
+ $raw .= "auto $iface\n";
+ }
}
my $i = 0; # some options should be printed only once