Skip to content

Commit eabeb84

Browse files
rluboskartben
authored andcommitted
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: Robert Lubos <robert.lubos@nordicsemi.no>
1 parent 45a1cf7 commit eabeb84

File tree

1 file changed

+6
-2
lines changed
  • tests/net/dhcpv4/client/src

1 file changed

+6
-2
lines changed

tests/net/dhcpv4/client/src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_DHCPV4_LOG_LEVEL);
3737
#include "net_private.h"
3838

3939
/* Sample DHCP offer (420 bytes) */
40-
static const unsigned char offer[420] = {
40+
static const unsigned char offer[] = {
4141
0x02, 0x01, 0x06, 0x00, 0x00, 0x00,
4242
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4343
0x00, 0x00, 0x0a, 0xed, 0x48, 0x9e, 0x0a, 0xb8,
@@ -70,6 +70,8 @@ static const unsigned char offer[420] = {
7070
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7171
/* Magic cookie: DHCP */
7272
0x63, 0x82, 0x53, 0x63,
73+
/* [0] Pad option */
74+
0x00,
7375
/* [53] DHCP Message Type: OFFER */
7476
0x35, 0x01, 0x02,
7577
/* [1] Subnet Mask: 255.255.255.0 */
@@ -124,7 +126,7 @@ static const unsigned char offer[420] = {
124126
};
125127

126128
/* Sample DHCPv4 ACK */
127-
static const unsigned char ack[420] = {
129+
static const unsigned char ack[] = {
128130
0x02, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
129131
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130132
0x0a, 0xed, 0x48, 0x9e, 0x00, 0x00, 0x00, 0x00,
@@ -157,6 +159,8 @@ static const unsigned char ack[420] = {
157159
0x00, 0x00, 0x00, 0x00,
158160
/* Magic cookie: DHCP */
159161
0x63, 0x82, 0x53, 0x63,
162+
/* [0] Pad option */
163+
0x00,
160164
/* [53] DHCP Message Type: ACK */
161165
0x35, 0x01, 0x05,
162166
/* [58] Renewal Time Value: (21600s) 6 hours */

0 commit comments

Comments
 (0)