Commit eabeb843 authored by Robert Lubos's avatar Robert Lubos Committed by Benjamin Cabé
Browse files

tests: net: dhcpv4: client: Verify that Pad option is handled



Add Pad option to the DHCP packets generated by the fake server, to
verify the client processes them correctly.

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent 45a1cf7f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_DHCPV4_LOG_LEVEL);
#include "net_private.h"

/* Sample DHCP offer (420 bytes) */
static const unsigned char offer[420] = {
static const unsigned char offer[] = {
0x02, 0x01, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xed, 0x48, 0x9e, 0x0a, 0xb8,
@@ -70,6 +70,8 @@ static const unsigned char offer[420] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* Magic cookie: DHCP */
0x63, 0x82, 0x53, 0x63,
/* [0] Pad option */
0x00,
/* [53] DHCP Message Type: OFFER */
0x35, 0x01, 0x02,
/* [1] Subnet Mask: 255.255.255.0 */
@@ -124,7 +126,7 @@ static const unsigned char offer[420] = {
};

/* Sample DHCPv4 ACK */
static const unsigned char ack[420] = {
static const unsigned char ack[] = {
0x02, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0xed, 0x48, 0x9e, 0x00, 0x00, 0x00, 0x00,
@@ -157,6 +159,8 @@ static const unsigned char ack[420] = {
0x00, 0x00, 0x00, 0x00,
/* Magic cookie: DHCP */
0x63, 0x82, 0x53, 0x63,
/* [0] Pad option */
0x00,
/* [53] DHCP Message Type: ACK */
0x35, 0x01, 0x05,
/* [58] Renewal Time Value: (21600s) 6 hours */