[27.x backport] Enable bridge netfiltering if userland-proxy=false #48685
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 I did
In release 27.0, ip6tables was enabled by default. That caused a problem on some hosts where iptables was explicitly disabled and loading the
br_netfilter
module (which loads with itsnf-call-iptables
settings enabled) caused user-defined iptables rules to block traffic on bridges, breaking inter-container communication.In 27.3.0, #48511 delayed loading of the
br_netfilter
module until it was needed. The load now happens in the function that setsbridge-nf-call-ip[6]tables
when needed. It was only called foricc=false
networks.However,
br_netfilter
is also needed whenuserland-proxy=false
. Without it, packets addressed to a host-mapped port for a container on the same network are not DNAT'd properly (responses have the server container's address instead of the host's).That means, in all releases including 26.x, if
br_netfilter
was loaded before the daemon started - and the OS/user/other-application had disabledbridge-nf-call-ip[6]tables
(which apparently some OSs try to do), it would not be enabled by the daemon. So, ICC would fail for host-mapped ports with the userland-proxy disabled.The change in 27.3.0 made this worse - previously, loading
br_netfilter
wheneveriptables
/ip6tables
was enabled meant that bridge-netfiltering got enabled, even though the daemon didn't check it was enabled.- How I did it
Check that
br_netfilter
is loaded, withbridge-nf-call-ip[6]tables
enabled, ifuserland-proxy=false
.- How to verify it
New test that disables
bridge-nf-call-iptables
and the userland proxy, then tries to access another container's mapped port ... not quite the same as unloadingbr_netfilter
- but this test fails with a daemon built from the 26.1 branch (as well as 27.x).Manually tested on an Ubuntu VM, including with
br_netfilter
unloaded before starting the daemon.- Description for the changelog