Skip to content

Commit 9a19154

Browse files
fix: clear gateway cache before applying routing changes
pfSense 2.8.0 adds a new backend GatewaysCache that is not automatically kept up-to-date. This means there can be a conflict between the current configuration and the cache when the routing subsystem is applied which can result in duplicate or unintentional routing changes. This change clears the cache before we apply routing changes to ensure its always up-to-date with the config
1 parent a257c17 commit 9a19154

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Dispatchers/RoutingApplyDispatcher.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ class RoutingApplyDispatcher extends Dispatcher {
1515
public function process(...$arguments): void {
1616
global $g;
1717

18+
# Clear the gateway cache to ensure the latest status is fetched during routing changes
19+
unset($GLOBALS['GatewaysCache']);
20+
1821
# Check for the pending changes file and unserialize it
1922
if (file_exists("{$g['tmp_path']}/.system_routes.apply")) {
2023
$to_apply_list = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply"));
21-
2224
# Run commands to apply these changes
2325
foreach ($to_apply_list as $to_apply) {
2426
mwexec("{$to_apply}");

0 commit comments

Comments
 (0)