cloudstack/systemvm/debian/opt/cloud/bin
Brad House - Nexthop 83f705ddc5
Static Routes with nexthop non-functional for private gateways (#12859)
* Fix static routes to be added to PBR tables in VPC routers

Static routes were only being added to the main routing table, but
policy-based routing (PBR) is active on VPC routers. This caused
traffic coming in from specific interfaces to not find the static
routes, as they use interface-specific routing tables (Table_ethX).

This fix:
- Adds a helper method to find which interface a gateway belongs to
  by matching the gateway IP against configured interface subnets
- Modifies route add/delete operations to update both the main table
  and the appropriate interface-specific PBR table
- Uses existing CsAddress databag metadata to avoid OS queries
- Handles both add and revoke operations for proper cleanup
- Adds comprehensive logging for troubleshooting

Fixes #12857

* Add iptables FORWARD rules for nexthop-based static routes

When static routes use nexthop (gateway) instead of referencing a
private gateway's public IP, the iptables FORWARD rules were not
being generated. This caused traffic to be dropped by ACLs.

This fix:
- Adds a shared helper CsHelper.find_device_for_gateway() to determine
  which interface a gateway belongs to by checking subnet membership
- Updates CsStaticRoutes to use the shared helper instead of duplicating
  the device-finding logic
- Modifies CsAddress firewall rule generation to handle both old-style
  (ip_address-based) and new-style (nexthop-based) static routes
- Generates the required FORWARD and PREROUTING rules for nexthop routes:
  * -A PREROUTING -s <network> ! -d <interface_ip>/32 -i <dev> -j ACL_OUTBOUND_<dev>
  * -A FORWARD -d <network> -o <dev> -j ACL_INBOUND_<dev>
  * -A FORWARD -d <network> -o <dev> -m state --state RELATED,ESTABLISHED -j ACCEPT

Fixes the second part of #12857

* network matching grep fix, don't let 1.2.3.4/32 match 11.2.3.4/32
2026-04-16 16:15:43 +05:30
..
cs Static Routes with nexthop non-functional for private gateways (#12859) 2026-04-16 16:15:43 +05:30
setup Set CORS headers for both http/https in SSVM apache config (#9389) 2026-01-30 11:53:44 +02:00
baremetal-vr.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
baremetal_snat.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
bumpup_priority.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
checkbatchs2svpn.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
checkrouter.sh VPC VR: return UNKNOWN redundant state if no guest nics (#11518) 2025-08-29 12:51:33 +05:30
checks2svpn.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
cks_iso.sh pre-commit add hook `check-shebang-scripts-are-executable` for Shell (#10150) 2025-09-17 14:22:28 +02:00
cleanup.sh Get Diagnostics: Download logs and diagnostics data from SSVM, CPVM, Router (#3350) 2020-01-15 11:38:33 +01:00
cloud-nic.sh router: Fixes #2789 fix proper mark based packet routing across interfaces (#2791) 2018-08-08 12:05:42 +05:30
configure.py Restart xl2tpd service when the VPN configuration is modified (#12422) 2026-01-30 17:46:12 +05:30
configure_router.py cloudstack: make code more inclusive 2021-06-08 15:47:20 +05:30
cs_bgppeers.py feature: Dynamic and Static Routing (#9470) 2024-09-06 08:55:17 +05:30
cs_cmdline.py CLOUDSTACK-10013: Fixes based on code review and test failures 2017-12-23 17:51:42 +05:30
cs_dhcp.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
cs_firewallrules.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
cs_forwardingrules.py Merge branch '4.19' into 4.20.merge 2024-12-03 16:32:15 +01:00
cs_guestnetwork.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
cs_ip.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
cs_loadbalancer.py CLOUDSTACK-10013: Fixes based on code review and test failures 2017-12-23 17:51:42 +05:30
cs_monitorservice.py Health check feature for virtual router (#3575) 2020-01-30 12:39:03 +01:00
cs_network_acl.py CLOUDSTACK-10013: Fixes based on code review and test failures 2017-12-23 17:51:42 +05:30
cs_remoteaccessvpn.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
cs_site2sitevpn.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
cs_staticroutes.py CLOUDSTACK-10013: Fixes based on code review and test failures 2017-12-23 17:51:42 +05:30
cs_vmdata.py CLOUDSTACK-10013: Fixes based on code review and test failures 2017-12-23 17:51:42 +05:30
cs_vmp.py CLOUDSTACK-10013: Fixes based on code review and test failures 2017-12-23 17:51:42 +05:30
cs_vpnusers.py Merge remote-tracking branch 'origin/4.19' 2024-09-04 13:20:42 +05:30
diagnostics.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
dnsmasq.sh Fix spelling (#6860) 2022-11-13 10:56:15 +01:00
edithosts.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
filesystem_writable_check.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
getRouterAlerts.sh pre-commit: apply `end-of-file-fixer` to all files (#7551) 2023-08-02 13:47:21 +02:00
getRouterMonitorResults.sh Health check feature for virtual router (#3575) 2020-01-30 12:39:03 +01:00
get_diagnostics_files.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
get_haproxy_stats.sh VM Autoscaling with virtual router (#6571) 2022-12-05 15:23:03 +01:00
get_template_version.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
ilb.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
ipassoc.sh cloudstack: make code more inclusive 2021-06-08 15:47:20 +05:30
ipsectunnel.sh server: Adding VPN options for IKE version and IKE split connections (#4953) 2021-05-05 12:54:23 +05:30
line_edit.py Fix Python code checkstyle execute by "systemvm\test\runtests.sh" (#2576) 2018-04-18 13:07:37 -03:00
loadbalancer.sh Fix spelling (#6860) 2022-11-13 10:56:15 +01:00
manage_service.sh Prevent network disruption on adding a VPC tier for redundant VRs (#9251) 2024-06-18 13:47:45 +02:00
merge.py feature: Dynamic and Static Routing (#9470) 2024-09-06 08:55:17 +05:30
monitor_service.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
netusage.sh VM Autoscaling with virtual router (#6571) 2022-12-05 15:23:03 +01:00
passwd_server_ip.py Netris Network Plugin Integration with CloudStack (#10458) 2025-07-25 15:26:42 +05:30
patched.sh pre-commit add hook `check-shebang-scripts-are-executable` for Shell (#10150) 2025-09-17 14:22:28 +02:00
prepare_pxe.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
savepassword.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
set_redundant.py CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
setup_tf_route.py Tungsten integration (#7065) 2023-02-01 09:19:53 +01:00
update_config.py Upgrade to JRE17 and Upgrade System VMs/VRs to Python3 and Debian 12 (#8497) 2024-02-26 18:07:50 +05:30
update_interface_config.sh pre-commit add hook `check-shebang-scripts-are-executable` for Shell (#10150) 2025-09-17 14:22:28 +02:00
vmdata.py [4.20] VR: fix issue if userdata is binary data (#8739) 2024-07-25 10:04:58 +02:00
vpc_func.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
vpc_netusage.sh VM Autoscaling with virtual router (#6571) 2022-12-05 15:23:03 +01:00
vpc_snat.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
vpc_staticroute.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
vpn_l2tp.sh CLOUDSTACK-10013: SystemVM codebase refactorings and improvements 2017-12-23 09:22:44 +05:30
vr_cfg.sh pre-commit: add hook to trim trailing whitespace (#8205) 2024-05-28 09:01:30 +02:00