diff options
author | Andrew Thompson <andrew@clonedev.co.nz> | 2011-07-12 15:35:14 +1200 |
---|---|---|
committer | Andrew Thompson <andrew@clonedev.co.nz> | 2011-07-12 15:35:14 +1200 |
commit | aa9948147cea4951784bc85b52bd79c289d0921c (patch) | |
tree | 23bae5cc05cd4334f2dd2e4301c44257cc5f2446 | |
parent | 156ecb643549601762b63714079344806886d7a0 (diff) | |
download | pfsense-aa9948147cea4951784bc85b52bd79c289d0921c.zip pfsense-aa9948147cea4951784bc85b52bd79c289d0921c.tar.gz |
Allow DHCP mappings to be resolved first for reverse lookups.
This was affecting a kerberos installation where the first DNS alias was
given for the PTR instead of the static DHCP mapping name, breaking the
kerberos tokens.
-rw-r--r-- | etc/inc/system.inc | 13 | ||||
-rwxr-xr-x | usr/local/www/services_dnsmasq.php | 12 |
2 files changed, 22 insertions, 3 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index f427cec..1b2bc34 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -228,6 +228,8 @@ function system_hosts_generate() { $hostscfg = $dnsmasqcfg['hosts']; $hosts = "127.0.0.1 localhost localhost.{$syscfg['domain']}\n"; + $lhosts = ""; + $dhosts = ""; if ($config['interfaces']['lan']) { $cfgip = get_interface_ip("lan"); @@ -248,18 +250,23 @@ function system_hosts_generate() { foreach ($hostscfg as $host) { if ($host['host']) - $hosts .= "{$host['ip']} {$host['host']}.{$host['domain']} {$host['host']}\n"; + $lhosts .= "{$host['ip']} {$host['host']}.{$host['domain']} {$host['host']}\n"; else - $hosts .= "{$host['ip']} {$host['domain']}\n"; + $lhosts .= "{$host['ip']} {$host['domain']}\n"; } if (isset($dnsmasqcfg['regdhcpstatic']) && is_array($config['dhcpd'])) { foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) if(is_array($dhcpifconf['staticmap']) && isset($dhcpifconf['enable'])) foreach ($dhcpifconf['staticmap'] as $host) if ($host['ipaddr'] && $host['hostname']) - $hosts .= "{$host['ipaddr']} {$host['hostname']}.{$syscfg['domain']} {$host['hostname']}\n"; + $dhosts .= "{$host['ipaddr']} {$host['hostname']}.{$syscfg['domain']} {$host['hostname']}\n"; } + if (isset($dnsmasqcfg['dhcpfirst'])) + $hosts .= $dhosts . $lhosts; + else + $hosts .= $lhosts . $dhosts; + /* * Do not remove this because dhcpleases monitors with kqueue it needs to be * killed before writing to hosts files. diff --git a/usr/local/www/services_dnsmasq.php b/usr/local/www/services_dnsmasq.php index defb275..a422fb0 100755 --- a/usr/local/www/services_dnsmasq.php +++ b/usr/local/www/services_dnsmasq.php @@ -47,6 +47,7 @@ require_once("shaper.inc"); $pconfig['enable'] = isset($config['dnsmasq']['enable']); $pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']); $pconfig['regdhcpstatic'] = isset($config['dnsmasq']['regdhcpstatic']); +$pconfig['dhcpfirst'] = isset($config['dnsmasq']['dhcpfirst']); if (!is_array($config['dnsmasq']['hosts'])) $config['dnsmasq']['hosts'] = array(); @@ -65,6 +66,7 @@ if ($_POST) { $config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false; $config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false; $config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false; + $config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false; write_config(); @@ -112,6 +114,7 @@ function enable_change(enable_over) { endis = !(document.iform.enable.checked || enable_over); document.iform.regdhcp.disabled = endis; document.iform.regdhcpstatic.disabled = endis; + document.iform.dhcpfirst.disabled = endis; } //--> </script> @@ -152,6 +155,15 @@ function enable_change(enable_over) { </td> </tr> <tr> + <td class="vtable"><p> + <input name="dhcpfirst" type="checkbox" id="dhcpfirst" value="yes" <?php if ($pconfig['dhcpfirst'] == "yes") echo "checked";?>> + <strong><?=gettext("Resolve DHCP mappings first");?><br> + </strong><?php printf(gettext("If this option is set, then DHCP mappings will ". + "be resolved before the manual list of names below. This only ". + "affects the name given for a reverse lookup (PTR).");?></p> + </td> + </tr> + <tr> <td> <input name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)"> </td> |