portmap: pick nftables when iptables is missing even without CAP_NET_ADMIN - #1288
Open
locker95 wants to merge 2 commits into
Open
portmap: pick nftables when iptables is missing even without CAP_NET_ADMIN#1288locker95 wants to merge 2 commits into
locker95 wants to merge 2 commits into
Conversation
…ADMIN SupportsNFTables() needs CAP_NET_ADMIN for knftables.New, so on nft-only hosts (or when detection runs without that cap) both probes could fail and we still defaulted to iptables. Fall back to nftables when the nft binary is on PATH if iptables is unavailable. Fixes containernetworking#1280 Signed-off-by: Dean Chen <862469039@qq.com>
Restricting PATH to the nft directory still left SupportsIPTables() true on some runners (iptables resolved outside PATH). Keep the empty- PATH and iptables-available cases only. Signed-off-by: Dean Chen <862469039@qq.com>
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.
SupportsNFTables()goes through knftables and needs CAP_NET_ADMIN. On nft-only systems (or when detection runs without that cap) both probes can fail and we still fell back to iptables, which then also fails.If iptables isn't available, treat a present
nftbinary as enough signal to default to the nftables backend. Same helper used for ipmasq defaulting.Fixes #1280