# 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;
# from the {options} hash for them to be removed correctly.
@$options = grep {defined($_)} map {
my ($pri, $line) = @$_;
- if ($line =~ /^allow-(\S+)\s+(.*)$/) {
+ if ($line =~ /^allow-ovs\s+(.*)$/) {
+ undef;
+ } elsif ($line =~ /^allow-(\S+)\s+(.*)$/) {
my $bridge = $1;
my @ports = split(/\s+/, $2);
if (defined(my $br = $ifaces->{$bridge})) {
$done->{ovs_type} = 1;
$raw .= "\tovs_ports $d->{ovs_ports}\n" if $d->{ovs_ports};
+
$done->{ovs_ports} = 1;
} elsif ($d->{type} eq 'OVSPort' || $d->{type} eq 'OVSIntPort' ||
$d->{type} eq 'OVSBond') {
$raw .= "\tovs_type $d->{type}\n";
$done->{ovs_type} = 1;
- if ($d->{ovs_bridge}) {
-
- if ($ifupdown2) {
- $raw = "auto $iface\n$raw";
- } else {
- $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;
}
return $a cmp $b;
} keys %$ifaces) {
next if $printed->{$iface};
-
my $d = $ifaces->{$iface};
my $pri = $d->{priority} // 0;
if (@options && $options[0]->[0] < $pri) {
}
$printed->{$iface} = 1;
- $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
$raw .= __interface_to_string($iface, $d, $_, !$i++, $ifupdown2) foreach @{$d->{families}};
}