Description
The firewall detection logic incorrectly tries to infer which iptables backend is active by checking which backend contains rules. This approach is fundamentally flawed because iptables-nft and iptables-legacy share the same kernel netfilter ruleset.
Steps to Reproduce
- System configured with
update-alternatives to use iptables-nft as default
- System has rules from multiple sources (e.g., Kubernetes using iptables-nft, Multipass using iptables-legacy)
- Observe that Multipass uses iptables-legacy despite system preference being iptables-nft
Expected Behavior
Multipass should respect the system's default iptables configuration and use the backend that /usr/sbin/iptables points to.
Root Cause
The current detect_firewall() function tries to determine the active backend by checking if rules exist in each backend. This fails on hybrid systems because both backends share the same ruleset - rules added via one backend appear in both.
The Fix
The fix implements a two-level detection strategy:
- Primary: Check
/usr/sbin/iptables symlink to determine system preference
- Fallback: Only use rule presence detection when system config is unavailable
This properly handles systems where:
- Multiple tools use different iptables backends
- Both backends have rules present
- System configuration indicates a preference
Related Files
src/platform/backends/qemu/linux/firewall_config.cpp
See PR #5114 for the implementation.
Description
The firewall detection logic incorrectly tries to infer which iptables backend is active by checking which backend contains rules. This approach is fundamentally flawed because iptables-nft and iptables-legacy share the same kernel netfilter ruleset.
Steps to Reproduce
update-alternativesto use iptables-nft as defaultExpected Behavior
Multipass should respect the system's default iptables configuration and use the backend that
/usr/sbin/iptablespoints to.Root Cause
The current
detect_firewall()function tries to determine the active backend by checking if rules exist in each backend. This fails on hybrid systems because both backends share the same ruleset - rules added via one backend appear in both.The Fix
The fix implements a two-level detection strategy:
/usr/sbin/iptablessymlink to determine system preferenceThis properly handles systems where:
Related Files
src/platform/backends/qemu/linux/firewall_config.cppSee PR #5114 for the implementation.