Revision 13164061
Added by A FL about 5 years ago
src/etc/inc/captiveportal.inc | ||
---|---|---|
841 | 841 |
$trafficquota = $cpcfg['trafficquota'] * 1048576; |
842 | 842 |
} |
843 | 843 |
|
844 |
/* Is there any job to do? */ |
|
845 |
if (!$timeout && !$idletimeout && !$trafficquota && !isset($cpcfg['reauthenticate']) && |
|
844 |
/* Is there any job to do? If we are in High Availability sync, are we in backup mode ? */
|
|
845 |
if ((!$timeout && !$idletimeout && !$trafficquota && !isset($cpcfg['reauthenticate']) &&
|
|
846 | 846 |
!isset($cpcfg['radiussession_timeout']) && !isset($cpcfg['radiustraffic_quota']) && |
847 |
!isset($vcpcfg['enable']) && !isset($cpcfg['radacct_enable'])) { |
|
847 |
!isset($vcpcfg['enable']) && !isset($cpcfg['radacct_enable'])) || |
|
848 |
captiveportal_ha_is_node_in_backup_mode($cpzone)) { |
|
848 | 849 |
return; |
849 | 850 |
} |
850 | 851 |
|
... | ... | |
1202 | 1203 |
|
1203 | 1204 |
// XMLRPC Call over to the backup node if necessary |
1204 | 1205 |
if (xmlrpc_sync_get_details($syncip, $syncport, |
1205 |
$vouchersyncusername, $syncpass) && !captiveportal_ha_is_node_in_backup_mode()) { |
|
1206 |
$vouchersyncusername, $syncpass) && !captiveportal_ha_is_node_in_backup_mode($cpzone)) {
|
|
1206 | 1207 |
$remote_status = xmlrpc_sync_voucher_disconnect($dbent, $syncip, |
1207 | 1208 |
$syncport, $syncpass, $vouchersyncusername, $term_cause, |
1208 | 1209 |
$stop_time); |
... | ... | |
2713 | 2714 |
$cpcfg = $config['captiveportal'][$cpzone]; |
2714 | 2715 |
$acctcfg = auth_get_authserver($cpcfg['radacct_server']); |
2715 | 2716 |
|
2716 |
if (!isset($cpcfg['radacct_enable']) || empty($acctcfg)) { |
|
2717 |
if (!isset($cpcfg['radacct_enable']) || empty($acctcfg) || |
|
2718 |
captiveportal_ha_is_node_in_backup_mode($cpzone)) { |
|
2717 | 2719 |
return null; |
2718 | 2720 |
} |
2719 | 2721 |
|
... | ... | |
2842 | 2844 |
} |
2843 | 2845 |
} |
2844 | 2846 |
|
2845 |
// Return true if the CARP status of at least one interface of a captive portal zone is in backup mode |
|
2846 |
function captiveportal_ha_is_node_in_backup_mode() { |
|
2847 |
global $config, $cpzone; |
|
2848 |
|
|
2849 |
$cpinterfaces = explode(",", $config['captiveportal'][$cpzone]['interface']); |
|
2850 |
|
|
2851 |
if (is_array($config['virtualip']['vip'])) { |
|
2852 |
foreach ($cpinterfaces as $interface) { |
|
2853 |
foreach ($config['virtualip']['vip'] as $vip) { |
|
2854 |
if ($vip['interface'] == $interface && $vip['mode'] == "carp") { |
|
2855 |
if (get_carp_interface_status("_vip{$vip['uniqid']}") != "MASTER") { |
|
2856 |
return true; |
|
2857 |
} |
|
2858 |
} |
|
2859 |
} |
|
2860 |
} |
|
2861 |
} |
|
2862 |
return false; |
|
2863 |
} |
|
2864 | 2847 |
?> |
src/etc/inc/pfsense-utils.inc | ||
---|---|---|
772 | 772 |
return ""; |
773 | 773 |
} |
774 | 774 |
|
775 |
/* |
|
776 |
* Return true if the CARP status of at least one interface of a captive portal zone is in backup mode |
|
777 |
* This function return false if CARP is not enabled on any interface of the captive portal zone |
|
778 |
*/ |
|
779 |
function captiveportal_ha_is_node_in_backup_mode($cpzone) { |
|
780 |
global $config; |
|
781 |
|
|
782 |
$cpinterfaces = explode(",", $config['captiveportal'][$cpzone]['interface']); |
|
783 |
|
|
784 |
if (is_array($config['virtualip']['vip'])) { |
|
785 |
foreach ($cpinterfaces as $interface) { |
|
786 |
foreach ($config['virtualip']['vip'] as $vip) { |
|
787 |
if (($vip['interface'] == $interface) && ($vip['mode'] == "carp")) { |
|
788 |
if (get_carp_interface_status("_vip{$vip['uniqid']}") != "MASTER") { |
|
789 |
return true; |
|
790 |
} |
|
791 |
} |
|
792 |
} |
|
793 |
} |
|
794 |
} |
|
795 |
return false; |
|
796 |
} |
|
797 |
|
|
775 | 798 |
/* |
776 | 799 |
* get_pfsync_interface_status($pfsyncinterface): returns the status of a pfsync |
777 | 800 |
*/ |
src/etc/inc/voucher.inc | ||
---|---|---|
294 | 294 |
|
295 | 295 |
// XMLRPC Call over to the node in backup mode |
296 | 296 |
if (xmlrpc_sync_get_details($syncip, $syncport, |
297 |
$vouchersyncusername, $syncpass) && !captiveportal_ha_is_node_in_backup_mode()) { |
|
297 |
$vouchersyncusername, $syncpass) && !captiveportal_ha_is_node_in_backup_mode($cpzone)) {
|
|
298 | 298 |
$remote_time_used = xmlrpc_sync_used_voucher($voucher_received, |
299 | 299 |
$syncip, $syncport, $syncpass, $vouchersyncusername); |
300 | 300 |
} |
Also available in: Unified diff
Do not perform RADIUS accounting/prune operations when node is in backup mode
Implement Redmine #97