Merge pull request #51830 from thaJeztah/29.x_backport_windows-network-none

[docker-29.x backport] daemon/libnetwork: Fix panic in findHNSEp when IP networks are nil
This commit is contained in:
Paweł Gronowski
2026-01-08 16:57:22 +00:00
committed by GitHub

View File

@@ -251,9 +251,14 @@ func deleteEpFromResolverImpl(
}
func findHNSEp(ip4, ip6 *net.IPNet, hnsEndpoints []hcsshim.HNSEndpoint) *hcsshim.HNSEndpoint {
if ip4 == nil && ip6 == nil {
return nil
}
for _, hnsEp := range hnsEndpoints {
if (hnsEp.IPAddress != nil && hnsEp.IPAddress.Equal(ip4.IP)) ||
(hnsEp.IPv6Address != nil && hnsEp.IPv6Address.Equal(ip6.IP)) {
if ip4 != nil && hnsEp.IPAddress != nil && hnsEp.IPAddress.Equal(ip4.IP) {
return &hnsEp
}
if ip6 != nil && hnsEp.IPv6Address != nil && hnsEp.IPv6Address.Equal(ip6.IP) {
return &hnsEp
}
}