$p = $1;
$vlanid = $2;
delete $d->{'vlan-raw-device'} if $d->{'vlan-raw-device'};
+ delete $d->{'vlan-id'} if $d->{'vlan-id'};
+
} else {
die "missing vlan-raw-device option" if !$d->{'vlan-raw-device'};
$p = $d->{'vlan-raw-device'};
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} && $n->{method} eq 'static' && $n->{address} ne '0.0.0.0') ||
- ($n->{method6} && $n->{method6} eq 'static' && $n->{address} ne '::');
+ ($n->{method6} && $n->{method6} eq 'static' && $n->{address6} ne '::');
&$check_mtu($ifaces_copy, $p, $iface);
$bridgeports->{$p} = $iface;
}
my ($rootiface, @rest) = split(/[.:]/, $iface);
my $childlevel = scalar(@rest);
- my $n = $ifaces->{$rootiface};
-
- my $pri = $if_type_hash->{$n->{type}} + $childlevel
- if $n->{type} && $n->{type} ne 'unknown';
+ my $type = $ifaces->{$rootiface}->{type};
+ return if !$type || $type eq 'unknown';
- return $pri;
+ return $if_type_hash->{$type} + $childlevel
};
foreach my $iface (sort {
my $raw = '';
- foreach my $machine (sort keys %$data) {
+ # sort longer entries first, so machine definitions with higher granularity are preferred
+ for my $machine (sort { length($b) <=> length($a) || $a cmp $b} keys %$data) {
my $d = $data->{$machine};
+ next if !defined($d); # allow "deleting" set entries
+
$raw .= "machine $machine\n";
$raw .= " login $d->{login}\n" if $d->{login};
$raw .= " password $d->{password}\n" if $d->{password};
sub write_apt_auth {
my ($filename, $fh, $data) = @_;
- my $raw = &$format_apt_auth_data($data);
+ my $raw = $format_apt_auth_data->($data);
die "write failed: $!" unless print $fh "$raw\n";
$orig->{$machine} = $data->{$machine};
}
- return &$format_apt_auth_data($orig);
+ return $format_apt_auth_data->($orig);
}
-register_file('apt-auth', "/etc/apt/auth.conf",
- \&read_apt_auth, \&write_apt_auth,
- \&update_apt_auth, perm => 0640);
+register_file(
+ 'apt-auth',
+ "/etc/apt/auth.conf",
+ \&read_apt_auth,
+ \&write_apt_auth,
+ \&update_apt_auth,
+ perm => 0640,
+);
1;