aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/common.h')
-rw-r--r--networking/udhcp/common.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 49a0b593d..3ef371a7c 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -20,8 +20,11 @@ extern const uint8_t MAC_BCAST_ADDR[6] ALIGN2; /* six all-ones */
20 20
21/*** DHCP packet ***/ 21/*** DHCP packet ***/
22 22
23#define RFC1048_MAGIC 0x63825363
24/* RFC 1048 still uses BOOTP's small buffer (4 byte cookie + 60 the rest) */
25#define RFC1048_OPTIONS_BUFSIZE 60
26
23/* DHCP protocol. See RFC 2131 */ 27/* DHCP protocol. See RFC 2131 */
24#define DHCP_MAGIC 0x63825363
25#define DHCP_OPTIONS_BUFSIZE 308 28#define DHCP_OPTIONS_BUFSIZE 308
26#define BOOTREQUEST 1 29#define BOOTREQUEST 1
27#define BOOTREPLY 2 30#define BOOTREPLY 2
@@ -57,8 +60,10 @@ struct dhcp_packet {
57 * such as 'unix' or 'gateway'; this means 'boot the named program 60 * such as 'unix' or 'gateway'; this means 'boot the named program
58 * configured for my machine'" 61 * configured for my machine'"
59 */ 62 */
60 /* BOOTP fields end here, BOOTP says optional uint8_t vend[64] follows */ 63 /* BOOTP fields end here, BOOTP says optional uint8_t vend[64] follows. */
61 uint32_t cookie; /* DHCP magic bytes: 99,130,83,99 decimal */ 64 /* RFC 1048 defined this cookie value and options 0-12 and 255. */
65 /* DHCP extended it and required option 255 (END) to be always present. */
66 uint32_t cookie; /* RFC 1048 magic bytes: 99,130,83,99 decimal */
62 uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS]; 67 uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS];
63}; 68};
64#define DHCP_PKT_SNAME_LEN 64 69#define DHCP_PKT_SNAME_LEN 64
@@ -200,6 +205,9 @@ struct dhcp_scan_state {
200#define SNAME_FIELD 2 205#define SNAME_FIELD 2
201 206
202/* DHCP_MESSAGE_TYPE values */ 207/* DHCP_MESSAGE_TYPE values */
208#if ENABLE_FEATURE_UDHCPD_BOOTP
209#define MSGTYPE_BOOTP 0 /* there was no TYPE option in client's packet, assuming BOOTP */
210#endif
203#define DHCPDISCOVER 1 /* client -> server */ 211#define DHCPDISCOVER 1 /* client -> server */
204#define DHCPOFFER 2 /* client <- server */ 212#define DHCPOFFER 2 /* client <- server */
205#define DHCPREQUEST 3 /* client -> server */ 213#define DHCPREQUEST 3 /* client -> server */