dhcp unit test: fixed 2 consts, use udp checksum 0x0000 in handcrafted packets so that CHECKSUM_CHECK_UDP==0 is not necessary

This commit is contained in:
goldsimon 2012-03-25 17:18:58 +02:00
parent e1225cec5f
commit 84d8760561
2 changed files with 7 additions and 8 deletions

View File

@ -10,12 +10,12 @@ static const u8_t broadcast[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
static const u8_t magic_cookie[] = { 0x63, 0x82, 0x53, 0x63 };
static const u8_t dhcp_offer[] = {
static u8_t dhcp_offer[] = {
0x00, 0x23, 0xc1, 0xde, 0xd0, 0x0d, // To unit
0x00, 0x0F, 0xEE, 0x30, 0xAB, 0x22, // From Remote host
0x08, 0x00, // Protocol: IP
0x45, 0x10, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00, 0x80, 0x11, 0x36, 0xcc, 0xc3, 0xaa, 0xbd, 0xab, 0xc3, 0xaa, 0xbd, 0xc8, // IP header
0x00, 0x43, 0x00, 0x44, 0x01, 0x34, 0x6a, 0xa9, // UDP header
0x00, 0x43, 0x00, 0x44, 0x01, 0x34, 0x00, 0x00, // UDP header
0x02, // Type == Boot reply
0x01, 0x06, // Hw Ethernet, 6 bytes addrlen
@ -54,12 +54,12 @@ static const u8_t dhcp_offer[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Padding
};
static const u8_t dhcp_ack[] = {
static u8_t dhcp_ack[] = {
0x00, 0x23, 0xc1, 0xde, 0xd0, 0x0d, // To unit
0x00, 0x0f, 0xEE, 0x30, 0xAB, 0x22, // From remote host
0x08, 0x00, // Proto IP
0x45, 0x10, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00, 0x80, 0x11, 0x36, 0xcc, 0xc3, 0xaa, 0xbd, 0xab, 0xc3, 0xaa, 0xbd, 0xc8, // IP header
0x00, 0x43, 0x00, 0x44, 0x01, 0x34, 0x67, 0xa8, // UDP header
0x00, 0x43, 0x00, 0x44, 0x01, 0x34, 0x00, 0x00, // UDP header
0x02, // Bootp reply
0x01, 0x06, // Hw type Eth, len 6
0x00, // 0 hops
@ -563,7 +563,7 @@ START_TEST(test_dhcp_relayed)
0x01, 0x38, 0xfd, 0x53, 0x00, 0x00, 0x40, 0x11,
0x78, 0x46, 0x4f, 0x8a, 0x32, 0x02, 0x4f, 0x8a,
0x33, 0x05, 0x00, 0x43, 0x00, 0x44, 0x01, 0x24,
0x38, 0x72, 0x02, 0x01, 0x06, 0x00, 0x51, 0x35,
0x00, 0x00, 0x02, 0x01, 0x06, 0x00, 0x51, 0x35,
0xb6, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x4f, 0x8a, 0x33, 0x05, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xb5, 0x04, 0x01, 0x00, 0x23,
@ -607,7 +607,7 @@ START_TEST(test_dhcp_relayed)
0x01, 0x38, 0xfd, 0x55, 0x00, 0x00, 0x40, 0x11,
0x78, 0x44, 0x4f, 0x8a, 0x32, 0x02, 0x4f, 0x8a,
0x33, 0x05, 0x00, 0x43, 0x00, 0x44, 0x01, 0x24,
0x35, 0x71, 0x02, 0x01, 0x06, 0x00, 0x51, 0x35,
0x00, 0x00, 0x02, 0x01, 0x06, 0x00, 0x51, 0x35,
0xb6, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x4f, 0x8a, 0x33, 0x05, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xb5, 0x04, 0x01, 0x00, 0x23,
@ -652,7 +652,7 @@ START_TEST(test_dhcp_relayed)
0x01, 0x38, 0xfa, 0x18, 0x00, 0x00, 0x40, 0x11,
0x7b, 0x81, 0x4f, 0x8a, 0x32, 0x02, 0x4f, 0x8a,
0x33, 0x05, 0x00, 0x43, 0x00, 0x44, 0x01, 0x24,
0x02, 0x6b, 0x02, 0x01, 0x06, 0x00, 0x49, 0x8b,
0x00, 0x00, 0x02, 0x01, 0x06, 0x00, 0x49, 0x8b,
0x6e, 0xab, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x8a,
0x33, 0x05, 0x4f, 0x8a, 0x33, 0x05, 0x00, 0x00,
0x00, 0x00, 0x0a, 0xb5, 0x04, 0x01, 0x00, 0x23,

View File

@ -39,7 +39,6 @@
/* Enable DHCP to test it, disable UDP checksum to easier inject packets */
#define LWIP_DHCP 1
#define CHECKSUM_CHECK_UDP 0
/* Minimal changes to opt.h required for tcp unit tests: */
#define MEM_SIZE 16000