diff options
author | Ermal <eri@pfsense.org> | 2010-11-08 22:42:27 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-11-08 22:42:27 +0000 |
commit | 58db1fc4947a8b4bb60b695a32adee4b830eaab3 (patch) | |
tree | decd94cfe9330798a9950543f48c5fb08ab631da /etc/inc | |
parent | 6e8b0ec31045316cae3ed8638b12279870cc7fda (diff) | |
download | pfsense-58db1fc4947a8b4bb60b695a32adee4b830eaab3.zip pfsense-58db1fc4947a8b4bb60b695a32adee4b830eaab3.tar.gz |
Kill dhcplease before writing the hosts file so that it does not scramble the content from kqueue events.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/system.inc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 3d5f807..68e666c 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -210,13 +210,7 @@ function system_hosts_generate() { } $hostscfg = $dnsmasqcfg['hosts']; - $fd = fopen("{$g['varetc_path']}/hosts", "w"); - if (!$fd) { - log_error("Error: cannot open hosts file in system_hosts_generate().\n"); - return 1; - } - - $hosts .= "127.0.0.1 localhost localhost.{$syscfg['domain']}\n"; + $hosts = "127.0.0.1 localhost localhost.{$syscfg['domain']}\n"; if ($config['interfaces']['lan']) { $cfgip = get_interface_ip("lan"); @@ -248,6 +242,20 @@ function system_hosts_generate() { if ($host['ipaddr'] && $host['hostname']) $hosts .= "{$host['ipaddr']} {$host['hostname']}.{$syscfg['domain']} {$host['hostname']}\n"; } + + /* + * Do not remove this because dhcpleases monitors with kqueue it needs to be + * killed before writing to hosts files. + */ + if (file_exists("{$g['varrun_path']}/dhcpleases.pid")) { + sigkillbypid("{$g['varrun_path']}/dhcpleases.pid", "TERM"); + @unlink("{$g['varrun_path']}/dhcpleases.pid"); + } + $fd = fopen("{$g['varetc_path']}/hosts", "w"); + if (!$fd) { + log_error("Error: cannot open hosts file in system_hosts_generate().\n"); + return 1; + } fwrite($fd, $hosts); fclose($fd); |