2 * Routines for BOOTP/DHCP packet disassembly
3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * $Id: packet-bootp.c,v 1.75 2003/09/02 22:47:57 guy Exp $
7 * The information used comes from:
8 * RFC 951: Bootstrap Protocol
9 * RFC 1497: BOOTP extensions
10 * RFC 1542: Clarifications and Extensions for the Bootstrap Protocol
11 * RFC 2131: Dynamic Host Configuration Protocol
12 * RFC 2132: DHCP Options and BOOTP Vendor Extensions
13 * RFC 2489: Procedure for Defining New DHCP Options
14 * RFC 3046: DHCP Relay Agent Information Option
15 * RFC 3118: Authentication for DHCP Messages
16 * RFC 3203: DHCP reconfigure extension
17 * BOOTP and DHCP Parameters
18 * http://www.iana.org/assignments/bootp-dhcp-parameters
20 * Ethereal - Network traffic analyzer
21 * By Gerald Combs <gerald@ethereal.com>
22 * Copyright 1998 Gerald Combs
24 * This program is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU General Public License
26 * as published by the Free Software Foundation; either version 2
27 * of the License, or (at your option) any later version.
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free Software
36 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45 #include <epan/int-64bit.h>
46 #include <epan/packet.h>
47 #include "packet-arp.h"
51 static int bootp_dhcp_tap = -1;
52 static int proto_bootp = -1;
53 static int hf_bootp_type = -1;
54 static int hf_bootp_hw_type = -1;
55 static int hf_bootp_hw_len = -1;
56 static int hf_bootp_hops = -1;
57 static int hf_bootp_id = -1;
58 static int hf_bootp_secs = -1;
59 static int hf_bootp_flags = -1;
60 static int hf_bootp_flags_broadcast = -1;
61 static int hf_bootp_flags_reserved = -1;
62 static int hf_bootp_ip_client = -1;
63 static int hf_bootp_ip_your = -1;
64 static int hf_bootp_ip_server = -1;
65 static int hf_bootp_ip_relay = -1;
66 static int hf_bootp_hw_addr = -1;
67 static int hf_bootp_server = -1;
68 static int hf_bootp_file = -1;
69 static int hf_bootp_cookie = -1;
70 static int hf_bootp_vendor = -1;
71 static int hf_bootp_dhcp = -1;
73 static guint ett_bootp = -1;
74 static guint ett_bootp_flags = -1;
75 static guint ett_bootp_option = -1;
77 #define UDP_PORT_BOOTPS 67
78 #define UDP_PORT_BOOTPC 68
80 #define BOOTP_BC 0x8000
81 #define BOOTP_MBZ 0x7FFF
83 enum field_type { none, ipv4, string, toggle, yes_no, special, opaque,
85 val_u_byte, val_u_short, val_u_le_short, val_u_long,
90 enum field_type ftype;
93 static const true_false_string flag_set_broadcast = {
98 #define NUM_OPT_INFOS 211
99 #define NUM_O63_SUBOPTS 11
101 static int dissect_vendor_pxeclient_suboption(proto_tree *v_tree, tvbuff_t *tvb,
103 static int dissect_netware_ip_suboption(proto_tree *v_tree, tvbuff_t *tvb,
105 static int bootp_dhcp_decode_agent_info(proto_tree *v_tree, tvbuff_t *tvb,
109 get_dhcp_type(guint8 byte)
111 static const char *opt53_text[] = {
112 "Unknown Message Type",
125 if (byte > 0 && byte < (sizeof opt53_text / sizeof opt53_text[0]))
129 return opt53_text[i];
132 /* DHCP Authentication protocols */
133 #define AUTHEN_PROTO_CONFIG_TOKEN 0
134 #define AUTHEN_PROTO_DELAYED_AUTHEN 1
136 /* DHCP Authentication algorithms for delayed authentication */
137 #define AUTHEN_DELAYED_ALGO_HMAC_MD5 1
139 /* DHCP Authentication Replay Detection Methods */
140 #define AUTHEN_RDM_MONOTONIC_COUNTER 0x00
142 /* DHCP Option Overload (option code 52) */
143 #define OPT_OVERLOAD_FILE 1
144 #define OPT_OVERLOAD_SNAME 2
145 #define OPT_OVERLOAD_BOTH 3
147 /* Server name and boot file offsets and lengths */
148 #define SERVER_NAME_OFFSET 44
149 #define SERVER_NAME_LEN 64
150 #define FILE_NAME_OFFSET 108
151 #define FILE_NAME_LEN 128
152 #define VENDOR_INFO_OFFSET 236
154 /* Returns the number of bytes consumed by this option. */
156 bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
157 gboolean first_pass, gboolean *at_end, const char **dhcp_type_p,
158 const guint8 **vendor_class_id_p)
161 enum field_type ftype;
162 guchar code = tvb_get_guint8(tvb, voff);
165 int i,optp, consumed;
167 proto_tree *v_tree, *o52tree;
172 int o52voff, o52eoff;
175 static const value_string nbnt_vals[] = {
182 static const value_string authen_protocol_vals[] = {
183 {AUTHEN_PROTO_CONFIG_TOKEN, "configuration token" },
184 {AUTHEN_PROTO_DELAYED_AUTHEN, "delayed authentication" },
187 static const value_string authen_da_algo_vals[] = {
188 {AUTHEN_DELAYED_ALGO_HMAC_MD5, "HMAC_MD5" },
191 static const value_string authen_rdm_vals[] = {
192 {AUTHEN_RDM_MONOTONIC_COUNTER, "Monotonically-increasing counter" },
195 static const value_string opt_overload_vals[] = {
196 { OPT_OVERLOAD_FILE, "Boot file name holds options", },
197 { OPT_OVERLOAD_SNAME, "Server host name holds options", },
198 { OPT_OVERLOAD_BOTH, "Boot file and server host names hold options" },
201 static struct opt_info opt[] = {
202 /* 0 */ { "Padding", none },
203 /* 1 */ { "Subnet Mask", ipv4 },
204 /* 2 */ { "Time Offset", val_s_long },
205 /* 3 */ { "Router", ipv4 },
206 /* 4 */ { "Time Server", ipv4 },
207 /* 5 */ { "Name Server", ipv4 },
208 /* 6 */ { "Domain Name Server", ipv4 },
209 /* 7 */ { "Log Server", ipv4 },
210 /* 8 */ { "Cookie Server", ipv4 },
211 /* 9 */ { "LPR Server", ipv4 },
212 /* 10 */ { "Impress Server", ipv4 },
213 /* 11 */ { "Resource Location Server", ipv4 },
214 /* 12 */ { "Host Name", string },
215 /* 13 */ { "Boot File Size", val_u_short },
216 /* 14 */ { "Merit Dump File", string },
217 /* 15 */ { "Domain Name", string },
218 /* 16 */ { "Swap Server", ipv4 },
219 /* 17 */ { "Root Path", string },
220 /* 18 */ { "Extensions Path", string },
221 /* 19 */ { "IP Forwarding", toggle },
222 /* 20 */ { "Non-Local Source Routing", toggle },
223 /* 21 */ { "Policy Filter", special },
224 /* 22 */ { "Maximum Datagram Reassembly Size", val_u_short },
225 /* 23 */ { "Default IP Time-to-Live", val_u_byte },
226 /* 24 */ { "Path MTU Aging Timeout", time_in_secs },
227 /* 25 */ { "Path MTU Plateau Table", val_u_short },
228 /* 26 */ { "Interface MTU", val_u_short },
229 /* 27 */ { "All Subnets are Local", yes_no },
230 /* 28 */ { "Broadcast Address", ipv4 },
231 /* 29 */ { "Perform Mask Discovery", toggle },
232 /* 30 */ { "Mask Supplier", yes_no },
233 /* 31 */ { "Perform Router Discover", toggle },
234 /* 32 */ { "Router Solicitation Address", ipv4 },
235 /* 33 */ { "Static Route", special },
236 /* 34 */ { "Trailer Encapsulation", toggle },
237 /* 35 */ { "ARP Cache Timeout", time_in_secs },
238 /* 36 */ { "Ethernet Encapsulation", toggle },
239 /* 37 */ { "TCP Default TTL", val_u_byte },
240 /* 38 */ { "TCP Keepalive Interval", time_in_secs },
241 /* 39 */ { "TCP Keepalive Garbage", toggle },
242 /* 40 */ { "Network Information Service Domain", string },
243 /* 41 */ { "Network Information Service Servers", ipv4 },
244 /* 42 */ { "Network Time Protocol Servers", ipv4 },
245 /* 43 */ { "Vendor-Specific Information", special },
246 /* 44 */ { "NetBIOS over TCP/IP Name Server", ipv4 },
247 /* 45 */ { "NetBIOS over TCP/IP Datagram Distribution Name Server", ipv4 },
248 /* 46 */ { "NetBIOS over TCP/IP Node Type", special },
249 /* 47 */ { "NetBIOS over TCP/IP Scope", string },
250 /* 48 */ { "X Window System Font Server", ipv4 },
251 /* 49 */ { "X Window System Display Manager", ipv4 },
252 /* 50 */ { "Requested IP Address", ipv4 },
253 /* 51 */ { "IP Address Lease Time", time_in_secs },
254 /* 52 */ { "Option Overload", special },
255 /* 53 */ { "DHCP Message Type", special },
256 /* 54 */ { "Server Identifier", ipv4 },
257 /* 55 */ { "Parameter Request List", special },
258 /* 56 */ { "Message", string },
259 /* 57 */ { "Maximum DHCP Message Size", val_u_short },
260 /* 58 */ { "Renewal Time Value", time_in_secs },
261 /* 59 */ { "Rebinding Time Value", time_in_secs },
262 /* 60 */ { "Vendor class identifier", special },
263 /* 61 */ { "Client identifier", special },
264 /* 62 */ { "Novell/Netware IP domain", string },
265 /* 63 */ { "Novell Options", special },
266 /* 64 */ { "Network Information Service+ Domain", string },
267 /* 65 */ { "Network Information Service+ Servers", ipv4 },
268 /* 66 */ { "TFTP Server Name", string },
269 /* 67 */ { "Bootfile name", string },
270 /* 68 */ { "Mobile IP Home Agent", ipv4 },
271 /* 69 */ { "SMTP Server", ipv4 },
272 /* 70 */ { "POP3 Server", ipv4 },
273 /* 71 */ { "NNTP Server", ipv4 },
274 /* 72 */ { "Default WWW Server", ipv4 },
275 /* 73 */ { "Default Finger Server", ipv4 },
276 /* 74 */ { "Default IRC Server", ipv4 },
277 /* 75 */ { "StreetTalk Server", ipv4 },
278 /* 76 */ { "StreetTalk Directory Assistance Server", ipv4 },
279 /* 77 */ { "User Class Information", opaque },
280 /* 78 */ { "Directory Agent Information", opaque },
281 /* 79 */ { "Service Location Agent Scope", opaque },
282 /* 80 */ { "Naming Authority", opaque },
283 /* 81 */ { "Client Fully Qualified Domain Name", opaque },
284 /* 82 */ { "Agent Information Option", special },
285 /* 83 */ { "Unassigned", opaque },
286 /* 84 */ { "Unassigned", opaque },
287 /* 85 */ { "Novell Directory Services Servers", opaque },
288 /* 86 */ { "Novell Directory Services Tree Name", opaque },
289 /* 87 */ { "Novell Directory Services Context", opaque },
290 /* 88 */ { "IEEE 1003.1 POSIX Timezone", opaque },
291 /* 89 */ { "Fully Qualified Domain Name", opaque },
292 /* 90 */ { "Authentication", special },
293 /* 91 */ { "Vines TCP/IP Server Option", opaque },
294 /* 92 */ { "Server Selection Option", opaque },
295 /* 93 */ { "Client System Architecture", opaque },
296 /* 94 */ { "Client Network Device Interface", opaque },
297 /* 95 */ { "Lightweight Directory Access Protocol", opaque },
298 /* 96 */ { "IPv6 Transitions", opaque },
299 /* 97 */ { "UUID/GUID-based Client Identifier", opaque },
300 /* 98 */ { "Open Group's User Authentication", opaque },
301 /* 99 */ { "Unassigned", opaque },
302 /* 100 */ { "Printer Name", opaque },
303 /* 101 */ { "MDHCP multicast address", opaque },
304 /* 102 */ { "Removed/unassigned", opaque },
305 /* 103 */ { "Removed/unassigned", opaque },
306 /* 104 */ { "Removed/unassigned", opaque },
307 /* 105 */ { "Removed/unassigned", opaque },
308 /* 106 */ { "Removed/unassigned", opaque },
309 /* 107 */ { "Removed/unassigned", opaque },
310 /* 108 */ { "Swap Path Option", opaque },
311 /* 109 */ { "Unassigned", opaque },
312 /* 110 */ { "IPX Compability", opaque },
313 /* 111 */ { "Unassigned", opaque },
314 /* 112 */ { "NetInfo Parent Server Address", ipv4 },
315 /* 113 */ { "NetInfo Parent Server Tag", string },
316 /* 114 */ { "URL", opaque },
317 /* 115 */ { "DHCP Failover Protocol", opaque },
318 /* 116 */ { "DHCP Auto-Configuration", opaque },
319 /* 117 */ { "Unassigned", opaque },
320 /* 118 */ { "Unassigned", opaque },
321 /* 119 */ { "Unassigned", opaque },
322 /* 120 */ { "Unassigned", opaque },
323 /* 121 */ { "Unassigned", opaque },
324 /* 122 */ { "Unassigned", opaque },
325 /* 123 */ { "Unassigned", opaque },
326 /* 124 */ { "Unassigned", opaque },
327 /* 125 */ { "Unassigned", opaque },
328 /* 126 */ { "Extension", opaque },
329 /* 127 */ { "Extension", opaque },
330 /* 128 */ { "Private", opaque },
331 /* 129 */ { "Private", opaque },
332 /* 130 */ { "Private", opaque },
333 /* 131 */ { "Private", opaque },
334 /* 132 */ { "Private", opaque },
335 /* 133 */ { "Private", opaque },
336 /* 134 */ { "Private", opaque },
337 /* 135 */ { "Private", opaque },
338 /* 136 */ { "Private", opaque },
339 /* 137 */ { "Private", opaque },
340 /* 138 */ { "Private", opaque },
341 /* 139 */ { "Private", opaque },
342 /* 140 */ { "Private", opaque },
343 /* 141 */ { "Private", opaque },
344 /* 142 */ { "Private", opaque },
345 /* 143 */ { "Private", opaque },
346 /* 144 */ { "Private", opaque },
347 /* 145 */ { "Private", opaque },
348 /* 146 */ { "Private", opaque },
349 /* 147 */ { "Private", opaque },
350 /* 148 */ { "Private", opaque },
351 /* 149 */ { "Private", opaque },
352 /* 150 */ { "Private", opaque },
353 /* 151 */ { "Private", opaque },
354 /* 152 */ { "Private", opaque },
355 /* 153 */ { "Private", opaque },
356 /* 154 */ { "Private", opaque },
357 /* 155 */ { "Private", opaque },
358 /* 156 */ { "Private", opaque },
359 /* 157 */ { "Private", opaque },
360 /* 158 */ { "Private", opaque },
361 /* 159 */ { "Private", opaque },
362 /* 160 */ { "Private", opaque },
363 /* 161 */ { "Private", opaque },
364 /* 162 */ { "Private", opaque },
365 /* 163 */ { "Private", opaque },
366 /* 164 */ { "Private", opaque },
367 /* 165 */ { "Private", opaque },
368 /* 166 */ { "Private", opaque },
369 /* 167 */ { "Private", opaque },
370 /* 168 */ { "Private", opaque },
371 /* 169 */ { "Private", opaque },
372 /* 170 */ { "Private", opaque },
373 /* 171 */ { "Private", opaque },
374 /* 172 */ { "Private", opaque },
375 /* 173 */ { "Private", opaque },
376 /* 174 */ { "Private", opaque },
377 /* 175 */ { "Private", opaque },
378 /* 176 */ { "Private", opaque },
379 /* 177 */ { "Private", opaque },
380 /* 178 */ { "Private", opaque },
381 /* 179 */ { "Private", opaque },
382 /* 180 */ { "Private", opaque },
383 /* 181 */ { "Private", opaque },
384 /* 182 */ { "Private", opaque },
385 /* 183 */ { "Private", opaque },
386 /* 184 */ { "Private", opaque },
387 /* 185 */ { "Private", opaque },
388 /* 186 */ { "Private", opaque },
389 /* 187 */ { "Private", opaque },
390 /* 188 */ { "Private", opaque },
391 /* 189 */ { "Private", opaque },
392 /* 190 */ { "Private", opaque },
393 /* 191 */ { "Private", opaque },
394 /* 192 */ { "Private", opaque },
395 /* 193 */ { "Private", opaque },
396 /* 194 */ { "Private", opaque },
397 /* 195 */ { "Private", opaque },
398 /* 196 */ { "Private", opaque },
399 /* 197 */ { "Private", opaque },
400 /* 198 */ { "Private", opaque },
401 /* 199 */ { "Private", opaque },
402 /* 200 */ { "Private", opaque },
403 /* 201 */ { "Private", opaque },
404 /* 202 */ { "Private", opaque },
405 /* 203 */ { "Private", opaque },
406 /* 204 */ { "Private", opaque },
407 /* 205 */ { "Private", opaque },
408 /* 206 */ { "Private", opaque },
409 /* 207 */ { "Private", opaque },
410 /* 208 */ { "Private", opaque },
411 /* 209 */ { "Private", opaque },
412 /* 210 */ { "Authentication", special }
415 /* Options whose length isn't "vlen + 2". */
418 case 0: /* Padding */
419 /* check how much padding we have */
420 for (i = voff + 1; i < eoff; i++ ) {
421 if (tvb_get_guint8(tvb, i) != 0) {
427 if (bp_tree != NULL) {
428 proto_tree_add_text(bp_tree, tvb, voff, i,
436 case 255: /* End Option */
438 if (bp_tree != NULL) {
439 proto_tree_add_text(bp_tree, tvb, voff, 1,
449 * Get the length of the option, and the number of bytes it
450 * consumes (the length doesn't include the option code or
453 * On the first pass, check first whether we have the length
454 * byte, so that we don't throw an exception; if we throw an
455 * exception in the first pass, which is only checking for options
456 * whose values we need in order to properly dissect the packet
457 * on the second pass, we won't actually dissect the options, so
458 * you won't be able to see which option had the problem.
461 if (!tvb_bytes_exist(tvb, voff+1, 1)) {
463 * We don't have the length byte; just return 1
464 * as the number of bytes we consumed, to count
470 vlen = tvb_get_guint8(tvb, voff+1);
474 * In the first pass, we don't put anything into the protocol
475 * tree; we just check for some options we have to look at
476 * in order to properly process the packet:
478 * 53 (DHCP message type) - if this is present, this is DHCP
480 * 60 (Vendor class identifier) - we need this in order to
481 * interpret the vendor-specific info
483 * We also check, before fetching anything, to make sure we
484 * have the entire item we're fetching, so that we don't throw
488 if (tvb_bytes_exist(tvb, voff+2, consumed-2)) {
493 get_dhcp_type(tvb_get_guint8(tvb, voff+2));
498 tvb_get_ptr(tvb, voff+2, consumed-2);
504 * We don't do anything else here.
510 * This is the second pass - if there's a protocol tree to be
511 * built, we put stuff into it, otherwise we just return.
513 if (bp_tree == NULL) {
514 /* Don't put anything in the protocol tree. */
518 text = opt[code].text;
522 case 21: /* Policy Filter */
524 /* one IP address pair */
525 proto_tree_add_text(bp_tree, tvb, voff, consumed,
526 "Option %d: %s = %s/%s", code, text,
527 ip_to_str(tvb_get_ptr(tvb, voff+2, 4)),
528 ip_to_str(tvb_get_ptr(tvb, voff+6, 4)));
530 /* > 1 IP address pair. Let's make a sub-tree */
531 vti = proto_tree_add_text(bp_tree, tvb, voff,
532 consumed, "Option %d: %s", code, text);
533 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
534 for (i = voff + 2; i < voff + consumed; i += 8) {
535 proto_tree_add_text(v_tree, tvb, i, 8, "IP Address/Mask: %s/%s",
536 ip_to_str(tvb_get_ptr(tvb, i, 4)),
537 ip_to_str(tvb_get_ptr(tvb, i+4, 4)));
542 case 33: /* Static Route */
544 /* one IP address pair */
545 proto_tree_add_text(bp_tree, tvb, voff, consumed,
546 "Option %d: %s = %s/%s", code, text,
547 ip_to_str(tvb_get_ptr(tvb, voff+2, 4)),
548 ip_to_str(tvb_get_ptr(tvb, voff+6, 4)));
550 /* > 1 IP address pair. Let's make a sub-tree */
551 vti = proto_tree_add_text(bp_tree, tvb, voff,
552 consumed, "Option %d: %s", code, text);
553 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
554 for (i = voff + 2; i < voff + consumed; i += 8) {
555 proto_tree_add_text(v_tree, tvb, i, 8,
556 "Destination IP Address/Router: %s/%s",
557 ip_to_str(tvb_get_ptr(tvb, i, 4)),
558 ip_to_str(tvb_get_ptr(tvb, i+4, 4)));
563 case 43: /* Vendor-Specific Info */
564 /* PXE protocol 2.1 as described in the intel specs */
565 if (*vendor_class_id_p != NULL &&
566 strncmp(*vendor_class_id_p, "PXEClient", strlen("PXEClient")) == 0) {
567 vti = proto_tree_add_text(bp_tree, tvb, voff,
568 consumed, "Option %d: %s (PXEClient)", code, text);
569 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
572 while (optp < voff+consumed) {
573 optp = dissect_vendor_pxeclient_suboption(v_tree,
577 proto_tree_add_text(bp_tree, tvb, voff, consumed,
578 "Option %d: %s (%d bytes)", code, text, vlen);
582 case 46: /* NetBIOS-over-TCP/IP Node Type */
583 byte = tvb_get_guint8(tvb, voff+2);
584 proto_tree_add_text(bp_tree, tvb, voff, consumed,
585 "Option %d: %s = %s", code, text,
586 val_to_str(byte, nbnt_vals,
587 "Unknown (0x%02x)"));
590 case 52: /* Option Overload */
591 byte = tvb_get_guint8(tvb, voff+2);
592 vti = proto_tree_add_text(bp_tree, tvb, voff, consumed,
593 "Option %d: %s = %s", code, text,
594 val_to_str(byte, opt_overload_vals,
595 "Unknown (0x%02x)"));
597 /* Just in case we find an option 52 in sname or file */
598 if (voff > VENDOR_INFO_OFFSET && byte >= 1 && byte <= 3) {
599 o52tree = proto_item_add_subtree(vti, ett_bootp_option);
600 if (byte == 1 || byte == 3) { /* 'file' */
601 vti = proto_tree_add_text (o52tree, tvb,
602 FILE_NAME_OFFSET, FILE_NAME_LEN,
603 "Boot file name option overload");
604 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
605 o52voff = FILE_NAME_OFFSET;
606 o52eoff = FILE_NAME_OFFSET + FILE_NAME_LEN;
608 while (o52voff < o52eoff && !o52at_end) {
609 o52voff += bootp_option(tvb, v_tree, o52voff,
610 o52eoff, FALSE, &o52at_end,
611 dhcp_type_p, vendor_class_id_p);
614 if (byte == 2 || byte == 3) { /* 'sname' */
615 vti = proto_tree_add_text (o52tree, tvb,
616 SERVER_NAME_OFFSET, SERVER_NAME_LEN,
617 "Server host name option overload");
618 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
619 o52voff = SERVER_NAME_OFFSET;
620 o52eoff = SERVER_NAME_OFFSET + SERVER_NAME_LEN;
622 while (o52voff < o52eoff && !o52at_end) {
623 o52voff += bootp_option(tvb, v_tree, o52voff,
624 o52eoff, FALSE, &o52at_end,
625 dhcp_type_p, vendor_class_id_p);
630 /* protocol = tvb_get_guint8(tvb, voff+2);
631 proto_tree_add_text(v_tree, tvb, voff+2, 1, "Protocol: %s (%u)",
632 val_to_str(protocol, authen_protocol_vals, "Unknown"),
635 case 53: /* DHCP Message Type */
636 proto_tree_add_text(bp_tree, tvb, voff, 3, "Option %d: %s = DHCP %s",
637 code, text, get_dhcp_type(tvb_get_guint8(tvb, voff+2)));
640 case 55: /* Parameter Request List */
641 vti = proto_tree_add_text(bp_tree, tvb, voff,
642 vlen + 2, "Option %d: %s", code, text);
643 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
644 for (i = 0; i < vlen; i++) {
645 byte = tvb_get_guint8(tvb, voff+2+i);
646 if (byte < NUM_OPT_INFOS) {
647 proto_tree_add_text(v_tree, tvb, voff+2+i, 1, "%d = %s",
648 byte, opt[byte].text);
650 proto_tree_add_text(vti, tvb, voff+2+i, 1,
651 "Unknown Option Code: %d", byte);
656 case 60: /* Vendor class identifier */
657 proto_tree_add_text(bp_tree, tvb, voff, consumed,
658 "Option %d: %s = \"%.*s\"", code, text, vlen,
659 tvb_get_ptr(tvb, voff+2, consumed-2));
662 case 61: /* Client Identifier */
663 /* We *MAY* use hwtype/hwaddr. If we have 7 bytes, I'll
664 guess that the first is the hwtype, and the last 6
669 vti = proto_tree_add_text(bp_tree, tvb, voff,
670 consumed, "Option %d: %s", code, text);
671 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
672 htype = tvb_get_guint8(tvb, voff+2);
673 proto_tree_add_text(v_tree, tvb, voff+2, 1,
675 arphrdtype_to_str(htype,
676 "Unknown (0x%02x)"));
677 proto_tree_add_text(v_tree, tvb, voff+3, 6,
678 "Client hardware address: %s",
679 arphrdaddr_to_str(tvb_get_ptr(tvb, voff+3, 6),
682 /* otherwise, it's opaque data */
683 proto_tree_add_text(bp_tree, tvb, voff, consumed,
684 "Option %d: %s (%d bytes)", code, text, vlen);
688 case 63: /* NetWare/IP options */
689 vti = proto_tree_add_text(bp_tree, tvb, voff,
690 consumed, "Option %d: %s", code, text);
691 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
694 while (optp < voff+consumed)
695 optp = dissect_netware_ip_suboption(v_tree, tvb, optp);
698 case 82: /* Relay Agent Information Option */
699 vti = proto_tree_add_text(bp_tree, tvb, voff, consumed,
700 "Option %d: %s (%d bytes)",
702 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
704 while (optp < voff+consumed) {
705 optp = bootp_dhcp_decode_agent_info(v_tree, tvb, optp);
709 case 90: /* DHCP Authentication */
710 case 210: /* Was this used for authentication at one time? */
711 vti = proto_tree_add_text(bp_tree, tvb, voff,
712 vlen + 2, "Option %d: %s", code, text);
713 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
715 protocol = tvb_get_guint8(tvb, voff+2);
716 proto_tree_add_text(v_tree, tvb, voff+2, 1, "Protocol: %s (%u)",
717 val_to_str(protocol, authen_protocol_vals, "Unknown"),
720 algorithm = tvb_get_guint8(tvb, voff+3);
723 case AUTHEN_PROTO_DELAYED_AUTHEN:
724 proto_tree_add_text(v_tree, tvb, voff+3, 1,
725 "Algorithm: %s (%u)",
726 val_to_str(algorithm, authen_da_algo_vals, "Unknown"),
731 proto_tree_add_text(v_tree, tvb, voff+3, 1,
732 "Algorithm: %u", algorithm);
736 rdm = tvb_get_guint8(tvb, voff+4);
737 proto_tree_add_text(v_tree, tvb, voff+4, 1,
738 "Replay Detection Method: %s (%u)",
739 val_to_str(rdm, authen_rdm_vals, "Unknown"),
744 case AUTHEN_RDM_MONOTONIC_COUNTER:
745 proto_tree_add_text(v_tree, tvb, voff+5, 8,
746 "Replay Detection Value: %s",
747 u64toh(tvb_get_ptr(tvb, voff+5, 8)));
751 proto_tree_add_text(v_tree, tvb, voff+5, 8,
752 "Replay Detection Value: %s",
753 tvb_bytes_to_str(tvb, voff+5, 8));
759 case AUTHEN_PROTO_DELAYED_AUTHEN:
762 case AUTHEN_DELAYED_ALGO_HMAC_MD5:
763 proto_tree_add_text(v_tree, tvb, voff+13, 4,
765 tvb_get_ntohl(tvb, voff+13));
766 proto_tree_add_text(v_tree, tvb, voff+17, 16,
768 tvb_bytes_to_str(tvb, voff+17, 16));
772 proto_tree_add_text(v_tree, tvb, voff+13, vlen-11,
773 "Authentication Information: %s",
774 tvb_bytes_to_str(tvb, voff+17, vlen-11));
780 proto_tree_add_text(v_tree, tvb, voff+13, vlen-11,
781 "Authentication Information: %s",
782 tvb_bytes_to_str(tvb, voff+17, vlen-11));
787 default: /* not special */
792 if (code < NUM_OPT_INFOS) {
793 text = opt[code].text;
794 ftype = opt[code].ftype;
804 proto_tree_add_text(bp_tree, tvb, voff, consumed,
805 "Option %d: %s = %s", code, text,
806 ip_to_str(tvb_get_ptr(tvb, voff+2, 4)));
808 /* > 1 IP addresses. Let's make a sub-tree */
809 vti = proto_tree_add_text(bp_tree, tvb, voff,
810 consumed, "Option %d: %s", code, text);
811 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
812 for (i = voff + 2; i < voff + consumed; i += 4) {
813 proto_tree_add_text(v_tree, tvb, i, 4, "IP Address: %s",
814 ip_to_str(tvb_get_ptr(tvb, i, 4)));
820 /* Fix for non null-terminated string supplied by
821 * John Lines <John.Lines@aeat.co.uk>
823 proto_tree_add_text(bp_tree, tvb, voff, consumed,
824 "Option %d: %s = \"%.*s\"", code, text, vlen,
825 tvb_get_ptr(tvb, voff+2, consumed-2));
829 proto_tree_add_text(bp_tree, tvb, voff, consumed,
830 "Option %d: %s (%d bytes)",
837 proto_tree_add_text(bp_tree, tvb, voff, consumed,
838 "Option %d: %s = %d", code, text,
839 tvb_get_ntohs(tvb, voff+2));
842 vti = proto_tree_add_text(bp_tree, tvb, voff,
843 consumed, "Option %d: %s", code, text);
844 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
845 for (i = voff + 2; i < voff + consumed; i += 2) {
846 proto_tree_add_text(v_tree, tvb, i, 4, "Value: %d",
847 tvb_get_ntohs(tvb, i));
853 proto_tree_add_text(bp_tree, tvb, voff, consumed,
854 "Option %d: %s = %d", code, text,
855 tvb_get_ntohl(tvb, voff+2));
859 proto_tree_add_text(bp_tree, tvb, voff, consumed,
860 "Option %d: %s = %d", code, text,
861 tvb_get_guint8(tvb, voff+2));
865 i = tvb_get_guint8(tvb, voff+2);
866 if (i != 0 && i != 1) {
867 proto_tree_add_text(bp_tree, tvb, voff, consumed,
868 "Option %d: %s = Invalid Value %d", code, text,
871 proto_tree_add_text(bp_tree, tvb, voff, consumed,
872 "Option %d: %s = %s", code, text,
873 i == 0 ? "Disabled" : "Enabled");
878 i = tvb_get_guint8(tvb, voff+2);
879 if (i != 0 && i != 1) {
880 proto_tree_add_text(bp_tree, tvb, voff, consumed,
881 "Option %d: %s = Invalid Value %d", code, text,
884 proto_tree_add_text(bp_tree, tvb, voff, consumed,
885 "Option %d: %s = %s", code, text,
886 i == 0 ? "No" : "Yes");
891 time_secs = tvb_get_ntohl(tvb, voff+2);
892 proto_tree_add_text(bp_tree, tvb, voff, consumed,
893 "Option %d: %s = %s", code, text,
894 ((time_secs == 0xffffffff) ?
896 time_secs_to_str(time_secs)));
900 proto_tree_add_text(bp_tree, tvb, voff, consumed,
901 "Option %d: %s (%d bytes)", code, text, vlen);
904 proto_tree_add_text(bp_tree, tvb, voff, consumed,
905 "Unknown Option Code: %d (%d bytes)", code, vlen);
912 bootp_dhcp_decode_agent_info(proto_tree *v_tree, tvbuff_t *tvb, int optp)
917 subopt = tvb_get_guint8(tvb, optp);
918 subopt_len = tvb_get_guint8(tvb, optp+1);
921 proto_tree_add_text(v_tree, tvb, optp, subopt_len + 2,
922 "Agent Circuit ID (%d bytes)", subopt_len);
925 proto_tree_add_text(v_tree, tvb, optp, subopt_len + 2,
926 "Agent Remote ID (%d bytes)", subopt_len);
929 proto_tree_add_text(v_tree, tvb, optp, subopt_len + 2,
930 "Unknown agent option: %d", subopt);
933 optp += (subopt_len + 2);
938 dissect_vendor_pxeclient_suboption(proto_tree *v_tree, tvbuff_t *tvb, int optp)
943 proto_tree *o43pxeclient_v_tree;
946 struct o43pxeclient_opt_info {
951 static struct o43pxeclient_opt_info o43pxeclient_opt[]= {
952 /* 0 */ {"nop", special}, /* dummy */
953 /* 1 */ {"PXE mtftp IP", ipv4},
954 /* 2 */ {"PXE mtftp client port", val_u_le_short},
955 /* 3 */ {"PXE mtftp server port",val_u_le_short},
956 /* 4 */ {"PXE mtftp timeout", val_u_byte},
957 /* 5 */ {"PXE mtftp delay", val_u_byte},
958 /* 6 */ {"PXE discovery control", val_u_byte},
960 * Correct: b0 (lsb): disable broadcast discovery
961 * b1: disable multicast discovery
962 * b2: only use/accept servers in boot servers
963 * b3: download bootfile without prompt/menu/disc
965 /* 7 */ {"PXE multicast address", ipv4},
966 /* 8 */ {"PXE boot servers", special},
967 /* 9 */ {"PXE boot menu", special},
968 /* 10 */ {"PXE menu prompt", special},
969 /* 11 */ {"PXE multicast address alloc", special},
970 /* 12 */ {"PXE credential types", special},
971 /* 71 {"PXE boot item", special} */
972 /* 255 {"PXE end options", special} */
974 #define NUM_O43PXECLIENT_SUBOPTS (12)
976 subopt = tvb_get_guint8(tvb, optp);
979 proto_tree_add_text(v_tree, tvb, optp, 1, "Padding");
981 } else if (subopt == 255) { /* End Option */
982 proto_tree_add_text(v_tree, tvb, optp, 1, "End PXEClient option");
983 /* Make sure we skip any junk left this option */
987 subopt_len = tvb_get_guint8(tvb, optp+1);
989 if ( subopt == 71 ) { /* 71 {"PXE boot item", special} */
991 /* I may need to decode that properly one day */
992 proto_tree_add_text(v_tree, tvb, optp, subopt_len+2,
993 "Suboption %d: %s (%d byte%s)" ,
994 subopt, "PXE boot item",
995 subopt_len, (subopt_len != 1)?"s":"");
996 } else if ( (subopt < 1 ) || (subopt > NUM_O43PXECLIENT_SUBOPTS) ) {
997 proto_tree_add_text(v_tree, tvb, optp, subopt_len+2,
998 "Unknown suboption %d (%d byte%s)", subopt, subopt_len,
999 (subopt_len != 1)?"s":"");
1001 switch (o43pxeclient_opt[subopt].ft) {
1004 proto_tree_add_text(v_tree, tvb, optp, subopt_len+2,
1005 "Suboption %d: %s", subopt, o43pxeclient_opt[subopt].text);
1009 /* I may need to decode that properly one day */
1010 proto_tree_add_text(v_tree, tvb, optp, subopt_len+2,
1011 "Suboption %d: %s (%d byte%s)" ,
1012 subopt, o43pxeclient_opt[subopt].text,
1013 subopt_len, (subopt_len != 1)?"s":"");
1016 case val_u_le_short:
1017 proto_tree_add_text(v_tree, tvb, optp, 4, "Suboption %d: %s = %u",
1018 subopt, o43pxeclient_opt[subopt].text,
1019 tvb_get_letohs(tvb, optp+2));
1023 proto_tree_add_text(v_tree, tvb, optp, 3, "Suboption %d: %s = %u",
1024 subopt, o43pxeclient_opt[subopt].text,
1025 tvb_get_guint8(tvb, optp+2));
1029 if (subopt_len == 4) {
1030 /* one IP address */
1031 proto_tree_add_text(v_tree, tvb, optp, 6,
1032 "Suboption %d : %s = %s",
1033 subopt, o43pxeclient_opt[subopt].text,
1034 ip_to_str(tvb_get_ptr(tvb, optp+2, 4)));
1036 /* > 1 IP addresses. Let's make a sub-tree */
1037 vti = proto_tree_add_text(v_tree, tvb, optp,
1038 subopt_len+2, "Suboption %d: %s",
1039 subopt, o43pxeclient_opt[subopt].text);
1040 o43pxeclient_v_tree = proto_item_add_subtree(vti, ett_bootp_option);
1041 for (slask = optp + 2 ; slask < optp+subopt_len; slask += 4) {
1042 proto_tree_add_text(o43pxeclient_v_tree, tvb, slask, 4, "IP Address: %s",
1043 ip_to_str(tvb_get_ptr(tvb, slask, 4)));
1048 proto_tree_add_text(v_tree, tvb, optp, subopt_len+2,"ERROR, please report: Unknown subopt type handler %d", subopt);
1052 optp += (subopt_len + 2);
1057 dissect_netware_ip_suboption(proto_tree *v_tree, tvbuff_t *tvb, int optp)
1062 proto_tree *o63_v_tree;
1065 struct o63_opt_info {
1071 static struct o63_opt_info o63_opt[]= {
1072 /* 0 */ {"","",none},
1073 /* 1 */ {"NWIP does not exist on subnet","",string},
1074 /* 2 */ {"NWIP exist in options area","",string},
1075 /* 3 */ {"NWIP exists in sname/file","",string},
1076 /* 4 */ {"NWIP exists, but too big","",string},
1077 /* 5 */ {"Broadcast for nearest Netware server","Do NOT Broadcast for nearest Netware server",yes_no},
1078 /* 6 */ {"Preferred DSS server","",ipv4},
1079 /* 7 */ {"Nearest NWIP server","",ipv4},
1080 /* 8 */ {"Autoretries","",val_u_short},
1081 /* 9 */ {"Autoretry delay, secs ","",val_u_short},
1082 /* 10*/ {"Support NetWare/IP v1.1","Do NOT support NetWare/IP v1.1",yes_no},
1083 /* 11*/ {"Primary DSS ", "" , special}
1086 subopt = tvb_get_guint8(tvb, optp);
1087 if (subopt > NUM_O63_SUBOPTS) {
1088 proto_tree_add_text(v_tree, tvb,optp,1,"Unknown suboption %d", subopt);
1091 switch (o63_opt[subopt].ft) {
1094 proto_tree_add_text(v_tree, tvb, optp, 2, "Suboption %d: %s", subopt, o63_opt[subopt].truet);
1099 if (tvb_get_guint8(tvb, optp+2)==1) {
1100 proto_tree_add_text(v_tree, tvb, optp, 3, "Suboption %d: %s", subopt, o63_opt[subopt].truet);
1102 proto_tree_add_text(v_tree, tvb, optp, 3, "Suboption %d: %s" , subopt, o63_opt[subopt].falset);
1108 proto_tree_add_text(v_tree, tvb, optp, 6,
1109 "Suboption %d: %s = %s" ,
1110 subopt, o63_opt[subopt].truet,
1111 ip_to_str(tvb_get_ptr(tvb, optp+2, 4)));
1116 proto_tree_add_text(v_tree, tvb, optp, 3, "Suboption %d: %s = %u",
1117 subopt, o63_opt[subopt].truet,
1118 tvb_get_guint8(tvb, optp+2)); /* XXX - 1 byte? */
1123 subopt_len = tvb_get_guint8(tvb, optp+1);
1124 if (subopt_len == 4) {
1125 /* one IP address */
1126 proto_tree_add_text(v_tree, tvb, optp, 6,
1127 "Suboption %d : %s = %s",
1128 subopt, o63_opt[subopt].truet,
1129 ip_to_str(tvb_get_ptr(tvb, optp+2, 4)));
1132 /* > 1 IP addresses. Let's make a sub-tree */
1133 vti = proto_tree_add_text(v_tree, tvb, optp,
1134 subopt_len+2, "Suboption %d: %s",
1135 subopt, o63_opt[subopt].truet);
1136 o63_v_tree = proto_item_add_subtree(vti, ett_bootp_option);
1137 for (slask = optp + 2 ; slask < optp+subopt_len; slask += 4) {
1138 proto_tree_add_text(o63_v_tree, tvb, slask, 4, "IP Address: %s",
1139 ip_to_str(tvb_get_ptr(tvb, slask, 4)));
1145 proto_tree_add_text(v_tree, tvb,optp,1,"Unknown suboption %d", subopt);
1153 #define BOOTREQUEST 1
1156 static const value_string op_vals[] = {
1157 { BOOTREQUEST, "Boot Request" },
1158 { BOOTREPLY, "Boot Reply" },
1163 dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1165 proto_tree *bp_tree = NULL;
1167 proto_tree *flag_tree = NULL;
1171 const guint8 *haddr;
1172 int voff, eoff, tmpvoff; /* vendor offset, end offset */
1175 const char *dhcp_type = NULL;
1176 const guint8 *vendor_class_id = NULL;
1179 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1180 col_set_str(pinfo->cinfo, COL_PROTOCOL, "BOOTP");
1181 if (check_col(pinfo->cinfo, COL_INFO)) {
1183 * In case we throw an exception fetching the opcode, etc.
1185 col_clear(pinfo->cinfo, COL_INFO);
1188 op = tvb_get_guint8(tvb, 0);
1189 htype = tvb_get_guint8(tvb, 1);
1190 hlen = tvb_get_guint8(tvb, 2);
1191 if (check_col(pinfo->cinfo, COL_INFO)) {
1195 col_add_fstr(pinfo->cinfo, COL_INFO, "Boot Request from %s",
1196 arphrdaddr_to_str(tvb_get_ptr(tvb, 28, hlen),
1201 col_set_str(pinfo->cinfo, COL_INFO, "Boot Reply");
1205 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown BOOTP message type (%u)",
1212 ti = proto_tree_add_item(tree, proto_bootp, tvb, 0, -1, FALSE);
1213 bp_tree = proto_item_add_subtree(ti, ett_bootp);
1215 proto_tree_add_uint(bp_tree, hf_bootp_type, tvb,
1218 proto_tree_add_uint_format(bp_tree, hf_bootp_hw_type, tvb,
1221 "Hardware type: %s",
1222 arphrdtype_to_str(htype,
1223 "Unknown (0x%02x)"));
1224 proto_tree_add_uint(bp_tree, hf_bootp_hw_len, tvb,
1226 proto_tree_add_item(bp_tree, hf_bootp_hops, tvb,
1228 proto_tree_add_item(bp_tree, hf_bootp_id, tvb,
1230 proto_tree_add_item(bp_tree, hf_bootp_secs, tvb,
1232 flags = tvb_get_ntohs(tvb, 10);
1233 fi = proto_tree_add_uint(bp_tree, hf_bootp_flags, tvb,
1235 proto_item_append_text(fi, " (%s)",
1236 (flags & BOOTP_BC) ? "Broadcast" : "Unicast");
1237 flag_tree = proto_item_add_subtree(fi, ett_bootp_flags);
1238 proto_tree_add_boolean(flag_tree, hf_bootp_flags_broadcast, tvb,
1240 proto_tree_add_uint(flag_tree, hf_bootp_flags_reserved, tvb,
1242 proto_tree_add_item(bp_tree, hf_bootp_ip_client, tvb,
1244 proto_tree_add_item(bp_tree, hf_bootp_ip_your, tvb,
1246 proto_tree_add_item(bp_tree, hf_bootp_ip_server, tvb,
1248 proto_tree_add_item(bp_tree, hf_bootp_ip_relay, tvb,
1252 haddr = tvb_get_ptr(tvb, 28, hlen);
1253 proto_tree_add_bytes_format(bp_tree, hf_bootp_hw_addr, tvb,
1256 "Client hardware address: %s",
1257 arphrdaddr_to_str(haddr,
1262 proto_tree_add_text(bp_tree, tvb,
1263 28, 0, "Client address not given");
1266 /* The server host name is optional */
1267 if (tvb_get_guint8(tvb, 44) != '\0') {
1268 proto_tree_add_item(bp_tree, hf_bootp_server, tvb,
1270 SERVER_NAME_LEN, FALSE);
1273 proto_tree_add_string_format(bp_tree, hf_bootp_server, tvb,
1276 tvb_get_ptr(tvb, SERVER_NAME_OFFSET, 1),
1277 "Server host name not given");
1281 if (tvb_get_guint8(tvb, 108) != '\0') {
1282 proto_tree_add_item(bp_tree, hf_bootp_file, tvb,
1284 FILE_NAME_LEN, FALSE);
1287 proto_tree_add_string_format(bp_tree, hf_bootp_file, tvb,
1290 tvb_get_ptr(tvb, FILE_NAME_OFFSET, 1),
1291 "Boot file name not given");
1295 voff = VENDOR_INFO_OFFSET;
1297 /* rfc2132 says it SHOULD exist, not that it MUST exist */
1298 if (tvb_bytes_exist(tvb, voff, 4)) {
1299 if (tvb_get_ntohl(tvb, voff) == 0x63825363) {
1301 tvb_memcpy(tvb, (void *)&ip_addr, voff, sizeof(ip_addr));
1302 proto_tree_add_ipv4_format(bp_tree, hf_bootp_cookie, tvb,
1304 "Magic cookie: (OK)");
1310 proto_tree_add_text(bp_tree, tvb,
1311 voff, 64, "Bootp vendor specific options");
1317 eoff = tvb_reported_length(tvb);
1320 * In the first pass, we just look for the DHCP message type
1321 * and Vendor class identifier options.
1325 while (tmpvoff < eoff && !at_end) {
1326 tmpvoff += bootp_option(tvb, 0, tmpvoff, eoff, TRUE, &at_end,
1327 &dhcp_type, &vendor_class_id);
1331 * If there was a DHCP message type option, flag this packet
1334 if (dhcp_type != NULL) {
1336 * Yes, this is a DHCP packet, and "dhcp_type" is the
1339 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1340 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DHCP");
1341 if (check_col(pinfo->cinfo, COL_INFO))
1342 col_add_fstr(pinfo->cinfo, COL_INFO, "DHCP %-8s - Transaction ID 0x%x",
1343 dhcp_type, tvb_get_ntohl(tvb, 4));
1345 proto_tree_add_boolean_hidden(bp_tree, hf_bootp_dhcp,
1347 tap_queue_packet( bootp_dhcp_tap, pinfo, (gpointer) dhcp_type);
1351 * If we're not building the protocol tree, we don't need to
1352 * make a second pass.
1358 * OK, now build the protocol tree.
1361 while (voff < eoff && !at_end) {
1362 voff += bootp_option(tvb, bp_tree, voff, eoff, FALSE, &at_end,
1363 &dhcp_type, &vendor_class_id);
1367 * Padding after the end option.
1369 proto_tree_add_text(bp_tree, tvb, voff, eoff - voff, "Padding");
1374 proto_register_bootp(void)
1376 static hf_register_info hf[] = {
1378 { "Frame is DHCP", "bootp.dhcp", FT_BOOLEAN,
1379 BASE_NONE, NULL, 0x0,
1383 { "Message type", "bootp.type", FT_UINT8,
1384 BASE_DEC, VALS(op_vals), 0x0,
1387 { &hf_bootp_hw_type,
1388 { "Hardware type", "bootp.hw.type", FT_UINT8,
1389 BASE_HEX, NULL, 0x0,
1393 { "Hardware address length", "bootp.hw.len", FT_UINT8,
1394 BASE_DEC, NULL, 0x0,
1398 { "Hops", "bootp.hops", FT_UINT8,
1399 BASE_DEC, NULL, 0x0,
1403 { "Transaction ID", "bootp.id", FT_UINT32,
1404 BASE_HEX, NULL, 0x0,
1408 { "Seconds elapsed", "bootp.secs", FT_UINT16,
1409 BASE_DEC, NULL, 0x0,
1413 { "Bootp flags", "bootp.flags", FT_UINT16,
1414 BASE_HEX, NULL, 0x0,
1417 { &hf_bootp_flags_broadcast,
1418 { "Broadcast flag", "bootp.flags.bc", FT_BOOLEAN,
1419 16, TFS(&flag_set_broadcast), BOOTP_BC,
1422 { &hf_bootp_flags_reserved,
1423 { "Reserved flags", "bootp.flags.reserved", FT_UINT16,
1424 BASE_HEX, NULL, BOOTP_MBZ,
1427 { &hf_bootp_ip_client,
1428 { "Client IP address", "bootp.ip.client",FT_IPv4,
1429 BASE_NONE, NULL, 0x0,
1432 { &hf_bootp_ip_your,
1433 { "Your (client) IP address", "bootp.ip.your", FT_IPv4,
1434 BASE_NONE, NULL, 0x0,
1437 { &hf_bootp_ip_server,
1438 { "Next server IP address", "bootp.ip.server",FT_IPv4,
1439 BASE_NONE, NULL, 0x0,
1442 { &hf_bootp_ip_relay,
1443 { "Relay agent IP address", "bootp.ip.relay", FT_IPv4,
1444 BASE_NONE, NULL, 0x0,
1447 { &hf_bootp_hw_addr,
1448 { "Client hardware address", "bootp.hw.addr", FT_BYTES,
1449 BASE_NONE, NULL, 0x0,
1453 { "Server host name", "bootp.server", FT_STRING,
1454 BASE_NONE, NULL, 0x0,
1458 { "Boot file name", "bootp.file", FT_STRING,
1459 BASE_NONE, NULL, 0x0,
1463 { "Magic cookie", "bootp.cookie", FT_IPv4,
1464 BASE_NONE, NULL, 0x0,
1468 { "Bootp Vendor Options", "bootp.vendor", FT_BYTES,
1469 BASE_NONE, NULL, 0x0,
1472 static gint *ett[] = {
1478 proto_bootp = proto_register_protocol("Bootstrap Protocol", "BOOTP/DHCP",
1480 proto_register_field_array(proto_bootp, hf, array_length(hf));
1481 proto_register_subtree_array(ett, array_length(ett));
1482 bootp_dhcp_tap = register_tap("bootp");
1486 proto_reg_handoff_bootp(void)
1488 dissector_handle_t bootp_handle;
1490 bootp_handle = create_dissector_handle(dissect_bootp, proto_bootp);
1491 dissector_add("udp.port", UDP_PORT_BOOTPS, bootp_handle);
1492 dissector_add("udp.port", UDP_PORT_BOOTPC, bootp_handle);