[En-Nut-Discussion] SVN r4206 broke DHCP with some DHCP servers

Harald Kipp harald.kipp at egnite.de
Tue Jul 3 10:13:41 CEST 2012

Hi Ole,

On 02.07.2012 23:09, Ole Reinhardt wrote:
> The new ip header check introduced in r4206 discards all incomming
> unicast ip packets, as long as the interface is not yet configured.
> But when using DHCP the interface might not yet be configured. 
> When the DHCP client now sends a DHCP_DISCOVER, the server _should_
> answer with a broadcast packet, but according to RFC1542, chapter 3.1.1
> (http://www.ietf.org/rfc/rfc1542.txt) it can also answer with a unicast
> packet.

I cannot see this. What I read is, that the reply is a broadcast, if the broadcast flag has been set in the request. This can be enabled by selecting DHCP_BROADCAST_FLAG in the Configurator.

_BUT_, the description of that flag claims: "If enabled, the client will set the broadcast flag in all outgoing messages. This is not required, because Nut/Net is able to receive UPD datagrams without configuring the interface."

> The old implementation allowed such packets to be received, but with
> r4206 this was changed.


> Is there any real need to discard unicast packets as long as our own
> interface is not yet configured?

I don't see any need to discard such packets.

> See the patch below.

Just a minor thing: If you 

> -    uint_fast8_t bcast;
> +    uint_fast8_t bcast = 0;

then you don't need to

> +            bcast = 0;

within the function.



More information about the En-Nut-Discussion mailing list