Skip to content

Instantly share code, notes, and snippets.

@luckman212
Last active June 1, 2026 13:51
Show Gist options
  • Select an option

  • Save luckman212/11c0a4d6ae81f2613690294b5ff23ff0 to your computer and use it in GitHub Desktop.

Select an option

Save luckman212/11c0a4d6ae81f2613690294b5ff23ff0 to your computer and use it in GitHub Desktop.
--- a/src/etc/inc/gwlb.inc
+++ b/src/etc/inc/gwlb.inc
@@ -2419,19 +2419,19 @@
$a_gateway_item = config_get_path("gateways/gateway_item/{$realid}");
/* NOTE: If gateway ip is changed need to cleanup the old static interface route */
if ($gateway_settings['monitor'] != "dynamic" &&
- !empty($a_gateway_item) &&
- is_ipaddr($a_gateway_item['gateway']) &&
- $gateway['gateway'] != $a_gateway_item['gateway'] &&
- isset($a_gateway_item["nonlocalgateway"])) {
+ !empty($a_gateway_item) &&
+ is_ipaddr($a_gateway_item['gateway']) &&
+ $gateway['gateway'] != $a_gateway_item['gateway'] &&
+ isset($a_gateway_item["nonlocalgateway"])) {
route_del($a_gateway_item['gateway']);
}
- /* NOTE: If monitor ip is changed need to cleanup the old static route */
+ /* NOTE: If monitor ip changed, or dpinger_dont_add_static_route is true (globally or per-gateway) remove the old static route */
if ($gateway_settings['monitor'] != "dynamic" &&
- !empty($a_gateway_item) &&
- is_ipaddr($a_gateway_item['monitor']) &&
- $gateway_settings['monitor'] != $a_gateway_item['monitor'] &&
- $gateway['gateway'] != $a_gateway_item['monitor']) {
+ !empty($a_gateway_item) &&
+ is_ipaddr($a_gateway_item['monitor']) &&
+ (isset($gateway['dpinger_dont_add_static_route']) || $skip_static_route ||
+ ($gateway_settings['monitor'] != $a_gateway_item['monitor'] && $gateway['gateway'] != $a_gateway_item['monitor']))) {
route_del($a_gateway_item['monitor']);
}
}
@luckman212

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment