Bug in Register DHCP Static Mappings feature of pfSense BIND package?
-
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 -
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.
-
@jimp OK, thanks. Do I create a Redmine issue first as per the guidelines or just submit the PR directly?
-
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.
-
@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 -
@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.
-
@jimp Cool.