BIND, Register DHCP static mappings and Subzones
If BIND is configured so that it has master zones for example.com and sub.example.com
(assuming proper delegation from one to the other, etc.), then all DHCP static mappings that would
only belong to example.com are also added to all subzones.
For example: host.example.com is added as static mapping to both example.com.DB and sub.example.com.DB,
so that there are two entries now leading to the same ip address, while there should only be one.
Line 558 of
has an error, should the above not be by design. The reverse zone part is correctly written
so that the above problem does not arise.
The arrays inside array_diff_assoc should be the other way around.
array_diff_assoc($parts, $zoneparts) returns all values of $parts that are NOT in $zoneparts.
Here $parts are the '.' exploded parts of the domain name of the static mapping and
$zoneparts are the '.' exploded parts of the zone name currently being parsed.
$parts = array( 0 => com, 1 => example );
$zoneparts = array( 0 => com, 1 => example, 2 => sub );
The check on line 559
count($diff) == 0
is true if there are no values in $parts, that are not also in $zoneparts.
Comparing the domain of a mapping ( com, example ) to the zone ( com, example ) gives an empty array,
since all entries of $parts are also in $zoneparts. OK.
Comparing the domain of a mapping ( com, example ) to the zone ( com, example, sub ) gives an empty array,
since all entries of $parts are also in $zoneparts, in fact, there is one more in $zoneparts than in $parts. PROBLEM.
The same would be true for any possible sub, subsub, ... domains of example.com.
It needs to be the other way around:
Check that all entries of $zoneparts are all in $parts (domain name of the static mapping). Otherwise they are added for all the subdomain zones, even if they don't belong there.
Then we would compare
Comparing the zone ( com, example ) to the domain of a mapping ( com, example ) gives an empty array,
since all entries of $zoneparts are also in $parts. OK.
Comparing the zone ( com, example, sub ) to the domain of a mapping ( com, example ) gives an array with one value: array( 2 => "sub" ),
since there is one entry in $zoneparts that is not also in $parts. OK.
Should this be by design, then please explain to me the reason for it and how I can circumvent the problem I'm having, thanks!