Unbound DHCP registration checkbox bug?
-
@ronpfs said in Unbound DHCP registration checkbox bug?:
@Ender117 ender117 Maybe it's time to provide more info about you pfsense box: version, hardware, packages, etc
What @Ender117 sees, is what I see. Its part of pfSense current (2.4.3_1) behavior.
Installed packages, or not, the issue is the same (except if packages start to modify system files like /etc/inc/system.inc etc).What happens can be seen here : function system_dhcpleases_configure() in /etc/inc/system.inc :
https://github.com/pfsense/pfsense/blob/7c15c19d76eac725c42133012488cb97e4dcd885/src/etc/inc/system.inc#L572First, the main issue :
My "DHCP Registration" is not checked.
Still, my unbound config file will include this file /var/unbound/dhcpleases_entries.conf, which contains leases - this is ok : but it should be empty in this case. And that's NOT the case.# dhcpleases automatically entered local-data: "iPhonevhristine.brit-hotel-fumel.net IN A 192.168.2.34" local-data-ptr: "192.168.2.34 iPhonevhristine.brit-hotel-fumel.net" local-data: "MBP-de-manu.brit-hotel-fumel.net IN A 192.168.2.162" local-data-ptr: "192.168.2.162 MBP-de-manu.brit-hotel-fumel.net" local-data: "iPhone-de-Julie.brit-hotel-fumel.net IN A 192.168.2.196" local-data-ptr: "192.168.2.196 iPhone-de-Julie.brit-hotel-fumel.net" local-data: "iPaddeVeronique.brit-hotel-fumel.net IN A 192.168.2.131" local-data-ptr: "192.168.2.131 iPaddeVeronique.brit-hotel-fumel.net" local-data: "android-b094ac578001045c.brit-hotel-fumel.net IN A 192.168.2.18" local-data-ptr: "192.168.2.18 android-b094ac578001045c.brit-hotel-fumel.net" local-data: "PO130022159.brit-hotel-fumel.net IN A 192.168.2.64" local-data-ptr: "192.168.2.64 PO130022159.brit-hotel-fumel.net" local-data: "Galaxy-S9.brit-hotel-fumel.net IN A 192.168.2.35" local-data-ptr: "192.168.2.35 Galaxy-S9.brit-hotel-fumel.net" local-data: "android-fdd7cf6422a374a4.brit-hotel-fumel.net IN A 192.168.2.88" local-data-ptr: "192.168.2.88 android-fdd7cf6422a374a4.brit-hotel-fumel.net" local-data: "Galaxy-Tab-S2.brit-hotel-fumel.net IN A 192.168.2.71" local-data-ptr: "192.168.2.71 Galaxy-Tab-S2.brit-hotel-fumel.net"
Why ?
It all happens on a day, when we decided to check "DHCP Registration" and Save :
The file /var/unbound/dhcpleases_etries.conf will get created, and a process called "dhcpleases" is started that syncs new incoming leases from the DHCP server into our /var/unbound/dhcpleases_etries.conf file- and when this happens, unbound (or the Forwarder) is restarted to take changes into account and all life happy together.
Maybe "DHCP Registration" for the Resolver and Forwarder are checked by default, when we installed pfSense ?
Now, the interesting part. we uncheck "DHCP Registration" - and Save + Apply.
The function system_dhcpleases_configure() doesn't do much anymore. The file /var/unbound/dhcpleases_entries.conf stays in place with our leases that existed at the moment "DHCP Registration" was unchecked. The file is not maintained by nothing anymore.
Forwarder or Resolver continues including and using the content. And this is (seems ,) wrong.Or, and here it is :
If "DHCP Registration" is unchecked,, /var/unbound/dhcpleases_entries.conf should be flushed.
That's it.I'm running this code now :
At the end of the function system_dhcpleases_configure()
} else if (isvalidpid($pidfile)) { sigkillbypid($pidfile, "TERM"); @unlink($pidfile); } } }
I put in place :
} else if (isvalidpid($pidfile)) { sigkillbypid($pidfile, "TERM"); @unlink($pidfile); } } else { if ((isset($config['dnsmasq']['enable']) && !isset($config['dnsmasq']['regdhcp'])) || (isset($config['unbound']['enable']) && !isset($config['unbound']['regdhcp']))) { mwexec("truncate -s 0 {$g['unbound_chroot_path']}/dhcpleases_entries.conf"); } } }
edit 2018-09-19 : same / simpler / better :
} else { if (isvalidpid($pidfile)) { sigkillbypid($pidfile, "TERM"); @unlink($pidfile); } if (file_exists("{$g['unbound_chroot_path']}/dhcpleases_entries.conf")) mwexec("truncate -s 0 {$g['unbound_chroot_path']}/dhcpleases_entries.conf"); } }
=> If running, kills the dhcpleases process.
=> Truncates (empties) the dhcpleases_entries.conf fileNow, when "DHCP Registration" is unchecked the file /var/unbound/dhcpleases_entries.conf exist (has to exist) and is empty.
-
@gertjan Ahhh, glad to see someone else had looked at the same problem. And thanks for describe the problem more thoroughly and provide a solution.
Do you know if there was a bug report for this? Would be nice if your solution goes official.
-
@gertjan If you don't have time for a bug report, would you mind me go ahead to file one and quote you there?
-
@ender117 Why don't you empty /var/unbound/dhcpleases_entries.conf for now ?
You can do that in Diagnostics / Edit File or run a in shell prompt :
/usr/bin/truncate -s 0 /var/unbound/dhcpleases_entries.conf
-
@ronpfs I had already fixed the problem manually, but thanks for your kind suggestion anyway. I just believe this is a bug and would like to let the developers know.
-
@ender117
I agree, but I prefer not to add new bug right now. They are finalizing 2.4.4.
I still need to check if it isn't possible to propose another solution - and if this solution doesn't provoke unwanted side-effect.
I hope you agree with me that this is a minor problem (now it solved). -
Yeah I guess you are right. I would be better to let them finish 2.4.4 first, which I heard that first RC should be out next week. Maybe it will get fix then, who knows.
-
@gertjan The official 2.4.4 is out and this bug persists. Guess I will go file a bug report soon
-
@gertjan I submitted a bug report: https://redmine.pfsense.org/issues/8981
-
I hit this one today... made a comment over here:
https://forum.netgate.com/post/920791