[Kea-users] Bug in the leases4_committed hook ?

Hreiðar Jóelsson hreidar.joelsson at gagnaveita.is
Fri Sep 21 15:07:57 UTC 2018


Hi, thank you for your quick respond. You are absolutely right, I missed this quite important thing 😉  My code works as it should now.

Kær kveðja / Best Regards,

Hreiðar Jóelsson

Netsérfræðingur IP netkerfis / Network Engineer
Tækni / Gagnaveita
Sími / Tel: +354 516 7777 | Farsími / Mobile: +354 617 7835 | Netfang / E-mail: hreidar.joelsson at gagnaveita.is
Gagnaveita Reykjavíkur / Gagnaveita Reykjavíkur | www.ljosleidarinn.is

-----Original Message-----
From: Marcin Siodelski <marcin at isc.org> 
Sent: Friday, September 21, 2018 13:22 PM
To: Hreiðar Jóelsson <hreidar.joelsson at gagnaveita.is>; 'kea-users at lists.isc.org' <kea-users at lists.isc.org>
Subject: Re: [Kea-users] Bug in the leases4_committed hook ?

Hello,

You seem to have the type of the arguments wrong. It should rather be:

Pkt4Ptr query4;
Lease4CollectionPtr leases4;
Lease4CollectionPtr deleted_leases4;

We implemented collection of leases in this hook point for DHCPv4 to keep parity with DHCPv6. In most cases, these collections will store at most one lease.

Marcin Siodelski

DHCP Engineering
ISC

On 21.09.2018 14:55, Hreiðar Jóelsson wrote:
> Hi, I’m any of you had problems with the leases4_committed hook? I’m 
> getting strange errors using it. If I simply try to log some message 
> from it I’m getting the following error.
> 
>  
> 
> 2018-09-21 10:57:04.843 ERROR [kea-dhcp4.callouts/1442] 
> HOOKS_CALLOUT_EXCEPTION exception thrown by callout on hook 1 
> registered by library with index leases4_committed (callout address
> 0x7f8803d131c3): boost::bad_any_cast: failed conversion using 
> boost::any_cast (callout duration: 0.063 ms)
> 
>  
> 
> Here is the hook code I’m currently using:
> 
>  
> 
> int leases4_committed(CalloutHandle& handle) {
> 
>     Pkt4Ptr query;
> 
>     Lease4Ptr leases, deleted_leases;
> 
>     handle.getArgument("query4", query);
> 
>     handle.getArgument("leases4", leases);
> 
>     handle.getArgument("deleted_leases4", deleted_leases);
> 
>  
> 
>     LOG_DEBUG(my_logger,50, "I'm at leases4_committed hook");
> 
>  
> 
>     return 0;
> 
> }
> 
>  
> 
> p.s I’m using this logger in other hooks in the same file without any 
> problems.
> 
>  
> 
>  
> 
> Regards, Hreiðar.
> 
>  
> 
> 
> 
> _______________________________________________
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
> 



More information about the Kea-users mailing list