mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-27 13:44:54 +00:00
try to keep ordering in /etc/network/interfaces
This commit is contained in:
parent
adbc988db3
commit
c9dc864557
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
|||||||
RELEASE=2.0
|
RELEASE=2.0
|
||||||
|
|
||||||
VERSION=1.0
|
VERSION=1.0
|
||||||
PKGREL=17
|
PKGREL=18
|
||||||
|
|
||||||
PACKAGE=libpve-common-perl
|
PACKAGE=libpve-common-perl
|
||||||
|
|
||||||
|
@ -692,6 +692,9 @@ sub read_etc_network_interfaces {
|
|||||||
close($fd2);
|
close($fd2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# we try to keep order inside the file
|
||||||
|
my $priority = 2; # 1 is reserved for lo
|
||||||
|
|
||||||
# always add the vmbr0 bridge device
|
# always add the vmbr0 bridge device
|
||||||
$ifaces->{vmbr0}->{exists} = 1;
|
$ifaces->{vmbr0}->{exists} = 1;
|
||||||
|
|
||||||
@ -720,6 +723,7 @@ sub read_etc_network_interfaces {
|
|||||||
} elsif ($line =~ m/^iface\s+(\S+)\s+inet\s+(\S+)\s*$/) {
|
} elsif ($line =~ m/^iface\s+(\S+)\s+inet\s+(\S+)\s*$/) {
|
||||||
my $i = $1;
|
my $i = $1;
|
||||||
$ifaces->{$i}->{method} = $2;
|
$ifaces->{$i}->{method} = $2;
|
||||||
|
$ifaces->{$i}->{priority} = $priority++;
|
||||||
|
|
||||||
my $d = $ifaces->{$i};
|
my $d = $ifaces->{$i};
|
||||||
while (defined ($line = <$fh>)) {
|
while (defined ($line = <$fh>)) {
|
||||||
@ -778,6 +782,7 @@ sub read_etc_network_interfaces {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$ifaces->{lo}) {
|
if (!$ifaces->{lo}) {
|
||||||
|
$ifaces->{lo}->{priority} = 1;
|
||||||
$ifaces->{lo}->{method} = 'loopback';
|
$ifaces->{lo}->{method} = 'loopback';
|
||||||
$ifaces->{lo}->{type} = 'loopback';
|
$ifaces->{lo}->{type} = 'loopback';
|
||||||
$ifaces->{lo}->{autostart} = 1;
|
$ifaces->{lo}->{autostart} = 1;
|
||||||
@ -889,16 +894,24 @@ sub write_etc_network_interfaces {
|
|||||||
|
|
||||||
my $printed = {};
|
my $printed = {};
|
||||||
|
|
||||||
foreach my $t (('lo', 'eth', '')) {
|
foreach my $iface (sort {
|
||||||
foreach my $iface (sort keys %$ifaces) {
|
my $ref1 = $ifaces->{$a};
|
||||||
my $d = $ifaces->{$iface};
|
my $ref2 = $ifaces->{$b};
|
||||||
|
my $p1 = $ref1->{priority} || 100000;
|
||||||
|
my $p2 = $ref2->{priority} || 100000;
|
||||||
|
|
||||||
next if $printed->{$iface};
|
return $p1 <=> $p2 if $p1 != $p2;
|
||||||
next if $iface !~ m/^$t/;
|
|
||||||
|
|
||||||
$printed->{$iface} = 1;
|
|
||||||
$raw .= __interface_to_string($iface, $d);
|
return $a cmp $b;
|
||||||
}
|
} keys %$ifaces) {
|
||||||
|
|
||||||
|
my $d = $ifaces->{$iface};
|
||||||
|
|
||||||
|
next if $printed->{$iface};
|
||||||
|
|
||||||
|
$printed->{$iface} = 1;
|
||||||
|
$raw .= __interface_to_string($iface, $d);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVE::Tools::safe_print($filename, $fh, $raw);
|
PVE::Tools::safe_print($filename, $fh, $raw);
|
||||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
|||||||
|
libpve-common-perl (1.0-18) unstable; urgency=low
|
||||||
|
|
||||||
|
* try to keep ordering in /etc/network/interfaces
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Fri, 02 Mar 2012 12:33:34 +0100
|
||||||
|
|
||||||
libpve-common-perl (1.0-17) unstable; urgency=low
|
libpve-common-perl (1.0-17) unstable; urgency=low
|
||||||
|
|
||||||
* better error message for usermod command
|
* better error message for usermod command
|
||||||
|
Loading…
Reference in New Issue
Block a user