mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Resolve problems with dns server setup when allow override is set. Also add static routes for all nameservers to be friendly with multiwan.
This commit is contained in:
parent
d5dbdd4115
commit
1033de7481
@ -149,25 +149,21 @@ function get_nameservers() {
|
||||
$master_list = array();
|
||||
|
||||
// Read in dhclient nameservers
|
||||
$dns_lists = split("\n", `ls /var/etc/nameserver_* 2>/dev/null`);
|
||||
if(is_array($dns_lists)) {
|
||||
$dns_lists = split("\n", `/bin/cat /var/etc/nameserver_* 2>/dev/null`);
|
||||
if (is_array($dns_lists)) {
|
||||
foreach($dns_lists as $dns) {
|
||||
if(!$dns)
|
||||
continue;
|
||||
$items = split("\n", file_get_contents($dns));
|
||||
foreach($items as $item)
|
||||
if($item <> "")
|
||||
$master_list[] = $item;
|
||||
if(is_ipaddr($dns))
|
||||
$master_list[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Read in any extra nameservers
|
||||
if(file_exists("/var/etc/nameservers.conf")) {
|
||||
$dns = `cat /var/etc/nameservers.conf`;
|
||||
$dns_s = split("\n", $dns);
|
||||
$dns_lists = split("\n", `/bin/cat /var/etc/nameservers.conf`);
|
||||
if(is_array($dns_s))
|
||||
foreach($dns_s as $dns)
|
||||
$master_list[] = $dns;
|
||||
if (is_ipaddr($dns))
|
||||
$master_list[] = $dns;
|
||||
}
|
||||
|
||||
return $master_list;
|
||||
|
||||
@ -174,7 +174,6 @@ add_new_routes() {
|
||||
|
||||
add_new_resolv_conf() {
|
||||
$LOGGER "Creating resolv.conf"
|
||||
/bin/rm -f /var/etc/nameservers.conf
|
||||
if [ ! -f "/var/etc/nameserver_$interface" ]; then
|
||||
# Make sure file exists to avoid errors
|
||||
touch /var/etc/nameserver_$interface
|
||||
@ -186,7 +185,6 @@ add_new_resolv_conf() {
|
||||
done
|
||||
rm -f /var/etc/nameserver_$interface
|
||||
for nameserver in $new_domain_name_servers; do
|
||||
echo $nameserver >>/var/etc/nameservers.conf
|
||||
# Add a route to the nameserver out the correct interface
|
||||
# so that mulitple wans work correctly with multiple dns
|
||||
# also backup the nameserver for later route removal
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
|
||||
# delete the node just in case mpd cannot do that
|
||||
/usr/sbin/ngctl shutdown $1:
|
||||
|
||||
rm -f /tmp/$1_router
|
||||
/bin/rm -f /var/etc/nameserver_$1
|
||||
/bin/rm -f /tmp/$1_router
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /var/etc/nameservers.conf
|
||||
rm -f /var/etc/nameserver_$1
|
||||
|
||||
# unset CGI environment variables so as not to confuse PHP
|
||||
unset CONTENT_TYPE GATEWAY_INTERFACE REMOTE_USER REMOTE_ADDR AUTH_TYPE
|
||||
@ -9,11 +9,14 @@ unset SERVER_SOFTWARE HTTP_REFERER SERVER_PROTOCOL REQUEST_METHOD
|
||||
unset SERVER_PORT SCRIPT_NAME SERVER_NAME
|
||||
|
||||
# write nameservers to file
|
||||
if [ "$6" = "dns1" ]; then
|
||||
/bin/echo $7 >> /var/etc/nameservers.conf
|
||||
if [ "$6" = "dns1" ]
|
||||
echo $7 >> /var/etc/nameserver_$1
|
||||
/sbin/route add $7 -if $1
|
||||
fi
|
||||
if [ "$8" = "dns2" ]; then
|
||||
/bin/echo $9 >> /var/etc/nameservers.conf
|
||||
|
||||
if [ "$8" = "dns1" ]
|
||||
echo $9 >> /var/etc/nameserver_$1
|
||||
/sbin/route add $9 -if $1
|
||||
fi
|
||||
|
||||
# let the configuration system know that the ip has changed.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user