mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-21 16:39:30 +00:00
02557a42b3
getzonesfornet() derives the number of reverse-zone nibbles as $nibbs = $maskbits / 4, then decrements it once per hex nibble of the network prefix. For a sub-nibble (not 4-bit-aligned) IPv6 mask $nibbs can go negative before the padding loop, and `while ($nibbs)` then never terminates: it keeps decrementing past zero while appending "0." to $rev, spinning forever and growing the string until the process is killed. Make the padding loop `while ($nibbs > 0)` so it can never run away, and return early only when $nibbs is genuinely negative. $nibbs == 0 is the normal nibble-aligned case (e.g. a /64) and must still emit its reverse zone. Recovered from the unmerged lenovobuild branch (original0e070cd2). The original guarded with `$nibbs < 1`, which also dropped the valid $nibbs == 0 case and left standard /64 subnets with no reverse zone; corrected to `$nibbs < 0` after lab validation on a real provisioning cluster. Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> (cherry picked from commitf0a879491d)