• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Unbound DHCP registration checkbox bug?

webGUI
4
25
3.1k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    Ender117
    last edited by Ender117 Sep 9, 2018, 6:13 PM Sep 9, 2018, 6:12 PM

    I recently find out that uncheck "DHCP Registration" and "Static DHCP" in WebGUI doesn't change unbound's behavior. I also confirmed that

    # dhcp lease entries
    include: /var/unbound/dhcpleases_entries.conf
    

    in unbound.conf remains unchanged. Is this a known bug or I did something wrong?

    R 1 Reply Last reply Sep 9, 2018, 6:55 PM Reply Quote 0
    • R
      RonpfS @Ender117
      last edited by Sep 9, 2018, 6:55 PM

      @ender117 Is the /var/unbound/dhcpleases_entries.conf file empty?

      2.4.5-RELEASE-p1 (amd64)
      Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
      Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

      1 Reply Last reply Reply Quote 0
      • E
        Ender117
        last edited by Sep 9, 2018, 6:56 PM

        no it's full of hosts

        1 Reply Last reply Reply Quote 0
        • R
          RonpfS
          last edited by Sep 9, 2018, 6:58 PM

          Maybe save the DHCP server settings?

          2.4.5-RELEASE-p1 (amd64)
          Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
          Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

          E G 2 Replies Last reply Sep 9, 2018, 7:16 PM Reply Quote 0
          • E
            Ender117 @RonpfS
            last edited by Ender117 Sep 9, 2018, 7:17 PM Sep 9, 2018, 7:16 PM

            @ronpfs

            That doesn't change anything.

            Can anyone reproduce this? if yes I would go file a bug report

            1 Reply Last reply Reply Quote 0
            • G
              Gertjan @RonpfS
              last edited by Gertjan Sep 9, 2018, 7:42 PM Sep 9, 2018, 7:41 PM

              @ronpfs said in Unbound DHCP registration checkbox bug?:

              Maybe save the DHCP server settings?

              That, for sure, will regenerate the /var/unbound/dhcpleases_entries.conf file (DHCP leases) as the /var/unbound/host_entries.conf.conf file (contains static DHCP leases and other 'fixed' host names).
              These files are created and maintained by the DHCP server(s).
              Side effect : unbound is also restarted when DHCP server is saved, thus restarted.

              I guess you can find the reply here : /etc/inc/system.inc : function system_dhcpleases_configure()
              When "DHCP Registration" is set, a process called dhcp_leases will be created that controls unbound for rereading the leases (like restarting it ...)

              This process exists when I check "DHCP Registration" :

              33397  -  Is       0:00.05 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d my-pfsense-domain.tld -p /var/run/unbound.pid -u /var/unbound/dhcpleases_entries.conf -h /etc/hosts
              

              This is the one that does the syncing between the DHCP server and unbound, the resolver.

              Btw : I'm not 100 %, but already digging in there for the last ... 10 years or so.

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

              E 1 Reply Last reply Sep 10, 2018, 5:49 PM Reply Quote 0
              • E
                Ender117 @Gertjan
                last edited by Ender117 Sep 10, 2018, 5:50 PM Sep 10, 2018, 5:49 PM

                @gertjan
                Thanks for the insight, though changing/saving DHCP setting didn't do anything for me. I will go check the process you mentioned when I got home.

                I thought that when you uncheck "DHCP registration" it would comment out

                include: /var/unbound/dhcpleases_entries.conf
                

                that was the most intuitive to me.

                1 Reply Last reply Reply Quote 0
                • E
                  Ender117
                  last edited by Sep 13, 2018, 12:40 AM

                  So I sshed in and rm the files, that fixed the problem. But if I check these boxes and then uncheck, the problem comes back. looks like a GUI bug to me

                  1 Reply Last reply Reply Quote 0
                  • R
                    RonpfS
                    last edited by Sep 13, 2018, 12:42 AM

                    The line is present with the box unchecked
                    The file dhcpleases_entries.conf should be empty when it's unchecked.

                    2.4.5-RELEASE-p1 (amd64)
                    Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
                    Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

                    E 1 Reply Last reply Sep 13, 2018, 12:45 AM Reply Quote 0
                    • E
                      Ender117 @RonpfS
                      last edited by Ender117 Sep 13, 2018, 12:45 AM Sep 13, 2018, 12:45 AM

                      @ronpfs
                      yeah but look at my post above, what's in /var/unbound/dhcpleases_entries.conf remains unchanged with the box checked or unchecked. At least for me

                      R 1 Reply Last reply Sep 13, 2018, 12:48 AM Reply Quote 0
                      • R
                        RonpfS @Ender117
                        last edited by Sep 13, 2018, 12:48 AM

                        @ender117 Did you check the box, save, uncheck the box save.
                        Both Unbound and DHCP server should restart when you save.

                        Do the same with DHCP Server settings.

                        2.4.5-RELEASE-p1 (amd64)
                        Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
                        Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

                        E 1 Reply Last reply Sep 13, 2018, 12:57 AM Reply Quote 0
                        • E
                          Ender117 @RonpfS
                          last edited by Sep 13, 2018, 12:57 AM

                          @ronpfs Yes I did saved and applied changes. DHCP server setting only allow me to save though

                          R 1 Reply Last reply Sep 13, 2018, 1:01 AM Reply Quote 0
                          • R
                            RonpfS @Ender117
                            last edited by Sep 13, 2018, 1:01 AM

                            @ender117 Well have a look at the System Log to see if the services restart.

                            You can restart DHCP server from the Status / Services tab.

                            2.4.5-RELEASE-p1 (amd64)
                            Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
                            Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

                            E 1 Reply Last reply Sep 13, 2018, 1:13 AM Reply Quote 0
                            • E
                              Ender117 @RonpfS
                              last edited by Sep 13, 2018, 1:13 AM

                              @ronpfs restarted DHCP service while the box unchecked. Didn't clear that file as it suppose to

                              R 1 Reply Last reply Sep 13, 2018, 4:57 AM Reply Quote 0
                              • R
                                RonpfS @Ender117
                                last edited by RonpfS Sep 13, 2018, 4:57 AM Sep 13, 2018, 4:57 AM

                                @ender117 Maybe it's time to provide more info about you pfsense box: version, hardware, packages, etc

                                2.4.5-RELEASE-p1 (amd64)
                                Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
                                Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

                                G 1 Reply Last reply Sep 13, 2018, 9:06 AM Reply Quote 0
                                • G
                                  Gertjan @RonpfS
                                  last edited by Gertjan Sep 19, 2018, 6:17 AM Sep 13, 2018, 9:06 AM

                                  @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#L572

                                  First, the main issue :

                                  login-to-view

                                  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 :

                                  login-to-view

                                  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 file

                                  Now, when "DHCP Registration" is unchecked the file /var/unbound/dhcpleases_entries.conf exist (has to exist) and is empty.

                                  No "help me" PM's please. Use the forum, the community will thank you.
                                  Edit : and where are the logs ??

                                  E 2 Replies Last reply Sep 13, 2018, 6:07 PM Reply Quote 0
                                  • E
                                    Ender117 @Gertjan
                                    last edited by Sep 13, 2018, 6:07 PM

                                    @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.

                                    1 Reply Last reply Reply Quote 0
                                    • E
                                      Ender117 @Gertjan
                                      last edited by Sep 14, 2018, 3:55 PM

                                      @gertjan If you don't have time for a bug report, would you mind me go ahead to file one and quote you there?

                                      R 1 Reply Last reply Sep 14, 2018, 5:15 PM Reply Quote 0
                                      • R
                                        RonpfS @Ender117
                                        last edited by Sep 14, 2018, 5:15 PM

                                        @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
                                        

                                        2.4.5-RELEASE-p1 (amd64)
                                        Intel Core2 Quad CPU Q8400 @ 2.66GHz 8GB
                                        Backup 0.5_5, Bandwidthd 0.7.4_4, Cron 0.3.7_5, pfBlockerNG-devel 3.0.0_16, Status_Traffic_Totals 2.3.1_1, System_Patches 1.2_5

                                        E 1 Reply Last reply Sep 14, 2018, 5:34 PM Reply Quote 0
                                        • E
                                          Ender117 @RonpfS
                                          last edited by Sep 14, 2018, 5:34 PM

                                          @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.

                                          G 1 Reply Last reply Sep 14, 2018, 6:14 PM Reply Quote 0
                                          3 out of 25
                                          • First post
                                            3/25
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.