diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-04 01:50:42 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-04 01:50:42 +0200 |
| commit | 8aa626ffffbe7f7dfa6db8a37a0f841ce777085d (patch) | |
| tree | a95ae70b60e39900a2f82b273f18739ec9200539 | |
| parent | d7e39f26d711b5736a3a478b0d8b353c0c02e958 (diff) | |
| download | busybox-w32-8aa626ffffbe7f7dfa6db8a37a0f841ce777085d.tar.gz busybox-w32-8aa626ffffbe7f7dfa6db8a37a0f841ce777085d.tar.bz2 busybox-w32-8aa626ffffbe7f7dfa6db8a37a0f841ce777085d.zip | |
udhcp: add comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | networking/udhcp/common.h | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index ca778dab8..e374771cb 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h | |||
| @@ -38,13 +38,27 @@ struct dhcp_packet { | |||
| 38 | #define BROADCAST_FLAG 0x8000 /* "I need broadcast replies" */ | 38 | #define BROADCAST_FLAG 0x8000 /* "I need broadcast replies" */ |
| 39 | uint32_t ciaddr; /* client IP (if client is in BOUND, RENEW or REBINDING state) */ | 39 | uint32_t ciaddr; /* client IP (if client is in BOUND, RENEW or REBINDING state) */ |
| 40 | uint32_t yiaddr; /* 'your' (client) IP address */ | 40 | uint32_t yiaddr; /* 'your' (client) IP address */ |
| 41 | /* IP address of next server to use in bootstrap, returned in DHCPOFFER, DHCPACK by server */ | 41 | /* IP address of "next server" (usually meant to be an TFTP server) |
| 42 | * to use in bootstrap, returned in DHCPOFFER, DHCPACK by server: */ | ||
| 42 | uint32_t siaddr_nip; | 43 | uint32_t siaddr_nip; |
| 43 | uint32_t gateway_nip; /* aka 'giaddr': relay agent IP address */ | 44 | /* RFC 951 (BOOTP): "place my (server) IP address in the 'siaddr' field" |
| 45 | * (IOW: unconditionally, not just if we are also a TFTP server). | ||
| 46 | * DHCP servers don't have to do this, they add SERVER_ID option | ||
| 47 | * to their reply packets to let client identify lease-giving server. | ||
| 48 | */ | ||
| 49 | uint32_t gateway_nip; /* aka 'giaddr': relay agent IP address, else 0 */ | ||
| 44 | uint8_t chaddr[16]; /* link-layer client hardware address (MAC) */ | 50 | uint8_t chaddr[16]; /* link-layer client hardware address (MAC) */ |
| 45 | uint8_t sname[64]; /* server host name (ASCIZ) */ | 51 | uint8_t sname[64]; /* server host name (ASCIZ) */ |
| 52 | /* RFC 951 (BOOTP): "If the client wishes to restrict booting | ||
| 53 | * to a particular server name, it may place [it] in 'sname'" | ||
| 54 | */ | ||
| 46 | uint8_t file[128]; /* boot file name (ASCIZ) */ | 55 | uint8_t file[128]; /* boot file name (ASCIZ) */ |
| 47 | uint32_t cookie; /* fixed first four option bytes (99,130,83,99 dec) */ | 56 | /* RFC 951 (BOOTP): in client requests, "...can be a 'generic' name |
| 57 | * such as 'unix' or 'gateway'; this means 'boot the named program | ||
| 58 | * configured for my machine'" | ||
| 59 | */ | ||
| 60 | /* BOOTP fields end here, BOOTP says optional uint8_t vend[64] follows */ | ||
| 61 | uint32_t cookie; /* DHCP magic bytes: 99,130,83,99 decimal */ | ||
| 48 | uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS]; | 62 | uint8_t options[DHCP_OPTIONS_BUFSIZE + CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS]; |
| 49 | }; | 63 | }; |
| 50 | #define DHCP_PKT_SNAME_LEN 64 | 64 | #define DHCP_PKT_SNAME_LEN 64 |
| @@ -142,18 +156,21 @@ struct dhcp_scan_state { | |||
| 142 | //#define DHCP_NTP_SERVER 0x2a | 156 | //#define DHCP_NTP_SERVER 0x2a |
| 143 | //#define DHCP_WINS_SERVER 0x2c | 157 | //#define DHCP_WINS_SERVER 0x2c |
| 144 | #define DHCP_REQUESTED_IP 0x32 /* 50: sent by client if specific IP is wanted */ | 158 | #define DHCP_REQUESTED_IP 0x32 /* 50: sent by client if specific IP is wanted */ |
| 145 | #define DHCP_LEASE_TIME 0x33 /* 51: */ | 159 | #define DHCP_LEASE_TIME 0x33 /* 51: 32bit big-endian */ |
| 146 | #define DHCP_OPTION_OVERLOAD 0x34 /* 52: */ | 160 | #define DHCP_OPTION_OVERLOAD 0x34 /* 52: 1 byte */ |
| 147 | #define DHCP_MESSAGE_TYPE 0x35 /* 53: */ | 161 | #define DHCP_MESSAGE_TYPE 0x35 /* 53: 1 byte */ |
| 148 | #define DHCP_SERVER_ID 0x36 /* 54: server's IP */ | 162 | #define DHCP_SERVER_ID 0x36 /* 54: server's IP */ |
| 149 | #define DHCP_PARAM_REQ 0x37 /* 55: list of options client wants */ | 163 | #define DHCP_PARAM_REQ 0x37 /* 55: list of options client wants */ |
| 150 | //#define DHCP_ERR_MESSAGE 0x38 /* 56: error message when sending NAK etc */ | 164 | //#define DHCP_ERR_MESSAGE 0x38 /* 56: error message when sending NAK etc */ |
| 151 | #define DHCP_MAX_SIZE 0x39 /* 57: */ | 165 | #define DHCP_MAX_SIZE 0x39 /* 57: 16bit big-endian */ |
| 166 | // 0x3a /* 58: from server: renew time, 32bit big-endian */ | ||
| 167 | // 0x3b /* 59: from server: rebind time, 32bit big-endian */ | ||
| 152 | #define DHCP_VENDOR 0x3c /* 60: client's vendor (a string) */ | 168 | #define DHCP_VENDOR 0x3c /* 60: client's vendor (a string) */ |
| 153 | #define DHCP_CLIENT_ID 0x3d /* 61: by default client's MAC addr, but may be arbitrarily long */ | 169 | #define DHCP_CLIENT_ID 0x3d /* 61: by default client's MAC addr, but may be arbitrarily long */ |
| 154 | //#define DHCP_TFTP_SERVER_NAME 0x42 /* 66: same as 'sname' field */ | 170 | //#define DHCP_TFTP_SERVER_NAME 0x42 /* 66: same as 'sname' field */ |
| 155 | //#define DHCP_BOOT_FILE 0x43 /* 67: same as 'file' field */ | 171 | //#define DHCP_BOOT_FILE 0x43 /* 67: same as 'file' field */ |
| 156 | //#define DHCP_USER_CLASS 0x4d /* 77: RFC 3004. set of LASCII strings. "I am a printer" etc */ | 172 | //#define DHCP_USER_CLASS 0x4d /* 77: RFC 3004. set of LASCII strings. "I am a printer" etc */ |
| 173 | // 0x50 /* 80: rapid commit ("I'm ok with getting immediate ACK, not just OFFER"), 0 bytes */ | ||
| 157 | #define DHCP_FQDN 0x51 /* 81: client asks to update DNS to map its FQDN to its new IP */ | 174 | #define DHCP_FQDN 0x51 /* 81: client asks to update DNS to map its FQDN to its new IP */ |
| 158 | //#define DHCP_PCODE 0x64 /* 100: RFC 4833. IEEE 1003.1 TZ string */ | 175 | //#define DHCP_PCODE 0x64 /* 100: RFC 4833. IEEE 1003.1 TZ string */ |
| 159 | //#define DHCP_TCODE 0x65 /* 101: RFC 4833. Reference to the TZ database string */ | 176 | //#define DHCP_TCODE 0x65 /* 101: RFC 4833. Reference to the TZ database string */ |
