Bug #3176
closedHosts file corrupted when using "Register DHCP leases in DNS forwarder"
100%
Description
When the option "Register DHCP leases in DNS forwarder" is enabled the Host Overrides are not working correctly. They are corrupted/truncated.
Disabling the option will solve the problem and give a good hosts file.
Problem is on 2.1-RC1 (amd64) built on Tue Aug 27 16:56:42
Files
Updated by Phillip Davis over 11 years ago
I am running:
2.1-RC1 (i386)
built on Sun Sep 1 01:17:51 EDT 2013
FreeBSD 8.3-RELEASE-p10
@10.49.80.254 test-entry.np.net.inf.org test-entry
10.49.80.254 test-entry1.np.net.inf.org test-entry1
- dhcpleases automatically entered
10.49.80.214 android-92ef1893ad40d810.np.net.inf.org android-92ef1893ad40d810 # dynamic entry from dhcpd.leases@
What pfSense version are you on?
How do you make the problem happen?
Post the corrupted/truncated /etc/hosts.
Updated by Rene Klomp over 11 years ago
What pfSense version are you on?
Like in issue description: 2.1-RC1 (amd64) built on Tue Aug 27 16:56:42
How do you make the problem happen?
It just happens. When Register DHCP leases in DNS forwarder is on. Otherwise it does not happen.
Post the corrupted/truncated /etc/hosts.
vi /etc/hosts 127.0.0.1 localhost 10.10.0.1 xxx 192.168.1.9 xxx 192.168.1.6 xxx 192.168.1.11 xxx 192.168.1.13 xxx 192.168.2.32 xxx 192.168.1.22 xxx 10.168^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ # dhcpleases automatically entered 10.10.255.239 xxx # dynamic entry from dhcpd.leases 10.10.255.173 xxx # dynamic entry from dhcpd.leases ... ...
Updated by Rene Klomp over 11 years ago
Cant reproduce the problem anymore. When i disabled the "DHCP leases in DNS forwarder" my problem was gone but after reenabling it the problem does not come back.
Updated by Chris Buechler over 11 years ago
- Status changed from New to Feedback
haven't seen this anywhere or heard of it elsewhere
Updated by Adam Thompson over 11 years ago
- File corrupted-hosts corrupted-hosts added
- File fixed-hosts fixed-hosts added
I just got bitten by this as well, running 2.1-RELEASE (i386). See attached.
I also can verify that turning off the checkbox clears up the corruption, but continues to register dhcpleases in /etc/hosts!
Turning the checkbox back on then makes no difference...
I also tried manually editing /etc/hosts to remove the crap, rebooting, and it was corrupt again upon reboot.
Updated by Jason Crowley about 11 years ago
- Disabled "Register DHCP leases in DNS forwarder"
- Verified /var/etc/hosts looked correct. I still had the DHCP-lease hosts in it. and truncated information above "# dhcpleases automatically entered"
- Restarted dnsmasq
- Verified /var/etc/hosts file looked correct. It was good.
- Enabled "Register DHCP leases in DNS forwarder"
- Verified /var/etc/hosts looked correct. It was still good.
Updated by Daniel Sheridan almost 11 years ago
I'm seeing this too (on 2.0). While the corruption is happening, there are two /usr/local/sbin/dhcpleases processes running:
28599 ?? Is 0:00.01 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d office.adelard.com -p /var/run/dnsmasq.pid -h /var/etc/hosts 30002 ?? S 0:00.10 /usr/local/sbin/dnsmasq --local-ttl 1 --all-servers --rebind-localhost-ok --stop-dns-rebind --dns-forward-max=5000 --cache-size=10000 --dhcp-hostsfile=/var/etc/hosts 32398 ?? Is 0:07.55 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d office.adelard.com -p /var/run/dnsmasq.pid -h /var/etc/hosts 34697 ?? Ss 0:00.01 /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf em0 em3
After switching off the "Register DHCP leases in DNS forwarder", only one:
[2.0.3-RELEASE][admin@pfsense.office.adelard.com]/var/etc(39): ps xawww|grep dhcp 9351 ?? Ss 0:00.06 /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf em0 em3 23543 ?? Ss 8:55.92 /usr/sbin/syslogd -s -c -c -l /var/dhcpd/var/run/log -f /var/etc/syslog.conf 32398 ?? Is 0:07.56 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d office.adelard.com -p /var/run/dnsmasq.pid -h /var/etc/hosts
And after switching it back on, still only one:
12040 ?? Ss 0:00.01 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d office.adelard.com -p /var/run/dnsmasq.pid -h /var/etc/hosts 13517 ?? S 0:00.02 /usr/local/sbin/dnsmasq --local-ttl 1 --all-servers --rebind-localhost-ok --stop-dns-rebind --dns-forward-max=5000 --cache-size=10000 --dhcp-hostsfile=/var/etc/hosts 16904 ?? Ss 0:00.00 /usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot /var/dhcpd -cf /etc/dhcpd.conf em0 em3 23543 ?? Ss 8:55.93 /usr/sbin/syslogd -s -c -c -l /var/dhcpd/var/run/log -f /var/etc/syslog.conf
Updated by Andrew Newell almost 11 years ago
Sorry, I don't have much to add as far as content, but I would like to say that my pfSense box has had the same behavior as everyone else in this thread. Specifically I was trying to resolve a static DHCP entry which was inserted into DNS using the checkbox in the DNS forwarder page, and it was never entered into the hosts file, and sometimes while trying to fix other hosts it would corrupt the file with the ^@ stuff that other people have had in here.
Here's my basic box info:
@
Version 2.1-RELEASE (amd64)
built on Wed Sep 11 18:17:48 EDT 2013
FreeBSD 8.3-RELEASE-p11
You are on the latest version.
Platform pfSense
CPU Type Intel(R) Xeon(TM) CPU 3.20GHz
4 CPUs: 2 package(s) x 1 core(s) x 2 HTT threads
Uptime 57 Days 21 Hours 22 Minutes 29 Seconds
@
Thanks for your hard work!
Updated by Andrew Newell almost 11 years ago
I am unfamiliar with this forum so I apologize for my messed up formatting.
Updated by Chris Buechler over 9 years ago
think this may be related to some edge case where dhcpleases runs multiple times, though I'm not seeing how that could happen, and launching multiple instances on 2.2.4 doesn't make it happen. Granted, I'm looking at 2.2.4 and 2.3, could have been fixed since then.
anyone still encountering this?
Updated by Luiz Souza almost 9 years ago
Yeah, this is fixed in the last version of dhcpleases.
Updated by Renato Botelho almost 9 years ago
- Assignee set to Luiz Souza
- % Done changed from 0 to 100
Updated by Chris Buechler almost 9 years ago
- Status changed from Feedback to Resolved
Updated by Erik Fonnesbeck almost 5 years ago
Just had something that looks exactly like this happen in 2.4.4-RELEASE-p3 with my overrides list truncated in the middle of an entry (still using the dnsmasq DNS forwarder). Unfortunately, I didn't check to see if there were any duplicate processes before I tried changing configuration to try fixing it (I removed the truncated host override in the GUI and re-added it, thinking maybe there was a configuration error). However, I am getting the duplicate "dhcpleases automatically entered" sections as reported by some. The first copy doesn't seem to update with added or removed leases until the DNS forwarder is restarted, as it only has a copy of the entries from the time it was restarted.
It's possible the truncation is a result of either a race condition or just simply being confused by the duplicate entries as it adds or removes entries.