nftables mode: 1.96 connmark rules in the ip/ip6 mangle tables break iptables-nft users (Cilium agent exits)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- go, linux
- Domain
- networking
Research direction
Start by locating the nftables firewall code that adds AddConnmarkSaveRule and trace why it writes to the shared ip and ip6 mangle tables whenever netfilter is enabled. Check the 1.96 change and reproduce with nftables mode, then verify that iptables-nft can list mangle and Cilium starts. The report gives reproduction steps and suggests possible fixes, but the right behavior may require understanding firewall ownership and when the rules are needed.
Written by the indexing model from the issue text.
Description
What is the issue?
I run tailscaled on Kubernetes nodes with Cilium as the CNI. Since 1.96, with the firewall in nftables mode, tailscaled adds connmark rules
(AddConnmarkSaveRule, the rp_filter workaround for exit nodes and subnet
routers) to the ip mangle and ip6 mangle tables, as native nftables
expressions. These are the same tables iptables-nft uses. It does this
whenever netfilter is on, including on nodes that are not exit nodes or
subnet routers.
What ends up on the host (nft list table ip mangle; ip6 is the same):
table ip mangle {
chain PREROUTING {
type filter hook prerouting priority mangle; policy accept;
ct state established,related meta mark set ct mark & 0x0000ff00
}
chain OUTPUT {
type filter hook output priority mangle; policy accept;
ct state new meta mark & 0x0000ff00 != 0x00000000 ct mark set meta mark & 0x0000ff00
}
}
iptables-nft does not accept native expressions in tables it manages.
Anything on the host that uses iptables-nft then can't touch mangle.
For Cilium (iptables 1.8.8 in its image), the agent exits:
level=warn msg="iptables table is not available on this system" error="unable to run 'iptables -t mangle -L -n' iptables command: exit status 1 stderr=\"iptables v1.8.8 (nf_tables): table `mangle' is incompatible, use 'nft' tool.\"" table=mangle
level=fatal msg="unable to run agent: failed to start: IPv6 is enabled, but the needed ip6tables tables are unavailable (try disabling IPv6 in Cilium or installing ip6tables and kernel modules: ip6_tables, ip6table_mangle, ip6table_raw, ip6table_filter)"
That leaves a Kubernetes node with no CNI. 1.92.x and 1.94.x are fine on the
same hosts. In iptables mode (TS_DEBUG_FIREWALL_MODE=iptables) 1.96.4
works too, because the same rules are written as xtables rules, which
iptables-nft can read.
Steps to reproduce
- A Linux host with no iptables binary, so tailscaled picks nftables mode
(or setTS_DEBUG_FIREWALL_MODE=nftables). - Run tailscaled 1.96.4 and bring it up.
iptables-nft -t mangle -L -n→ "table `mangle' is incompatible, use 'nft' tool."- With Cilium as the CNI, the cilium-agent exits as above.
Suggested fix
One of:
- In nftables mode, put the connmark rules in a table of tailscaled's own
instead ofip mangle/ip6 mangle, - or add them only when they are needed (exit node / subnet router in use),
- or provide an opt-out.
Are there any recent changes that introduced the issue?
1.96 (connmark save/restore rules in mangle).
OS
Linux
OS version
A minimal Linux distribution for Kubernetes nodes, kernel 6.18.60
Tailscale version
1.96.4
Other software
Cilium (agent image with iptables v1.8.8, nf_tables backend)
Bug report
N/A
- Dominant language
- Go
- Stars
- 38.8k
- Forks
- 3.4k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 194
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tailscale/tailscale
-
FR: update golang.org/x/sys to v0.50.0Possibly taken @wrenix claimed this today. Openfr needs-triage
Difficulty 2/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
fr
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug kubernetes
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Document using Docker Compose secrets support for TS_AUTHKEYPossibly taken @Marouane-elfadli claimed this 6 days ago. OpenDocumentation
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
tailscale/tailscale#22214 · 1 reaction ·
Maintainers usually reply within 1 day
-
fr OS-linux
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
All issues in tailscale/tailscale
Similar issues
-
area: interop area: sip-core v3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fonoster/routr#705 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
kind/bug require/reproduce require/severity
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
oxc-project/tsgolint#1362 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
hashicorp/terraform-provider-google#30703 ·
Maintainers usually reply within 1 day