]> git.proxmox.com Git - pve-common.git/commitdiff
read_prox_net_ipv6_route fixup
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 22 Oct 2015 13:45:24 +0000 (15:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 23 Oct 2015 10:13:35 +0000 (12:13 +0200)
- 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.

src/PVE/ProcFSTools.pm

index 3dc5680df69aa7b4d96a4c49a95a1aa01d571efd..9c9eb8116c66f40b6842ef87b6d0cba0461b445d 100644 (file)
@@ -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
        };
     }