Fix incorrect CIDR construction in hostmap (#1493)

* Fix incorrect CIDR construction in hostmap

* Introduce a regression test for incorrect hostmap CIDR
This commit is contained in:
Gary Guo
2025-10-08 17:02:36 +01:00
committed by GitHub
parent eb89839d13
commit 634181ba66
2 changed files with 46 additions and 1 deletions

View File

@@ -738,7 +738,8 @@ func (i *HostInfo) buildNetworks(networks, unsafeNetworks []netip.Prefix) {
i.networks = new(bart.Lite)
for _, network := range networks {
i.networks.Insert(network)
nprefix := netip.PrefixFrom(network.Addr(), network.Addr().BitLen())
i.networks.Insert(nprefix)
}
for _, network := range unsafeNetworks {