[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] DHCP requesting additional options via option 55
From: |
Craig McQueen |
Subject: |
Re: [lwip-users] DHCP requesting additional options via option 55 |
Date: |
Tue, 13 Nov 2018 05:10:32 +0000 |
I wrote:
>
> I have tried using LWIP_HOOK_DHCP_APPEND_OPTIONS() and
> LWIP_HOOK_DHCP_PARSE_OPTION() to request additional DHCP options
> from the server, using DHCP option 55
> (DHCP_OPTION_PARAMETER_REQUEST_LIST).
>
> At first I thought it was working fine. But on closer examination, it seems
> the
> server is not sending all requested options (e.g. options 3 and 6). That is
> evidently because the DHCP request contains the option 55 twice (once from
> the lwIP core code, a second time from my
> LWIP_HOOK_DHCP_APPEND_OPTIONS()). According to the DHCP RFC 2131, "
> Options may appear only once, unless otherwise specified in the options
> document." So I guess the DHCP server (Microsoft in this case) is ignoring the
> first occurrence of option 55.
>
> So, it would be good to improve the DHCP hook mechanism so that user code
> can request additional options via option 55, without duplicating the option
> contrary to the RFC. Ideally, it could be dynamic not a static array, so the
> user
> code could decide at run-time which additional options are requested.
>
> What would be a good way to improve the hook mechanism?
>
> (I'm interested in contributing some code back to the lwIP project, as long as
> I have a rough idea what would be accepted.)
I worked out that in LWIP_HOOK_DHCP_APPEND_OPTIONS(), I can actually do a
search through the existing options in msg->options[], looking for any
pre-existing DHCP_OPTION_PARAMETER_REQUEST_LIST. Then I can insert the extra
options into it. It's a bit fiddly, but I've got it working. Does that sound
like a reasonable thing to do in LWIP_HOOK_DHCP_APPEND_OPTIONS()?
--
Craig McQueen