Setting host-identifier from omapi
Matej
matej at matnet.net
Thu Oct 25 20:54:17 UTC 2012
Hi,
I have to report that we were able to implement this successfully.
Thank you very much for sharing this patch. I hope it will be included
in the following versions by default.
Regards,
Matej
Dne 22.10.2012 20:44, piše Christian Kratzer:
> Hi,
>
> On Mon, 22 Oct 2012, Matej wrote:
>> Hi,
>>
>> did you have any success with implementing this?
>
> yes we did. Although it turned out to be slightly more than we
> initially thought.
>
> I have attached two patches to server/omapi.c and server/db.c and
> am cc:ing dhcp-hackers so this gets archived. I hope the list
> accepts the attachments.
>
> The first patch in patch-server__omapi.c.20121015 does following:
>
> - Adds printing of host-identifier options to dhcp_lease_stuff_values()
>
> This is not related to provisioning host objects but quite handy
> to be able to lookup the agent options on dynamic leases.
>
> - Parses values of type host-identifier in dhcp_host_set_value()
> into a host object.
>
> - Patch dhcp_host_signal_handler() to permit host-identifiers as
> a client identifier.
>
> - Adds printing of host-identifier options to dhcp_host_stuff_values()
>
> The second patch in patch-server__db.c.20121015 does following
>
> - Adds printing of host-identifier options to write_lease()
>
> A couple of things to keep in mind when using this patch:
>
> - When setting values in the host object you supply 'host-identifier' as
> the name of the value and something like
>
> option agent.circuit-id "foo"
> option agent.remote-id "bar"
> option agent.subscriber-id "baz"
>
> as the value. As you see the value includes the quoted option value.
>
> We set this from python via a patched pypureomapi. Not sure if it's
> possible to get the escaping of the quoted value right from omshell.
>
> - You cannot delete hosts via their host-identifier. Not sure how much
> work this would be. Might be non trivial. The workaround is quite
> easy as you can always find, modify and delete hosts via their name.
>
> So just provision a unique name and use that to delete the host objects.
>
> I would of course be happy to see this in a future ISC dhcp release.
>
> Greetings
> Christian Kratzer
> CK Software GmbH
>
>>
>> Thanks,
>> Matej Serc
>>
>> Dne 24.9.2012 11:23, pi?e Christian Kratzer:
>>> Hi,
>>>
>>> I am reasearching the possibility of setting up hosts identified by
>>> dhcp option 82 circuit-id or subscriber-id using omapi as follows:
>>>
>>> host foo {
>>> host-identifier option agent.circuit-id "foo"
>>> fixed-address 192.0.2.99;
>>> }
>>>
>>> I found following thread from January this year:
>>>
>>> https://lists.isc.org/pipermail/dhcp-users/2012-January/014807.html
>>>
>>>> From looking at the defintion of dhcp_host_set_value in
>>>> server/omapi.c using host-identifier does not seem to be supported
>>>> currently.
>>>
>>>> From further reading it seems that dhcp_host_set_value sets value
>>>> in a struct host_decl instance. I see there is a "struct option
>>>> *host_id_option;" in host_decl.
>>>
>>> In order to support host-identifiers over omapi would it be enough
>>> to extend dhcp_host_set_value to parse an option into host_id_option
>>> of host_decl by taking the code from server/confparse.c after if
>>> (token == HOST_IDENTIFIER) at approx line 1893 ?
>>>
>>> I am inclined to attempt a path but would like some confirmation
>>> that I am on the right track before opening up a can of worms.
>>>
>>> Greetings
>>> Christian
>>>
>>
>>
>
More information about the dhcp-hackers
mailing list