]> git.proxmox.com Git - pve-common.git/commitdiff
INotify::read_etc_resolv_conf: ipv6 support
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 5 Oct 2015 07:30:56 +0000 (09:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Oct 2015 10:30:44 +0000 (12:30 +0200)
src/PVE/INotify.pm
src/PVE/Tools.pm

index 1c364ba89482b1a788f9d1d4740ca5beac5c80b3..a68c262a577cc2478ff5ec8bb05b7af16659f210 100644 (file)
@@ -540,7 +540,7 @@ sub read_etc_resolv_conf {
        chomp $line;
        if ($line =~ m/^(search|domain)\s+(\S+)\s*/) {
            $res->{search} = $2;
        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;
            $nscount++;
            if ($nscount <= 3) {
                $res->{"dns$nscount"} = $1;
index 1a342ee04cc660f88dd567d4442ba895be5a0f43..d5a386621d1054ebea388de3fcd2c1e274aef3a1 100644 (file)
@@ -63,6 +63,8 @@ our $IPV6RE = "(?:" .
     "(?:(?:(?:(?:$IPV6H16:){0,5}$IPV6H16)?::" .            ")$IPV6H16)|" .
     "(?:(?:(?:(?:$IPV6H16:){0,6}$IPV6H16)?::" .                    ")))";
 
     "(?:(?:(?:(?:$IPV6H16:){0,5}$IPV6H16)?::" .            ")$IPV6H16)|" .
     "(?:(?:(?:(?:$IPV6H16:){0,6}$IPV6H16)?::" .                    ")))";
 
+our $IPRE = "(?:$IPV4RE|$IPV6RE)";
+
 use constant (CLONE_NEWNS   => 0x00020000,
               CLONE_NEWUTS  => 0x04000000,
               CLONE_NEWIPC  => 0x08000000,
 use constant (CLONE_NEWNS   => 0x00020000,
               CLONE_NEWUTS  => 0x04000000,
               CLONE_NEWIPC  => 0x08000000,