Bug #16861
openIf a a gateway monitor IP is set, and then later the "dpinger_dont_add_static_route" option is enabled, the static route is NOT removed
0%
Description
I found this out the hard way today after a puzzling bit of DNS trouble when an LTE gateway with a monitor IP of 8.8.8.8 was powered off, resulting in all traffic to 8.8.8.8 blackholing since the GW had a static route bound to it.
I thought the fix would be to check the dpinger_dont_add_static_route checkbox for the gateway, but that seemed not to actually remove the route.
Digging in, I saw the problem in gwlb.inc (call to route_del() only fires if the monitor IP actually changes). Came up with this patch, which I tested successfully on my 6100 running 26.03.1:
https://gist.github.com/luckman212/11c0a4d6ae81f2613690294b5ff23ff0
It can be tested via System Patches using this URL
https://gist.githubusercontent.com/luckman212/11c0a4d6ae81f2613690294b5ff23ff0/raw/a8e5e3ad492223fe6a71fbc8e384a74add3b6ea0/gwlb.inc.patch
It also accounts for the case when the global option is changed from System → Advanced → Miscellaneous