Repository navigation
Conversation
sipsma
force-pushed
the
sipsma/engine-network-overlap
branch
3 times, most recently
from
November 10, 2026 22:10
a380a99 to
6af12e0
Compare
An engine whose container network overlaps a subnet it is attached to cut itself off from that subnet. Its bridge took the subnet's addresses, among them the DNS server of an engine it runs inside on the same range, so its lookups went to its own resolver, which forwarded them to itself, and every lookup timed out after 30 s. A released engine image run with default flags inside a default engine does this: both take 10.87.0.0/16, and the nested engine can't resolve github.com or pull an image. At start the engine now checks its network against the subnets on its own interfaces, but its own bridge, and when they overlap takes the next free range of the same size, saying so in its log. Signed-off-by: Erik Sipsma <[email protected]>
…t address An engine on a host install keeps its bridge across restarts, and its range can now change between starts, but the CNI bridge plugin refuses a bridge with another IPv4 address unless asked to replace it: the engine's network config now asks it to. The bridge's address, which is also the containers' DNS server, was the range's base with its last byte set to 1, while CNI gives the gateway the range's first address. For a range not at a .0 base, such as the one after a /25, they differed: both the address and the subnet rules' gateway are now the range's first address. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sipsma/engine-network-overlap
branch
from
November 19, 2026 23:03
6af12e0 to
ef0fc43
Compare
Contributor
Author
|
Everything this held is carried in #15273, which brings together the engine side of the remote cache: both commits are there with identical patches. Closing in favor of that pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
An engine whose container network overlaps a network it is attached to can't resolve any name. Every lookup times out after 30 s, so it can't pull images, load modules from git, or reach anything by hostname.
Who hits it today: any engine nested inside another engine on the same address range. The simplest case is the released engine image run with default flags inside a default engine: both take
10.87.0.0/16. With v1.0.0-beta.24, loadinggithub.com/dagger/gofrom such a nested engine fails with:The same failure broke the mock release publish check in #15080, two engines deep. There, an engine nested in the check's release engine was started on the release engine's own range.
Cause
The engine's bridge takes the first address of its range, and the engine points its own
/etc/resolv.confat that bridge address. The bridge also runs a dnsmasq that forwards to the original nameserver. When the range overlaps the network the engine sits on, the parent's DNS server (that network's first address) is the same address as the engine's own bridge. Lookups then go to the engine's own dnsmasq, which forwards them to itself, until they time out.Fix
--network-cidragainst the subnets on its own interfaces, skipping loopback and its own bridge. If they overlap, it takes the next free range of the same size and logs a warning naming both. A range that doesn't overlap is used exactly as configured.forceAddress, so the plugin replaces the bridge's old address instead of refusing to start. The subnet rules already replace their own stale rules when the range changes..0base. The subnet rules' gateway uses the same function.Testing
TestEngine/TestNestedOnParentNetwork: it nests an engine on its parent's range and pulls an image through it. On main it fails after about 65 s withlookup mirror.gcr.io: i/o timeout; with this change it passes. It runs intest-split/test-cli-engine../network) and the CNI config (./network/netinst). They run intest-split/test-packages.10.91.0.0/16, a nested engine on10.92.0.0/16loadsgithub.com/dagger/goin 2 s, while one on10.91.0.0/16fails with the error above after 30 s.Cost: one listing of interface addresses at engine start.