[pve-devel] [PATCH pve-common 1/2] INotify::read_etc_resolv_conf: ipv6 support

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Oct 5 09:30:56 CEST 2015


---
 src/PVE/INotify.pm | 2 +-
 src/PVE/Tools.pm   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 1c364ba..a68c262 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -540,7 +540,7 @@ sub read_etc_resolv_conf {
 	chomp $line;
 	if ($line =~ m/^(search|domain)\s+(\S+)\s*/) {
 	    $res->{search} = $2;
-	} elsif ($line =~ m/^nameserver\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s*/) {
+	} elsif ($line =~ m/^\s*nameserver\s+($PVE::Tools::IPRE)\s*/) {
 	    $nscount++;
 	    if ($nscount <= 3) {
 		$res->{"dns$nscount"} = $1;
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 1a342ee..d5a3866 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -63,6 +63,8 @@ our $IPV6RE = "(?:" .
     "(?:(?:(?:(?:$IPV6H16:){0,5}$IPV6H16)?::" .            ")$IPV6H16)|" .
     "(?:(?:(?:(?:$IPV6H16:){0,6}$IPV6H16)?::" .                    ")))";
 
+our $IPRE = "(?:$IPV4RE|$IPV6RE)";
+
 use constant (CLONE_NEWNS   => 0x00020000,
               CLONE_NEWUTS  => 0x04000000,
               CLONE_NEWIPC  => 0x08000000,
-- 
2.1.4





More information about the pve-devel mailing list