OMAPI lookup by IP fails for static host entries

Glenn Satchell Glenn.Satchell at uniq.com.au
Tue Oct 31 11:05:49 UTC 2006


>Date: Tue, 31 Oct 2006 13:50:28 +1300
>From: Matt Brown <matt at mattb.net.nz>
>To: dhcp-users at isc.org
>Subject: OMAPI lookup by IP fails for static host entries
>
>Hi There,
>I have an application where I want to lookup the mac address associated
>with a particular IP address via OMAPI.
>
>This is working fine for dynamically allocated leases, but for hosts
>where I have specified a static address in the dhcp configuration there
>is no lease found. I understand this is by design...
>
>So my fallback plan was to query the server for a static host entry in
>the case where a lease isn't found. Unfortunately this doesn't seem to
>work, despite my quick skim of dhcp_host_lookup in omapi.c suggesting
>that there is support for looking up hosts via IP. Looking up the host
>entry by the hardware address succeeds with no problems.
>
>The only complicating factor that I can think of is that the host entry
>is not present in the configuration file, it too is added via OMAPI, I
>wouldn't have expected this to cause problems though...
>
>Is this a bug or am I missing something? Example omshell session below:
>
>> new host
>obj: host
>> set ip-address = 10.1.50.10
>obj: host
>ip-address = 0a:01:32:0a
>> open
>can't open object: not found
>obj: host
>ip-address = 0a:01:32:0a
>
>> new host
>obj: host
>> set hardware-addressobj: host
>hardware-address = 00:16:6f:49:b6:b4
>> open
>obj: host
>hardware-address = 00:16:6f:49:b6:b4
>ip-address = 0a:01:32:0a:b6:b4
>name = "nh4546a1c60816f040"
>hardware-type = 00:00:00:01
>
>I'm using 3.0.3, but didn't notice any relevant changes in the 3.0.4
>changelog.
>
>Thanks in advance for your help.

Hi Matt,

This is by design. When an IP address is handed out based on a host
entry the server does not store any knowledge of it, either in-memory
or in the leases file. When you search for it using omapi there is
nothing stored to match against.

In this case you either need to use dynamic leases for all hosts, or
have a script that can parse your dhcpd.conf looking at the ost
entries.

In 3.1.0 (currently a1) you can use a reserved lease rather than a host
entry and this will create a lease file entry so I imagine you could
then search for it. I've been running this release in test and it seems
to work ok for me. YMMV if you want to put it in production...

regards,
-glenn
--
Glenn Satchell     mailto:glenn.satchell at uniq.com.au | Some days we are
Uniq Advances Pty Ltd         http://www.uniq.com.au | the flies;  some
PO Box 70 Paddington NSW Australia 2021              | days we  are the
tel:0409-458-580  tel:02-9380-6360  fax:02-9380-6416 | windscreens...




More information about the dhcp-users mailing list