mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-12 21:41:28 +00:00
pack the fields in dhcp_msg.This way DHCP works on non-byte aligned archs too.
This commit is contained in:
parent
6ef24c4e48
commit
8b9a303e21
@ -51,32 +51,32 @@ PACK_STRUCT_BEGIN
|
||||
// minimum set of fields of any DHCP message
|
||||
struct dhcp_msg
|
||||
{
|
||||
u8_t op;
|
||||
u8_t htype;
|
||||
u8_t hlen;
|
||||
u8_t hops;
|
||||
u32_t xid;
|
||||
u16_t secs;
|
||||
u16_t flags;
|
||||
u32_t ciaddr;
|
||||
u32_t yiaddr;
|
||||
u32_t siaddr;
|
||||
u32_t giaddr;
|
||||
PACK_STRUCT_FIELD(u8_t op);
|
||||
PACK_STRUCT_FIELD(u8_t htype);
|
||||
PACK_STRUCT_FIELD(u8_t hlen);
|
||||
PACK_STRUCT_FIELD(u8_t hops);
|
||||
PACK_STRUCT_FIELD(u32_t xid);
|
||||
PACK_STRUCT_FIELD(u16_t secs);
|
||||
PACK_STRUCT_FIELD(u16_t flags);
|
||||
PACK_STRUCT_FIELD(u32_t ciaddr);
|
||||
PACK_STRUCT_FIELD(u32_t yiaddr);
|
||||
PACK_STRUCT_FIELD(u32_t siaddr);
|
||||
PACK_STRUCT_FIELD(u32_t giaddr);
|
||||
#define DHCP_CHADDR_LEN 16U
|
||||
u8_t chaddr[DHCP_CHADDR_LEN];
|
||||
PACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]);
|
||||
#define DHCP_SNAME_LEN 64U
|
||||
u8_t sname[DHCP_SNAME_LEN];
|
||||
PACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]);
|
||||
#define DHCP_FILE_LEN 128U
|
||||
u8_t file[DHCP_FILE_LEN];
|
||||
u32_t cookie;
|
||||
PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]);
|
||||
PACK_STRUCT_FIELD(u32_t cookie);
|
||||
#define DHCP_MIN_OPTIONS_LEN 68U
|
||||
// allow this to be configured in lwipopts.h, but not too small
|
||||
#if ((!defined(DHCP_OPTIONS_LEN)) || (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN))
|
||||
// set this to be sufficient for your options in outgoing DHCP msgs
|
||||
# define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN
|
||||
#endif
|
||||
u8_t options[DHCP_OPTIONS_LEN];
|
||||
};
|
||||
PACK_STRUCT_FIELD(u8_t options[DHCP_OPTIONS_LEN]);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
@ -97,13 +97,11 @@ void dhcp_inform(struct netif *netif);
|
||||
#if DHCP_DOES_ARP_CHECK
|
||||
void dhcp_arp_reply(struct ip_addr *addr);
|
||||
#endif
|
||||
// to be called regularly
|
||||
#if (DHCP_TIMER_CALLBACKS == 0)
|
||||
|
||||
// to be called every minute
|
||||
void dhcp_coarse_tmr(void);
|
||||
// to be called every half second
|
||||
void dhcp_fine_tmr(void);
|
||||
#endif
|
||||
|
||||
// DHCP message item offsets and length
|
||||
#define DHCP_MSG_OFS (UDP_DATA_OFS)
|
||||
|
Loading…
Reference in New Issue
Block a user