MitchDrage opened a new pull request, #14785:
URL: https://github.com/apache/cloudstack/pull/14785

   ### Description
   
   This PR fixes return traffic to ROUTED routers. The `ip4_acl` (VPC) and 
`ip4_firewall` (isolated) INPUT chains drop by policy and accept only ICMP 
echo. Replies to traffic the router starts itself are dropped. I saw this with 
DNS and TCP from the router to a network behind a private gateway. Ping works 
because echo replies are accepted by type.
   
   - `add_ip4_chain` adds `ct state established,related accept` to every IPv4 
input hook, beside the ICMP accept.
   - #12986 added the same rule to the forward hook. This adds it to input.
   - The routed code adds this accept per interface, for the public NIC and the 
guest tiers. Private gateway NICs never get one. One rule on the chain covers 
them, as `-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT` already does 
on non-routed VPC routers.
   - New unit test `TestCsRoutedInputEstablished`.
   
   Fixes: #
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   - [ ] test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [x] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   - Unit tests in `TestCsRoutedInputEstablished`: both input hooks get the 
accept, it sits before the ACL rules after a rebuild, and the ICMP and forward 
accepts stay. Three of the five tests failed before the fix.
   - A lab running the 4.20 router scripts in ROUTED mode (Debian 12) with a 
static route over a private gateway:
   
   | From the router to the far side | Before this PR | With this PR |
   |---|---|---|
   | Ping | Works | Works |
   | UDP 53 (DNS) | Reply dropped | Works |
   | TCP connect | Reply dropped | Works |
   
   - A ROUTED VPC on CloudStack 4.22.1.1 (KVM, systemvm 4.22.0) with a private 
gateway and a host on the far side. Before the fix, UDP 53 and TCP 22 from the 
router timed out while tcpdump showed the far side replying. With this change 
applied on the router and its firewall rebuilt, both worked.
   - `systemvm/test/runtests.sh`: pylint and the unit tests pass. pycodestyle 
2.15 flags existing lines in `CsAddress.py`, `configure.py` and 
`cs_forwardingrules.py`, which this PR leaves unchanged.
   
   #### How did you try to break this feature and the system with this change?
   
   - Checked that the rule is only on input hooks. The output and forward hooks 
are unchanged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to