pkgs/subnetplan/render.rb: fix

This commit is contained in:
Astro 2024-02-05 04:07:45 +01:00
parent 65127a79aa
commit df3d446992
1 changed files with 5 additions and 1 deletions

View File

@ -60,7 +60,11 @@ exit 1 if collisions > 0
GROUP_PREFIX = 19
groups = {}
nets.each do |net|
group = net.addr.supernet(GROUP_PREFIX).to_s
if net.addr.prefix > GROUP_PREFIX
group = net.addr.supernet(GROUP_PREFIX).to_s
else
group = net.addr.to_s
end
(groups[group] ||= []) << net
end