[Kea-users] AllocationEngine instance from Hooks

classic Classic list List threaded Threaded
3 messages Options
raj
Reply | Threaded
Open this post in threaded view
|

[Kea-users] AllocationEngine instance from Hooks

raj
Hello Kea Users,

I want to write custom Kea hook as per hook developer guide.

How can I get access AllocationEngine instance from hooks callback function ?

Thanks,
Rajdip Patel

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] AllocationEngine instance from Hooks

Francis Dupont
Rajdip Patel writes:
> I want to write custom Kea hook as per hook developer guide.
>
> How can I get access AllocationEngine instance from hooks callback function
> ?

=> I do not believe you can: it is a private member of the exchange context
which is not passed to hooks. It is a protected member of the Dhcpv4Srv
which is derived into the ControlledDhcpv4Srv singleton so if it is changed
to be public using ControlledDhcpv4Srv::getInstance() will give an access
to it.
Now why do you need AllocationEngine instance? I can't see obvious reason
to ask for this...

Regards

Francis Dupont <[hidden email]>
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
raj
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] AllocationEngine instance from Hooks

raj
Thanks you so much Francis,

My requirement is as below.

Once Kea assigns a IPv4 lease, I want to confirm it operating system's MAC Table and if it is already present in Mac table I want Kea AllocationEngine to assign new lease. So for requesting new lease I need AllocationEngine's instance from hook callback which is not available.
I want this validation in case users assigned static IP to their devices and I want to prevent IP conflicts in enterprise network. 

Also, I tried to use ControlledDhcpv4Srv::getInstance() but ControlledDhcpv4Srv class doesn't seems part of any exported header file.

Any alternative workaround would be highly appreciated.

Thanks

On Wed, May 1, 2019 at 7:25 PM Francis Dupont <[hidden email]> wrote:
Rajdip Patel writes:
> I want to write custom Kea hook as per hook developer guide.
>
> How can I get access AllocationEngine instance from hooks callback function
> ?

=> I do not believe you can: it is a private member of the exchange context
which is not passed to hooks. It is a protected member of the Dhcpv4Srv
which is derived into the ControlledDhcpv4Srv singleton so if it is changed
to be public using ControlledDhcpv4Srv::getInstance() will give an access
to it.
Now why do you need AllocationEngine instance? I can't see obvious reason
to ask for this...

Regards

Francis Dupont <[hidden email]>


--
Thanks,
Rajdip Patel

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users