Need help with LEASEQUERY..
Pat Winn
ptwinn at cimtel.net
Thu May 20 16:04:20 UTC 2010
Matt,
That codebase is (rather ironically) what I stumbled across
and was using for a baseline when I started hacking away at this.
I'm in the same boat as you...wanting to pull lease info from the
running daemon rather than looking at what is in the leases file.
We are an isp and are in the process of switching from using radius
with user authentication for our dialup and dsl customers to DHCP.
As such, I need all the info I can glean for each session/lease for
logging purposes and some of the info we need isn't in the leases
file..so it's down to pulling from the running daemon.
I've tried forking an omshell process to talk to the daemon and
pull the lease info back into PHP. It worked fine except that every
so often the omshell process hangs while connected to the daemon
and won't disconnect. When that happens, the daemon stops responding
to any new requests. Guessing it puts a lock on it's internal lease
objects while omshell is connected since it can alter things and
simply won't work until it disconnects...so that becomes an unusable
option (short of patching ISC's code which I'd rather not tamper with).
I've considered writing my own version of omshell in php but then
figured out I could send a leasequery packet to the running daemon
and get the same info back...without being connected to it like
omshell. So now it's down to...create a PHP class which can send and
receive a packet to get the info back that way and be able to re-use
said class in whatever php code I want to use it in.
That is...IF..I can ever get dhcpd to acknowledge that it received
a lease query packet and actually respond to it. :-(
I'm totally open for suggestions at this point, and open to working
in a collaborative fashion as well. Perhaps we could both benefit
from it. ;-)
Thanks for your time and response!
--
Patrick T. Winn
Systems Engineer
Cimarron Telephone Co.
(918) 865-3311 x280 - office
(918) 606-6602 - cell
While counting 0's and 1's, Matt Pascoe said:
> I too would love to do LEASEQUERY from PHP. I have tried and
> been unsuccessful as well. I've worked a bit with the following code but
> have not had time to do any testing with it since it was updated. You
> might
> give it a test and see if you can get further with it? check out the
> leasequery.php file in the repository.
>
> http://github.com/adinardi/phpdhcp
>
> I also have tried to use the PERL leasequery tool and had trouble getting
> it
> to work.
>
> My goal with leasequery is to simply create a function that I can give a
> single IP or a range of IPs (masked or range) and get a list of lease
> information from the DHCP server. I'd prefer not to have to look at
> leasefiles but to use the LEASEQUERY method to ask the server directly.
>
> Thanks
>
> On Thu, May 20, 2010 at 8:53 AM, Pat Winn <ptwinn at cimtel.net> wrote:
>
>>
>> Greetings,
>> I am trying to construct a LEASEQUERY packet in PHP that
>> I can use to query our ISC DHCP daemon with.
>>
>> I have gotten as far as seeing the packet show up in a
>> WireShark packet trace and it looks correct there (I think?).
>> I never see anything show up in our syslog or on stderr if
>> ran in debug however.
>>
>> If I attach to the running daemon with strace (Linux/Fedora),
>> I can see about four lines come up when the packet arrives,
>> acknowledging that it received a packet, but it doesn't do
>> anything with it, just throws it out or so I'm assuming.
>> I am using packet type 10, not 13 as stated in RFC 4338 and
>> RFC 2131.
>>
>> I can try sending a lease query using a Perl script which is
>> said to work w/ ISC's DHCPd but even with that I see the same
>> things take place in my packet trace/syslog/strace/etc.
>>
>> No matter how I go about it, it's still no joy.
>>
>> I have tried version 3.x and am now on a freshly compiled
>> version 4.1.1 with pretty much everything enabled.
>>
>> I do have allow leasequery in my dhcpd.conf.
>>
>> What else might I be missing or doing wrong?
>> I know I am close.
>>
>> Also, is there anything like this already written that I'm not
>> finding that might save me from re-inventing the wheel??
>>
>> Thanks in advance for any help offered!
>>
>> --
>> Patrick T. Winn
>> Systems Engineer
>> Cimarron Telephone Co.
>> (918) 865-3311 x280 - office
>> (918) 606-6602 - cell
>>
>>
>>
>> _______________________________________________
>> dhcp-hackers mailing list
>> dhcp-hackers at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/dhcp-hackers
>>
>
More information about the dhcp-hackers
mailing list