From fadd8dc47c0643e1a39cdbebdb588a9fb7d2f87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 8 Jan 2026 15:00:27 +0100 Subject: [PATCH] daemon/libnetwork: Fix panic in findHNSEp when IP networks are nil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Can happen for `docker run --network none ...` Signed-off-by: Paweł Gronowski --- daemon/libnetwork/network_windows.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/daemon/libnetwork/network_windows.go b/daemon/libnetwork/network_windows.go index 2df53d7ba1..3e62d66d7c 100644 --- a/daemon/libnetwork/network_windows.go +++ b/daemon/libnetwork/network_windows.go @@ -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 } }