Repository navigation
Conversation
In ROUTED mode the VR replaces iptables with nftables (table ip4_firewall for isolated networks, ip4_acl for VPCs) whose INPUT chain has a drop policy. The INPUT whitelist does not accept VRRP (224.0.0.18) and conntrackd (225.0.0.50) multicast, which the iptables path allows via "-A INPUT -d 224.0.0.18/32 -j ACCEPT" and "-d 225.0.0.50/32". With a redundant router offering both VRs drop each other's advertisements and both become PRIMARY, holding the guest gateway and public IPs at the same time. Accept both on the guest interface in fw_router_routing and fw_vpcrouter_routing, and add unit tests for them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
|
@hulucc To be frank, when I developed the feature, I did not take redundant VRs into consideration. I will review and test the PR. I am glad to see the feature is being tested or used. Are you doing PoC of routed network/vpc, or running it in production ? |
|
@blueorangutan package |
|
@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14446 +/- ##
============================================
- Coverage 16.41% 16.41% -0.01%
+ Complexity 13657 13655 -2
============================================
Files 5669 5669
Lines 501628 501628
Branches 60942 60942
============================================
- Hits 82336 82323 -13
- Misses 410064 410078 +14
+ Partials 9228 9227 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
This PR fixes redundant VRs of ROUTED isolated networks and VPCs coming up as PRIMARY on both routers.
In ROUTED mode the VR flushes iptables and builds nftables tables (
ip4_firewallfor isolated networks,ip4_aclfor VPCs) whose INPUT chain has a drop policy. The INPUT whitelist built byfw_router_routingandfw_vpcrouter_routinglacks VRRP (224.0.0.18) and conntrackd (225.0.0.50) multicast, whichfw_router/fw_vpcrouteraccept for non-routed networks. Both routers drop each other's VRRP advertisements and both become PRIMARY.This adds
iifname <guest dev> ip daddr 224.0.0.18 counter acceptandiifname <guest dev> ip daddr 225.0.0.50 counter acceptto the INPUT whitelist of both functions, plus unit tests. The rules match the destination address rather than the protocol because keepalived uses AH authentication, so the advertisements are IP protocol 51, not 112.Redundant ROUTED offerings can be created on 4.20 (the RedundantRouter capability on the Gateway service was added for ROUTED in #9470), so this targets 4.20 as a bug fix, following CONTRIBUTING.md. If you would rather take it as part of #11565 on main, I can retarget the PR; the commit cherry-picks cleanly onto main and the new tests pass there.
Fixes: #14445
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Unit tests: the two new tests in
TestCsAddress.TestCsIPRoutedpass. pycodestyle (--max-line-length=179) and pylint report nothing new for the changed files; the twoTestCsRoutefailures in a container are pre-existing (they need a real default route).Test environment: management server 4.20.3.1, KVM on CentOS 8, systemvm template 4.20.2. The change was applied to
/usr/share/cloudstack-common/vms/cloud-scripts.tgzon the host, which the agent copies into the VR at boot (the new md5 showed up as the routers' scripts version).RedundantRoutercapability on the Gateway service): before the change both VRs were PRIMARY; after, PRIMARY/BACKUP, and the INPUT counters of the new rules show VRRP and conntrackd traffic being accepted. Forced stop of the primary: about 3 s of ping loss, and the stopped VR rejoins as BACKUP when started again (nopreempt).How did you try to break this feature and the system with this change?
fw_router_routingandfw_vpcrouter_routingchange, and both return early unless the network is ROUTED, so non-routed VRs are not affected.Not addressed here, but possibly useful for #11565: during a BGP failover the peer may refuse the new primary with a Connection Collision until the stale session from the old primary is torn down. With default timers this caused about 20 s without the route in our test, and with keepalive 3 s / hold 9 s on the peer the total failover was about 5 s.
🤖 Generated with Claude Code