diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-12-12 18:18:50 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-12-12 18:18:50 +0000 |
commit | 29edaa0b9d8401f98c7625c69174dd1bad125550 (patch) | |
tree | 849efc64a8c225966ca464af45db046e0efbe51e /etc | |
parent | 5b6582a2b4dc6b4e248538ae67f9ad1996c8d410 (diff) | |
download | pfsense-29edaa0b9d8401f98c7625c69174dd1bad125550.zip pfsense-29edaa0b9d8401f98c7625c69174dd1bad125550.tar.gz |
Check DHCP interfaces every 6 hours for dhclient issues. Launch dhclient if it is not bound to an interface correctly.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/crontab | 2 | ||||
-rw-r--r-- | etc/rc.dhclient_cron | 54 |
2 files changed, 56 insertions, 0 deletions
diff --git a/etc/crontab b/etc/crontab index 556827d..c83ebb3 100644 --- a/etc/crontab +++ b/etc/crontab @@ -10,3 +10,5 @@ HOME=/var/log */5 * * * * root /usr/bin/nice -n20 /etc/ping_hosts.sh */60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot */60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c +*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c +*/360 * * * * root /usr/bin/nice -n20 /etc/rc.dhclient_cron diff --git a/etc/rc.dhclient_cron b/etc/rc.dhclient_cron new file mode 100644 index 0000000..77254ec --- /dev/null +++ b/etc/rc.dhclient_cron @@ -0,0 +1,54 @@ +#!/usr/local/bin/php -f +<?php +/* $Id$ */ +/* + rc.dhclient_cron + part of pfSense (http://www.pfSense.com) + Copyright (C) 2006 Scott Ullrich + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require_once("config.inc"); +require_once("functions.inc"); +require_once("filter.inc"); +require_once("interfaces.inc"); + +/* invalidate cache */ +vc_invalidate(); + +unlink_if_exists("/tmp/config.cache"); + +foreach($config['interfaces'] as $interface) { + $real_interface = $interface['if']; + if($interface['ipaddr'] == "dhcp") { + $pid = find_dhclient_process($real_interface); + if($pid == 0 or !$pid) { + /* dhclient is not running for interface, kick it */ + log_error("DHCLIENT was not running for {$real_interface} ... Launching new instance."); + exec("/sbin/dhclient $real_interface"); + } + } +} + +?>
\ No newline at end of file |