Bug #16861
openStatic route not removed when enabling ``dpinger_dont_add_static_route`` while a gateway monitor IP address is set
100%
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
Updated by → luckman212 23 days ago
I forgot to submit the Pull Request, I'll do that tomorrow. By the way, the diff had some whitespace changes (spaces to tabs) to make the indentation consistent. That's why it appears that the first changed block doesn't actually change anything.
Updated by → luckman212 22 days ago
PR: https://github.com/pfsense/pfsense/pull/4754
I had to base it off the CE codebase since I don't have access to Plus, but the patch should apply to either.
Updated by Alhusein Zawi 20 days ago
The static route for the monitor gateway is removed when the option is enabled from the Edit Gateway page.
However, it is not removed when the same option is enabled from System → Advanced → Miscellaneous.
26.07-DEVELOPMENT (amd64)
built on Wed Jun 3 16:15:00 UTC 2026
FreeBSD 16.0-CURRENT
Updated by → luckman212 20 days ago
Alhusein: I know, see marcos comment here: https://github.com/pfsense/pfsense/pull/4754#issuecomment-4594641028
That portion of the patch was removed, because he flagged it for some edge cases
Updated by Jim Pingle 5 days ago
- Subject changed from If 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 to Static route not removed when enabling ``dpinger_dont_add_static_route`` while a gateway monitor IP address is set