- bug fixed with user name display
[obnox/wireshark/wip.git] / packet-bootp.c
1 /* packet-bootp.c
2  * Routines for BOOTP/DHCP packet disassembly
3  * Gilbert Ramirez <gram@verdict.uthscsa.edu>
4  *
5  * $Id: packet-bootp.c,v 1.21 1999/10/12 06:20:02 gram Exp $
6  *
7  * The information used comes from:
8  * RFC 2132: DHCP Options and BOOTP Vendor Extensions
9  * RFC 1542: Clarifications and Extensions for the Bootstrap Protocol
10  * RFC 2131: Dynamic Host Configuration Protocol
11  *
12  * Ethereal - Network traffic analyzer
13  * By Gerald Combs <gerald@unicom.net>
14  * Copyright 1998 Gerald Combs
15  *
16  * 
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version 2
20  * of the License, or (at your option) any later version.
21  * 
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  * 
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
30  */
31
32 #ifdef HAVE_CONFIG_H
33 # include "config.h"
34 #endif
35
36 #ifdef HAVE_SYS_TYPES_H
37 # include <sys/types.h>
38 #endif
39
40 #include <glib.h>
41 #include "packet.h"
42
43 static int proto_bootp = -1;
44 static int hf_bootp_type = -1;
45 static int hf_bootp_hw_type = -1;
46 static int hf_bootp_hw_len = -1;
47 static int hf_bootp_hops = -1;
48 static int hf_bootp_id = -1;
49 static int hf_bootp_secs = -1;
50 static int hf_bootp_flag = -1;
51 static int hf_bootp_ip_client = -1;
52 static int hf_bootp_ip_your = -1;
53 static int hf_bootp_ip_server = -1;
54 static int hf_bootp_ip_relay = -1;
55 static int hf_bootp_hw_addr = -1;
56 static int hf_bootp_server = -1;
57 static int hf_bootp_file = -1;
58 static int hf_bootp_cookie = -1;
59
60 enum field_type { none, ipv4, string, toggle, yes_no, special, opaque,
61         time_in_secs,
62         val_u_byte, val_u_short, val_u_long,
63         val_s_long };
64
65 struct opt_info {
66         char    *text;
67         enum field_type ftype;
68 };
69
70 #define NUM_OPT_INFOS 77
71
72 /* returns the number of bytes consumed by this option */
73 static int
74 bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff)
75 {
76         char                    *text;
77         enum field_type ftype;
78         u_char                  code = pd[voff];
79         int                             vlen = pd[voff+1];
80         u_char                  byte;
81         int                             i, consumed = vlen + 2;
82         u_long                  time_secs;
83         proto_tree              *v_tree;
84         proto_item              *vti;
85
86         static const char       *opt53_text[] = {
87                 "Unknown Message Type",
88                 "Discover",
89                 "Offer",
90                 "Request",
91                 "Decline",
92                 "ACK",
93                 "NAK",
94                 "Release",
95                 "Inform"
96         };
97         static const value_string nbnt_vals[] = {
98             {0x1,   "B-node" },
99             {0x2,   "P-node" },
100             {0x4,   "M-node" },
101             {0x8,   "H-node" },
102             {0,     NULL     } };
103
104         static struct opt_info opt[] = {
105                 /*   0 */ { "Padding",                                                          none },
106                 /*   1 */ { "Subnet Mask",                                                      ipv4 },
107                 /*   2 */ { "Time Offset",                                                      val_s_long },
108                 /*   3 */ { "Router",                                                           ipv4 },
109                 /*   4 */ { "Time Server",                                                      ipv4 },
110                 /*   5 */ { "Name Server",                                                      ipv4 },
111                 /*   6 */ { "Domain Name Server",                                       ipv4 },
112                 /*   7 */ { "Log Server",                                                       ipv4 },
113                 /*   8 */ { "Cookie Server",                                            ipv4 },
114                 /*   9 */ { "LPR Server",                                                       ipv4 },
115                 /*  10 */ { "Impress Server",                                           ipv4 },
116                 /*  11 */ { "Resource Location Server",                         ipv4 },
117                 /*  12 */ { "Host Name",                                                        string },
118                 /*  13 */ { "Boot File Size",                                           val_u_short },
119                 /*  14 */ { "Merit Dump File",                                          string },
120                 /*  15 */ { "Domain Name",                                                      string },
121                 /*  16 */ { "Swap Server",                                                      ipv4 },
122                 /*  17 */ { "Root Path",                                                        string },
123                 /*  18 */ { "Extensions Path",                                          string },
124                 /*  19 */ { "IP Forwarding",                                            toggle },
125                 /*  20 */ { "Non-Local Source Routing",                         toggle },
126                 /*  21 */ { "Policy Filter",                                            special },
127                 /*  22 */ { "Maximum Datagram Reassembly Size",         val_u_short },
128                 /*  23 */ { "Default IP Time-to-Live",                          val_u_byte },
129                 /*  24 */ { "Path MTU Aging Timeout",                           time_in_secs },
130                 /*  25 */ { "Path MTU Plateau Table",                           val_u_short },
131                 /*  26 */ { "Interface MTU",                                            val_u_short },
132                 /*  27 */ { "All Subnets are Local",                            yes_no },
133                 /*  28 */ { "Broadcast Address",                                        ipv4 },
134                 /*  29 */ { "Perform Mask Discovery",                           toggle },
135                 /*  30 */ { "Mask Supplier",                                            yes_no },
136                 /*  31 */ { "Perform Router Discover",                          toggle },
137                 /*  32 */ { "Router Solicitation Address",                      ipv4 },
138                 /*  33 */ { "Static Route",                                                     special },
139                 /*  34 */ { "Trailer Encapsulation",                            toggle },
140                 /*  35 */ { "ARP Cache Timeout",                                        time_in_secs },
141                 /*  36 */ { "Ethernet Encapsulation",                           toggle },
142                 /*  37 */ { "TCP Default TTL",                                          val_u_byte },
143                 /*  38 */ { "TCP Keepalive Interval",                           time_in_secs },
144                 /*  39 */ { "TCP Keepalive Garbage",                            toggle },
145                 /*  40 */ { "Network Information Service Domain",       string },
146                 /*  41 */ { "Network Information Service Servers",      ipv4 },
147                 /*  42 */ { "Network Time Protocol Servers",            ipv4 },
148                 /*  43 */ { "Vendor-Specific Information",                      special },
149                 /*  44 */ { "NetBIOS over TCP/IP Name Server",          ipv4 },
150                 /*  45 */ { "NetBIOS over TCP/IP Datagram Distribution Name Server", ipv4 },
151                 /*  46 */ { "NetBIOS over TCP/IP Node Type",            special },
152                 /*  47 */ { "NetBIOS over TCP/IP Scope",                        string },
153                 /*  48 */ { "X Window System Font Server",                      ipv4 },
154                 /*  49 */ { "X Window System Display Manager",          ipv4 },
155                 /*  50 */ { "Requested IP Address",                                     ipv4 },
156                 /*  51 */ { "IP Address Lease Time",                            time_in_secs },
157                 /*  52 */ { "Option Overload",                                          special },
158                 /*  53 */ { "DHCP Message Type",                                        special },
159                 /*  54 */ { "Server Identifier",                                        ipv4 },
160                 /*  55 */ { "Parameter Request List",                           special },
161                 /*  56 */ { "Message",                                                          string },
162                 /*  57 */ { "Maximum DHCP Message Size",                        val_u_short },
163                 /*  58 */ { "Renewal Time Value",                                       time_in_secs },
164                 /*  59 */ { "Rebinding Time Value",                                     time_in_secs },
165                 /*  60 */ { "Vendor class identifier",                          opaque },
166                 /*  61 */ { "Client identifier",                                        special },
167                 /*  64 */ { "Network Information Service+ Domain",      string },
168                 /*  65 */ { "Network Information Service+ Servers",     ipv4 },
169                 /*  66 */ { "TFTP Server Name",                                         string },
170                 /*  67 */ { "Bootfile name",                                            string },
171                 /*  68 */ { "Mobile IP Home Agent",                                     ipv4 },
172                 /*  69 */ { "SMTP Server",                                                      ipv4 },
173                 /*  70 */ { "POP3 Server",                                                      ipv4 },
174                 /*  71 */ { "NNTP Server",                                                      ipv4 },
175                 /*  72 */ { "Default WWW Server",                                       ipv4 },
176                 /*  73 */ { "Default Finger Server",                            ipv4 },
177                 /*  74 */ { "Default IRC Server",                                       ipv4 },
178                 /*  75 */ { "StreetTalk Server",                                        ipv4 },
179                 /*  76 */ { "StreetTalk Directory Assistance Server", ipv4 }
180         };
181
182         text = opt[code].text;
183         /* Special cases */
184         switch (code) {
185                 /* Padding */
186                 case 0:
187                         /* check how much padding we have */
188                         for (i = voff + 1; i < eoff; i++ ) {
189                                 if (pd[i] != 0) {
190                                         break;
191                                 }
192                         }
193                         i = i - voff;
194                         proto_tree_add_text(bp_tree, voff, i, "Padding");
195                         consumed = i;
196                         return consumed;
197
198                 /* Policy Filter */
199                 case 21:
200                         /* one IP address pair */
201                         if (vlen == 8) {
202                                 proto_tree_add_text(bp_tree, voff, consumed,
203                                         "Option %d: %s = %s/%s", code, text,
204                                         ip_to_str((guint8*)&pd[voff+2]),
205                                         ip_to_str((guint8*)&pd[voff+6]));
206                         }
207                         /* > 1 IP address pair. Let's make a sub-tree */
208                         else {
209
210                                 vti = proto_tree_add_text(bp_tree, voff,
211                                         consumed, "Option %d: %s", code, text);
212                                 v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION);
213                                 for (i = voff + 2; i < voff + consumed; i += 8) {
214                                         proto_tree_add_text(v_tree, i, 8, "IP Address/Mask: %s/%s",
215                                                 ip_to_str((guint8*)&pd[i]),
216                                                 ip_to_str((guint8*)&pd[i+4]));
217                                 }
218                         }
219                         break;
220
221                 /* Static Route */
222                 case 33:
223                         /* one IP address pair */
224                         if (vlen == 8) {
225                                 proto_tree_add_text(bp_tree, voff, consumed,
226                                         "Option %d: %s = %s/%s", code, text,
227                                         ip_to_str((guint8*)&pd[voff+2]),
228                                         ip_to_str((guint8*)&pd[voff+6]));
229                         }
230                         /* > 1 IP address pair. Let's make a sub-tree */
231                         else {
232
233                                 vti = proto_tree_add_text(bp_tree, voff,
234                                         consumed, "Option %d: %s", code, text);
235                                 v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION);
236                                 for (i = voff + 2; i < voff + consumed; i += 8) {
237                                         proto_tree_add_text(v_tree, i, 8,
238                                                 "Destination IP Address/Router: %s/%s",
239                                                 ip_to_str((guint8*)&pd[i]),
240                                                 ip_to_str((guint8*)&pd[i+4]));
241                                 }
242                         }
243                         break;
244
245                 /* Vendor-Specific Info */
246                 case 43:
247                         proto_tree_add_text(bp_tree, voff, consumed,
248                                         "Option %d: %s", code, text);
249                         break;
250
251                 /* NetBIOS-over-TCP/IP Node Type */
252                 case 46:
253                         byte = pd[voff+2];
254                         proto_tree_add_text(bp_tree, voff, consumed,
255                                         "Option %d: %s = %s", code, text,
256                                         val_to_str(byte, nbnt_vals,
257                                             "Unknown (0x%02x)"));
258                         break;
259                                 
260                 /* DHCP Message Type */
261                 case 53:
262                         byte = pd[voff+2];
263                         if (byte > 0 && byte < 9) {
264                                 i = byte;
265                         }
266                         else {
267                                 i = 0;
268                         }
269                         proto_tree_add_text(bp_tree, voff, 3, "Option %d: %s = DHCP %s",
270                                 code, text, opt53_text[i]);
271                         break;
272
273                 /* Parameter Request List */
274                 case 55:
275                         vti = proto_tree_add_text(bp_tree, voff,
276                                 vlen + 2, "Option %d: %s", code, text);
277                         v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION);
278                         for (i = 0; i < vlen; i++) {
279                                 byte = pd[voff+2+i];
280                                 if (byte < NUM_OPT_INFOS) {
281                                         proto_tree_add_text(v_tree, voff+2+i, 1, "%d = %s",
282                                                         byte, opt[byte].text);
283                                 }
284                                 else {
285                                         proto_tree_add_text(vti, voff+2+i, 1,
286                                                 "Unknown Option Code: %d", byte);
287                                 }
288                         }
289                         break;
290
291                 /* Client Identifier */
292                 case 61:
293                         /* We *MAY* use hwtype/hwaddr. If we have 7 bytes, I'll
294                                 guess that the first is the hwtype, and the last 6 are
295                                 the hw addr */
296                         if (vlen == 7) {
297                                 vti = proto_tree_add_text(bp_tree, voff,
298                                         consumed, "Option %d: %s", code, text);
299                                 v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION);
300                                 proto_tree_add_text(v_tree, voff+2, 1,
301                                         "Hardware type: %s",
302                                         arphrdtype_to_str(pd[voff+2],
303                                                 "Unknown (0x%02x)"));
304                                 proto_tree_add_text(v_tree, voff+3, 6,
305                                         "Client hardware address: %s",
306                                         arphrdaddr_to_str((guint8*)&pd[voff+3],
307                                                 6, pd[voff+2]));
308                         }
309                         /* otherwise, it's opaque data */
310                         else {
311                                 proto_tree_add_text(bp_tree, voff, consumed,
312                                         "Option %d: %s (%d bytes)", code, text, vlen);
313                         }
314                         break;
315
316                 /* End Option */
317                 case 255:
318                         proto_tree_add_text(bp_tree, voff, 1, "End Option");
319                         consumed = 1;
320                         return consumed;
321
322                 default:
323                         /* nothing */
324                         break;
325         }
326
327         /* Normal cases */
328         if (code < NUM_OPT_INFOS) {
329                 text = opt[code].text;
330                 ftype = opt[code].ftype;
331
332                 switch (ftype) {
333                         case special:
334                                 return consumed;
335
336                         case ipv4:
337                                 /* one IP address */
338                                 if (vlen == 4) {
339                                         proto_tree_add_text(bp_tree, voff, consumed,
340                                                 "Option %d: %s = %s", code, text,
341                                                 ip_to_str((guint8*)&pd[voff+2]));
342                                 }
343                                 /* > 1 IP addresses. Let's make a sub-tree */
344                                 else {
345
346                                         vti = proto_tree_add_text(bp_tree, voff,
347                                                 consumed, "Option %d: %s", code, text);
348                                         v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION);
349                                         for (i = voff + 2; i < voff + consumed; i += 4) {
350                                                 proto_tree_add_text(v_tree, i, 4, "IP Address: %s",
351                                                         ip_to_str((guint8*)&pd[i]));
352                                         }
353                                 }
354                                 break;
355
356                         case string:
357                                 /* Fix for non null-terminated string supplied by
358                                  * John Lines <John.Lines@aeat.co.uk>
359                                  */
360                                 proto_tree_add_text(bp_tree, voff, consumed,
361                                                 "Option %d: %s = %.*s", code, text, vlen, &pd[voff+2]);
362                                 break;
363
364                         case opaque:
365                                 proto_tree_add_text(bp_tree, voff, consumed,
366                                                 "Option %d: %s (%d bytes)",
367                                                 code, text, vlen);
368                                 break;
369
370                         case val_u_short:
371                                 /* one IP address */
372                                 if (vlen == 2) {
373                                         proto_tree_add_text(bp_tree, voff, consumed,
374                                                         "Option %d: %s = %d", code, text,
375                                                         pntohs(&pd[voff+2]));
376                                 }
377                                 /* > 1 u_short */
378                                 else {
379                                         vti = proto_tree_add_text(bp_tree, voff,
380                                                 consumed, "Option %d: %s", code, text);
381                                         v_tree = proto_item_add_subtree(vti, ETT_BOOTP_OPTION);
382                                         for (i = voff + 2; i < voff + consumed; i += 2) {
383                                                 proto_tree_add_text(v_tree, i, 4, "Value: %d",
384                                                         pntohs(&pd[i]));
385                                         }
386                                 }
387                                 break;
388
389                         case val_u_long:
390                                 proto_tree_add_text(bp_tree, voff, consumed,
391                                                 "Option %d: %s = %d", code, text,
392                                                 pntohl(&pd[voff+2]));
393                                 break;
394
395                         case val_u_byte:
396                                 proto_tree_add_text(bp_tree, voff, consumed,
397                                                 "Option %d: %s = %d", code, text, pd[voff+2]);
398                                 break;
399
400                         case toggle:
401                                 i = pd[voff+2];
402                                 if (i != 0 && i != 1) {
403                                         proto_tree_add_text(bp_tree, voff, consumed,
404                                                         "Option %d: %s = Invalid Value %d", code, text,
405                                                         pd[voff+2]);
406                                 }
407                                 else {
408                                         proto_tree_add_text(bp_tree, voff, consumed,
409                                                         "Option %d: %s = %s", code, text,
410                                                         pd[voff+2] == 0 ? "Disabled" : "Enabled");
411                                 }
412                                 break;
413
414                         case yes_no:
415                                 i = pd[voff+2];
416                                 if (i != 0 && i != 1) {
417                                         proto_tree_add_text(bp_tree, voff, consumed,
418                                                         "Option %d: %s = Invalid Value %d", code, text,
419                                                         pd[voff+2]);
420                                 }
421                                 else {
422                                         proto_tree_add_text(bp_tree, voff, consumed,
423                                                         "Option %d: %s = %s", code, text,
424                                                         pd[voff+2] == 0 ? "No" : "Yes");
425                                 }
426                                 break;
427
428                         case time_in_secs:
429                                 time_secs = pntohl(&pd[voff+2]);
430                                 proto_tree_add_text(bp_tree, voff, consumed,
431                                         "Option %d: %s = %s", code, text,
432                                         ((time_secs == 0xffffffff) ?
433                                             "infinity" :
434                                             time_secs_to_str(time_secs)));
435                                 break;
436
437                         default:
438                                 proto_tree_add_text(bp_tree, voff, consumed,
439                                                 "Option %d: %s (%d bytes)", code, text, vlen);
440                 }
441         }
442         else {
443                 proto_tree_add_text(bp_tree, voff, consumed,
444                                 "Unknown Option Code: %d (%d bytes)", code, vlen);
445         }
446
447         return consumed;
448 }
449
450 void
451 dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
452 {
453         proto_tree      *bp_tree;
454         proto_item      *ti;
455         int                     voff, eoff; /* vender offset, end offset */
456         guint32         ip_addr;
457
458         if (check_col(fd, COL_PROTOCOL))
459                 col_add_str(fd, COL_PROTOCOL, "BOOTP");
460
461         if (check_col(fd, COL_INFO)) {
462                 if (pd[offset] == 1) {
463                         col_add_fstr(fd, COL_INFO, "Boot Request from %s",
464                                 arphrdaddr_to_str((guint8*)&pd[offset+28],
465                                         pd[offset+2], pd[offset+1]));
466                 }
467                 else {
468                         col_add_str(fd, COL_INFO, "Boot Reply");
469                 }
470         }
471
472         if (tree) {
473                 ti = proto_tree_add_item(tree, proto_bootp, offset, END_OF_FRAME, NULL);
474                 bp_tree = proto_item_add_subtree(ti, ETT_BOOTP);
475
476                 proto_tree_add_item_format(bp_tree, hf_bootp_type, 
477                                            offset, 1,
478                                            pd[offset], 
479                                            pd[offset] == 1 ?
480                                            "Boot Request" : "Boot Reply");
481                 proto_tree_add_item_format(bp_tree, hf_bootp_hw_type,
482                                            offset + 1, 1,
483                                            pd[offset+1],
484                                            "Hardware type: %s",
485                                            arphrdtype_to_str(pd[offset+1],
486                                                              "Unknown (0x%02x)"));
487                 proto_tree_add_item(bp_tree, hf_bootp_hw_len,
488                                     offset + 2, 1, pd[offset+2]);
489                 proto_tree_add_item(bp_tree, hf_bootp_hops,
490                                     offset + 3, 1, pd[offset+3]);
491                 proto_tree_add_item(bp_tree, hf_bootp_id,
492                                    offset + 4, 4, pntohl(&pd[offset+4]));
493                 proto_tree_add_item(bp_tree, hf_bootp_secs,
494                                     offset + 8, 2, pntohs(&pd[offset+8]));
495                 proto_tree_add_item(bp_tree, hf_bootp_flag,
496                                     offset + 10, 2, pd[offset+10] & 1);
497
498                 memcpy(&ip_addr, &pd[offset+12], sizeof(ip_addr));
499                 proto_tree_add_item(bp_tree, hf_bootp_ip_client, 
500                                     offset + 12, 4, ip_addr);
501                 memcpy(&ip_addr, &pd[offset+16], sizeof(ip_addr));
502                 proto_tree_add_item(bp_tree, hf_bootp_ip_your, 
503                                     offset + 16, 4, ip_addr);
504                 memcpy(&ip_addr, &pd[offset+20], sizeof(ip_addr));
505                 proto_tree_add_item(bp_tree, hf_bootp_ip_server,
506                                     offset + 20, 4, ip_addr);
507                 memcpy(&ip_addr, &pd[offset+24], sizeof(ip_addr));
508                 proto_tree_add_item(bp_tree, hf_bootp_ip_relay,
509                                     offset + 24, 4, ip_addr);
510
511                 proto_tree_add_item_format(bp_tree, hf_bootp_hw_addr, 
512                                            offset + 28, pd[offset+2],
513                                            &pd[offset+28],
514                                            "Client hardware address: %s",
515                                            arphrdaddr_to_str((guint8*)&pd[offset+28],
516                                                              pd[offset+2], pd[offset+1]));
517
518                 /* The server host name is optional */
519                 if (pd[offset+44]) {
520                         proto_tree_add_item_format(bp_tree, hf_bootp_server,
521                                                    offset + 44, 64,
522                                                    &pd[offset+44],
523                                                    "Server host name: %s",
524                                                    &pd[offset+44]);
525                 }
526                 else {
527                         proto_tree_add_item_format(bp_tree, hf_bootp_server,
528                                                    offset + 44, 64,
529                                                    &pd[offset+44],
530                                                    "Server host name not given");
531                 }
532
533                 /* Boot file */
534                 if (pd[offset+108]) {
535                         proto_tree_add_item_format(bp_tree, hf_bootp_file,
536                                                    offset + 108, 128,
537                                                    &pd[offset+108],
538                                                    "Boot file name: %s",
539                                                    &pd[offset+108]);
540                 }
541                 else {
542                         proto_tree_add_item_format(bp_tree, hf_bootp_file,
543                                                    offset + 108, 128,
544                                                    &pd[offset+108],
545                                                    "Boot file name not given");
546                 }
547
548                 if (pntohl(&pd[offset+236]) == 0x63825363) {
549                         proto_tree_add_item_format(bp_tree, hf_bootp_cookie,
550                                                    offset + 236, 4,
551                                                    pd[offset+236],
552                                                    "Magic cookie: (OK)");
553                 }
554                 else {
555                         memcpy(&ip_addr, &pd[offset + 236], sizeof(ip_addr));
556                         proto_tree_add_item(bp_tree, hf_bootp_cookie,
557                                             offset + 236, 4, ip_addr);
558                 }
559
560                 voff = offset+240;
561                 eoff = pi.captured_len;
562
563                 while (voff < eoff) {
564                         voff += bootp_option(pd, bp_tree, voff, eoff);
565                 }
566         }
567 }
568
569 void
570 proto_register_bootp(void)
571 {
572   static hf_register_info hf[] = {
573     { &hf_bootp_type,
574       { "Message type",                 "bootp.type",    FT_UINT8,  BASE_NONE, NULL, 0x0,
575         "" }},
576
577     { &hf_bootp_hw_type,
578       { "Hardware type",                "bootp.hw.type", FT_UINT8,  BASE_HEX, NULL, 0x0,
579         "" }},
580
581     { &hf_bootp_hw_len,
582       { "Hardware address length",      "bootp.hw.len",  FT_UINT8,  BASE_DEC, NULL, 0x0,
583         "" }},
584
585     { &hf_bootp_hops,
586       { "Hops",                         "bootp.hops",    FT_UINT8,  BASE_DEC, NULL, 0x0,
587         "" }},
588
589     { &hf_bootp_id,
590       { "Transaction ID",               "bootp.id",      FT_UINT32, BASE_HEX, NULL, 0x0,
591         "" }},
592
593     { &hf_bootp_secs,
594       { "Seconds elapsed",              "bootp.secs",    FT_UINT16, BASE_DEC, NULL, 0x0,
595         "" }},
596
597     { &hf_bootp_flag,
598       { "Broadcast flag",               "bootp.flag",    FT_UINT16, BASE_DEC, NULL, 0x0,
599         "" }},
600
601     { &hf_bootp_ip_client,
602       { "Client IP address",            "bootp.ip.client",FT_IPv4,  BASE_NONE, NULL, 0x0,
603         "" }},
604
605     { &hf_bootp_ip_your,
606       { "Your (client) IP address",     "bootp.ip.your",  FT_IPv4,  BASE_NONE, NULL, 0x0,
607         "" }},
608
609     { &hf_bootp_ip_server,
610       { "Next server IP address",       "bootp.ip.server",FT_IPv4,  BASE_NONE, NULL, 0x0,
611         "" }},
612
613     { &hf_bootp_ip_relay,
614       { "Relay agent IP address",       "bootp.ip.relay", FT_IPv4,  BASE_NONE, NULL, 0x0,
615         "" }},
616
617     { &hf_bootp_hw_addr,
618       { "Client hardware address",      "bootp.hw.addr", FT_BYTES,  BASE_NONE, NULL, 0x0,
619         "" }},
620
621     { &hf_bootp_server,
622       { "Server host name",             "bootp.server",  FT_STRING, BASE_NONE, NULL, 0x0,
623         "" }},
624
625     { &hf_bootp_file,
626       { "Boot file name",               "bootp.file",    FT_STRING, BASE_NONE, NULL, 0x0,
627         "" }},
628
629     { &hf_bootp_cookie,
630       { "Magic cookie",                 "bootp.cookie",  FT_IPv4,   BASE_NONE, NULL, 0x0,
631         "" }},
632   };
633   
634   proto_bootp = proto_register_protocol("Bootstrap Protocol", "bootp");
635   proto_register_field_array(proto_bootp, hf, array_length(hf));
636 }