summaryrefslogtreecommitdiffstats
path: root/etc/inc/system.inc
diff options
context:
space:
mode:
authorDaniel Becker <razzfazz@gmail.com>2013-07-29 22:48:00 -0700
committerDaniel Becker <razzfazz@gmail.com>2013-07-29 22:48:00 -0700
commit2ec52b3e69e2dbb5ad2b176837c27108b826bcc7 (patch)
treeb9c7c395b3d567b067308de37903b4042e165375 /etc/inc/system.inc
parent53bd164217644725ede6bdea04e7f1987572ac1a (diff)
downloadpfsense-2ec52b3e69e2dbb5ad2b176837c27108b826bcc7.zip
pfsense-2ec52b3e69e2dbb5ad2b176837c27108b826bcc7.tar.gz
use correct domain names when registering static DHCP entries in DNS
When registering static DHCP entries in DNS, we first try to use the domain name configured for the static entry (if any), then the domain name configured in the DHCP server settings for the corresponding interface (if any), and as a last resort the system domain name. This change was proposed by user TechSmurf on the pfSense boards; see <http://forum.pfsense.org/index.php/topic,64934.msg352331.html#msg352331>.
Diffstat (limited to 'etc/inc/system.inc')
-rw-r--r--etc/inc/system.inc12
1 files changed, 10 insertions, 2 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index b2ba9f0..d6d6615 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -277,14 +277,22 @@ function system_hosts_generate() {
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf)
if(is_array($dhcpifconf['staticmap']) && isset($dhcpifconf['enable']))
foreach ($dhcpifconf['staticmap'] as $host)
- if ($host['ipaddr'] && $host['hostname'])
+ if ($host['ipaddr'] && $host['hostname'] && $host['domain'])
+ $dhosts .= "{$host['ipaddr']} {$host['hostname']}.{$host['domain']} {$host['hostname']}\n";
+ else if ($host['ipaddr'] && $host['hostname'] && $dhcpifconf['domain'])
+ $dhosts .= "{$host['ipaddr']} {$host['hostname']}.{$dhcpifconf['domain']} {$host['hostname']}\n";
+ else if ($host['ipaddr'] && $host['hostname'])
$dhosts .= "{$host['ipaddr']} {$host['hostname']}.{$syscfg['domain']} {$host['hostname']}\n";
}
if (isset($dnsmasqcfg['regdhcpstatic']) && is_array($config['dhcpdv6'])) {
foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf)
if(is_array($dhcpifconf['staticmap']) && isset($dhcpifconf['enable']))
foreach ($dhcpifconf['staticmap'] as $host)
- if ($host['ipaddrv6'] && $host['hostname'])
+ if ($host['ipaddrv6'] && $host['hostname'] && $host['domain'])
+ $dhosts .= "{$host['ipaddrv6']} {$host['hostname']}.{$host['domain']} {$host['hostname']}\n";
+ else if ($host['ipaddrv6'] && $host['hostname'] && $dhcpifconf['domain'])
+ $dhosts .= "{$host['ipaddrv6']} {$host['hostname']}.{$dhcpifconf['domain']} {$host['hostname']}\n";
+ else if ($host['ipaddrv6'] && $host['hostname'])
$dhosts .= "{$host['ipaddrv6']} {$host['hostname']}.{$syscfg['domain']} {$host['hostname']}\n";
}
OpenPOWER on IntegriCloud