fix(containers): bypass Docker bridge traffic before sidecar TPROXY#6794
Open
iGmainC wants to merge 1 commit into
Open
fix(containers): bypass Docker bridge traffic before sidecar TPROXY#6794iGmainC wants to merge 1 commit into
iGmainC wants to merge 1 commit into
Conversation
The local proxy-everything sidecar installs TPROXY/DIVERT rules in mangle PREROUTING. Without an earlier bridge-CIDR RETURN rule, Docker bridge traffic can be intercepted before the container startup and egress readiness path completes. Install the bridge bypass idempotently after sidecar start and during recovery, while preserving the existing main-container helper exec behavior. Fixes cloudflare#6793
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.
Summary
Fix local Containers sidecar startup/readiness failures caused by the proxy-everything sidecar intercepting Docker bridge traffic with its TPROXY/DIVERT rules.
The sidecar installs
mangle PREROUTINGrules for transparent proxying. In local Docker bridge mode, traffic whose source and destination are both inside the Docker bridge CIDR can hit those rules before the container readiness and egress configuration path completes. That can make the local container path time out or fail even though the application container itself is otherwise runnable.This change installs an idempotent first-position
RETURNrule for bridge-CIDR-to-bridge-CIDR traffic inside the sidecar network namespace. The rule is applied after fresh sidecar startup and again when recovering an already-running sidecar after workerd restarts.Reproduction
Minimal repro: https://github.com/iGmainC/workerd-container-sidecar-tproxy-repro
Validation
bazel build --action_env=PATH=/home/linuxbrew/.linuxbrew/bin:/bin:/usr/bin:/usr/local/bin --host_linkopt=-L/home/linuxbrew/.linuxbrew/Cellar/llvm/22.1.6/lib --linkopt=-L/home/linuxbrew/.linuxbrew/Cellar/llvm/22.1.6/lib //src/workerd/server:workerdFixes #6793
Related to #6790, but this PR targets the distinct sidecar bridge traffic interception issue.