mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-09 11:38:40 +00:00
read_prox_net_ipv6_route fixup
- read_v6addr used the wrong $_ - All values in the file are hex and possibly prefixed with zeroes so we need to make sure they don't get interpreted as octal.
This commit is contained in:
parent
87ffaecbfb
commit
ef67212cf2
@ -311,16 +311,16 @@ sub read_proc_net_ipv6_route {
|
|||||||
my $fh = IO::File->new ($filename, "r");
|
my $fh = IO::File->new ($filename, "r");
|
||||||
return $res if !$fh;
|
return $res if !$fh;
|
||||||
|
|
||||||
my $read_v6addr = sub { s/....(?!$)/$&:/g };
|
my $read_v6addr = sub { $_[0] =~ s/....(?!$)/$&:/gr };
|
||||||
|
|
||||||
# ipv6_route has no header
|
# ipv6_route has no header
|
||||||
while (defined(my $line = <$fh>)) {
|
while (defined(my $line = <$fh>)) {
|
||||||
my ($dest, $prefix, $nexthop, $metric, $iface) = (split(/\s+/, $line))[0,1,4,5,9];
|
my ($dest, $prefix, $nexthop, $metric, $iface) = (split(/\s+/, $line))[0,1,4,5,9];
|
||||||
push @$res, {
|
push @$res, {
|
||||||
dest => &$read_v6addr($dest),
|
dest => &$read_v6addr($dest),
|
||||||
prefix => $prefix,
|
prefix => hex("$prefix"),
|
||||||
gateway => &$read_v6addr($nexthop),
|
gateway => &$read_v6addr($nexthop),
|
||||||
metric => $metric,
|
metric => hex("$metric"),
|
||||||
iface => $iface
|
iface => $iface
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user