]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/ProcFSTools.pm
read_prox_net_ipv6_route fixup
[pve-common.git] / src / PVE / ProcFSTools.pm
index 368ae73a1674b93018d1df9505604c7746f07811..9c9eb8116c66f40b6842ef87b6d0cba0461b445d 100644 (file)
@@ -6,7 +6,7 @@ use POSIX;
 use Time::HiRes qw (gettimeofday);
 use IO::File;
 use PVE::Tools;
-use Cwd;
+use Cwd qw();
 
 my $clock_ticks = POSIX::sysconf(&POSIX::_SC_CLK_TCK);
 
@@ -311,16 +311,16 @@ sub read_proc_net_ipv6_route {
     my $fh = IO::File->new ($filename, "r");
     return $res if !$fh;
 
-    my $read_v6addr = sub { s/....(?!$)/$&:/g };
+    my $read_v6addr = sub { $_[0] =~ s/....(?!$)/$&:/gr };
 
     # ipv6_route has no header
     while (defined(my $line = <$fh>)) {
        my ($dest, $prefix, $nexthop, $metric, $iface) = (split(/\s+/, $line))[0,1,4,5,9];
        push @$res, {
            dest => &$read_v6addr($dest),
-           prefix => $prefix,
+           prefix => hex("$prefix"),
            gateway => &$read_v6addr($nexthop),
-           metric => $metric,
+           metric => hex("$metric"),
            iface => $iface
        };
     }