summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-09-27 21:49:15 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-09-27 21:49:15 +0000
commit727a2b918e03c1d2a1b4cf33eb52771bcd83a996 (patch)
treeeab6df9a34932578f7d320a0f479418f7328ed0a /etc
parent5d61b44e45cc8078d2c7ff71a628bceda670dc87 (diff)
downloadpfsense-727a2b918e03c1d2a1b4cf33eb52771bcd83a996.zip
pfsense-727a2b918e03c1d2a1b4cf33eb52771bcd83a996.tar.gz
* Add new /debugging check which enables $debugging. We should use this in the future to output as much additional information that we need to in diagnosing problems. in this case we're adding data to carp on boot to deterimine why its locking up / rebooting
* Add debugging data to carp init
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.inc6
-rw-r--r--etc/inc/interfaces.inc29
2 files changed, 28 insertions, 7 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 83a5d06..a3b42b2 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -57,6 +57,12 @@ if (file_exists("{$g['etc_path']}/platform")) {
$g['platform'] = "unknown";
}
+/* if /debugging exists, lets set $debugging
+ so we can output more information */
+if(file_exists("/debugging"))
+ $debugging = true;
+
+
/* if our config file exists bail out, we're already set. */
if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) {
/* find the device where config.xml resides and write out an fstab */
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index a7934dc..8de8a7d 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -296,7 +296,7 @@ function interfaces_optional_configure_if($opti) {
function interfaces_carp_configure() {
global $g, $config;
- if ($g['booting']) {
+ if ($g['booting'] and !$debugging) {
echo "Configuring CARP interfaces...";
mute_kernel_msgs();
}
@@ -310,19 +310,30 @@ function interfaces_carp_configure() {
if(is_array($config['installedpackages']['carpsettings']['config'])) {
foreach($config['installedpackages']['carpsettings']['config'] as $carp)
if($carp['pfsyncenabled'] != "") {
+ if($debugging)
+ echo "Enabling preempt\n";
if($carp['premption'] != "")
mwexec("/sbin/sysctl net.inet.carp.preempt=1");
if($carp['balancing'] != "")
mwexec("/sbin/sysctl net.inet.arpbalance=1");
+ if($debugging)
+ echo "Get friendly interface name.\n";
$carp_sync_int = convert_friendly_interface_to_real_interface_name($carp['pfsyncinterface']);
- mwexec("/sbin/ifconfig pfsync0 create");
- mwexec("/sbin/ifconfig pfsync0 syncdev " . $carp_sync_int);
- mwexec("/sbin/ifconfig pfsync0 syncif " . $carp_sync_int);
- mwexec("/sbin/ifconfig pfsync0 up");
+ /* do not setup pfsync twice */
+ if($total_carp_interfaces_defined == 0) {
+ if($debugging)
+ echo "Bringing up pfsync0.\n";
+ mwexec("/sbin/ifconfig pfsync0 create");
+ mwexec("/sbin/ifconfig pfsync0 syncdev " . $carp_sync_int);
+ mwexec("/sbin/ifconfig pfsync0 syncif " . $carp_sync_int);
+ mwexec("/sbin/ifconfig pfsync0 up");
+ }
if($g['booting']) {
/* install rules to alllow pfsync to sync up during boot
* carp interfaces will remain down until the bootup sequence finishes
*/
+ if($debugging)
+ echo "Adding firewall rules..\n";
exec("echo pass quick proto carp all keep state > /tmp/rules.boot");
exec("echo pass quick proto pfsync all >> /tmp/rules.boot");
exec("echo pass out proto { tcp, udp } from any to any port 53 keep state >> /tmp/rules.boot");
@@ -337,8 +348,9 @@ function interfaces_carp_configure() {
/*
* create the carp interface
*/
+ if($debugging)
+ echo "Creating carp{$carp_instances_counter}.\n";
mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " create");
- mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " down");
$broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']);
if($vip['password'] != "") {
$password = " pass " . $vip['password'];
@@ -350,6 +362,8 @@ function interfaces_carp_configure() {
$carpdev = " carpdev {$ci} ";
}
*/
+ if($debugging)
+ echo "Configuring carp{$carp_instances_counter}.\n";
mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew " . $vip['advskew'] . $password);
if($g['booting'])
mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " down");
@@ -361,7 +375,7 @@ function interfaces_carp_configure() {
GeekGod's gonna buy you a mocking bird. */
mwexec("/sbin/ifconfig pfsync0 syncdev lo0 up");
}
- if ($g['booting']) {
+ if ($g['booting'] and !$debugging) {
unmute_kernel_msgs();
echo "done.\n";
}
@@ -374,6 +388,7 @@ function interfaces_carp_bring_up_final() {
if(!is_array($viparr))
return;
foreach ($viparr as $vip) {
+ echo "Upping interface carp{$carp_instances_counter}.\n";
mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " up");
$carp_instances_counter++;
}
OpenPOWER on IntegriCloud