diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 906e55533..ba959530c 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1770,77 +1770,25 @@ function interfaces_carp_setup() echo gettext("Configuring CARP settings..."); mute_kernel_msgs(); } + set_single_sysctl("net.inet.carp.preempt" => "1"); - /* suck in configuration items */ - if (isset($config['hasync'])) { - if (isset($config['hasync']['pfsyncenabled'])) { - $pfsyncenabled = $config['hasync']['pfsyncenabled']; - } - if (isset($config['hasync']['pfsyncinterface'])) { - $pfsyncinterface = $config['hasync']['pfsyncinterface']; - } - if (isset($config['hasync']['pfsyncpeerip'])) { - $pfsyncpeerip = $config['hasync']['pfsyncpeerip']; - } - } else { - unset($pfsyncinterface); - unset($pfsyncenabled); - } - - set_sysctl(array( - "net.inet.carp.preempt" => "1", - "net.inet.carp.log" => "1" - )); - - if (!empty($pfsyncinterface)) { - $carp_sync_int = get_real_interface($pfsyncinterface); - } else { - unset($carp_sync_int); + if (!empty($config['hasync']['pfsyncinterface'])) { + $carp_sync_int = get_real_interface($config['hasync']['pfsyncinterface']); } /* setup pfsync interface */ - if (!empty($carp_sync_int) && isset($pfsyncenabled)) { - if (is_ipaddr($pfsyncpeerip)) { - $syncpeer = "syncpeer {$pfsyncpeerip}"; + if (!empty($carp_sync_int) && isset($config['hasync']['pfsyncenabled'])) { + if (isset($config['hasync']['pfsyncpeerip']) && is_ipaddr($config['hasync']['pfsyncpeerip'])) { + $syncpeer = "syncpeer " . $config['hasync']['pfsyncpeerip']; } else { $syncpeer = "-syncpeer"; } mwexec("/sbin/ifconfig pfsync0 syncdev {$carp_sync_int} {$syncpeer} up", false); - - sleep(1); - - /* XXX: Handle an issue with pfsync(4) and carp(4). In a cluster carp will come up before pfsync(4) has updated and so will cause issues - * for existing sessions. - */ - log_error("waiting for pfsync..."); - $i = 0; - while (intval(trim(`/sbin/ifconfig pfsync0 | /usr/bin/grep 'syncok: 0' | /usr/bin/grep -v grep | /usr/bin/wc -l`)) == 0 && $i < 30) { - $i++; - sleep(1); - } - log_error("pfsync done in $i seconds."); - log_error("Configuring CARP settings finalize..."); } else { mwexec("/sbin/ifconfig pfsync0 -syncdev -syncpeer down", false); } - $has_carp_vips = false; - if (isset($config['virtualip']['vip']) && count($config['virtualip']['vip']) > 0) { - foreach ($config['virtualip']['vip'] as $vip) { - if ($vip['mode'] == 'carp') { - $has_carp_vips = true; - break; - } - } - } - - if ($has_carp_vips) { - set_single_sysctl("net.inet.carp.allow", "1"); - } else { - set_single_sysctl("net.inet.carp.allow", "0"); - } - if (file_exists("/var/run/booting")) { unmute_kernel_msgs(); echo gettext("done.") . "\n"; diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 06bccd4ba..814e64874 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -118,9 +118,7 @@ function activate_sysctls() "net.enc.in.ipsec_bpf_mask" => "0x0002", "net.enc.in.ipsec_filter_mask" => "0x0002", "net.enc.out.ipsec_bpf_mask" => "0x0001", - "net.enc.out.ipsec_filter_mask" => "0x0001", - 'net.inet.carp.senderr_demotion_factor' => '0', - 'net.pfsync.carp_demotion_factor' => '0', + "net.enc.out.ipsec_filter_mask" => "0x0001" ); if (isset($config['sysctl']['item'])) { diff --git a/src/etc/rc.linkup b/src/etc/rc.linkup index bdc5e4c2e..9c7ca07de 100755 --- a/src/etc/rc.linkup +++ b/src/etc/rc.linkup @@ -38,23 +38,6 @@ require_once("system.inc"); require_once("unbound.inc"); require_once("services.inc"); -/** - * signal CARP to go down when there's a ip configured on the provided interface - * interfaces_carp_setup will enable carp when pfsync completes. - */ -function interface_signal_carp($intf) -{ - global $config; - if (!empty($config['virtualip']['vip'])) { - foreach ($config['virtualip']['vip'] as $vip) { - if ($vip['interface'] == $intf && $vip['mode'] == 'carp') { - set_single_sysctl("net.inet.carp.allow", "0"); - } - } - } -} - - function handle_argument_group($iface, $argument2) { global $config; @@ -85,7 +68,6 @@ function handle_argument_group($iface, $argument2) { case "stop": log_error("DEVD Ethernet detached event for {$iface}"); interface_bring_down($iface); - interface_signal_carp($iface); break; case "start": log_error("DEVD Ethernet attached event for {$iface}");