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

    Bug in Register DHCP Static Mappings feature of pfSense BIND package?

    Scheduled Pinned Locked Moved pfSense Packages
    7 Posts 2 Posters 926 Views
    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.
    • T
      techstone
      last edited by

      Does anybody know how I can get in touch with the pfSense BIND package maintainer(s)? I think I may have found a bug in one of its implemented features but I'd like to confirm that this is indeed the case and not just a misunderstanding on my part before I submit a pull request.

      The "bug" I've found is in the Register DHCP Static Mappings feature of zones. I've noticed that if I create DHCP static mappings with a domain such as "domain.com", if I have zones that are subdomain of "domain.com", such as "sub1.domain.com" and "sub2.domain.com", then these subdomain zones will also be populated with the static DHCP mappings of "domain.com". This is not the behavior that I would personally expect.

      I've narrowed it down to https://github.com/pfsense/FreeBSD-ports/blob/devel/dns/pfSense-pkg-bind9/files/usr/local/pkg/bind.inc line 576 where the PHP function array_diff_assoc is used to compare the domain defined for a given static DHCP mapping and a given zone's domain. This function "Returns an array containing all the values from array1 that are not present in any of the other arrays.". So with array1 being the DHCP static mapping domain and array2 being the current loop iteration's zone name, it is normal that array1 (["com", "domain"]) does not have any values that are not already contained in the other array (such as ["com", "domain", "sub1"]). Therefore it returns an empty array with a length of zero, which triggers the behavior to create the static DHCP mapping.

      By replacing the array_diff_assoc function with an equality comparison it replaces the above behavior with one which I believe is the correct one, which is to only register DHCP static mappings in the zone that is an exact match for the domain specified for that DHCP mapping:

      --- bind.inc.orig-magi  2018-06-20 16:56:03.522194000 -0400
      +++ bind.inc.change-magi        2018-06-21 09:01:15.353851000 -0400
      @@ -566,8 +566,7 @@
                                                                                      }
                                                                              } else {
                                                                                      $parts = array_reverse(explode('.', $domain));
      -                                                                               $diff = array_diff_assoc($parts, $zoneparts);
      -                                                                               if (count($diff) == 0) {
      +                                                                               if ($parts === $zoneparts) {
                                                                                              $zone_conf .= "{$host['hostname']}\tIN A\t{$host['ipaddr']}\n";
                                                                                      }
                                                                              }
      

      Thanks,
      -Martin

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        That package does not currently have a maintainer, but if you'd like to see that get in, submit it as a pull request on Github to the pfSense/FreeBSD-ports repository.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        T 1 Reply Last reply Reply Quote 0
        • T
          techstone @jimp
          last edited by

          @jimp OK, thanks. Do I create a Redmine issue first as per the guidelines or just submit the PR directly?

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            You will need a Redmine entry and a PR, each with a reference to the other. So create the redmine entry, then create the PR and put the Redmine entry link in the PR description, and then once the PR is created, add the PR URL to the Redmine entry as well.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            T 1 Reply Last reply Reply Quote 1
            • T
              techstone @jimp
              last edited by

              @jimp Unrelated to pfSense, but I cannot seem to receive the activation e-mail from Redmine after registering. I tried to have it resent but I still haven't received anything.

              I use Gmail (I checked the Spam folder) so I don't know if it blocks it because of SPF. Any Redmine members using Gmail successfully?

              Thanks,
              -Martin

              jimpJ 1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate @techstone
                last edited by

                @techstone said in Bug in Register DHCP Static Mappings feature of pfSense BIND package?:

                @jimp Unrelated to pfSense, but I cannot seem to receive the activation e-mail from Redmine after registering. I tried to have it resent but I still haven't received anything.

                I use Gmail (I checked the Spam folder) so I don't know if it blocks it because of SPF. Any Redmine members using Gmail successfully?

                We're investigating a problem with mail sending from Redmine right now, it's been acting up since at least Yesterday that we're aware of. We'll get it fixed up soon.

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                T 1 Reply Last reply Reply Quote 1
                • T
                  techstone @jimp
                  last edited by

                  @jimp Cool.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.