diff options
author | jim-p <jim@pingle.org> | 2010-02-27 14:47:36 -0500 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2010-02-27 14:47:36 -0500 |
commit | 7b819cdbb268b106d648904b2f1596b980552f0a (patch) | |
tree | e6344f76fb6ab90d56a4e7c8e5286849359252ca /etc | |
parent | 423afd2d4300fc6170b4051787cc9515cc94f140 (diff) | |
download | pfsense-7b819cdbb268b106d648904b2f1596b980552f0a.zip pfsense-7b819cdbb268b106d648904b2f1596b980552f0a.tar.gz |
A couple fixes for DHCP lease parsing. Ticket #374
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/services.inc | 1 | ||||
-rwxr-xr-x | etc/rc.parse-isc-dhcpd | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 8797994..636c75f 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -39,6 +39,7 @@ */ function services_parse_dhcpd_hostnames() { + global $config; $ps = `ps awux | grep isc | grep -v grep | grep parse | awk '{ print $2 }'`; if($ps) exec("kill {$ps}"); diff --git a/etc/rc.parse-isc-dhcpd b/etc/rc.parse-isc-dhcpd index 4770f87..d7e465f 100755 --- a/etc/rc.parse-isc-dhcpd +++ b/etc/rc.parse-isc-dhcpd @@ -3,13 +3,14 @@ # This script will monitor dhcpd.leases and parse # out active leases and ensure they are present # in /var/etc/hosts +SEARCH_DOMAIN=`grep ^domain /etc/resolv.conf | cut -f 2 -d ' '` update_hosts_file() { # $1 = host # $2 = ip cat /var/etc/hosts | grep -v "$1" > /tmp/hosts.tmp if [ "$3" != "" ]; then - echo "$2 $1 # dynamic entry created by rc.parse-isc-dhcpd" >> /tmp/hosts.tmp + echo "$2 $1.$SEARCH_DOMAIN $1 # dynamic entry created by rc.parse-isc-dhcpd" >> /tmp/hosts.tmp fi mv /tmp/hosts.tmp /var/etc/hosts killall -HUP dnsmasq @@ -20,7 +21,7 @@ cat /var/dhcpd/var/db/dhcpd.leases | grep "lease" -A8 | while read LINE do HOSTNAMEA=`echo "$LINE" | grep client-hostname | awk '{ print $2 }' | cut -d'"' -f2` ACTIVEA=`echo "$LINE" | grep active` - IPADDRA=`echo "$LINE" | grep lease | awk '{ print $2 }'` + IPADDRA=`echo "$LINE" | grep "^lease" | awk '{ print $2 }'` if [ "$HOSTNAMEA" != "" ]; then HOSTNAME="$HOSTNAMEA" fi @@ -45,7 +46,7 @@ tail -F /var/dhcpd/var/db/dhcpd.leases | grep "lease" -A8 | while read LINE do HOSTNAMEA=`echo "$LINE" | grep client-hostname | awk '{ print $2 }' | cut -d'"' -f2` ACTIVEA=`echo "$LINE" | grep active` - IPADDRA=`echo "$LINE" | grep lease | awk '{ print $2 }'` + IPADDRA=`echo "$LINE" | grep "^lease" | awk '{ print $2 }'` if [ "$HOSTNAMEA" != "" ]; then HOSTNAME="$HOSTNAMEA" fi |