1 | #ifndef _BOOTP_H
|
---|
2 | #define _BOOTP_H
|
---|
3 |
|
---|
4 | #ifdef ALTERNATE_DHCP_PORTS_1067_1068
|
---|
5 | #undef NON_STANDARD_BOOTP_SERVER
|
---|
6 | #define NON_STANDARD_BOOTP_SERVER 1067
|
---|
7 | #undef NON_STANDARD_BOOTP_CLIENT
|
---|
8 | #define NON_STANDARD_BOOTP_CLIENT 1068
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #ifdef NON_STANDARD_BOOTP_SERVER
|
---|
12 | #define BOOTP_SERVER NON_STANDARD_BOOTP_SERVER
|
---|
13 | #else
|
---|
14 | #define BOOTP_SERVER 67
|
---|
15 | #endif
|
---|
16 | #ifdef NON_STANDARD_BOOTP_CLIENT
|
---|
17 | #define BOOTP_CLIENT NON_STANDARD_BOOTP_CLIENT
|
---|
18 | #else
|
---|
19 | #define BOOTP_CLIENT 68
|
---|
20 | #endif
|
---|
21 | #define PROXYDHCP_SERVER 4011 /* For PXE */
|
---|
22 | #define PXE_BOOT_SERVER 4011
|
---|
23 | #define PXE_BOOT_CLIENT 4011
|
---|
24 |
|
---|
25 | #define BOOTP_REQUEST 1
|
---|
26 | #define BOOTP_REPLY 2
|
---|
27 |
|
---|
28 | #define TAG_LEN(p) (*((p)+1))
|
---|
29 | #define RFC1533_COOKIE 99, 130, 83, 99
|
---|
30 | #define RFC1533_PAD 0
|
---|
31 | #define RFC1533_NETMASK 1
|
---|
32 | #define RFC1533_TIMEOFFSET 2
|
---|
33 | #define RFC1533_GATEWAY 3
|
---|
34 | #define RFC1533_TIMESERVER 4
|
---|
35 | #define RFC1533_IEN116NS 5
|
---|
36 | #define RFC1533_DNS 6
|
---|
37 | #define RFC1533_LOGSERVER 7
|
---|
38 | #define RFC1533_COOKIESERVER 8
|
---|
39 | #define RFC1533_LPRSERVER 9
|
---|
40 | #define RFC1533_IMPRESSSERVER 10
|
---|
41 | #define RFC1533_RESOURCESERVER 11
|
---|
42 | #define RFC1533_HOSTNAME 12
|
---|
43 | #define RFC1533_BOOTFILESIZE 13
|
---|
44 | #define RFC1533_MERITDUMPFILE 14
|
---|
45 | #define RFC1533_DOMAINNAME 15
|
---|
46 | #define RFC1533_SWAPSERVER 16
|
---|
47 | #define RFC1533_ROOTPATH 17
|
---|
48 | #define RFC1533_EXTENSIONPATH 18
|
---|
49 | #define RFC1533_IPFORWARDING 19
|
---|
50 | #define RFC1533_IPSOURCEROUTING 20
|
---|
51 | #define RFC1533_IPPOLICYFILTER 21
|
---|
52 | #define RFC1533_IPMAXREASSEMBLY 22
|
---|
53 | #define RFC1533_IPTTL 23
|
---|
54 | #define RFC1533_IPMTU 24
|
---|
55 | #define RFC1533_IPMTUPLATEAU 25
|
---|
56 | #define RFC1533_INTMTU 26
|
---|
57 | #define RFC1533_INTLOCALSUBNETS 27
|
---|
58 | #define RFC1533_INTBROADCAST 28
|
---|
59 | #define RFC1533_INTICMPDISCOVER 29
|
---|
60 | #define RFC1533_INTICMPRESPOND 30
|
---|
61 | #define RFC1533_INTROUTEDISCOVER 31
|
---|
62 | #define RFC1533_INTROUTESOLICIT 32
|
---|
63 | #define RFC1533_INTSTATICROUTES 33
|
---|
64 | #define RFC1533_LLTRAILERENCAP 34
|
---|
65 | #define RFC1533_LLARPCACHETMO 35
|
---|
66 | #define RFC1533_LLETHERNETENCAP 36
|
---|
67 | #define RFC1533_TCPTTL 37
|
---|
68 | #define RFC1533_TCPKEEPALIVETMO 38
|
---|
69 | #define RFC1533_TCPKEEPALIVEGB 39
|
---|
70 | #define RFC1533_NISDOMAIN 40
|
---|
71 | #define RFC1533_NISSERVER 41
|
---|
72 | #define RFC1533_NTPSERVER 42
|
---|
73 | #define RFC1533_VENDOR 43
|
---|
74 | #define RFC1533_NBNS 44
|
---|
75 | #define RFC1533_NBDD 45
|
---|
76 | #define RFC1533_NBNT 46
|
---|
77 | #define RFC1533_NBSCOPE 47
|
---|
78 | #define RFC1533_XFS 48
|
---|
79 | #define RFC1533_XDM 49
|
---|
80 | #ifndef NO_DHCP_SUPPORT
|
---|
81 | #define RFC2132_REQ_ADDR 50
|
---|
82 | #define RFC2132_MSG_TYPE 53
|
---|
83 | #define RFC2132_SRV_ID 54
|
---|
84 | #define RFC2132_PARAM_LIST 55
|
---|
85 | #define RFC2132_MAX_SIZE 57
|
---|
86 | #define RFC2132_VENDOR_CLASS_ID 60
|
---|
87 | #define RFC2132_CLIENT_ID 61
|
---|
88 | #define RFC2132_TFTP_SERVER_NAME 66
|
---|
89 | #define RFC2132_BOOTFILE_NAME 67
|
---|
90 | #define RFC3004_USER_CLASS 77
|
---|
91 |
|
---|
92 | #ifdef PXE_DHCP_STRICT
|
---|
93 | /*
|
---|
94 | * The following options are acknowledged in RFC3679 because they are
|
---|
95 | * widely used by PXE implementations, but have never been properly
|
---|
96 | * allocated. Despite other PXE options being correctly packed in a
|
---|
97 | * vendor encapsulated field, these are exposed. Sigh. Note that the
|
---|
98 | * client UUID (option 97) is also noted in the PXE spec as using
|
---|
99 | * option 61.
|
---|
100 | */
|
---|
101 | #define RFC3679_PXE_CLIENT_ARCH 93
|
---|
102 | #define RFC3679_PXE_CLIENT_NDI 94
|
---|
103 | #define RFC3679_PXE_CLIENT_UUID 97
|
---|
104 |
|
---|
105 | /* The lengths are fixed. */
|
---|
106 | #define RFC3679_PXE_CLIENT_ARCH_LENGTH 2
|
---|
107 | #define RFC3679_PXE_CLIENT_NDI_LENGTH 3
|
---|
108 | #define RFC3679_PXE_CLIENT_UUID_LENGTH 17
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * The following define the encapsulated vendor-specific PXE options
|
---|
112 | */
|
---|
113 | #define PXE_MTFTP_IP 1
|
---|
114 | #define PXE_MTFTP_CPORT 2
|
---|
115 | #define PXE_MTFTP_SPORT 3
|
---|
116 | #define PXE_MTFTP_TMOUT 4
|
---|
117 | #define PXE_MTFTP_DELAY 5
|
---|
118 | #define PXE_DISCOVERY_CONTROL 6
|
---|
119 | #define PXE_MCAST_ADDR 7
|
---|
120 | #define PXE_BOOT_SERVERS 8
|
---|
121 | #define PXE_BOOT_MENU 9
|
---|
122 | #define PXE_MENU_PROMPT 10
|
---|
123 | #define PXE_MCAST_ADDRS_ALLOC 11
|
---|
124 | #define PXE_CREDENTIAL_TYPES 12
|
---|
125 | #define PXE_BOOT_ITEM 71
|
---|
126 |
|
---|
127 | /*
|
---|
128 | * Values of RFC3679_PXE_CLIENT_ARCH can apparently be one of the
|
---|
129 | * following, according to the PXE spec. The spec only actually
|
---|
130 | * described the 2nd octet, not the first. Duh... assume 0.
|
---|
131 | */
|
---|
132 | #define RFC3679_PXE_CLIENT_ARCH_IAX86PC 0,0
|
---|
133 | #define RFC3679_PXE_CLIENT_ARCH_NECPC98 0,1
|
---|
134 | #define RFC3679_PXE_CLIENT_ARCH_IA64PC 0,2
|
---|
135 | #define RFC3679_PXE_CLIENT_ARCH_DECALPHA 0,3
|
---|
136 | #define RFC3679_PXE_CLIENT_ARCH_ARCX86 0,4
|
---|
137 | #define RFC3679_PXE_CLIENT_ARCH_INTELLEAN 0,5
|
---|
138 |
|
---|
139 | /*
|
---|
140 | * Only one valid value of NDI type (must be 1) and UNDI version (must
|
---|
141 | * be 2.1)
|
---|
142 | */
|
---|
143 | #define RFC3679_PXE_CLIENT_NDI_21 1,2,1
|
---|
144 |
|
---|
145 | #ifdef VBOX
|
---|
146 | /*
|
---|
147 | * UUID - type must be 0 and then 16 octets of UID, as with the client ID.
|
---|
148 | * The value is a default for testing only
|
---|
149 | */
|
---|
150 | #define RFC3679_PXE_CLIENT_UUID_TYPE 0
|
---|
151 | #define RFC3679_PXE_CLIENT_UUID_DEFAULT \
|
---|
152 | RFC3679_PXE_CLIENT_UUID_TYPE, \
|
---|
153 | 0xDE,0xAD,0xBE,0xEF, \
|
---|
154 | 0xDE,0xAD,0xBE,0xEF, \
|
---|
155 | 0xDE,0xAD,0xBE,0xEF, \
|
---|
156 | 0xDE,0xAD,0xBE,0xEF
|
---|
157 | #else /* !VBOX */
|
---|
158 | /*
|
---|
159 | * UUID - type must be 1 and then 16 octets of UID, as with the client ID.
|
---|
160 | * The value is a default for testing only
|
---|
161 | */
|
---|
162 | #define RFC3679_PXE_CLIENT_UUID_TYPE 0
|
---|
163 | #warning "UUID is a default for testing ONLY!"
|
---|
164 | #define RFC3679_PXE_CLIENT_UUID_DEFAULT \
|
---|
165 | RFC3679_PXE_CLIENT_UUID_TYPE, \
|
---|
166 | 0xDE,0xAD,0xBE,0xEF, \
|
---|
167 | 0xDE,0xAD,0xBE,0xEF, \
|
---|
168 | 0xDE,0xAD,0xBE,0xEF, \
|
---|
169 | 0xDE,0xAD,0xBE,0xEF
|
---|
170 | #endif /* !VBOX */
|
---|
171 | /*
|
---|
172 | * The Vendor Class ID. Note that the Arch and UNDI version numbers
|
---|
173 | * are fixed and must be same as the ARCH and NDI above.
|
---|
174 | */
|
---|
175 | #define RFC2132_VENDOR_CLASS_ID_PXE_LENGTH 32
|
---|
176 | #define RFC2132_VENDOR_CLASS_ID_PXE \
|
---|
177 | 'P','X','E','C','l','i','e','n','t',':', \
|
---|
178 | 'A','r','c','h',':','0','0','0','0','0',':', \
|
---|
179 | 'U','N','D','I',':','0','0','2','0','0','1'
|
---|
180 |
|
---|
181 | /*
|
---|
182 | * The following vendor options are required in the PXE spec to pull
|
---|
183 | * options for the *next* image. The PXE spec doesn't help us with
|
---|
184 | * this (like explaining why).
|
---|
185 | */
|
---|
186 | #define RFC1533_VENDOR_PXE_OPT128 128
|
---|
187 | #define RFC1533_VENDOR_PXE_OPT129 129
|
---|
188 | #define RFC1533_VENDOR_PXE_OPT130 130
|
---|
189 | #define RFC1533_VENDOR_PXE_OPT131 131
|
---|
190 | #define RFC1533_VENDOR_PXE_OPT132 132
|
---|
191 | #define RFC1533_VENDOR_PXE_OPT133 133
|
---|
192 | #define RFC1533_VENDOR_PXE_OPT134 134
|
---|
193 | #define RFC1533_VENDOR_PXE_OPT135 135
|
---|
194 |
|
---|
195 | #endif /* PXE_DHCP_STRICT */
|
---|
196 |
|
---|
197 | #define DHCPDISCOVER 1
|
---|
198 | #define DHCPOFFER 2
|
---|
199 | #define DHCPREQUEST 3
|
---|
200 | #define DHCPACK 5
|
---|
201 | #endif /* NO_DHCP_SUPPORT */
|
---|
202 |
|
---|
203 | #define RFC1533_VENDOR_MAJOR 0
|
---|
204 | #define RFC1533_VENDOR_MINOR 0
|
---|
205 |
|
---|
206 | #define RFC1533_VENDOR_MAGIC 128
|
---|
207 | #define RFC1533_VENDOR_ADDPARM 129
|
---|
208 | #define RFC1533_VENDOR_ETHDEV 130
|
---|
209 | /* We should really apply for an official Etherboot encap option */
|
---|
210 | #define RFC1533_VENDOR_ETHERBOOT_ENCAP 150
|
---|
211 | /* I'll leave it to FREEBSD to decide if they want to renumber */
|
---|
212 | #ifdef IMAGE_FREEBSD
|
---|
213 | #define RFC1533_VENDOR_HOWTO 132
|
---|
214 | #define RFC1533_VENDOR_KERNEL_ENV 133
|
---|
215 | #endif
|
---|
216 | #define RFC1533_VENDOR_NIC_DEV_ID 175
|
---|
217 | #define RFC1533_VENDOR_ARCH 177
|
---|
218 |
|
---|
219 | #define RFC1533_END 255
|
---|
220 |
|
---|
221 | #define BOOTP_VENDOR_LEN 64
|
---|
222 | #ifndef NO_DHCP_SUPPORT
|
---|
223 | #define DHCP_OPT_LEN 312
|
---|
224 | #endif /* NO_DHCP_SUPPORT */
|
---|
225 |
|
---|
226 | /* Format of a bootp packet */
|
---|
227 | struct bootp_t {
|
---|
228 | uint8_t bp_op;
|
---|
229 | uint8_t bp_htype;
|
---|
230 | uint8_t bp_hlen;
|
---|
231 | uint8_t bp_hops;
|
---|
232 | uint32_t bp_xid;
|
---|
233 | uint16_t bp_secs;
|
---|
234 | uint16_t unused;
|
---|
235 | in_addr bp_ciaddr;
|
---|
236 | in_addr bp_yiaddr;
|
---|
237 | in_addr bp_siaddr;
|
---|
238 | in_addr bp_giaddr;
|
---|
239 | uint8_t bp_hwaddr[16];
|
---|
240 | uint8_t bp_sname[64];
|
---|
241 | char bp_file[128];
|
---|
242 | #ifdef NO_DHCP_SUPPORT
|
---|
243 | uint8_t bp_vend[BOOTP_VENDOR_LEN];
|
---|
244 | #else
|
---|
245 | uint8_t bp_vend[DHCP_OPT_LEN];
|
---|
246 | #endif /* NO_DHCP_SUPPORT */
|
---|
247 | };
|
---|
248 |
|
---|
249 | /* Format of a bootp IP packet */
|
---|
250 | struct bootpip_t
|
---|
251 | {
|
---|
252 | struct iphdr ip;
|
---|
253 | struct udphdr udp;
|
---|
254 | struct bootp_t bp;
|
---|
255 | };
|
---|
256 |
|
---|
257 | /* Format of bootp packet with extensions */
|
---|
258 | struct bootpd_t {
|
---|
259 | struct bootp_t bootp_reply;
|
---|
260 | uint8_t bootp_extension[MAX_BOOTP_EXTLEN];
|
---|
261 | };
|
---|
262 |
|
---|
263 | #endif /* _BOOTP_H */
|
---|