fix: fall back to binary presence when netfilter capability checks both fails - #1281
Open
thomasferrandiz wants to merge 1 commit into
Open
fix: fall back to binary presence when netfilter capability checks both fails#1281thomasferrandiz wants to merge 1 commit into
thomasferrandiz wants to merge 1 commit into
Conversation
thomasferrandiz
force-pushed
the
portmap-autodetect
branch
from
July 21, 2026 16:20
1f1b13e to
8f3169a
Compare
…th fail SupportsNFTables() runs `nft --check` via exec, which requires CAP_NET_ADMIN even for a dry run. On systems where iptables is absent but that capability is unavailable at detection time, both SupportsIPTables() and SupportsNFTables() return false, causing ensureBackend() and SetupIPMasqForNetworks() to unconditionally default to iptables — which then also fails. Add IPTablesBinaryAvailable() and NFTablesBinaryAvailable() (LookPath only, no kernel access required) as a second detection tier. When both full checks fail, binary presence breaks the tie: if the iptables binary is absent but nft is present, select the nftables backend. Signed-off-by: Thomas Ferrandiz <thomas.ferrandiz@suse.com>
thomasferrandiz
force-pushed
the
portmap-autodetect
branch
from
July 22, 2026 08:23
8f3169a to
3566a9c
Compare
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
IPTablesBinaryAvailable()andNFTablesBinaryAvailable()topkg/utils— lightweight PATH checks that require no kernel accessensureBackend()(portmap) andSetupIPMasqForNetworks()(ipmasq) to use these as a fallback detection tier when the full capability checks failProblem
Closes #1280
Auto-detection of the nftables backend fails on systems where iptables is not installed, even when nftables is fully available.
SupportsNFTables()callsknftables.New(), which runsnft --checkvia exec. That requiresCAP_NET_ADMINto connect to the kernel nftables subsystem via netlink — even for a dry run. When the process lacks that capability at detection time,SupportsNFTables()returnsfalse.The detection logic was: