[pve-devel] [PATCH pve-common] read_prox_net_ipv6_route fixup

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Oct 22 15:45:24 CEST 2015


- 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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 3dc5680..9c9eb81 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -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
 	};
     }
-- 
2.1.4




More information about the pve-devel mailing list