[Kea-users] Force DHCP option in response

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Kea-users] Force DHCP option in response

Arne Baeumler
Hi,

is there a way to append non standard dhcp options not explicitly
requested by the client?
We use DHCP option 43 to provide ACS URL to our CPE's.
The majority of our CPEs (AVM Fritz!Box) do not request option 43 in
their DHCP Request.

In ISC DHCPD we added within the shared-network configuration:

    append dhcp-parameter-request-list 43;

Is there anything similar to "append" in Kea?

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

Re: [Kea-users] Force DHCP option in response

Marcin Siodelski
On 06.07.2017 14:24, Arne Baeumler wrote:

> Hi,
>
> is there a way to append non standard dhcp options not explicitly
> requested by the client?
> We use DHCP option 43 to provide ACS URL to our CPE's.
> The majority of our CPEs (AVM Fritz!Box) do not request option 43 in
> their DHCP Request.
>
> In ISC DHCPD we added within the shared-network configuration:
>
>    append dhcp-parameter-request-list 43;
>
> Is there anything similar to "append" in Kea?
>

Arne,

This is going to be implemented in Kea 1.3.0 release. See ticket
http://kea.isc.org/ticket/5241.

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

Re: [Kea-users] Force DHCP option in response

Francis Dupont
In reply to this post by Arne Baeumler
Arne Baeumler writes:

> is there a way to append non standard dhcp options not explicitly
> requested by the client?
> We use DHCP option 43 to provide ACS URL to our CPE's.
> The majority of our CPEs (AVM Fritz!Box) do not request option 43 in
> their DHCP Request.
>
> In ISC DHCPD we added within the shared-network configuration:
>
>     append dhcp-parameter-request-list 43;
>
> Is there anything similar to "append" in Kea?

=> not yet (it is half done in the code and there is already a ticket
asking to finish this). I am afraid you have to write a hook which
patches the PRL (option 55 dhcp-parameter-request-list) as this feature
is implemented in ISC DHCP (it will be more user friendly in future Kea).

Thanks

Francis Dupont <[hidden email]>

PS: from RFC 2132:

9.8. Parameter Request List

   This option is used by a DHCP client to request values for specified
   configuration parameters.  The list of requested parameters is
   specified as n octets, where each octet is a valid DHCP option code
   as defined in this document.

   The client MAY list the options in order of preference.  The DHCP
   server is not required to return the options in the requested order,
   but MUST try to insert the requested options in the order requested
   by the client.

   The code for this option is 55.  Its minimum length is 1.

    Code   Len   Option Codes
    +-----+-----+-----+-----+---
    |  55 |  n  |  c1 |  c2 | ...
    +-----+-----+-----+-----+---
_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Kea-users] Force DHCP option in response

Arne Baeumler
Hi Francis,

thank you for your hint.
I was already trying to write a hook appending Option 43 to the Pkt
instead of the PRL ... ;-)

Below is the main part of the hook (in case someone else might have the
same issue).
Any recommendations or improvements?

#include <hooks/hooks.h>
#include <dhcp/pkt4.h>
#include <dhcp/option_int_array.h>

using namespace isc::dhcp;
using namespace isc::hooks;

extern "C" {


         int pkt4_receive(CalloutHandle &handle) {
                 Pkt4Ptr query4_ptr;
                 handle.getArgument("query4",query4_ptr);

                 // retrieve Parameter Request List (PRL)
                 OptionUint8ArrayPtr prl =
boost::dynamic_pointer_cast<OptionUint8Array>(query4_ptr->getOption(DHO_DHCP_PARAMETER_REQUEST_LIST));

                 // check if PRL already contains option 43
                 const std::vector<uint8_t>& prl_vector =
prl->getValues();
                 for(int i=0; i < prl_vector.size(); i++) {
                         if(prl_vector[i] ==
DHO_VENDOR_ENCAPSULATED_OPTIONS) {
                                 // skip if option 43 is already present
                                 
return(CalloutHandle::NEXT_STEP_CONTINUE);
                         }
                 }

                 // append option 43 to PRL
                 prl->addValue(DHO_VENDOR_ENCAPSULATED_OPTIONS);

                 return(CalloutHandle::NEXT_STEP_CONTINUE);
         }

}


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

Re: [Kea-users] Force DHCP option in response

Francis Dupont
Arne Baeumler writes:
> thank you for your hint.
> I was already trying to write a hook appending Option 43 to the Pkt
> instead of the PRL ... ;-)

=> it should work too but the advantage of dealing with the PRL is
you will get the expected result if the option 43 is defined locally,
for instance in a class. Note the option 43 itself will change soon
in Kea because current code requires improvement (and even a fix).

> Below is the main part of the hook (in case someone else might have the
> same issue).
> Any recommendations or improvements?

=> you should check that some critical values are not 0, for instance
the result of the dynamic cast. This should make your code more robust.

Regards

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