Title: [BUG] fw_chain_egress missing ct state established,related accept causes inbound TCP to fail with default egress deny on routed networks · Issue #12962 · apache/cloudstack · GitHub
Open Graph Title: [BUG] fw_chain_egress missing ct state established,related accept causes inbound TCP to fail with default egress deny on routed networks · Issue #12962 · apache/cloudstack
X Title: [BUG] fw_chain_egress missing ct state established,related accept causes inbound TCP to fail with default egress deny on routed networks · Issue #12962 · apache/cloudstack
Description: problem Problem When a routed network is configured with default egress policy Deny, inbound TCP connections to guest VMs fail even when the correct ingress firewall rules are present. The Virtual Router's nftables fw_chain_egress chain ...
Open Graph Description: problem Problem When a routed network is configured with default egress policy Deny, inbound TCP connections to guest VMs fail even when the correct ingress firewall rules are present. The Virtual ...
X Description: problem Problem When a routed network is configured with default egress policy Deny, inbound TCP connections to guest VMs fail even when the correct ingress firewall rules are present. The Virtual ...
Opengraph URL: https://github.com/apache/cloudstack/issues/12962
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] fw_chain_egress missing ct state established,related accept causes inbound TCP to fail with default egress deny on routed networks","articleBody":"### problem\n\n\nProblem\n\nWhen a routed network is configured with default egress policy Deny, inbound TCP connections to guest VMs fail even when the correct ingress firewall rules are present. The Virtual Router's nftables fw_chain_egress chain is missing a ct state established,related accept rule, causing return packets (e.g. TCP SYN-ACK) from the VM to be dropped by the final drop rule in fw_chain_egress.\n\nThe FORWARD chain correctly jumps traffic sourced from the guest subnet (ip saddr \u003cguest-subnet\u003e jump fw_chain_egress). However, fw_chain_egress only contains explicit port/protocol allow rules followed by a default drop — there is no connection tracking rule to permit return traffic for inbound connections that were allowed by fw_chain_ingress.\n\nNote: This issue only occurs when the network's default egress policy is Deny. Networks with default egress policy Allow are not affected — inbound TCP works correctly in that configuration.\n\n\n\n### versions\n\nCloudStack Management Server: 4.22.0.0-shapeblue0 (package: cloudstack-management)\nVirtual Router: 4.22.0 (Debian GNU/Linux 12 bookworm, kernel 6.1.0-40-arm64 aarch64)\nHypervisor: KVM\nNetwork type: Routed isolated network, dynamic BGP routing mode\nDefault egress policy: Deny\nSteps to reproduce\n\n### The steps to reproduce the bug\n\nObserved fw_chain_egress on VR (clean state, post-reboot):\n\n```\nchain fw_chain_egress {\n ip saddr 0.0.0.0/0 ip daddr 0.0.0.0/0 icmp type { echo-reply, destination-unreachable, source-quench, redirect, echo-request, router-advertisement, router-solicitation, time-exceeded, parameter-problem, timestamp-request, timestamp-reply, info-request, info-reply, address-mask-request, address-mask-reply } accept\n ip saddr 0.0.0.0/0 ip daddr 0.0.0.0/0 tcp dport 22 accept\n counter packets 115 bytes 6900 drop\n}\n```\nExpected fw_chain_egress:\n\n```\nchain fw_chain_egress {\n ct state established,related accept ← missing\n ip saddr 0.0.0.0/0 ip daddr 0.0.0.0/0 icmp type { ... } accept\n ip saddr 0.0.0.0/0 ip daddr 0.0.0.0/0 tcp dport 22 accept\n counter drop\n}\n```\nThis is the IPv4 analog of the issue fixed for IPv6 in PR #10970.\n\nCreate a zone with dynamic routing enabled and an IP subnet pool configured\nCreate a network offering with routing mode = Dynamic and default egress policy = Deny\nDeploy an isolated routed network using that offering\nIn the network's IPv4 Routing Firewall, add:\nIngress rule: TCP port 22 from 0.0.0.0/0\nEgress rule: TCP port 22 to 0.0.0.0/0\nDeploy a VM in the network\nAttempt to SSH to the VM from an external host\nConnection hangs\nDiagnosis: tcpdump on the VR confirms the SYN arrives on eth2, is forwarded out eth0 to the VM, the VM responds with SYN-ACK on eth0, but the SYN-ACK is dropped by the counter drop rule in fw_chain_egress because no ct state established,related accept rule exists.\n\nWorkaround\n\nManually insert the missing rule on the VR (lost on VR restart):\n\n\nnft insert rule ip ip4_firewall fw_chain_egress ct state established,related accept\nWhat to do about it?\n\nAdd ct state established,related accept as the first rule in fw_chain_egress in the VR nftables generation code. This should always be present regardless of user-defined egress rules, as it is required to allow return traffic for inbound connections permitted by fw_chain_ingress. This mirrors the fix applied for IPv6 in PR #10970.\n\n### What to do about it?\n\n_No response_","author":{"url":"https://github.com/khumps","@type":"Person","name":"khumps"},"datePublished":"2026-04-04T20:13:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/12962/cloudstack/issues/12962"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4067e512-57b7-cc97-2a09-64fbeeb0b90f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB02:512E3:3AB118D:5229CEB:6A4F5372 |
| html-safe-nonce | e3936368027868b24712169392fd3ede4babd70410b7a73f439b725494672c2e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjAyOjUxMkUzOjNBQjExOEQ6NTIyOUNFQjo2QTRGNTM3MiIsInZpc2l0b3JfaWQiOiIzNzg0MTYxNTcxNjQwMzk4NzA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 22741a67cdf86da53500cd14607e10e6489f645164ab8d8e0fd40dd626042f9f |
| hovercard-subject-tag | issue:4205729723 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/cloudstack/12962/issue_layout |
| twitter:image | https://opengraph.githubassets.com/01a1d9da10db1dc863c1b0ccd4da339157c59c88b2a41c931b70d859f93000c6/apache/cloudstack/issues/12962 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/01a1d9da10db1dc863c1b0ccd4da339157c59c88b2a41c931b70d859f93000c6/apache/cloudstack/issues/12962 |
| og:image:alt | problem Problem When a routed network is configured with default egress policy Deny, inbound TCP connections to guest VMs fail even when the correct ingress firewall rules are present. The Virtual ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | khumps |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/cloudstack git https://github.com/apache/cloudstack.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 9759448 |
| octolytics-dimension-repository_nwo | apache/cloudstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9759448 |
| octolytics-dimension-repository_network_root_nwo | apache/cloudstack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width