PHP LeaseQuery code v1.0 Release!

Pat Winn ptwinn at cimtel.net
Thu Jun 17 21:46:38 UTC 2010


All,
After much to-do and a fair amount of blood, sweat and tears,
I've decided to release the dhcpLeaseQuery class as version 1.0.

Please note that there could surely be some additional code clean-up
and optimization, as well as some additional error-checking.

For now, it just works.  :-)

Please note also that this code *cannot* be run from the dhcpd server
itself as the dhcpd daemon will not listen on the local loopback for
incoming packets and thus, it will never see the udp packet come in.
It sucks, but run it from another box and you are good.
Would be nice if a Unix domain socket file could be used to communicate
with the server instead. Then we could pass the query from a PHP
daemon running on the same box.

How are we using this?
I have included this class into a PHP based syslog replacement
which catches option-82 syslog messages from dhcpd.
The syslog config on the dhcpd server says to forward any dhcp
messages to the server my PHP syslog daemon runs on.
When the PHP syslog daemon receives a syslog option-82
message, it takes the IP address from it and uses the lease query
class to send the leasequery packet to the server and inquire for the
additional info. Once handed back, it parses everything from the
syslog message and the leasequery response and either creates or updates
a session record in MySQL for IP lease/session history tracking.

The code may be downloaded here:
http://www.cimtel.net/opensource/php_dhcpLeaseQuery_1.0.tgz

I am always open to suggestions and enhancements..so please feel free
to gut it all you want and submit any changes you'd like to see go back
into it. I'll be sure to consider it and/or put it in and re-issue a
new version.

Thanks again to all who chimed in on this.
Your help was instrumental in getting this to work!!

-- 
Patrick T. Winn
Senior Systems Engineer
Cimarron Telephone Co.
(918) 865-3311 x280 - office
(918) 606-6602 - cell






More information about the dhcp-hackers mailing list