mirror of
https://github.com/pi-hole/web.git
synced 2026-04-25 19:29:20 +01:00
Add IPv6 upstream servers
This commit is contained in:
@@ -86,19 +86,36 @@ function readStaticLeasesFile()
|
||||
return true;
|
||||
}
|
||||
|
||||
function isequal(&$argument, &$compareto) {
|
||||
$ret = false;
|
||||
if(isset($argument))
|
||||
{
|
||||
if($argument === $compareto)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isinserverlist($ip) {
|
||||
global $DNSserverslist;
|
||||
foreach ($DNSserverslist as $key => $value) {
|
||||
if (isequal($value['v4p'],$ip) || isequal($value['v4s'],$ip))
|
||||
return true;
|
||||
if (isequal($value['v6p'],$ip) || isequal($value['v6s'],$ip))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$DNSserverslist = [
|
||||
"8.8.8.8" => "Google (Primary)",
|
||||
"208.67.222.222" => "OpenDNS (Primary)",
|
||||
"4.2.2.1" => "Level3 (Primary)",
|
||||
"199.85.126.10" => "Norton (Primary)",
|
||||
"8.26.56.26" => "Comodo (Primary)",
|
||||
"84.200.69.80" => "DNS.WATCH (Primary)",
|
||||
"8.8.4.4" => "Google (Secondary)",
|
||||
"208.67.220.220" => "OpenDNS (Secondary)",
|
||||
"4.2.2.2" => "Level3 (Secondary)",
|
||||
"199.85.127.10" => "Norton (Secondary)",
|
||||
"8.20.247.20" => "Comodo (Secondary)",
|
||||
"84.200.70.40" => "DNS.WATCH (Secondary)",
|
||||
"Google" => ["v4p" => "8.8.8.8","v4s" => "8.8.4.4", "v6p" => "2001:4860:4860:0:0:0:0:8888", "v6s" => "2001:4860:4860:0:0:0:0:8844"],
|
||||
"OpenDNS" => ["v4p" => "208.67.222.222", "v4s" => "208.67.220.220"],
|
||||
"Level3" => ["v4p" => "4.2.2.1", "v4s" => "4.2.2.2"],
|
||||
"Norton" => ["v4p" => "199.85.126.10", "v4s" => "199.85.127.10"],
|
||||
"Comodo" => ["v4p" => "8.26.56.26", "v4s" => "8.20.247.20"],
|
||||
"DNS.WATCH" => ["v4p" => "84.200.69.80", "v4s" => "84.200.70.40", "v6p" => "2001:1608:10:25:0:0:1c04:b12f", "v6s" => "2001:1608:10:25:0:0:9249:d69b"]
|
||||
];
|
||||
|
||||
$error = "";
|
||||
@@ -115,9 +132,12 @@ function readStaticLeasesFile()
|
||||
// Add selected predefined servers to list
|
||||
foreach ($DNSserverslist as $key => $value)
|
||||
{
|
||||
if(array_key_exists("DNSserver".str_replace(".","_",$key),$_POST))
|
||||
foreach(["v4p", "v4s", "v6p", "v6s"] as $type)
|
||||
{
|
||||
array_push($DNSservers,$key);
|
||||
if(@array_key_exists("DNSserver".str_replace(".","_",$value[$type]),$_POST))
|
||||
{
|
||||
array_push($DNSservers,$value[$type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +215,7 @@ function readStaticLeasesFile()
|
||||
// Fallback
|
||||
$DNSinterface = "local";
|
||||
}
|
||||
$return .= exec("sudo pihole -a -i ".$DNSinterface." -web");
|
||||
exec("sudo pihole -a -i ".$DNSinterface." -web");
|
||||
|
||||
// If there has been no error we can save the new DNS server IPs
|
||||
if(!strlen($error))
|
||||
|
||||
Reference in New Issue
Block a user