DHCP Client bug found


#1

While using the latest ioLibrary with the WIZ830MJ interface, a problem was found related to the use of the “magic cookie” value. In the dhcp.h file there is a define as shown below.
#define MAGIC_COOKIE 0x63825363 ///< Any number. You can be modifyed it any number.

This statement is not correct. The magic cookie MUST BE 0x63825363, or else the DHCP client will not work. RFC2131, section 3. The Client-Server Protocol, states;
The first four octets of the ‘options’ field of the DHCP message
contain the (decimal) values 99, 130, 83 and 99, respectively (this
is the same magic cookie as is defined in RFC 1497 [17]). So, 0x63825363 is the hex value for 99,130,83,99 shown above.
It took me 2 days to find this problem, because I read the comment in the dhcp.h file and decided to change the magic cookie to something clever. Big Mistake! So who ever it is that writes or supports this code should remove that comment. It is completely wrong to make that statement, and violates RFC2131 if you do change it.

User beware…