Project

General

Profile

« Previous | Next » 

Revision 1c9355bd

Added by Marcos M 4 months ago

Remove the pppoe reset cron job when the interface is disabled or with if_pppoe

View differences:

src/etc/inc/interfaces.inc
2337 2337
	}
2338 2338
	$ifcfg = $iface;
2339 2339
	if (!isset($ifcfg['enable'])) {
2340
		remove_pppoe_cron_items($ifcfg['if']);
2340 2341
		return 0;
2341 2342
	}
2342 2343

  
src/etc/inc/pfsense-utils.inc
3857 3857
		implode(', ', array_column($renamed_aliases, 'old'))
3858 3858
	);
3859 3859
}
3860

  
3861
function remove_pppoe_cron_items(string $interface = '') {
3862
	$cron_config = config_get_path('cron/item', []);
3863
	$cron_pppoe_file_paths = [];
3864
	foreach (config_get_path('ppps/ppp') as $ppp_config) {
3865
		if ($ppp_config['type'] != 'pppoe') {
3866
			continue;
3867
		}
3868
		if (empty($interface) || ($ppp_config['if'] == $interface)) {
3869
			$cron_pppoe_file_paths[] = g_get('varetc_path') . "/pppoe_restart_{$ppp_config['if']}";
3870
		}
3871
	}
3872
	if (!empty($cron_pppoe_file_paths)) {
3873
		foreach ($cron_pppoe_file_paths as $file_path) {
3874
			unlink_if_exists($file_path);
3875
		}
3876

  
3877
		$config_changed = false;
3878
		foreach ($cron_config as $idx => $cron_item) {
3879
			if (in_array($cron_item['command'], $cron_pppoe_file_paths)) {
3880
				unset($cron_config[$idx]);
3881
				$config_changed = true;
3882
			}
3883
		}
3884
		if ($config_changed) {
3885
			config_set_path('cron/item', $cron_config);
3886
		}
3887
	}
3888
}
src/usr/local/pfSense/include/www/system_advanced_network.inc
236 236
		}
237 237
		if ($post['use_if_pppoe'] == "yes") {
238 238
			config_set_path('system/use_if_pppoe', true);
239
			remove_pppoe_cron_items();
239 240
		} else {
240 241
			config_del_path('system/use_if_pppoe');
241 242
		}

Also available in: Unified diff