Browse code

Revert "libnet: populateNetworkResourcesOS: updateDNS only if !needResolver"

This reverts commit 937246a86837bb8d76725eef64696d1364bc6289.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>

Albin Kerouanton authored on 2025/11/28 17:47:07
Showing 1 changed files
... ...
@@ -366,11 +366,6 @@ func (sb *Sandbox) populateNetworkResourcesOS(ctx context.Context, ep *Endpoint)
366 366
 
367 367
 	if ep.needResolver() {
368 368
 		sb.startResolver(false)
369
-	} else {
370
-		// Make sure /etc/resolv.conf is set up.
371
-		if err := sb.updateDNS(ep.getNetwork().enableIPv6); err != nil {
372
-			return err
373
-		}
374 369
 	}
375 370
 
376 371
 	if i != nil && i.srcName != "" {
... ...
@@ -453,6 +448,10 @@ func (sb *Sandbox) populateNetworkResourcesOS(ctx context.Context, ep *Endpoint)
453 453
 	}
454 454
 
455 455
 	sb.addHostsEntries(ctx, ep.getEtcHostsAddrs())
456
+	// Make sure /etc/resolv.conf is set up.
457
+	if err := sb.updateDNS(ep.getNetwork().enableIPv6); err != nil {
458
+		return err
459
+	}
456 460
 
457 461
 	// Populate load balancer only after updating all the other
458 462
 	// information including gateway and other routes so that