Eliminate #include <epan/oui.h> from dissectors that don't need it.
[metze/wireshark/wip.git] / epan / dissectors / packet-bootp.c
1 /* packet-bootp.c
2  * Routines for BOOTP/DHCP packet disassembly
3  *
4  * Copyright 1998, Gilbert Ramirez <gram@alumni.rice.edu>
5  * Copyright 2004, Thomas Anders <thomas.anders [AT] blue-cable.de>
6  *
7  * Added option field filters
8  * Copyright 2011, Michael Mann
9  *
10  * Added option  77 : RFC 3004 - The User Class Option for DHCP
11  * Added option 117 : RFC 2937 - The Name Service Search Option for DHCP
12  * Added option 119 : RFC 3397 - Dynamic Host Configuration Protocol (DHCP) Domain Search Option
13  *                    RFC 3396 - Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)
14  * Improved opt 120 : Add support of RFC 3396 - Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)
15  *                    Add support compression according to the encoding in Section 4.1.4 of RFC 1035 - DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION
16  *
17  *
18  * Copyright 2012, Jerome LAFORGE <jerome.laforge [AT] gmail.com>
19  *
20  * The information used comes from:
21  * RFC  951: Bootstrap Protocol
22  * RFC 1035: Domain Names - Implementation And Specification
23  * RFC 1497: BOOTP extensions
24  * RFC 1542: Clarifications and Extensions for the Bootstrap Protocol
25  * RFC 2131: Dynamic Host Configuration Protocol
26  * RFC 2132: DHCP Options and BOOTP Vendor Extensions
27  * RFC 2241: DHCP Options for Novell Directory Services
28  * RFC 2242: NetWare/IP Domain Name and Information
29  * RFC 2489: Procedure for Defining New DHCP Options
30  * RFC 2610: DHCP Options for Service Location Protocol
31  * RFC 2685: Virtual Private Networks Identifier
32  * RFC 2937: The Name Service Search Option for DHCP
33  * RFC 3004: The User Class Option for DHCP
34  * RFC 3046: DHCP Relay Agent Information Option
35  * RFC 3118: Authentication for DHCP Messages
36  * RFC 3203: DHCP reconfigure extension
37  * RFC 3315: Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
38  * RFC 3396: Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)
39  * RFC 3397: Dynamic Host Configuration Protocol (DHCP) Domain Search Option
40  * RFC 3495: DHCP Option (122) for CableLabs Client Configuration
41  * RFC 3594: PacketCable Security Ticket Control Sub-Option (122.9)
42  * RFC 3442: Classless Static Route Option for DHCP version 4
43  * RFC 3825: Dynamic Host Configuration Protocol Option for Coordinate-based Location Configuration Information
44  * RFC 3925: Vendor-Identifying Vendor Options for Dynamic Host Configuration Protocol version 4 (DHCPv4)
45  * RFC 3942: Reclassifying DHCPv4 Options
46  * RFC 4174: The IPv4 Dynamic Host Configuration Protocol (DHCP) Option for the Internet Storage Name Service
47  * RFC 4243: Vendor-Specific Information Suboption for the Dynamic Host Configuration Protocol (DHCP) Relay Agent Option
48  * RFC 4361: Node-specific Client Identifiers for Dynamic Host Configuration Protocol Version Four (DHCPv4)
49  * RFC 4388: Dynamic Host Configuration Protocol (DHCP) Leasequery
50  * RFC 4578: Dynamic Host Configuration Protocol (DHCP) Options for PXE
51  * RFC 4776: Dynamic Host Configuration Protocol (DHCPv4 and DHCPv6) Option for Civic Addresses Configuration Information
52  * RFC 5223: Discovering Location-to-Service Translation (LoST) Servers Using the Dynamic Host Configuration Protocol (DHCP)
53  * RFC 5417: CAPWAP Access Controller DHCP Option
54  * RFC 5969: IPv6 Rapid Deployment on IPv4 Infrastructures (6rd)
55  * RFC 6607: Virtual Subnet Selection Options for DHCPv4 and DHCPv6
56  * RFC 7710: Captive-Portal Identification Using DHCP or Router Advertisements (RAs)
57  * draft-ietf-dhc-fqdn-option-07.txt
58  * TFTP Server Address Option for DHCPv4 [draft-raj-dhc-tftp-addr-option-06.txt: http://tools.ietf.org/html/draft-raj-dhc-tftp-addr-option-06]
59  * BOOTP and DHCP Parameters
60  *     http://www.iana.org/assignments/bootp-dhcp-parameters
61  * DOCSIS(TM) 2.0 Radio Frequency Interface Specification
62  *     http://www.cablelabs.com/specifications/CM-SP-RFI2.0-I11-060602.pdf
63  * DOCSIS(TM) 3.0 MAC and Upper Layer Protocols Interface Specification
64  *     http://www.cablelabs.com/specifications/CM-SP-MULPIv3.0-I20-121113.pdf
65  * PacketCable(TM) 1.0 MTA Device Provisioning Specification
66  *     http://www.cablelabs.com/packetcable/downloads/specs/PKT-SP-PROV-I11-050812.pdf
67  *     http://www.cablelabs.com/specifications/archives/PKT-SP-PROV-I05-021127.pdf (superseded by above)
68  * PacketCable(TM) 1.5 MTA Device Provisioning Specification
69  *     http://www.cablelabs.com/packetcable/downloads/specs/PKT-SP-PROV1.5-I02-050812.pdf
70  * PacketCable(TM) 2.0 EUE Device Provisioning Specification
71  *     http://www.cablelabs.com/specifications/PKT-SP-EUE-DATA-I03-090528.pdf
72  * Business Services over DOCSIS(R) Layer 2 Virtual Private Networks
73  *     http://www.cablelabs.com/specifications/CM-SP-L2VPN-I09-100611.pdf
74  * CableHome(TM) 1.1 Specification
75  *     http://www.cablelabs.com/projects/cablehome/downloads/specs/CH-SP-CH1.1-I11-060407.pdf
76  * Broadband Forum TR-111
77  *     http://www.broadband-forum.org/technical/download/TR-111.pdf
78  * Boot Server Discovery Protocol (BSDP)
79  *     http://opensource.apple.com/source/bootp/bootp-198.1/Documentation/BSDP.doc
80  *
81  * Wireshark - Network traffic analyzer
82  * By Gerald Combs <gerald@wireshark.org>
83  * Copyright 1998 Gerald Combs
84  *
85  * This program is free software; you can redistribute it and/or
86  * modify it under the terms of the GNU General Public License
87  * as published by the Free Software Foundation; either version 2
88  * of the License, or (at your option) any later version.
89  *
90  * This program is distributed in the hope that it will be useful,
91  * but WITHOUT ANY WARRANTY; without even the implied warranty of
92  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
93  * GNU General Public License for more details.
94  *
95  * You should have received a copy of the GNU General Public License
96  * along with this program; if not, write to the Free Software
97  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
98  */
99
100 /*
101  * Some of the development of the BOOTP/DHCP protocol decoder was sponsored by
102  * Cable Television Laboratories, Inc. ("CableLabs") based upon proprietary
103  * CableLabs' specifications. Your license and use of this protocol decoder
104  * does not mean that you are licensed to use the CableLabs'
105  * specifications.  If you have questions about this protocol, contact
106  * jf.mule [AT] cablelabs.com or c.stuart [AT] cablelabs.com for additional
107  * information.
108  */
109
110
111 #include "config.h"
112
113 #include <stdio.h>
114
115 #include <epan/packet.h>
116 #include <epan/exceptions.h>
117 #include "packet-arp.h"
118 #include "packet-dns.h"                         /* for get_dns_name() */
119 #include <epan/addr_resolv.h>
120 #include <epan/prefs.h>
121 #include <epan/tap.h>
122 #include <epan/stat_tap_ui.h>
123 #include <epan/arptypes.h>
124 #include <epan/addr_resolv.h>
125 #include <epan/expert.h>
126 #include <epan/uat.h>
127 #include <epan/strutil.h>
128 #include <wsutil/str_util.h>
129 #include <wsutil/strtoi.h>
130 void proto_register_bootp(void);
131 void proto_reg_handoff_bootp(void);
132
133 static int bootp_dhcp_tap = -1;
134 static int proto_bootp = -1;
135 static int hf_bootp_type = -1;
136 static int hf_bootp_hw_type = -1;
137 static int hf_bootp_hw_len = -1;
138 static int hf_bootp_hops = -1;
139 static int hf_bootp_id = -1;
140 static int hf_bootp_secs = -1;
141 static int hf_bootp_flags = -1;
142 static int hf_bootp_flags_broadcast = -1;
143 static int hf_bootp_flags_reserved = -1;
144 static int hf_bootp_ip_client = -1;
145 static int hf_bootp_ip_your = -1;
146 static int hf_bootp_ip_server = -1;
147 static int hf_bootp_ip_relay = -1;
148 static int hf_bootp_hw_addr = -1;
149 static int hf_bootp_hw_addr_padding = -1;
150 static int hf_bootp_hw_ether_addr = -1;
151 static int hf_bootp_server = -1;
152 static int hf_bootp_file = -1;
153 static int hf_bootp_cookie = -1;
154 static int hf_bootp_vendor_specific_options = -1;
155 static int hf_bootp_dhcp = -1;
156 static int hf_bootp_fqdn_flags = -1;
157 static int hf_bootp_fqdn_s = -1;
158 static int hf_bootp_fqdn_o = -1;
159 static int hf_bootp_fqdn_e = -1;
160 static int hf_bootp_fqdn_n = -1;
161 static int hf_bootp_fqdn_mbz = -1;
162 static int hf_bootp_fqdn_rcode1 = -1;
163 static int hf_bootp_fqdn_rcode2 = -1;
164 static int hf_bootp_fqdn_name = -1;
165 static int hf_bootp_fqdn_asciiname = -1;
166 static int hf_bootp_pkt_mta_cap_len = -1;
167 static int hf_bootp_pkt_mta_cap_type = -1;
168 static int hf_bootp_docsis_cm_cap_type = -1;
169 static int hf_bootp_docsis_cm_cap_len = -1;
170 static int hf_bootp_client_identifier_uuid = -1;
171 static int hf_bootp_client_id_iaid = -1;
172 static int hf_bootp_client_id_duid_type = -1;
173 static int hf_bootp_client_hardware_address = -1;
174 static int hf_bootp_client_identifier_duid_llt_hw_type = -1;
175 static int hf_bootp_client_identifier_duid_ll_hw_type = -1;
176 static int hf_bootp_client_identifier_time = -1;
177 static int hf_bootp_client_identifier_link_layer_address = -1;
178 static int hf_bootp_client_identifier_enterprise_num = -1;
179 static int hf_bootp_client_identifier = -1;
180 static int hf_bootp_client_identifier_type = -1;
181 static int hf_bootp_client_identifier_undef = -1;
182 static int hf_bootp_option_type = -1;
183 static int hf_bootp_option_length = -1;
184 static int hf_bootp_option_value = -1;
185 static int hf_bootp_option_value_8 = -1;
186 static int hf_bootp_option_value_16 = -1;
187 static int hf_bootp_option_value_u32 = -1;
188 static int hf_bootp_option_value_i32 = -1;
189 static int hf_bootp_option_value_stringz = -1;
190 static int hf_bootp_option_value_ip_address = -1;
191 static int hf_bootp_option_value_boolean = -1;
192 static int hf_bootp_suboption_length = -1;
193
194 static int hf_bootp_option_padding = -1;                                /* 0 */
195 static int hf_bootp_option_subnet_mask = -1;                            /* 1 */
196 static int hf_bootp_option_time_offset = -1;                            /* 2 */
197 static int hf_bootp_option_router = -1;                                 /* 3 */
198 static int hf_bootp_option_time_server = -1;                            /* 4 */
199 static int hf_bootp_option_name_server = -1;                            /* 5 */
200 static int hf_bootp_option_domain_name_server = -1;                     /* 6 */
201 static int hf_bootp_option_log_server = -1;                             /* 7 */
202 static int hf_bootp_option_quotes_server = -1;                          /* 8 */
203 static int hf_bootp_option_lpr_server = -1;                             /* 9 */
204 static int hf_bootp_option_impress_server = -1;                         /* 10 */
205 static int hf_bootp_option_resource_location_server = -1;               /* 11 */
206 static int hf_bootp_option_hostname = -1;                               /* 12 */
207 static int hf_bootp_option_boot_file_size = -1;                         /* 13 */
208 static int hf_bootp_option_merit_dump_file = -1;                        /* 14 */
209 static int hf_bootp_option_domain_name = -1;                            /* 15 */
210 static int hf_bootp_option_swap_server = -1;                            /* 16 */
211 static int hf_bootp_option_root_path = -1;                              /* 17 */
212 static int hf_bootp_option_extension_path = -1;                         /* 18 */
213 static int hf_bootp_option_ip_forwarding = -1;                          /* 19 */
214 static int hf_bootp_option_non_local_source_routing = -1;               /* 20 */
215 static int hf_bootp_option_policy_filter_ip = -1;                       /* 21 - IP address */
216 static int hf_bootp_option_policy_filter_subnet_mask = -1;              /* 21 - Subnet mask */
217 static int hf_bootp_option_max_datagram_reassembly_size = -1;           /* 22 */
218 static int hf_bootp_option_default_ip_ttl = -1;                         /* 23 */
219 static int hf_bootp_option_path_mtu_aging_timeout = -1;                 /* 24 */
220 static int hf_bootp_option_path_mtu_plateau_table_item = -1;            /* 25 */
221 static int hf_bootp_option_interface_mtu = -1;                          /* 26 */
222 static int hf_bootp_option_all_subnets_are_local = -1;                  /* 27 */
223 static int hf_bootp_option_broadcast_address = -1;                      /* 28 */
224 static int hf_bootp_option_perform_mask_discovery = -1;                 /* 29 */
225 static int hf_bootp_option_mask_supplier = -1;                          /* 30 */
226 static int hf_bootp_option_perform_router_discover = -1;                /* 31 */
227 static int hf_bootp_option_router_solicitation_address = -1;            /* 32 */
228 static int hf_bootp_option_static_route_ip = -1;                        /* 33 - Destination IP */
229 static int hf_bootp_option_static_route_router = -1;                    /* 33 - Router */
230 static int hf_bootp_option_trailer_encapsulation = -1;                  /* 34 */
231 static int hf_bootp_option_arp_cache_timeout = -1;                      /* 35 */
232 static int hf_bootp_option_ethernet_encapsulation = -1;                 /* 36 */
233 static int hf_bootp_option_tcp_default_ttl = -1;                        /* 37 */
234 static int hf_bootp_option_tcp_keepalive_interval = -1;                 /* 38 */
235 static int hf_bootp_option_tcp_keepalive_garbage = -1;                  /* 39 */
236 static int hf_bootp_option_nis_domain = -1;                             /* 40 */
237 static int hf_bootp_option_nis_server = -1;                             /* 41 */
238 static int hf_bootp_option_ntp_server = -1;                             /* 42 */
239
240 static int hf_bootp_option43_value = -1;                                /* 43 suboption value */
241 static int hf_bootp_option43_value_8 = -1;                              /* 43 suboption value */
242 static int hf_bootp_option43_value_32 = -1;                             /* 43 suboption value */
243 static int hf_bootp_option43_value_stringz = -1;                        /* 43 suboption value */
244 static int hf_bootp_option43_value_ip_address = -1;                     /* 43 suboption value */
245
246 static int hf_bootp_option43_pxeclient_suboption = -1;                  /* 43 suboption */
247 static int hf_bootp_option43_pxeclient_padding = -1;                    /* 43:0 PXE  */
248 static int hf_bootp_option43_pxeclient_mtftp_ip = -1;                   /* 43:1 PXE  */
249 static int hf_bootp_option43_pxeclient_mtftp_client_port = -1;          /* 43:2 PXE  */
250 static int hf_bootp_option43_pxeclient_mtftp_server_port = -1;          /* 43:3 PXE  */
251 static int hf_bootp_option43_pxeclient_mtftp_timeout = -1;              /* 43:4 PXE  */
252 static int hf_bootp_option43_pxeclient_mtftp_delay = -1;                /* 43:5 PXE  */
253 static int hf_bootp_option43_pxeclient_discovery_control = -1;          /* 43:6 PXE  */
254 static int hf_bootp_option43_pxeclient_multicast_address = -1;          /* 43:7 PXE  */
255 static int hf_bootp_option43_pxeclient_boot_servers = -1;               /* 43:8 PXE  */
256 static int hf_bootp_option43_pxeclient_boot_menu = -1;                  /* 43:9 PXE  */
257 static int hf_bootp_option43_pxeclient_menu_prompt = -1;                /* 43:10 PXE  */
258 static int hf_bootp_option43_pxeclient_multicast_address_alloc = -1;    /* 43:11 PXE  */
259 static int hf_bootp_option43_pxeclient_credential_types = -1;           /* 43:12 PXE  */
260 static int hf_bootp_option43_pxeclient_boot_item = -1;                  /* 43:71 PXE  */
261 static int hf_bootp_option43_pxeclient_end = -1;                        /* 43:255 PXE */
262
263 static int hf_bootp_option43_cl_suboption = -1;                         /* 43 suboption */
264 static int hf_bootp_option43_cl_padding = -1;                           /* 43:0 CL  */
265 static int hf_bootp_option43_cl_suboption_request_list = -1;            /* 43:1 CL  */
266 static int hf_bootp_option43_cl_device_type = -1;                       /* 43:2 CL  */
267 static int hf_bootp_option43_cl_esafe_type = -1;                        /* 43:3 CL  */
268 static int hf_bootp_option43_cl_serial_number = -1;                     /* 43:4 CL  */
269 static int hf_bootp_option43_cl_hardware_version = -1;                  /* 43:5 CL  */
270 static int hf_bootp_option43_cl_software_version = -1;                  /* 43:6 CL  */
271 static int hf_bootp_option43_cl_boot_rom_version = -1;                  /* 43:7 CL  */
272 static int hf_bootp_option43_cl_oui_bytes = -1;                         /* 43:8 CL  */
273 static int hf_bootp_option43_cl_oui_string = -1;                        /* 43:8 CL  */
274 static int hf_bootp_option43_cl_model_number = -1;                      /* 43:9 CL  */
275 static int hf_bootp_option43_cl_vendor_name10 = -1;                     /* 43:10 CL  */
276 static int hf_bootp_option43_cl_address_realm = -1;                     /* 43:11 CL  */
277 static int hf_bootp_option43_cl_cm_ps_system_desc = -1;                 /* 43:12 CL  */
278 static int hf_bootp_option43_cl_cm_ps_firmware_revision = -1;           /* 43:13 CL  */
279 static int hf_bootp_option43_cl_firewall_policy_file_version = -1;      /* 43:14 CL  */
280 static int hf_bootp_option43_cl_esafe_config_file_devices = -1;         /* 43:15 CL  */
281 static int hf_bootp_option43_cl_video_security_tape = -1;               /* 43:18 CL  */
282 static int hf_bootp_option43_cl_mta_mac_address = -1;                   /* 43:31 CL  */
283 static int hf_bootp_option43_cl_correlation_ID = -1;                    /* 43:32 CL  */
284 static int hf_bootp_option43_cl_vendor_name51 = -1;                     /* 43:51 CL  */
285 static int hf_bootp_option43_cl_cablecard_capability = -1;              /* 43:52 CL  */
286 static int hf_bootp_option43_cl_device_id_ca = -1;                      /* 43:53 CL  */
287 static int hf_bootp_option43_cl_device_id_x509 = -1;                    /* 43:54 CL  */
288 static int hf_bootp_option43_cl_end = -1;                               /* 43:255 CL */
289
290 static int hf_bootp_option43_bsdp_suboption = -1;                       /* 43 suboption */
291 static int hf_bootp_option43_bsdp_message_type = -1;                    /* 43:1 BSDP  */
292 static int hf_bootp_option43_bsdp_version = -1;                         /* 43:2 BSDP  */
293 static int hf_bootp_option43_bsdp_server_identifier = -1;               /* 43:3 BSDP  */
294 static int hf_bootp_option43_bsdp_server_priority = -1;                 /* 43:4 BSDP  */
295 static int hf_bootp_option43_bsdp_reply_port = -1;                      /* 43:5 BSDP  */
296 static int hf_bootp_option43_bsdp_boot_image_list_path = -1;            /* 43:6 BSDP  */
297 static int hf_bootp_option43_bsdp_default_boot_image_id = -1;           /* 43:7 BSDP  */
298 static int hf_bootp_option43_bsdp_selected_boot_image_id = -1;          /* 43:8 BSDP  */
299 static int hf_bootp_option43_bsdp_boot_image_list = -1;                 /* 43:9 BSDP  */
300 static int hf_bootp_option43_bsdp_netboot_firmware = -1;                /* 43:10 BSDP  */
301 static int hf_bootp_option43_bsdp_attributes_filter_list = -1;          /* 43:11 BSDP  */
302 static int hf_bootp_option43_bsdp_message_size = -1;                    /* 43:12 BSDP  */
303 static int hf_bootp_option43_bsdp_boot_image_index = -1;                /* 43 BSDP  */
304 static int hf_bootp_option43_bsdp_boot_image_attribute = -1;            /* 43 BSDP  */
305 static int hf_bootp_option43_bsdp_boot_image_attribute_install = -1;    /* 43 BSDP  */
306 static int hf_bootp_option43_bsdp_boot_image_attribute_kind = -1;       /* 43 BSDP  */
307 static int hf_bootp_option43_bsdp_boot_image_attribute_reserved = -1;   /* 43 BSDP  */
308 static int hf_bootp_option43_bsdp_image_desc = -1;                      /* 43 BSDP  */
309 static int hf_bootp_option43_bsdp_boot_image_name = -1;                 /* 43 BSDP  */
310 static int hf_bootp_option43_bsdp_boot_image_name_len = -1;             /* 43 BSDP  */
311
312 static int hf_bootp_option43_alcatel_suboption = -1;                    /* 43 suboption */
313 static int hf_bootp_option43_alcatel_padding = -1;                      /* 43:0 Alcatel  */
314 static int hf_bootp_option43_alcatel_vlan_id = -1;                      /* 43:58 Alcatel  */
315 static int hf_bootp_option43_alcatel_tftp1 = -1;                        /* 43:64 Alcatel  */
316 static int hf_bootp_option43_alcatel_tftp2 = -1;                        /* 43:65 Alcatel  */
317 static int hf_bootp_option43_alcatel_app_type = -1;                     /* 43:66 Alcatel  */
318 static int hf_bootp_option43_alcatel_sip_url = -1;                      /* 43:67 Alcatel  */
319 static int hf_bootp_option43_alcatel_end = -1;                          /* 43:255 Alcatel */
320
321 static int hf_bootp_option43_arubaap_controllerip = -1;                 /* 43: ArubaAP*/
322 static int hf_bootp_option43_arubaiap = -1;                             /* 43: ArubaIAP*/
323 static int hf_bootp_option43_arubaiap_nameorg = -1;                     /* 43: ArubaIAP: Name Organisation*/
324 static int hf_bootp_option43_arubaiap_ampip = -1;                       /* 43: ArubaIAP: AMP IP Address*/
325 static int hf_bootp_option43_arubaiap_password = -1;                    /* 43 :ArubaIAP: Password*/
326
327 static int hf_bootp_option_netbios_over_tcpip_name_server = -1;         /* 44 */
328 static int hf_bootp_option_netbios_over_tcpip_dd_name_server = -1;      /* 45 */
329 static int hf_bootp_option_netbios_over_tcpip_node_type = -1;           /* 46 */
330 static int hf_bootp_option_netbios_over_tcpip_scope = -1;               /* 47 */
331 static int hf_bootp_option_xwindows_system_font_server = -1;            /* 48 */
332 static int hf_bootp_option_xwindows_system_display_manager = -1;        /* 49 */
333 static int hf_bootp_option_requested_ip_address = -1;                   /* 50 */
334 static int hf_bootp_option_ip_address_lease_time = -1;                  /* 51 */
335 static int hf_bootp_option_option_overload = -1;                        /* 52 */
336 static int hf_bootp_option_dhcp = -1;                                   /* 53 */
337 static int hf_bootp_option_dhcp_server_id = -1;                         /* 54 */
338 static int hf_bootp_option_parameter_request_list_item = -1;            /* 55 */
339 static int hf_bootp_option_message = -1;                                /* 56 */
340 static int hf_bootp_option_dhcp_max_message_size = -1;                  /* 57 */
341 static int hf_bootp_option_renewal_time_value = -1;                     /* 58 */
342 static int hf_bootp_option_rebinding_time_value = -1;                   /* 59 */
343 static int hf_bootp_option_vendor_class_id = -1;                        /* 60 */
344 static int hf_bootp_option_vendor_class_data = -1;                      /* 60 */
345
346 static int hf_bootp_option_novell_netware_ip_domain = -1;               /* 62 */
347
348 static int hf_bootp_option63_suboption = -1;                            /* 63 suboption */
349 static int hf_bootp_option63_value = -1;                                /* 63 suboption value */
350 static int hf_bootp_option63_value_8 = -1;                              /* 63 suboption value */
351 static int hf_bootp_option63_value_ip_address = -1;                     /* 63 suboption value */
352 static int hf_bootp_option63_value_boolean = -1;                        /* 63 suboption value */
353 static int hf_bootp_option63_broadcast = -1;                            /* 63:5 */
354 static int hf_bootp_option63_preferred_dss_server = -1;                 /* 63:6 */
355 static int hf_bootp_option63_nearest_nwip_server = -1;                  /* 63:7 */
356 static int hf_bootp_option63_autoretries = -1;                          /* 63:8 */
357 static int hf_bootp_option63_autoretry_delay = -1;                      /* 63:9 */
358 static int hf_bootp_option63_support_netware_v1_1 = -1;                 /* 63:10 */
359 static int hf_bootp_option63_primary_dss = -1;                          /* 63:11 */
360
361 static int hf_bootp_option_nis_plus_domain = -1;                        /* 64 */
362 static int hf_bootp_option_nis_plus_server = -1;                        /* 65 */
363 static int hf_bootp_option_tftp_server_name = -1;                       /* 66 */
364 static int hf_bootp_option_bootfile_name = -1;                          /* 67 */
365 static int hf_bootp_option_mobile_ip_home_agent = -1;                   /* 68 */
366 static int hf_bootp_option_smtp_server = -1;                            /* 69 */
367 static int hf_bootp_option_pop3_server = -1;                            /* 70 */
368 static int hf_bootp_option_nntp_server = -1;                            /* 71 */
369 static int hf_bootp_option_default_www_server = -1;                     /* 72 */
370 static int hf_bootp_option_default_finger_server = -1;                  /* 73 */
371 static int hf_bootp_option_default_irc_server = -1;                     /* 74 */
372 static int hf_bootp_option_streettalk_server = -1;                      /* 75 */
373 static int hf_bootp_option_streettalk_da_server = -1;                   /* 76 */
374 static int hf_bootp_option77_user_class = -1;                           /* 77 User Class instance */
375 static int hf_bootp_option77_user_class_length = -1;                    /* 77 length of User Class instance */
376 static int hf_bootp_option77_user_class_data = -1;                      /* 77 data of User Class instance */
377 static int hf_bootp_option_slp_directory_agent_value = -1;              /* 78 */
378 static int hf_bootp_option_slp_directory_agent_slpda_address = -1;      /* 78 */
379 static int hf_bootp_option_slp_service_scope_value = -1;                /* 79 */
380 static int hf_bootp_option_slp_service_scope_string = -1;               /* 79 */
381
382 static int hf_bootp_option82_suboption = -1;                            /* 82 suboption */
383 static int hf_bootp_option82_value = -1;                                /* 82 suboption value */
384 static int hf_bootp_option82_value_8 = -1;                              /* 82 suboption value */
385 static int hf_bootp_option82_value_32 = -1;                             /* 82 suboption value */
386 static int hf_bootp_option82_value_ip_address = -1;                     /* 82 suboption value */
387 static int hf_bootp_option82_value_stringz = -1;                        /* 82 suboption value */
388 static int hf_bootp_option82_padding = -1;                              /* 82:0 */
389 static int hf_bootp_option82_agent_circuit_id = -1;                     /* 82:1 */
390 static int hf_bootp_option82_agent_remote_id = -1;                      /* 82:2 */
391 static int hf_bootp_option82_reserved = -1;                             /* 82:3 */
392 static int hf_bootp_option82_docsis_device_class = -1;                  /* 82:4 */
393 static int hf_bootp_option82_link_selection = -1;                       /* 82:5 */
394 static int hf_bootp_option82_subscriber_id = -1;                        /* 82:6 */
395 static int hf_bootp_option82_radius_attributes = -1;                    /* 82:7 */
396 static int hf_bootp_option82_authentication = -1;                       /* 82:8 */
397 static int hf_bootp_option82_vi = -1;                                   /* 82:9 */
398                                                                         /* 82:9 suboptions */
399 static int hf_bootp_option82_vi_enterprise = -1;
400 static int hf_bootp_option82_vi_data_length = -1;
401 static int hf_bootp_option82_vi_cl_option = -1;
402 static int hf_bootp_option82_vi_cl_length = -1;
403 static int hf_bootp_option82_vi_cl_tag = -1;
404 static int hf_bootp_option82_vi_cl_tag_length = -1;
405 static int hf_bootp_option82_vi_cl_docsis_version = -1;
406                                                                         /* 82:9 suboptions end */
407 static int hf_bootp_option82_flags = -1;                                /* 82:10 */
408 static int hf_bootp_option82_server_id_override = -1;                   /* 82:11 */
409 static int hf_bootp_option82_relay_agent_id = -1;                       /* 82:12 */
410 static int hf_bootp_option82_link_selection_cisco = -1;                 /* 82:150 */
411 static int hf_bootp_option82_vrf_name_vpn_id = -1;                      /* 82:151 */
412                                                                         /* 82:151 suboptions */
413 static int hf_bootp_option82_vrf_name_global = -1;
414 static int hf_bootp_option82_vrf_name = -1;
415 static int hf_bootp_option82_vrf_name_vpn_id_oui = -1;
416 static int hf_bootp_option82_vrf_name_vpn_id_index = -1;
417                                                                         /* 82:151 suboptions end */
418 static int hf_bootp_option82_server_id_override_cisco = -1;             /* 82:152 */
419
420 static int hf_bootp_option_isns_functions = -1;
421 static int hf_bootp_option_isns_functions_enabled = -1;
422 static int hf_bootp_option_isns_functions_dd_authorization = -1;
423 static int hf_bootp_option_isns_functions_sec_policy_distibution = -1;
424 static int hf_bootp_option_isns_functions_reserved = -1;
425
426 static int hf_bootp_option_isns_discovery_domain_access = -1;
427 static int hf_bootp_option_isns_discovery_domain_access_enabled = -1;
428 static int hf_bootp_option_isns_discovery_domain_access_control_node = -1;
429 static int hf_bootp_option_isns_discovery_domain_access_iscsi_target = -1;
430 static int hf_bootp_option_isns_discovery_domain_access_iscsi_inititator = -1;
431 static int hf_bootp_option_isns_discovery_domain_access_ifcp_target_port = -1;
432 static int hf_bootp_option_isns_discovery_domain_access_ifcp_initiator_port = -1;
433 static int hf_bootp_option_isns_discovery_domain_access_reserved = -1;
434
435 static int hf_bootp_option_isns_administrative_flags = -1;
436 static int hf_bootp_option_isns_administrative_flags_enabled = -1;
437 static int hf_bootp_option_isns_administrative_flags_heartbeat = -1;
438 static int hf_bootp_option_isns_administrative_flags_management_scns = -1;
439 static int hf_bootp_option_isns_administrative_flags_default_dd = -1;
440 static int hf_bootp_option_isns_administrative_flags_reserved = -1;
441
442 static int hf_bootp_option_isns_server_security_bitmap = -1;
443 static int hf_bootp_option_isns_server_security_bitmap_enabled = -1;
444 static int hf_bootp_option_isns_server_security_bitmap_ike_ipsec_enabled = -1;
445 static int hf_bootp_option_isns_server_security_bitmap_main_mode = -1;
446 static int hf_bootp_option_isns_server_security_bitmap_aggressive_mode = -1;
447 static int hf_bootp_option_isns_server_security_bitmap_pfs = -1;
448 static int hf_bootp_option_isns_server_security_bitmap_transport_mode = -1;
449 static int hf_bootp_option_isns_server_security_bitmap_tunnel_mode = -1;
450 static int hf_bootp_option_isns_server_security_bitmap_reserved = -1;
451
452 static int hf_bootp_option_isns_heartbeat_originator_addr = -1;
453 static int hf_bootp_option_isns_primary_server_addr = -1;
454 static int hf_bootp_option_isns_secondary_server_addr_list = -1;
455
456 static int hf_bootp_option_novell_dss_string = -1;                      /* 85 */
457 static int hf_bootp_option_novell_dss_ip = -1;                          /* 85 */
458 static int hf_bootp_option_novell_ds_tree_name = -1;                    /* 86 */
459 static int hf_bootp_option_novell_ds_context = -1;                      /* 87 */
460 static int hf_bootp_option_dhcp_authentication_protocol = -1;           /* 90 */
461 static int hf_bootp_option_dhcp_authentication_alg_delay = -1;          /* 90 */
462 static int hf_bootp_option_dhcp_authentication_algorithm = -1;          /* 90 */
463 static int hf_bootp_option_dhcp_authentication_rdm = -1;                /* 90 */
464 static int hf_bootp_option_dhcp_authentication_rdm_replay_detection = -1;   /* 90 */
465 static int hf_bootp_option_dhcp_authentication_rdm_rdv = -1;            /* 90 */
466 static int hf_bootp_option_dhcp_authentication_secret_id = -1;          /* 90 */
467 static int hf_bootp_option_dhcp_authentication_hmac_md5_hash = -1;      /* 90 */
468 static int hf_bootp_option_dhcp_authentication_information = -1;        /* 90 */
469 static int hf_bootp_option_client_last_transaction_time = -1;           /* 91 */
470 static int hf_bootp_option_associated_ip_option = -1;                   /* 92 */
471 static int hf_bootp_option_client_system_architecture = -1;             /* 93 */
472 static int hf_bootp_option_client_network_id_major_ver = -1;            /* 94 */
473 static int hf_bootp_option_client_network_id_minor_ver = -1;            /* 94 */
474 static int hf_bootp_option_civic_location_what = -1;                    /* 99 */
475 static int hf_bootp_option_civic_location_country = -1;                 /* 99 */
476 static int hf_bootp_option_civic_location_ca_type = -1;                 /* 99 */
477 static int hf_bootp_option_civic_location_ca_length = -1;               /* 99 */
478 static int hf_bootp_option_civic_location_ca_value = -1;                /* 99 */
479 static int hf_bootp_option_tz_pcode = -1;                               /* 100 */
480 static int hf_bootp_option_tz_tcode = -1;                               /* 101 */
481 static int hf_bootp_option_netinfo_parent_server_address = -1;          /* 112 */
482 static int hf_bootp_option_netinfo_parent_server_tag = -1;              /* 113 */
483 static int hf_bootp_option_dhcp_auto_configuration = -1;                /* 116 */
484 static int hf_bootp_option_dhcp_name_service_search_option = -1;                /* 117 */
485 static int hf_bootp_option_dhcp_dns_domain_search_list_rfc_3396_detected = -1;  /* 119 */
486 static int hf_bootp_option_dhcp_dns_domain_search_list_refer_last_option = -1;  /* 119 */
487 static int hf_bootp_option_dhcp_dns_domain_search_list_fqdn = -1;               /* 119 */
488 static int hf_bootp_option_sip_server_rfc_3396_detected = -1;                   /* 120 */
489 static int hf_bootp_option_sip_server_refer_last_option = -1;                   /* 120 */
490 static int hf_bootp_option_sip_server_enc = -1;                         /* 120 */
491 static int hf_bootp_option_sip_server_name = -1;                                /* 120 */
492 static int hf_bootp_option_sip_server_address = -1;                             /* 120 */
493 static int hf_bootp_option_classless_static_route = -1;                 /* 120 */
494 static int hf_bootp_option_rfc3825_error = -1;                                  /* 123 */
495 static int hf_bootp_option_rfc3825_latitude = -1;                               /* 123 */
496 static int hf_bootp_option_rfc3825_longitude = -1;                              /* 123 */
497 static int hf_bootp_option_rfc3825_latitude_res = -1;                   /* 123 */
498 static int hf_bootp_option_rfc3825_longitude_res = -1;                  /* 123 */
499 static int hf_bootp_option_rfc3825_altitude = -1;                               /* 123 */
500 static int hf_bootp_option_rfc3825_altitide_res = -1;                   /* 123 */
501 static int hf_bootp_option_rfc3825_altitude_type = -1;                  /* 123 */
502 static int hf_bootp_option_rfc3825_map_datum = -1;                              /* 123 */
503 static int hf_bootp_option_cl_dss_id_option = -1;                       /* 123 CL */
504 static int hf_bootp_option_cl_dss_id_len = -1;                          /* 123 CL */
505 static int hf_bootp_option_cl_dss_id = -1;                              /* 123 CL */
506 static int hf_bootp_option_vi_class_cl_address_mode = -1;               /* 124 */
507 static int hf_bootp_option_vi_class_enterprise = -1;                    /* 124 */
508 static int hf_bootp_option_vi_class_data_length = -1;                   /* 124 */
509 static int hf_bootp_option_vi_class_data = -1;                          /* 124 */
510
511 static int hf_bootp_option125_enterprise = -1;
512 static int hf_bootp_option125_length = -1;
513 static int hf_bootp_option125_value = -1;                               /* 125 suboption value */
514 static int hf_bootp_option125_value_8 = -1;                             /* 125 suboption value */
515 static int hf_bootp_option125_value_16 = -1;                            /* 125 suboption value */
516 static int hf_bootp_option125_value_ip_address = -1;                    /* 125 suboption value */
517 static int hf_bootp_option125_value_stringz = -1;                       /* 125 suboption value */
518 static int hf_bootp_option125_tr111_suboption = -1;                     /* 125 suboption */
519 static int hf_bootp_option125_tr111_device_manufacturer_oui = -1;       /* 125:TR-111 1 */
520 static int hf_bootp_option125_tr111_device_serial_number = -1;          /* 125:TR-111 2 */
521 static int hf_bootp_option125_tr111_device_product_class = -1;          /* 125:TR-111 3 */
522 static int hf_bootp_option125_tr111_gateway_manufacturer_oui = -1;      /* 125:TR-111 4 */
523 static int hf_bootp_option125_tr111_gateway_serial_number = -1;         /* 125:TR-111 5 */
524 static int hf_bootp_option125_tr111_gateway_product_class = -1;         /* 125:TR-111 6 */
525 static int hf_bootp_option125_cl_suboption = -1;                        /* 125 suboption */
526 static int hf_bootp_option125_cl_option_request = -1;                   /* 125:CL 1 */
527 static int hf_bootp_option125_cl_tftp_server_addresses = -1;            /* 125:CL 2 */
528 static int hf_bootp_option125_cl_erouter_container_option = -1;         /* 125:CL 3 */
529 static int hf_bootp_option125_cl_mib_environment_indicator_option = -1; /* 125:CL 4 */
530 static int hf_bootp_option125_cl_modem_capabilities = -1;               /* 125:CL 5 */
531
532 static int hf_bootp_option_subnet_selection_option = -1;                /* 118 */
533 static int hf_bootp_option_lost_server_domain_name = -1;                /* 137 */
534 static int hf_bootp_option_capwap_access_controller = -1;               /* 138 */
535 static int hf_bootp_option_tftp_server_address = -1;                    /* 150 */
536 static int hf_bootp_option_captive_portal = -1;                         /* 160 */
537 static int hf_bootp_option_mudurl = -1;                                 /* 161 */
538 static int hf_bootp_option_pxe_config_file = -1;                        /* 209 */
539 static int hf_bootp_option_pxe_path_prefix = -1;                        /* 210 */
540 static int hf_bootp_option_6RD_ipv4_mask_len = -1;                      /* 212 */
541 static int hf_bootp_option_6RD_prefix_len = -1;                         /* 212 */
542 static int hf_bootp_option_6RD_prefix = -1;                             /* 212 */
543 static int hf_bootp_option_6RD_border_relay_ip = -1;                    /* 212 */
544 static int hf_bootp_option242_avaya = -1;                               /* 242 */
545 static int hf_bootp_option242_avaya_tlssrvr = -1;                       /* 242 */
546 static int hf_bootp_option242_avaya_httpsrvr = -1;                      /* 242 */
547 static int hf_bootp_option242_avaya_httpdir = -1;                       /* 242 */
548 static int hf_bootp_option242_avaya_static = -1;                        /* 242 */
549 static int hf_bootp_option242_avaya_mcipadd = -1;                       /* 242 */
550 static int hf_bootp_option242_avaya_dot1x = -1;                         /* 242 */
551 static int hf_bootp_option242_avaya_icmpdu = -1;                        /* 242 */
552 static int hf_bootp_option242_avaya_icmpred = -1;                       /* 242 */
553 static int hf_bootp_option242_avaya_l2q = -1;                           /* 242 */
554 static int hf_bootp_option242_avaya_l2qvlan = -1;                       /* 242 */
555 static int hf_bootp_option242_avaya_loglocal = -1;                      /* 242 */
556 static int hf_bootp_option242_avaya_phy1stat = -1;                      /* 242 */
557 static int hf_bootp_option242_avaya_phy2stat = -1;                      /* 242 */
558 static int hf_bootp_option242_avaya_procpswd = -1;                      /* 242 */
559 static int hf_bootp_option242_avaya_procstat = -1;                      /* 242 */
560 static int hf_bootp_option242_avaya_snmpadd = -1;                       /* 242 */
561 static int hf_bootp_option242_avaya_snmpstring = -1;                    /* 242 */
562 static int hf_bootp_option242_avaya_vlantest = -1;                      /* 242 */
563 static int hf_bootp_option_private_proxy_autodiscovery = -1;            /* 252 */
564 static int hf_bootp_option_end = -1;                                    /* 255 */
565 static int hf_bootp_option_end_overload = -1;                           /* 255 (with overload)*/
566 static int hf_bootp_vendor_unknown_suboption = -1;
567 static int hf_bootp_suboption_data = -1;
568 static int hf_bootp_pc_ietf_ccc_suboption = -1;
569 static int hf_bootp_pc_i05_ccc_suboption = -1;
570
571 static int hf_bootp_cl_ietf_ccc_dev_realm_unc_key_nom_timeout = -1;
572 static int hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_timeout = -1;
573 static int hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_retries = -1;
574 static int hf_bootp_cl_ietf_ccc_dev_prov_unc_key_nom_timeout = -1;
575 static int hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_timeout = -1;
576 static int hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_retries = -1;
577
578 static gint ett_bootp = -1;
579 static gint ett_bootp_flags = -1;
580 static gint ett_bootp_option = -1;
581 static gint ett_bootp_option43_suboption = -1;
582 static gint ett_bootp_option63_suboption = -1;
583 static gint ett_bootp_option77_instance = -1;
584 static gint ett_bootp_option82_suboption = -1;
585 static gint ett_bootp_option82_suboption9 = -1;
586 static gint ett_bootp_option125_suboption = -1;
587 static gint ett_bootp_option125_tr111_suboption = -1;
588 static gint ett_bootp_option125_cl_suboption = -1;
589 static gint ett_bootp_option242_suboption = -1;
590 static gint ett_bootp_fqdn = -1;
591 static gint ett_bootp_fqdn_flags = -1;
592 static gint ett_bootp_filename_option = -1;
593 static gint ett_bootp_server_hostname = -1;
594 static gint ett_bootp_isns_functions = -1;
595 static gint ett_bootp_isns_discovery_domain_access = -1;
596 static gint ett_bootp_isns_administrative_flags = -1;
597 static gint ett_bootp_isns_server_security_bitmap = -1;
598 static gint ett_bootp_isns_secondary_server_addr = -1;
599 static gint ett_bootp_o43_bsdp_boot_image = -1;
600 static gint ett_bootp_o43_bsdp_attributes = -1;
601 static gint ett_bootp_o43_bsdp_image_desc_list = -1;
602 static gint ett_bootp_o43_bsdp_image_desc = -1;
603 static gint ett_bootp_o43_bsdp_attributes_flags = -1;
604
605 static expert_field ei_bootp_bad_length = EI_INIT;
606 static expert_field ei_bootp_bad_bitfield = EI_INIT;
607 static expert_field ei_bootp_missing_subopt_length = EI_INIT;
608 static expert_field ei_bootp_missing_subopt_value = EI_INIT;
609 static expert_field ei_bootp_mal_duid = EI_INIT;
610 static expert_field hf_bootp_opt_overload_file_end_missing = EI_INIT;
611 static expert_field hf_bootp_opt_overload_sname_end_missing = EI_INIT;
612 static expert_field hf_bootp_subopt_unknown_type = EI_INIT;
613 static expert_field ei_bootp_option_civic_location_bad_cattype = EI_INIT;
614 static expert_field ei_bootp_option_dhcp_name_service_invalid = EI_INIT;
615 static expert_field ei_bootp_option_sip_server_address_encoding = EI_INIT;
616 static expert_field ei_bootp_option_classless_static_route = EI_INIT;
617 static expert_field ei_bootp_option125_enterprise_malformed = EI_INIT;
618 static expert_field ei_bootp_option_6RD_malformed = EI_INIT;
619 static expert_field ei_bootp_option82_vi_cl_tag_unknown = EI_INIT;
620 static expert_field ei_bootp_option_parse_err = EI_INIT;
621 static expert_field ei_bootp_suboption_invalid = EI_INIT;
622 static expert_field ei_bootp_secs_le = EI_INIT;
623 static expert_field ei_bootp_end_option_missing = EI_INIT;
624 static expert_field ei_bootp_client_address_not_given = EI_INIT;
625 static expert_field ei_bootp_server_name_overloaded_by_dhcp = EI_INIT;
626 static expert_field ei_bootp_boot_filename_overloaded_by_dhcp = EI_INIT;
627 static expert_field ei_bootp_option_isns_ignored_bitfield = EI_INIT;
628 static expert_field ei_bootp_option242_avaya_l2qvlan_invalid = EI_INIT;
629 static expert_field ei_bootp_option242_avaya_vlantest_invalid = EI_INIT;
630
631 static dissector_table_t bootp_option_table;
632 static dissector_table_t bootp_enterprise_table;
633 static heur_dissector_list_t bootp_vendor_id_subdissector;
634 static heur_dissector_list_t bootp_vendor_info_subdissector;
635 static dissector_handle_t bootp_handle;
636 static dissector_handle_t bootpopt_basic_handle;
637
638 typedef struct bootp_option_data
639 {
640         guchar option;
641         guint8 *overload;
642         tvbuff_t *orig_tvb;
643         const char *dhcp_type;
644         const guint8 *vendor_class_id;
645 } bootp_option_data_t;
646
647 /* RFC2937 The Name Service Search Option for DHCP */
648 #define RFC2937_LOCAL_NAMING_INFORMATION                           0
649 #define RFC2937_DOMAIN_NAME_SERVER_OPTION                          6
650 #define RFC2937_NETWORK_INFORMATION_SERVERS_OPTION                41
651 #define RFC2937_NETBIOS_OVER_TCP_IP_NAME_SERVER_OPTION            44
652 #define RFC2937_NETWORK_INFORMATION_SERVICE_PLUS_SERVERS_OPTION   65
653
654 /* RFC3825decoder error codes of the conversion function */
655 #define RFC3825_NOERROR                           0
656 #define RFC3825_LATITUDE_OUTOFRANGE               1
657 #define RFC3825_LATITUDE_UNCERTAINTY_OUTOFRANGE   2
658 #define RFC3825_LONGITUDE_OUTOFRANGE              3
659 #define RFC3825_LONGITUDE_UNCERTAINTY_OUTOFRANGE  4
660 #define RFC3825_ALTITUDE_OUTOFRANGE               5
661 #define RFC3825_ALTITUDE_UNCERTAINTY_OUTOFRANGE   6
662 #define RFC3825_ALTITUDE_TYPE_OUTOFRANGE          7
663 #define RFC3825_DATUM_TYPE_OUTOFRANGE             8
664
665 #define DUID_LLT                1
666 #define DUID_EN                 2
667 #define DUID_LL                 3
668
669 struct rfc3825_location_fixpoint_t {
670
671         gint64 latitude;        /* latitude in degrees, allowed range from -90deg to 90deg.
672                                    Fixpoint A(8,25) with 34 bits */
673         guint8 latitude_res;    /* the resolution of the latitude in bits, allowed range is from 0 to 34.
674                                    6 bits. */
675         gint64 longitude;       /* longitude in degrees, range from -180deg to 180deg.
676                                    Fixpoint A(8,25) with 34 bits */
677         guint8 longitude_res;   /* the resolution of the longitude in bits, allowed range is from 0 to 34.
678                                    6 bits. */
679         gint32 altitude;        /* the altitude, 30 bits.
680                                    Depending on alt_type this are meters or floors, no range limit.
681                                    altitude_type==1: A(13,8) with 22 bits
682                                    altitude_type==2: A(13,8) with 22 bits */
683         guint8 altitude_res;    /* the resolution of the altitude in bits, allowed range is from 0 to 30.
684                                    6 bits.
685                                    altitude_type==1: any value between 0 and 30
686                                    altitude_type==2: either 0 (floor unknown) or 30 */
687         guint8 altitude_type;   /* the type of the altitude, 4 bits. allowed values are:
688                                    0: unknown
689                                    1: altitude in meters
690                                    2: altitude in floors */
691         guint8 datum_type;      /* the map datum used for the coordinates. 8 bits.
692                                    All values are allowed although currently only the
693                                    following ones are defined:
694                                    1: WGS84
695                                    2: NAD83/NAVD88
696                                    3: NAD83/MLLW */
697 };
698
699 /* The rfc3825_location_decimal_t structure holds the location parameters
700  * in decimal (floating point) format.
701  */
702 struct rfc3825_location_decimal_t {
703
704         double latitude;        /* latitude in degrees, allowed range from -90deg to 90deg */
705         double latitude_res;    /* the uncertainty of the latitude in grad, "0.01" means +-0.01deg
706                                    from the altitude. During conversion this will be rounded to
707                                    next smaller value which can be represented in fixpoint arithmetic */
708         double longitude;       /* longitude in degrees, range from -180deg to 180deg */
709         double longitude_res;   /* the uncertainty of the longitude in grad, "0.01" means +-0.01deg
710                                    from the longitude. During conversion this will be rounded to
711                                    next smaller value which can be represented in fixpoint arithmetic */
712         double altitude;        /* the altitude, depending on alt_type this are meters or floors, no range limit */
713         double altitude_res;    /* the uncertainty of the altitude in either:
714                                    - altitude-type=meters: "10" means 10 meters which means +-10 meters from the altitude
715                                    - altitude-type=floors: either 0 (unknown) or 30 (exact) */
716         int altitude_type;      /* the type of the altitude, allowed values are
717                                    0: unknown
718                                    1: altitude in meters
719                                    2: altitude in floors */
720         int datum_type;          /* the map datum used for the coordinates.
721                                     All values are allowed although currently only the
722                                     following ones are defined:
723                                     1: WGS84
724                                     2: NAD83/NAVD88
725                                     3: NAD83/MLLW */
726 };
727
728 /* For managing split options with RFC 3396 */
729 struct rfc3396_for_option_t {
730         unsigned int total_number_of_block;
731         unsigned int index_current_block;
732         tvbuff_t* tvb_composite;
733 };
734
735 /* The RFC 3397 allows to cut long option (RFC 3396). */
736 struct rfc3396_for_option_t rfc3396_dns_domain_search_list;
737
738 /* The RFC 3361 allows to cut long option (RFC 3396). */
739 struct rfc3396_for_option_t rfc3396_sip_server;
740
741 enum {
742         RFC_3361_ENC_FQDN,
743         RFC_3361_ENC_IPADDR
744 };
745
746 static void dissect_vendor_avaya_param(proto_tree *tree, packet_info *pinfo, proto_item *vti,
747                 tvbuff_t *tvb, int optoff, wmem_strbuf_t *avaya_param_buf);
748
749 /* converts fixpoint presentation into decimal presentation
750    also converts values which are out of range to allow decoding of received data */
751 static int rfc3825_fixpoint_to_decimal(struct rfc3825_location_fixpoint_t *fixpoint, struct rfc3825_location_decimal_t *decimal);
752
753 /* decodes the LCI string received from DHCP into the fixpoint values */
754 static void rfc3825_lci_to_fixpoint(const unsigned char lci[16], struct rfc3825_location_fixpoint_t *fixpoint);
755
756
757 /* Map Datum Types used for the coordinates (RFC 3825) */
758 static const value_string map_datum_type_values[] = {
759         { 1,    "WGS 84" },
760         { 2,    "NAD83 (NAVD88)" },
761         { 3,    "NAD83 (MLLW)" },
762         { 0,    NULL }
763 };
764
765
766 /* Altitude Types used for the coordinates (RFC 3825) */
767 static const value_string altitude_type_values[] = {
768         { 1,    "Meters" },
769         { 2,    "Floors" },
770         { 0,    NULL }
771 };
772
773 /* AutoConfigure (RFC 2563) */
774 static const value_string dhcp_autoconfig[] = {
775         { 0,    "DoNotAutoConfigure"},
776         { 1,    "AutoConfigure"},
777         { 0,    NULL }
778 };
779
780 /* Error Types for RFC 3825 coordinate location decoding */
781 static const value_string rfc3825_error_types[] = {
782         { 1,    "Latitude is out of range [-90,90]"},
783         { 2,    "Latitude Uncertainty is out of range [0,90]"},
784         { 3,    "Longitude is out of range [-180,180]"},
785         { 4,    "Longitude Uncertainty is out of range [0,180]"},
786         { 5,    "Altitude is out of range [-(2^21),(2^21)-1]"},
787         { 6,    "Altitude Uncertainty is out of range [0,2^20]"},
788         { 7,    "Altitude Type is out of range [0,2]"},
789         { 8,    "Datum is out of range [1,3]"},
790         { 0,    NULL }
791 };
792
793
794
795 /* Civic Address What field (RFC 4776) */
796 static const value_string civic_address_what_values[] = {
797         { 0,    "Location of the DHCP server" },
798         { 1,    "Location of the network element believed to be closest to the client" },
799         { 2,    "Location of the client"},
800         { 0, NULL}
801 };
802
803 /* Civic Address Type field (RFC 4119, RFC 4776, RFC 5139) */
804 static const value_string civic_address_type_values[] = {
805         {   0,  "Language" },
806         {   1,  "A1" },
807         {   2,  "A2" },
808         {   3,  "A3" },
809         {   4,  "A4" },
810         {   5,  "A5" },
811         {   6,  "A6" },
812         {  16,  "PRD (Leading street direction)" },
813         {  17,  "POD (Trailing street suffix)" },
814         {  18,  "STS (Street suffix)" },
815         {  19,  "HNO (House number)" },
816         {  20,  "HNS (House number suffix)" },
817         {  21,  "LMK (Landmark or vanity address)" },
818         {  22,  "LOC (Additional location information)" },
819         {  23,  "NAM" },
820         {  24,  "PC (Postal/ZIP code)" },
821         {  25,  "BLD (Building)" },
822         {  26,  "UNIT" },
823         {  27,  "FLR (Floor)" },
824         {  28,  "ROOM" },
825         {  29,  "PLC (Place-type)" },
826         {  30,  "PCN (Postal community name)" },
827         {  31,  "POBOX" },
828         {  32,  "ADDCODE (Additional Code)" },
829         {  33,  "SEAT" },
830         {  34,  "RD (Primary road or street)" },
831         {  35,  "RDSEC (Road section)" },
832         {  36,  "RDBR (Road branch)" },
833         {  37,  "RDSUBBR (Road sub-branch)" },
834         {  38,  "PRM (Road pre-modifier)" },
835         {  39,  "POM (Road post-modifier" },
836         { 128,  "Script" },
837         { 0, NULL }
838 };
839
840 static const value_string cablelab_ipaddr_mode_vals[] = {
841         { 1, "IPv4" },
842         { 2, "IPv6" },
843         { 0, NULL }
844 };
845
846 static const value_string duidtype_vals[] =
847 {
848         { DUID_LLT,     "link-layer address plus time" },
849         { DUID_EN,      "assigned by vendor based on Enterprise number" },
850         { DUID_LL,      "link-layer address" },
851         { 0, NULL }
852 };
853
854 static gboolean novell_string = FALSE;
855
856 static guint bootp_uuid_endian = ENC_LITTLE_ENDIAN;
857
858 static const enum_val_t bootp_uuid_endian_vals[] = {
859         { "Little Endian", "Little Endian",     ENC_LITTLE_ENDIAN},
860         { "Big Endian",  "Big Endian", ENC_BIG_ENDIAN },
861         { NULL, NULL, 0 }
862 };
863
864 #define BOOTP_UDP_PORT_RANGE  "67-68"
865
866 #define BOOTP_BC        0x8000
867 #define BOOTP_MBZ       0x7FFF
868
869 /* FQDN stuff */
870 #define F_FQDN_S        0x01
871 #define F_FQDN_O        0x02
872 #define F_FQDN_E        0x04
873 #define F_FQDN_N        0x08
874 #define F_FQDN_MBZ      0xf0
875
876 #define ISNS_BITFIELD_NZ_MUST_BE_IGNORED(mask, ena_flag)                \
877         ((mask) && !((mask) & (ena_flag)))
878
879 /* iSNS bit fields */
880 #define F_ISNS_FUNCTIONS_ENABLED        0x0001
881 #define F_ISNS_FUNCTIONS_DD_AUTH        0x0002
882 #define F_ISNS_FUNCTIONS_SEC_POLICY     0x0004
883 #define F_ISNS_FUNCTIONS_RESERVED       0xFFF8
884
885 #define F_ISNS_DD_ACCESS_ENABLED                0x0001
886 #define F_ISNS_DD_ACCESS_CTRL_NODE              0x0002
887 #define F_ISNS_DD_ACCESS_ISCSI_TARGET           0x0004
888 #define F_ISNS_DD_ACCESS_ISCSI_INITIATOR        0x0008
889 #define F_ISNS_DD_ACCESS_IFCP_TARGET_PORT       0x0010
890 #define F_ISNS_DD_ACCESS_IFCP_INITIATOR_PORT    0x0020
891 #define F_ISNS_DD_ACCESS_RESERVED               0xFFC0
892
893 #define F_ISNS_ADMIN_FLAGS_ENABLED              0x0001
894 #define F_ISNS_ADMIN_FLAGS_HEARTBEAT            0x0002
895 #define F_ISNS_ADMIN_FLAGS_MANAGEMENT_SCNS      0x0004
896 #define F_ISNS_ADMIN_FLAGS_DEFAULT_DD           0x0008
897 #define F_ISNS_ADMIN_FLAGS_RESERVED             0xFFF0
898
899 #define F_ISNS_SRV_SEC_BITMAP_ENABLED           0x0001
900 #define F_ISNS_SRV_SEC_BITMAP_IKE_IPSEC         0x0002
901 #define F_ISNS_SRV_SEC_BITMAP_MAIN_MODE         0x0004
902 #define F_ISNS_SRV_SEC_BITMAP_AGGRESSIVE        0x0008
903 #define F_ISNS_SRV_SEC_BITMAP_PFS               0x0010
904 #define F_ISNS_SRV_SEC_BITMAP_TRASPORT_MODE     0x0020
905 #define F_ISNS_SRV_SEC_BITMAP_TUNNEL_MODE       0x0040
906 #define F_ISNS_SRV_SEC_BITMAP_RESERVED          0xFF80
907
908 static const true_false_string tfs_fqdn_s = {
909         "Server",
910         "Client"
911 };
912
913 static const true_false_string tfs_fqdn_o = {
914         "Override",
915         "No override"
916 };
917
918 static const true_false_string tfs_fqdn_e = {
919         "Binary encoding",
920         "ASCII encoding"
921 };
922
923 static const true_false_string tfs_fqdn_n = {
924         "No server updates",
925         "Some server updates"
926 };
927
928 static const true_false_string tfs_isns_function_dd_based_auth = {
929         "Automatically allowed access",
930         "Explicitly performed",
931 };
932
933 static const true_false_string tfs_isns_functions_sec_distrib = {
934         "Download from iSNS server",
935         "By other means",
936 };
937
938 enum field_type {
939         special,
940         none,
941         presence,
942         ipv4,                   /* single IPv4 address */
943         ipv4_list,              /* list of IPv4 addresses */
944         string,
945         bytes,
946         opaque,
947         val_boolean,
948         val_u_byte,
949         val_u_short,
950         val_u_short_list,
951         val_u_le_short,
952         val_u_long,
953         time_in_s_secs,         /* Signed */
954         time_in_u_secs,         /* Unsigned (not micro) */
955         fqdn,
956         ipv4_or_fqdn,
957         oui
958 };
959
960 struct opt_info {
961         const char      *text;
962         enum field_type ftype;
963         int* phf;
964 };
965
966 static const true_false_string flag_set_broadcast = {
967         "Broadcast",
968         "Unicast"
969 };
970
971 #define BOOTP_MAX_NO_CHAR 64
972
973 /* PacketCable/DOCSIS definitions */
974 #define PACKETCABLE_MTA_CAP10 "pktc1.0:"
975 #define PACKETCABLE_MTA_CAP15 "pktc1.5:"
976 #define PACKETCABLE_MTA_CAP20 "pktc2.0:"
977 #define PACKETCABLE_CM_CAP11  "docsis1.1:"
978 #define PACKETCABLE_CM_CAP20  "docsis2.0:"
979 #define PACKETCABLE_CM_CAP30  "docsis3.0:"
980
981 #define PACKETCABLE_CCC_I05      1
982 #define PACKETCABLE_CCC_DRAFT5   2
983 #define PACKETCABLE_CCC_RFC_3495 3
984
985 static const enum_val_t pkt_ccc_protocol_versions[] = {
986         { "ccc_i05",     "PKT-SP-PROV-I05-021127", PACKETCABLE_CCC_I05 },
987         { "ccc_draft_5", "IETF Draft 5",           PACKETCABLE_CCC_DRAFT5 },
988         { "rfc_3495",    "RFC 3495",               PACKETCABLE_CCC_RFC_3495 },
989         { NULL, NULL, 0 }
990 };
991
992 #define PACKETCABLE_BSDP  "AAPLBSDPC"
993 #define PACKETCABLE_BSDPD "AAPLBSDPC/"
994
995 static gint pkt_ccc_protocol_version = PACKETCABLE_CCC_RFC_3495;
996 static guint pkt_ccc_option = 122;
997
998 static void dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb,
999                                   int voff, int len, gboolean opt125);
1000
1001 #define ARUBA_INSTANT_AP "ArubaInstantAP"
1002 #define ARUBA_AP "ArubaAP"
1003
1004 #define OPT53_DISCOVER "Discover"
1005 /* http://www.iana.org/assignments/bootp-dhcp-parameters */
1006 static const value_string opt53_text[] = {
1007         {  1,   OPT53_DISCOVER },
1008         {  2,   "Offer" },
1009         {  3,   "Request" },
1010         {  4,   "Decline" },
1011         {  5,   "ACK" },
1012         {  6,   "NAK" },
1013         {  7,   "Release" },
1014         {  8,   "Inform" },
1015         {  9,   "Force Renew" },
1016         { 10,   "Lease query" },                /* RFC4388 */
1017         { 11,   "Lease Unassigned" },           /* RFC4388 */
1018         { 12,   "Lease Unknown" },              /* RFC4388 */
1019         { 13,   "Lease Active" },               /* RFC4388 */
1020         { 14,   "Bulk Lease Query" },           /* RFC6926 */
1021         { 15,   "Lease Query Done" },           /* RFC6926 */
1022         { 16,   "Active LeaseQuery" },          /* RFC7724 */
1023         { 17,   "Lease Query Status" },         /* RFC7724 */
1024         { 18,   "TLS" },                        /* RFC7724 */
1025         { 0,    NULL }
1026 };
1027
1028 /* DHCP Authentication protocols */
1029 #define AUTHEN_PROTO_CONFIG_TOKEN       0
1030 #define AUTHEN_PROTO_DELAYED_AUTHEN     1
1031
1032 /* DHCP Authentication algorithms for delayed authentication */
1033 #define AUTHEN_DELAYED_ALGO_HMAC_MD5    1
1034
1035 /* DHCP Authentication Replay Detection Methods */
1036 #define AUTHEN_RDM_MONOTONIC_COUNTER    0x00
1037
1038 /* DHCP Option Overload (option code 52) */
1039 #define OPT_OVERLOAD_FILE               1
1040 #define OPT_OVERLOAD_SNAME              2
1041 #define OPT_OVERLOAD_BOTH               3
1042
1043 /* Server name and boot file offsets and lengths */
1044 #define SERVER_NAME_OFFSET              44
1045 #define SERVER_NAME_LEN                 64
1046 #define FILE_NAME_OFFSET                108
1047 #define FILE_NAME_LEN                   128
1048 #define VENDOR_INFO_OFFSET              236
1049
1050 static const value_string bootp_nbnt_vals[] = {
1051         {0x1,   "B-node" },
1052         {0x2,   "P-node" },
1053         {0x4,   "M-node" },
1054         {0x8,   "H-node" },
1055         {0,     NULL     }
1056 };
1057
1058 static const value_string bootp_client_arch[] = {
1059         { 0x0000, "IA x86 PC" },
1060         { 0x0001, "NEC/PC98" },
1061         { 0x0002, "IA64 PC" },
1062         { 0x0003, "DEC Alpha" },
1063         { 0x0004, "ArcX86" },
1064         { 0x0005, "Intel Lean Client" },
1065         { 0x0006, "EFI IA32" },
1066         { 0x0007, "EFI BC" },
1067         { 0x0008, "EFI Xscale" },
1068         { 0x0009, "EFI x86-64" },
1069         { 0,      NULL }
1070 };
1071
1072 static const value_string opt_overload_vals[] = {
1073         { OPT_OVERLOAD_FILE,  "Boot file name holds options",                },
1074         { OPT_OVERLOAD_SNAME, "Server host name holds options",              },
1075         { OPT_OVERLOAD_BOTH,  "Boot file and server host names hold options" },
1076         { 0,                  NULL                                           } };
1077
1078 static const value_string slpda_vals[] = {
1079         {0x00,   "Dynamic Discovery" },
1080         {0x01,   "Static Discovery" },
1081         {0x80,   "Backwards compatibility" },
1082         {0,     NULL     } };
1083
1084 static const value_string slp_scope_vals[] = {
1085         {0x00,   "Preferred Scope" },
1086         {0x01,   "Mandatory Scope" },
1087         {0,     NULL     } };
1088
1089 static const value_string authen_protocol_vals[] = {
1090         {AUTHEN_PROTO_CONFIG_TOKEN,   "configuration token" },
1091         {AUTHEN_PROTO_DELAYED_AUTHEN, "delayed authentication" },
1092         {0,                           NULL     } };
1093
1094 static const value_string authen_da_algo_vals[] = {
1095         {AUTHEN_DELAYED_ALGO_HMAC_MD5, "HMAC_MD5" },
1096         {0,                            NULL     } };
1097
1098 static const value_string authen_rdm_vals[] = {
1099         {AUTHEN_RDM_MONOTONIC_COUNTER, "Monotonically-increasing counter" },
1100         {0,                            NULL     } };
1101
1102 static const value_string cl_dss_id_type_vals[] = {
1103         {1, "Primary DSS_ID" },
1104         {2, "Secondary DSS_ID" },
1105         {0, NULL }
1106 };
1107
1108 static const value_string sip_server_enc_vals[] = {
1109         {0, "Fully Qualified Domain Name" },
1110         {1, "IPv4 Address" },
1111         {0, NULL }
1112 };
1113
1114 static const value_string o43_bsdp_boot_image_install_vals[] = {
1115         { 0, "non-install" },
1116         { 1, "install" },
1117         { 0, NULL }
1118 };
1119
1120 static const value_string o43_bsdp_boot_image_kind_vals[] = {
1121         { 0, "Mac OS 9" },
1122         { 1, "Mac OS X" },
1123         { 2, "Mac OS X Server" },
1124         { 3, "Hardware Diagnostics" },
1125         { 0, NULL }
1126 };
1127
1128 static const value_string o43_bsdp_message_type_vals[] = {
1129         { 1, "LIST" },
1130         { 2, "SELECT" },
1131         { 3, "FAILED" },
1132         { 0, NULL }
1133 };
1134
1135 static const string_string option242_avaya_phystat_vals[] = {
1136         { "0", "Disabled" },
1137         { "1", "Auto" },
1138         { "2", "10Mbps half" },
1139         { "3", "10Mbps full" },
1140         { "4", "100Mbps half" },
1141         { "5", "100Mbps full" },
1142         { "6", "1000Mbps full" },
1143         { 0, NULL }
1144 };
1145
1146 static const string_string option242_avaya_l2q_vals[] = {
1147         { "0", "Auto" },
1148         { "1", "Enabled" },
1149         { "2", "Disabled" },
1150         { 0, NULL }
1151 };
1152
1153 static const string_string option242_avaya_dot1x_vals[] = {
1154         { "0", "With PAE pass-through" },
1155         { "1", "With PAE pass-through and proxy Logoff" },
1156         { "2", "Without PAE pass-through or proxy Logoff" },
1157         { 0, NULL }
1158 };
1159
1160 static const string_string option242_avaya_icmpdu_vals[] = {
1161         { "0", "No ICMP Destination Unreachable messages" },
1162         { "1", "Send limited Port Unreachable messages" },
1163         { "2", "Send Protocol and Port Unreachable messages" },
1164         { 0, NULL }
1165 };
1166
1167 static const string_string option242_avaya_icmpred_vals[] = {
1168         { "0", "Ignore ICMP Redirect messages" },
1169         { "1", "Process ICMP Redirect messages" },
1170         { 0, NULL }
1171 };
1172
1173 static const string_string option242_avaya_loglocal_vals[] = {
1174         { "0", "Disabled" },
1175         { "1", "Emergencie" },
1176         { "2", "Alerts" },
1177         { "3", "Critical" },
1178         { "4", "Errors" },
1179         { "5", "Warnings" },
1180         { "6", "Notices" },
1181         { "7", "Information" },
1182         { "8", "Debug" },
1183         { 0, NULL }
1184 };
1185
1186 static const string_string option242_avaya_procstat_vals[] = {
1187         { "0", "All administrative options" },
1188         { "1", "Only view administrative options" },
1189         { 0, NULL }
1190 };
1191
1192 static const string_string option242_avaya_static_vals[] = {
1193         { "0", "Static programming never overrides call server (DHCP) or call server administered data" },
1194         { "1", "Static programming overrides only file server administered data" },
1195         { "2", "Static programming overrides only call server administered data" },
1196         { "3", "Static programming overrides both file server- and call server-administered data" },
1197         { 0, NULL }
1198 };
1199
1200 /* bootp options administration */
1201 #define BOOTP_OPT_NUM   256
1202
1203 /* All of the options that have a "basic" type that can be handled by dissect_bootpopt_basic_type() */
1204 #define BOOTP_OPTION_BASICTYPE_RANGE "1-20,22-32,34-42,44-51,53-54,56-59,64-76,86-87,91-93,100-101,112-113,116,118,137-138,150,161,209-210,252"
1205
1206 /* Re-define structure.  Values to be updated by bootp_init_protocol */
1207 static struct opt_info bootp_opt[BOOTP_OPT_NUM];
1208
1209 static struct opt_info default_bootp_opt[BOOTP_OPT_NUM] = {
1210 /*   0 */ { "Padding",                                  none, &hf_bootp_option_padding },
1211 /*   1 */ { "Subnet Mask",                              ipv4, &hf_bootp_option_subnet_mask },
1212 /*   2 */ { "Time Offset",                              time_in_s_secs, &hf_bootp_option_time_offset },
1213 /*   3 */ { "Router",                                   ipv4_list, &hf_bootp_option_router },
1214 /*   4 */ { "Time Server",                              ipv4_list, &hf_bootp_option_time_server },
1215 /*   5 */ { "Name Server",                              ipv4_list, &hf_bootp_option_name_server },
1216 /*   6 */ { "Domain Name Server",                       ipv4_list, &hf_bootp_option_domain_name_server },
1217 /*   7 */ { "Log Server",                               ipv4_list, &hf_bootp_option_log_server },
1218 /*   8 */ { "Quotes Server",                            ipv4_list, &hf_bootp_option_quotes_server },
1219 /*   9 */ { "LPR Server",                               ipv4_list, &hf_bootp_option_lpr_server },
1220 /*  10 */ { "Impress Server",                           ipv4_list, &hf_bootp_option_impress_server },
1221 /*  11 */ { "Resource Location Server",                 ipv4_list, &hf_bootp_option_resource_location_server },
1222 /*  12 */ { "Host Name",                                string, &hf_bootp_option_hostname },
1223 /*  13 */ { "Boot File Size",                           val_u_short, &hf_bootp_option_boot_file_size },
1224 /*  14 */ { "Merit Dump File",                          string, &hf_bootp_option_merit_dump_file },
1225 /*  15 */ { "Domain Name",                              string, &hf_bootp_option_domain_name },
1226 /*  16 */ { "Swap Server",                              ipv4, &hf_bootp_option_swap_server },
1227 /*  17 */ { "Root Path",                                string, &hf_bootp_option_root_path },
1228 /*  18 */ { "Extensions Path",                          string, &hf_bootp_option_extension_path },
1229 /*  19 */ { "IP Forwarding",                            val_boolean, &hf_bootp_option_ip_forwarding },
1230 /*  20 */ { "Non-Local Source Routing",                 val_boolean, &hf_bootp_option_non_local_source_routing },
1231 /*  21 */ { "Policy Filter",                            special, NULL },
1232 /*  22 */ { "Maximum Datagram Reassembly Size",         val_u_short, &hf_bootp_option_max_datagram_reassembly_size },
1233 /*  23 */ { "Default IP Time-to-Live",                  val_u_byte, &hf_bootp_option_default_ip_ttl },
1234 /*  24 */ { "Path MTU Aging Timeout",                   time_in_u_secs, &hf_bootp_option_path_mtu_aging_timeout },
1235 /*  25 */ { "Path MTU Plateau Table",                   val_u_short_list, &hf_bootp_option_path_mtu_plateau_table_item },
1236 /*  26 */ { "Interface MTU",                            val_u_short, &hf_bootp_option_interface_mtu },
1237 /*  27 */ { "All Subnets are Local",                    val_boolean, &hf_bootp_option_all_subnets_are_local },
1238 /*  28 */ { "Broadcast Address",                        ipv4, &hf_bootp_option_broadcast_address },
1239 /*  29 */ { "Perform Mask Discovery",                   val_boolean, &hf_bootp_option_perform_mask_discovery },
1240 /*  30 */ { "Mask Supplier",                            val_boolean, &hf_bootp_option_mask_supplier },
1241 /*  31 */ { "Perform Router Discover",                  val_boolean, &hf_bootp_option_perform_router_discover },
1242 /*  32 */ { "Router Solicitation Address",              ipv4, &hf_bootp_option_router_solicitation_address },
1243 /*  33 */ { "Static Route",                             special, NULL },
1244 /*  34 */ { "Trailer Encapsulation",                    val_boolean, &hf_bootp_option_trailer_encapsulation },
1245 /*  35 */ { "ARP Cache Timeout",                        time_in_u_secs, &hf_bootp_option_arp_cache_timeout },
1246 /*  36 */ { "Ethernet Encapsulation",                   val_boolean, &hf_bootp_option_ethernet_encapsulation },
1247 /*  37 */ { "TCP Default TTL",                          val_u_byte, &hf_bootp_option_tcp_default_ttl },
1248 /*  38 */ { "TCP Keepalive Interval",                   time_in_u_secs, &hf_bootp_option_tcp_keepalive_interval },
1249 /*  39 */ { "TCP Keepalive Garbage",                    val_boolean, &hf_bootp_option_tcp_keepalive_garbage },
1250 /*  40 */ { "Network Information Service Domain",       string, &hf_bootp_option_nis_domain },
1251 /*  41 */ { "Network Information Service Servers",      ipv4_list, &hf_bootp_option_nis_server },
1252 /*  42 */ { "Network Time Protocol Servers",            ipv4_list, &hf_bootp_option_ntp_server },
1253 /*  43 */ { "Vendor-Specific Information",              special, NULL },
1254 /*  44 */ { "NetBIOS over TCP/IP Name Server",          ipv4_list, &hf_bootp_option_netbios_over_tcpip_name_server },
1255 /*  45 */ { "NetBIOS over TCP/IP Datagram Distribution Name Server", ipv4_list, &hf_bootp_option_netbios_over_tcpip_dd_name_server },
1256 /*  46 */ { "NetBIOS over TCP/IP Node Type",            val_u_byte, &hf_bootp_option_netbios_over_tcpip_node_type },
1257 /*  47 */ { "NetBIOS over TCP/IP Scope",                string, &hf_bootp_option_netbios_over_tcpip_scope },
1258 /*  48 */ { "X Window System Font Server",              ipv4_list, &hf_bootp_option_xwindows_system_font_server },
1259 /*  49 */ { "X Window System Display Manager",          ipv4_list, &hf_bootp_option_xwindows_system_display_manager },
1260 /*  50 */ { "Requested IP Address",                     ipv4, &hf_bootp_option_requested_ip_address },
1261 /*  51 */ { "IP Address Lease Time",                    time_in_u_secs, &hf_bootp_option_ip_address_lease_time },
1262 /*  52 */ { "Option Overload",                          special, &hf_bootp_option_option_overload },
1263 /*  53 */ { "DHCP Message Type",                        val_u_byte, &hf_bootp_option_dhcp },
1264 /*  54 */ { "DHCP Server Identifier",                   ipv4, &hf_bootp_option_dhcp_server_id },
1265 /*  55 */ { "Parameter Request List",                   special, &hf_bootp_option_parameter_request_list_item },
1266 /*  56 */ { "Message",                                  string, &hf_bootp_option_message },
1267 /*  57 */ { "Maximum DHCP Message Size",                val_u_short, &hf_bootp_option_dhcp_max_message_size },
1268 /*  58 */ { "Renewal Time Value",                       time_in_u_secs, &hf_bootp_option_renewal_time_value },
1269 /*  59 */ { "Rebinding Time Value",                     time_in_u_secs, &hf_bootp_option_rebinding_time_value },
1270 /*  60 */ { "Vendor class identifier",                  special, NULL },
1271 /*  61 */ { "Client identifier",                        special, NULL },
1272 /*  62 */ { "Novell/Netware IP domain",                 string, &hf_bootp_option_novell_netware_ip_domain },
1273 /*  63 */ { "Novell Options",                           special, NULL },
1274 /*  64 */ { "Network Information Service+ Domain",      string, &hf_bootp_option_nis_plus_domain },
1275 /*  65 */ { "Network Information Service+ Servers",     ipv4_list, &hf_bootp_option_nis_plus_server },
1276 /*  66 */ { "TFTP Server Name",                         string, &hf_bootp_option_tftp_server_name },
1277 /*  67 */ { "Bootfile name",                            string, &hf_bootp_option_bootfile_name },
1278 /*  68 */ { "Mobile IP Home Agent",                     ipv4_list, &hf_bootp_option_mobile_ip_home_agent  },
1279 /*  69 */ { "SMTP Server",                              ipv4_list, &hf_bootp_option_smtp_server },
1280 /*  70 */ { "POP3 Server",                              ipv4_list, &hf_bootp_option_pop3_server },
1281 /*  71 */ { "NNTP Server",                              ipv4_list, &hf_bootp_option_nntp_server },
1282 /*  72 */ { "Default WWW Server",                       ipv4_list, &hf_bootp_option_default_www_server },
1283 /*  73 */ { "Default Finger Server",                    ipv4_list, &hf_bootp_option_default_finger_server },
1284 /*  74 */ { "Default IRC Server",                       ipv4_list, &hf_bootp_option_default_irc_server },
1285 /*  75 */ { "StreetTalk Server",                        ipv4_list, &hf_bootp_option_streettalk_server },
1286 /*  76 */ { "StreetTalk Directory Assistance Server",   ipv4_list, &hf_bootp_option_streettalk_da_server },
1287 /*  77 */ { "User Class Information",                   special, NULL },
1288 /*  78 */ { "Directory Agent Information",              special, NULL },
1289 /*  79 */ { "Service Location Agent Scope",             special, NULL },
1290 /*  80 */ { "Rapid commit",                             opaque, NULL },
1291 /*  81 */ { "Client Fully Qualified Domain Name",       special, NULL},
1292 /*  82 */ { "Agent Information Option",                 special, NULL},
1293 /*  83 */ { "iSNS",                                     opaque, NULL },
1294 /*  84 */ { "Removed/Unassigned",                       opaque, NULL },
1295 /*  85 */ { "Novell Directory Services Servers",        special, NULL},
1296 /*  86 */ { "Novell Directory Services Tree Name",      string, &hf_bootp_option_novell_ds_tree_name },
1297 /*  87 */ { "Novell Directory Services Context",        string, &hf_bootp_option_novell_ds_context },
1298 /*  88 */ { "BCMCS Controller Domain Name [TODO:RFC4280]",      opaque, NULL },
1299 /*  89 */ { "BCMCS Controller IPv4 address [TODO:RFC4280]",     opaque, NULL },
1300 /*  90 */ { "Authentication",                           special, NULL},
1301 /*  91 */ { "Client last transaction time",             time_in_u_secs, &hf_bootp_option_client_last_transaction_time },
1302 /*  92 */ { "Associated IP option",                     ipv4_list, &hf_bootp_option_associated_ip_option },
1303 /*  93 */ { "Client System Architecture",               val_u_short, &hf_bootp_option_client_system_architecture },
1304 /*  94 */ { "Client Network Device Interface",          special, NULL},
1305 /*  95 */ { "LDAP [TODO:RFC3679]",                      opaque, NULL },
1306 /*  96 */ { "Removed/Unassigned",                       opaque, NULL },
1307 /*  97 */ { "UUID/GUID-based Client Identifier",        special, NULL},
1308 /*  98 */ { "Open Group's User Authentication [TODO:RFC2485]",  opaque, NULL },
1309 /*  99 */ { "Civic Addresses Configuration",            special, NULL},
1310 /* 100 */ { "PCode",                                    string, &hf_bootp_option_tz_pcode },
1311 /* 101 */ { "TCode",                                    string, &hf_bootp_option_tz_tcode },
1312 /* 102 */ { "Removed/unassigned",                       opaque, NULL },
1313 /* 103 */ { "Removed/unassigned",                       opaque, NULL },
1314 /* 104 */ { "Removed/unassigned",                       opaque, NULL },
1315 /* 105 */ { "Removed/unassigned",                       opaque, NULL },
1316 /* 106 */ { "Removed/unassigned",                       opaque, NULL },
1317 /* 107 */ { "Removed/unassigned",                       opaque, NULL },
1318 /* 108 */ { "Removed/Unassigned",                       opaque, NULL },
1319 /* 109 */ { "Unassigned",                               opaque, NULL },
1320 /* 110 */ { "Removed/Unassigned",                       opaque, NULL },
1321 /* 111 */ { "Unassigned",                               opaque, NULL },
1322 /* 112 */ { "NetInfo Parent Server Address",            ipv4_list, &hf_bootp_option_netinfo_parent_server_address },
1323 /* 113 */ { "NetInfo Parent Server Tag",                string, &hf_bootp_option_netinfo_parent_server_tag },
1324 /* 114 */ { "URL [TODO:RFC3679]",                       opaque, NULL },
1325 /* 115 */ { "Removed/Unassigned",                       opaque, NULL },
1326 /* 116 */ { "DHCP Auto-Configuration",                  val_u_byte, &hf_bootp_option_dhcp_auto_configuration },
1327 /* 117 */ { "Name Service Search",                      special, NULL },
1328 /* 118 */ { "Subnet Selection Option",                  ipv4_list, &hf_bootp_option_subnet_selection_option },
1329 /* 119 */ { "Domain Search",                            special, NULL },
1330 /* 120 */ { "SIP Servers",              special, NULL },
1331 /* 121 */ { "Classless Static Route",                   special, NULL},
1332 /* 122 */ { "CableLabs Client Configuration [TODO:RFC3495]",    opaque, NULL },
1333 /* 123 */ { "Coordinate-based Location Configuration",  special, NULL},
1334 /* 124 */ { "V-I Vendor Class",                         special, NULL},
1335 /* 125 */ { "V-I Vendor-specific Information",          special, NULL},
1336 /* 126 */ { "Removed/Unassigned",                       opaque, NULL },
1337 /* 127 */ { "Removed/Unassigned",                       opaque, NULL },
1338 /* 128 */ { "DOCSIS full security server IP [TODO]",    opaque, NULL },
1339 /* 129 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1340 /* 130 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1341 /* 131 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1342 /* 132 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1343 /* 133 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1344 /* 134 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1345 /* 135 */ { "PXE - undefined (vendor specific)",        opaque, NULL },
1346 /* 136 */ { "OPTION_PANA_AGENT [TODO:RFC5192]",         opaque, NULL },
1347 /* 137 */ { "LoST Server Domain Name",                  string, &hf_bootp_option_lost_server_domain_name },
1348 /* 138 */ { "CAPWAP Access Controllers",                ipv4_list, &hf_bootp_option_capwap_access_controller },
1349 /* 139 */ { "IPv4 Address-MoS",                         opaque, NULL },
1350 /* 140 */ { "IPv4 FQDN-MoS",                            opaque, NULL },
1351 /* 141 */ { "SIP UA Configuration Domains",             opaque, NULL },
1352 /* 142 */ { "Unassigned",                               opaque, NULL },
1353 /* 143 */ { "Unassigned",                               opaque, NULL },
1354 /* 144 */ { "Unassigned",                               opaque, NULL },
1355 /* 145 */ { "Unassigned",                               opaque, NULL },
1356 /* 146 */ { "Unassigned",                               opaque, NULL },
1357 /* 147 */ { "Unassigned",                               opaque, NULL },
1358 /* 148 */ { "Unassigned",                               opaque, NULL },
1359 /* 149 */ { "Unassigned",                               opaque, NULL },
1360 /* 150 */ { "TFTP Server Address",                      ipv4_list, &hf_bootp_option_tftp_server_address },
1361 /* 151 */ { "Unassigned",                               opaque, NULL },
1362 /* 152 */ { "Unassigned",                               opaque, NULL },
1363 /* 153 */ { "Unassigned",                               opaque, NULL },
1364 /* 154 */ { "Unassigned",                               opaque, NULL },
1365 /* 155 */ { "Unassigned",                               opaque, NULL },
1366 /* 156 */ { "Unassigned",                               opaque, NULL },
1367 /* 157 */ { "Unassigned",                               opaque, NULL },
1368 /* 158 */ { "Unassigned",                               opaque, NULL },
1369 /* 159 */ { "Unassigned",                               opaque, NULL },
1370 /* 160 */ { "DHCP Captive-Portal",                      special, NULL },
1371 /* 161 */ { "Manufacturer Usage Description",           string, &hf_bootp_option_mudurl},
1372 /* 162 */ { "Unassigned",                               opaque, NULL },
1373 /* 163 */ { "Unassigned",                               opaque, NULL },
1374 /* 164 */ { "Unassigned",                               opaque, NULL },
1375 /* 165 */ { "Unassigned",                               opaque, NULL },
1376 /* 166 */ { "Unassigned",                               opaque, NULL },
1377 /* 167 */ { "Unassigned",                               opaque, NULL },
1378 /* 168 */ { "Unassigned",                               opaque, NULL },
1379 /* 169 */ { "Unassigned",                               opaque, NULL },
1380 /* 170 */ { "Unassigned",                               opaque, NULL },
1381 /* 171 */ { "Unassigned",                               opaque, NULL },
1382 /* 172 */ { "Unassigned",                               opaque, NULL },
1383 /* 173 */ { "Unassigned",                               opaque, NULL },
1384 /* 174 */ { "Unassigned",                               opaque, NULL },
1385 /* 175 */ { "Etherboot",                                opaque, NULL },
1386 /* 176 */ { "IP Telephone",                             opaque, NULL },
1387 /* 177 */ { "Etherboot",                                opaque, NULL },
1388 /* 178 */ { "Unassigned",                               opaque, NULL },
1389 /* 179 */ { "Unassigned",                               opaque, NULL },
1390 /* 180 */ { "Unassigned",                               opaque, NULL },
1391 /* 181 */ { "Unassigned",                               opaque, NULL },
1392 /* 182 */ { "Unassigned",                               opaque, NULL },
1393 /* 183 */ { "Unassigned",                               opaque, NULL },
1394 /* 184 */ { "Unassigned",                               opaque, NULL },
1395 /* 185 */ { "Unassigned",                               opaque, NULL },
1396 /* 186 */ { "Unassigned",                               opaque, NULL },
1397 /* 187 */ { "Unassigned",                               opaque, NULL },
1398 /* 188 */ { "Unassigned",                               opaque, NULL },
1399 /* 189 */ { "Unassigned",                               opaque, NULL },
1400 /* 190 */ { "Unassigned",                               opaque, NULL },
1401 /* 191 */ { "Unassigned",                               opaque, NULL },
1402 /* 192 */ { "Unassigned",                               opaque, NULL },
1403 /* 193 */ { "Unassigned",                               opaque, NULL },
1404 /* 194 */ { "Unassigned",                               opaque, NULL },
1405 /* 195 */ { "Unassigned",                               opaque, NULL },
1406 /* 196 */ { "Unassigned",                               opaque, NULL },
1407 /* 197 */ { "Unassigned",                               opaque, NULL },
1408 /* 198 */ { "Unassigned",                               opaque, NULL },
1409 /* 199 */ { "Unassigned",                               opaque, NULL },
1410 /* 200 */ { "Unassigned",                               opaque, NULL },
1411 /* 201 */ { "Unassigned",                               opaque, NULL },
1412 /* 202 */ { "Unassigned",                               opaque, NULL },
1413 /* 203 */ { "Unassigned",                               opaque, NULL },
1414 /* 204 */ { "Unassigned",                               opaque, NULL },
1415 /* 205 */ { "Unassigned",                               opaque, NULL },
1416 /* 206 */ { "Unassigned",                               opaque, NULL },
1417 /* 207 */ { "Unassigned",                               opaque, NULL },
1418 /* 208 */ { "PXELINUX Magic",                           opaque, NULL },
1419 /* 209 */ { "PXE Configuration file",                   string, &hf_bootp_option_pxe_config_file },
1420 /* 210 */ { "PXE Path Prefix",                          string, &hf_bootp_option_pxe_path_prefix },
1421 /* 211 */ { "Reboot Time",                              opaque, NULL },
1422 /* 212 */ { "6RD",                                      opaque, NULL },
1423 /* 213 */ { "V4 Access Domain",                         opaque, NULL },
1424 /* 214 */ { "Unassigned",                               opaque, NULL },
1425 /* 215 */ { "Unassigned",                               opaque, NULL },
1426 /* 216 */ { "Unassigned",                               opaque, NULL },
1427 /* 217 */ { "Unassigned",                               opaque, NULL },
1428 /* 218 */ { "Unassigned",                               opaque, NULL },
1429 /* 219 */ { "Unassigned",                               opaque, NULL },
1430 /* 220 */ { "Subnet Allocation",                        opaque, NULL },
1431 /* 221 */ { "Virtual Subnet Selection",                 opaque, NULL },
1432 /* 222 */ { "Unassigned",                               opaque, NULL },
1433 /* 223 */ { "Unassigned",                               opaque, NULL },
1434 /* 224 */ { "Private",                                  opaque, NULL },
1435 /* 225 */ { "Private",                                  opaque, NULL },
1436 /* 226 */ { "Private",                                  opaque, NULL },
1437 /* 227 */ { "Private",                                  opaque, NULL },
1438 /* 228 */ { "Private",                                  opaque, NULL },
1439 /* 229 */ { "Private",                                  opaque, NULL },
1440 /* 230 */ { "Private",                                  opaque, NULL },
1441 /* 231 */ { "Private",                                  opaque, NULL },
1442 /* 232 */ { "Private",                                  opaque, NULL },
1443 /* 233 */ { "Private",                                  opaque, NULL },
1444 /* 234 */ { "Private",                                  opaque, NULL },
1445 /* 235 */ { "Private",                                  opaque, NULL },
1446 /* 236 */ { "Private",                                  opaque, NULL },
1447 /* 237 */ { "Private",                                  opaque, NULL },
1448 /* 238 */ { "Private",                                  opaque, NULL },
1449 /* 239 */ { "Private",                                  opaque, NULL },
1450 /* 240 */ { "Private",                                  opaque, NULL },
1451 /* 241 */ { "Private",                                  opaque, NULL },
1452 /* 242 */ { "Private/Avaya IP Telephone",               special, NULL },
1453 /* 243 */ { "Private",                                  opaque, NULL },
1454 /* 244 */ { "Private",                                  opaque, NULL },
1455 /* 245 */ { "Private",                                  opaque, NULL },
1456 /* 246 */ { "Private",                                  opaque, NULL },
1457 /* 247 */ { "Private",                                  opaque, NULL },
1458 /* 248 */ { "Private",                                  opaque, NULL },
1459 /* 249 */ { "Private/Classless Static Route (Microsoft)",       special, NULL},
1460 /* 250 */ { "Private",                                  opaque, NULL },
1461 /* 251 */ { "Private",                                  opaque, NULL },
1462 /* 252 */ { "Private/Proxy autodiscovery",                      string, &hf_bootp_option_private_proxy_autodiscovery },
1463 /* 253 */ { "Private",                                  opaque, NULL },
1464 /* 254 */ { "Private",                                  opaque, NULL },
1465 /* 255 */ { "End",                                      opaque, NULL }
1466 };
1467
1468 /*-------------------------------------
1469  * UAT for BOOTP
1470  *-------------------------------------
1471  */
1472 /* UAT entry structure. */
1473 typedef struct {
1474         guint  opt;
1475         gchar *text;
1476         enum field_type ftype;
1477
1478 } uat_bootp_record_t;
1479
1480 static uat_bootp_record_t *uat_bootp_records = NULL;
1481 static uat_t *bootp_uat = NULL;
1482 static guint num_bootp_records_uat = 0;
1483 static wmem_list_t *saved_uat_opts = NULL; /* List of previous options from UAT to "free" from dissection */
1484
1485 static void* uat_bootp_record_copy_cb(void* n, const void* o, size_t siz _U_) {
1486         uat_bootp_record_t* new_record = (uat_bootp_record_t *)n;
1487         const uat_bootp_record_t* old_record = (const uat_bootp_record_t *)o;
1488
1489         new_record->text = g_strdup(old_record->text);
1490
1491         return new_record;
1492 }
1493
1494 static gboolean uat_bootp_record_update_cb(void* r, char** err) {
1495         uat_bootp_record_t* rec = (uat_bootp_record_t *)r;
1496
1497         if ((rec->opt == 0) || (rec->opt >=BOOTP_OPT_NUM-1)) {
1498                 *err = g_strdup_printf("Option must be between 1 and %d", BOOTP_OPT_NUM-2);
1499                 return FALSE;
1500         }
1501         return TRUE;
1502 }
1503
1504 static void uat_bootp_record_free_cb(void*r) {
1505         uat_bootp_record_t* rec = (uat_bootp_record_t *)r;
1506
1507         g_free(rec->text);
1508 }
1509
1510 UAT_DEC_CB_DEF(uat_bootp_records, opt, uat_bootp_record_t)
1511 UAT_CSTRING_CB_DEF(uat_bootp_records, text, uat_bootp_record_t)
1512 UAT_VS_DEF(uat_bootp_records, ftype, uat_bootp_record_t, enum field_type, special, "string")
1513
1514
1515 static struct opt_info* bootp_get_opt(unsigned int idx)
1516 {
1517         if(idx>=BOOTP_OPT_NUM)
1518                 return NULL;
1519
1520         return &bootp_opt[idx];
1521 }
1522
1523 static const char *
1524 bootp_get_opt_text(unsigned int idx)
1525 {
1526         if(idx>=BOOTP_OPT_NUM)
1527                 return "unknown";
1528         return bootp_opt[idx].text;
1529 }
1530
1531 struct basic_types_hfs {
1532         gint* bytes;
1533         gint* ipv4;
1534         gint* ipv4_list;
1535         gint* string;
1536         gint* val_boolean;
1537         gint* val_u_byte;
1538         gint* val_u_short;
1539         gint* val_u_short_list;
1540         gint* val_u_long;
1541         gint* time_in_s_secs;
1542         gint* time_in_u_secs;
1543 };
1544
1545 /* Handle "basic" datatypes adding to a tree */
1546 static int
1547 bootp_handle_basic_types(packet_info *pinfo, proto_tree *tree, proto_item *item, tvbuff_t *tvb,
1548                          enum field_type ftype, int offset, int total_len,
1549                          gint *hf, struct basic_types_hfs* hf_default)
1550 {
1551         int     i, left;
1552         gint32  time_s_secs;
1553         guint32 time_u_secs;
1554         int     consumed = 0;
1555
1556         switch (ftype) {
1557         case bytes:
1558                 if (hf != NULL)
1559                         proto_tree_add_item(tree, *hf, tvb, offset, total_len, ENC_BIG_ENDIAN);
1560                 else if (hf_default->bytes != NULL)
1561                         proto_tree_add_item(tree, *hf_default->bytes, tvb, offset, total_len, ENC_BIG_ENDIAN);
1562                 consumed = total_len;
1563                 break;
1564
1565         case ipv4:
1566                 if (total_len != 4) {
1567                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 4");
1568                         break;
1569                 }
1570
1571                 if (hf != NULL)
1572                         proto_tree_add_item(tree, *hf, tvb, offset, 4, ENC_BIG_ENDIAN);
1573                 else if (hf_default->ipv4 != NULL)
1574                         proto_tree_add_item(tree, *hf_default->ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
1575                 consumed = 4;
1576                 break;
1577
1578         case ipv4_list:
1579                 for (i = offset, left = total_len; left > 0; i += 4, left -= 4) {
1580                         if (left < 4) {
1581                                 expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "Option length isn't a multiple of 4");
1582                                 break;
1583                         }
1584
1585                         if (hf != NULL)
1586                                 proto_tree_add_item(tree, *hf, tvb, i, 4, ENC_BIG_ENDIAN);
1587                         else if (hf_default->ipv4_list != NULL)
1588                                 proto_tree_add_item(tree, *hf_default->ipv4_list, tvb, i, 4, ENC_BIG_ENDIAN);
1589                         consumed += 4;
1590                 }
1591
1592                 break;
1593
1594         case string:
1595                 if (hf != NULL)
1596                         proto_tree_add_item(tree, *hf, tvb, offset, total_len, ENC_BIG_ENDIAN);
1597                 else if (hf_default->string != NULL)
1598                         proto_tree_add_item(tree, *hf_default->string, tvb, offset, total_len, ENC_BIG_ENDIAN);
1599                 consumed = total_len;
1600                 break;
1601
1602         case val_boolean:
1603                 if (total_len != 1) {
1604                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 1");
1605                         break;
1606                 }
1607
1608                 if (hf != NULL)
1609                         proto_tree_add_item(tree, *hf, tvb, offset, 1, ENC_BIG_ENDIAN);
1610                 else if (hf_default->val_boolean != NULL)
1611                         proto_tree_add_item(tree, *hf_default->val_boolean, tvb, offset, 1, ENC_BIG_ENDIAN);
1612                 consumed = 1;
1613                 break;
1614
1615         case val_u_byte:
1616                 if (total_len != 1) {
1617                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 1");
1618                         break;
1619                 }
1620
1621                 if (hf != NULL)
1622                         proto_tree_add_item(tree, *hf, tvb, offset, 1, ENC_BIG_ENDIAN);
1623                 else if (hf_default->val_u_byte != NULL)
1624                         proto_tree_add_item(tree, *hf_default->val_u_byte, tvb, offset, 1, ENC_BIG_ENDIAN);
1625                 consumed = 1;
1626                 break;
1627
1628         case val_u_short:
1629                 if (total_len != 2) {
1630                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 2");
1631                         break;
1632                 }
1633
1634                 if (hf != NULL)
1635                         proto_tree_add_item(tree, *hf, tvb, offset, 2, ENC_BIG_ENDIAN);
1636                 else if (hf_default->val_u_short != NULL)
1637                         proto_tree_add_item(tree, *hf_default->val_u_short, tvb, offset, 2, ENC_BIG_ENDIAN);
1638                 consumed = 2;
1639                 break;
1640
1641         case val_u_le_short:
1642                 if (total_len != 2) {
1643                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 2");
1644                         break;
1645                 }
1646
1647                 if (hf != NULL)
1648                         proto_tree_add_item(tree, *hf, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1649                 else if (hf_default->val_u_short != NULL)
1650                         proto_tree_add_item(tree, *hf_default->val_u_short, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1651                 consumed = 2;
1652                 break;
1653
1654         case val_u_short_list:
1655                 for (i = offset, left = total_len; left > 0; i += 2, left -= 2) {
1656                         if (left < 2) {
1657                                 expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "Option length isn't a multiple of 2");
1658                                 break;
1659                         }
1660
1661                         if (hf != NULL)
1662                                 proto_tree_add_item(tree, *hf, tvb, i, 2, ENC_BIG_ENDIAN);
1663                         else if (hf_default->val_u_short_list != NULL)
1664                                 proto_tree_add_item(tree, *hf_default->val_u_short_list, tvb, i, 2, ENC_BIG_ENDIAN);
1665                         consumed += 2;
1666                 }
1667                 break;
1668
1669         case val_u_long:
1670                 if (total_len != 4) {
1671                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 4");
1672                         break;
1673                 }
1674
1675                 if (hf != NULL)
1676                         proto_tree_add_item(tree, *hf, tvb, offset, 4, ENC_BIG_ENDIAN);
1677                 else if (hf_default->val_u_long != NULL)
1678                         proto_tree_add_item(tree, *hf_default->val_u_long, tvb, offset, 4, ENC_BIG_ENDIAN);
1679                 consumed = 4;
1680                 break;
1681
1682         case time_in_s_secs:
1683                 if (total_len != 4) {
1684                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 4");
1685                         break;
1686                 }
1687
1688                 if (hf != NULL) {
1689                         time_s_secs = (gint32) tvb_get_ntohl(tvb, offset);
1690                         proto_tree_add_int_format_value(tree, *hf,
1691                                 tvb, offset, 4, time_s_secs, "(%ds) %s", time_s_secs, signed_time_secs_to_str(wmem_packet_scope(), time_s_secs));
1692                 }
1693                 else if (hf_default->time_in_s_secs != NULL)
1694                         proto_tree_add_item(tree, *hf_default->time_in_s_secs, tvb, offset, 4, ENC_BIG_ENDIAN);
1695
1696                 consumed = 4;
1697                 break;
1698
1699         case time_in_u_secs:
1700                 if (total_len != 4) {
1701                         expert_add_info_format(pinfo, item, &ei_bootp_bad_length, "length isn't 4");
1702                         break;
1703                 }
1704
1705                 if (hf != NULL) {
1706                         time_u_secs = tvb_get_ntohl(tvb, offset);
1707                         proto_tree_add_uint_format_value(tree, *hf,
1708                                 tvb, offset, 4, time_u_secs, "(%us) %s", time_u_secs,
1709                                 ((time_u_secs == 0xffffffff) ? "infinity" : unsigned_time_secs_to_str(wmem_packet_scope(), time_u_secs)));
1710                 }
1711                 else if (hf_default->time_in_u_secs != NULL)
1712                         proto_tree_add_item(tree, *hf_default->time_in_u_secs, tvb, offset, 4, ENC_BIG_ENDIAN);
1713                 consumed = 4;
1714                 break;
1715         default:
1716                 /* Ignore other field_types */
1717                 break;
1718         }
1719
1720         return consumed;
1721 }
1722
1723 static int
1724 dissect_bootpopt_basic_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1725 {
1726         struct opt_info *opt;
1727         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
1728         struct basic_types_hfs default_hfs = {
1729                 &hf_bootp_option_value,
1730                 &hf_bootp_option_value_ip_address,
1731                 &hf_bootp_option_value_ip_address,
1732                 &hf_bootp_option_value_stringz,
1733                 &hf_bootp_option_value_boolean,
1734                 &hf_bootp_option_value_8,
1735                 &hf_bootp_option_value_16,
1736                 &hf_bootp_option_value_16,
1737                 &hf_bootp_option_value_u32,
1738                 &hf_bootp_option_value_i32,
1739                 &hf_bootp_option_value_u32
1740         };
1741
1742         opt = bootp_get_opt(option_data->option);
1743         if (opt == NULL)
1744                 return 0;
1745
1746         return bootp_handle_basic_types(pinfo, tree, tree, tvb, opt->ftype,
1747                                                       0, tvb_reported_length(tvb), opt->phf, &default_hfs);
1748 }
1749
1750 /* Returns the number of bytes consumed by this option. */
1751 static int
1752 bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, int voff,
1753              int eoff, gboolean first_pass, gboolean *at_end, const char **dhcp_type_p,
1754              const guint8 **vendor_class_id_p, guint8 *overload_p)
1755 {
1756         struct opt_info *opt;
1757         guchar           code = tvb_get_guint8(tvb, voff);
1758         int              optlen;
1759         int              i, consumed;
1760         proto_tree      *v_tree;
1761         proto_item      *vti, *ti_value;
1762         tvbuff_t *option_tvb;
1763         bootp_option_data_t option_data;
1764
1765         /* Options whose length isn't "optlen + 2". */
1766         switch (code) {
1767
1768         case 0:         /* Padding */
1769                 /* check how much padding we have */
1770                 for (i = voff + 1; i < eoff; i++ ) {
1771                         if (tvb_get_guint8(tvb, i) != 0) {
1772                                 break;
1773                         }
1774                 }
1775                 i = i - voff;
1776                 if (!first_pass) {
1777                         if (bp_tree != NULL) {
1778                                 vti = proto_tree_add_uint_format_value(bp_tree, hf_bootp_option_type,
1779                                                 tvb, voff, 1, 0, "(0) Padding");
1780                                 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
1781                                 proto_tree_add_item(v_tree, hf_bootp_option_padding, tvb, voff, i, ENC_NA);
1782                         }
1783                 }
1784                 consumed = i;
1785                 return consumed;
1786
1787         case 255:       /* End Option */
1788                 if (!first_pass) {
1789                         if (bp_tree != NULL) {
1790                                 vti = proto_tree_add_uint_format_value(bp_tree, hf_bootp_option_type,
1791                                                 tvb, voff, 1, 0, "(255) End");
1792                                 v_tree = proto_item_add_subtree(vti, ett_bootp_option);
1793                                 if (*overload_p)
1794                                         proto_tree_add_item(v_tree, hf_bootp_option_end_overload, tvb, voff, 1, ENC_BIG_ENDIAN);
1795                                 else
1796                                         proto_tree_add_item(v_tree, hf_bootp_option_end, tvb, voff, 1, ENC_BIG_ENDIAN);
1797                         }
1798                 }
1799                 *at_end = TRUE;
1800                 consumed = 1;
1801                 return consumed;
1802         }
1803
1804         /*
1805          * Get the length of the option, and the number of bytes it
1806          * consumes (the length doesn't include the option code or
1807          * length bytes).
1808          *
1809          * On the first pass, check first whether we have the length
1810          * byte, so that we don't throw an exception; if we throw an
1811          * exception in the first pass, which is only checking for options
1812          * whose values we need in order to properly dissect the packet
1813          * on the second pass, we won't actually dissect the options, so
1814          * you won't be able to see which option had the problem.
1815          */
1816         if (first_pass) {
1817                 if (!tvb_bytes_exist(tvb, voff+1, 1)) {
1818                         /*
1819                          * We don't have the length byte; just return 1
1820                          * as the number of bytes we consumed, to count
1821                          * the code byte.
1822                          */
1823                         return 1;
1824                 }
1825         }
1826         optlen = tvb_get_guint8(tvb, voff+1);
1827         consumed = optlen + 2;
1828
1829         /*
1830          * In the first pass, we don't put anything into the protocol
1831          * tree; we just check for some options we have to look at
1832          * in order to properly process the packet:
1833          *
1834          *      52 (Overload) - we need this to properly dissect the
1835          *         file and sname fields
1836          *
1837          *      53 (DHCP message type) - if this is present, this is DHCP
1838          *
1839          *      60 (Vendor class identifier) - we need this in order to
1840          *         interpret the vendor-specific info
1841          *
1842          * We also check, before fetching anything, to make sure we
1843          * have the entire item we're fetching, so that we don't throw
1844          * an exception.
1845          */
1846         if (first_pass) {
1847                 if (tvb_bytes_exist(tvb, voff+2, consumed-2)) {
1848                         switch (code) {
1849
1850                         case 52:
1851                                 *overload_p = tvb_get_guint8(tvb, voff+2);
1852                                 break;
1853
1854                         case 53:
1855                                 *dhcp_type_p =
1856                                     val_to_str(tvb_get_guint8(tvb, voff+2),
1857                                         opt53_text,
1858                                         "Unknown Message Type (0x%02x)");
1859                                 break;
1860
1861                         case 60:
1862                                 *vendor_class_id_p =
1863                                         tvb_get_string_enc(wmem_packet_scope(),
1864                                         tvb, voff+2, consumed-2, ENC_ASCII);
1865                                 break;
1866                         case 119:
1867                                 rfc3396_dns_domain_search_list.total_number_of_block++;
1868                                 break;
1869                         case 120:
1870                                 rfc3396_sip_server.total_number_of_block++;
1871                                 break;
1872                         }
1873                 }
1874
1875                 /*
1876                  * We don't do anything else here.
1877                  */
1878                 return consumed;
1879         }
1880
1881         /* Normal cases */
1882         opt = bootp_get_opt(code);
1883         if (opt == NULL)
1884         {
1885                 /* THIS SHOULD NEVER HAPPEN!!! */
1886                 return consumed;
1887         }
1888
1889         vti = proto_tree_add_uint_format_value(bp_tree, hf_bootp_option_type,
1890                 tvb, voff, consumed, code, "(%d) %s", code, opt->text);
1891         v_tree = proto_item_add_subtree(vti, ett_bootp_option);
1892         proto_tree_add_item(v_tree, hf_bootp_option_length, tvb, voff+1, 1, ENC_BIG_ENDIAN);
1893
1894         ti_value = proto_tree_add_item(v_tree, hf_bootp_option_value, tvb, voff+2, optlen, ENC_NA);
1895         PROTO_ITEM_SET_HIDDEN(ti_value);
1896
1897         /* prepate data for dissector table */
1898         option_tvb = tvb_new_subset_length(tvb, voff+2, optlen);
1899         option_data.option = code;
1900         option_data.overload = overload_p;
1901         option_data.dhcp_type = *dhcp_type_p;
1902         option_data.vendor_class_id = *vendor_class_id_p;
1903         option_data.orig_tvb = tvb;
1904
1905         if (!dissector_try_uint_new(bootp_option_table, code, option_tvb, pinfo, v_tree, FALSE, &option_data)) {
1906                 /* hf_bootp_option_value is already in tree, just make it visible */
1907                 PROTO_ITEM_SET_VISIBLE(ti_value);
1908         }
1909
1910         return consumed;
1911 }
1912
1913 static int
1914 dissect_bootpopt_policy_filter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1915 {
1916         int offset = 0;
1917
1918         while (tvb_reported_length_remaining(tvb, offset) >= 8) {
1919                 proto_tree_add_item(tree, hf_bootp_option_policy_filter_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
1920                 offset += 4;
1921                 proto_tree_add_item(tree, hf_bootp_option_policy_filter_subnet_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
1922                 offset += 4;
1923         }
1924
1925         if (tvb_reported_length_remaining(tvb, offset) > 0) {
1926                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Option length isn't a multiple of 8");
1927         }
1928
1929         return tvb_captured_length(tvb);
1930 }
1931
1932 static int
1933 dissect_bootpopt_static_route(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1934 {
1935         int offset = 0;
1936
1937         while (tvb_reported_length_remaining(tvb, offset) >= 8) {
1938                 proto_tree_add_item(tree, hf_bootp_option_static_route_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
1939                 offset += 4;
1940                 proto_tree_add_item(tree, hf_bootp_option_static_route_router, tvb, offset, 4, ENC_BIG_ENDIAN);
1941                 offset += 4;
1942         }
1943
1944         if (tvb_reported_length_remaining(tvb, offset) > 0) {
1945                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Option length isn't a multiple of 8");
1946         }
1947
1948         return tvb_captured_length(tvb);
1949 }
1950
1951 static int
1952 dissect_bootpopt_vendor_specific_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1953 {
1954         heur_dtbl_entry_t *hdtbl_entry;
1955         proto_tree *vendor_tree;
1956
1957         if (!dissector_try_heuristic(bootp_vendor_info_subdissector, tvb, pinfo, tree, &hdtbl_entry, data)) {
1958                 /* Default Vendor-Specific Info.. display in bytes */
1959                 vendor_tree = proto_item_add_subtree(tree, ett_bootp_option);
1960                 proto_tree_add_item(vendor_tree, hf_bootp_option43_value, tvb, 0, tvb_reported_length(tvb), ENC_NA);
1961         }
1962
1963         return tvb_captured_length(tvb);
1964 }
1965
1966 static int
1967 dissect_bootpopt_option_overload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1968 {
1969         int offset = 0;
1970         int     suboffset, suboffset_end;
1971         gboolean at_end;
1972         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
1973         guint32 byte;
1974
1975         if (tvb_reported_length(tvb) < 1) {
1976                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 1");
1977                 return 1;
1978         }
1979
1980         proto_tree_add_item_ret_uint(tree, hf_bootp_option_option_overload, tvb, offset, 1, ENC_BIG_ENDIAN, &byte);
1981
1982         /* Just in case we find an option 52 in sname or file */
1983         if ((*option_data->overload >= 1) && (*option_data->overload <= 3)) {
1984                 if (byte & OPT_OVERLOAD_SNAME) {
1985                         proto_item *oti;
1986                         proto_tree *overload_tree = proto_tree_add_subtree(tree, option_data->orig_tvb,
1987                                 SERVER_NAME_OFFSET, SERVER_NAME_LEN, ett_bootp_server_hostname, &oti,
1988                                 "Server host name option overload");
1989                         guint8 ignore_overload = 0;
1990                         suboffset = SERVER_NAME_OFFSET;
1991                         suboffset_end = SERVER_NAME_OFFSET + SERVER_NAME_LEN;
1992                         at_end = FALSE;
1993                         rfc3396_dns_domain_search_list.index_current_block = 0;
1994                         rfc3396_sip_server.index_current_block = 0;
1995                         while (suboffset < suboffset_end && !at_end) {
1996                                 suboffset += bootp_option(option_data->orig_tvb, pinfo, overload_tree, suboffset,
1997                                         suboffset_end, FALSE, &at_end,
1998                                         &option_data->dhcp_type, &option_data->vendor_class_id,
1999                                         &ignore_overload);
2000                         }
2001                         if (!at_end)
2002                         {
2003                                 expert_add_info(pinfo, oti, &hf_bootp_opt_overload_sname_end_missing);
2004                         }
2005                 }
2006                 if (byte & OPT_OVERLOAD_FILE) {
2007                         proto_item *oti;
2008                         proto_tree *overload_tree = proto_tree_add_subtree(tree, option_data->orig_tvb,
2009                                 FILE_NAME_OFFSET, FILE_NAME_LEN, ett_bootp_filename_option, &oti,
2010                                 "Boot file name option overload");
2011                         guint8 ignore_overload = 0;
2012                         suboffset = FILE_NAME_OFFSET;
2013                         suboffset_end = FILE_NAME_OFFSET + FILE_NAME_LEN;
2014                         at_end = FALSE;
2015                         rfc3396_dns_domain_search_list.index_current_block = 0;
2016                         rfc3396_sip_server.index_current_block = 0;
2017                         while (suboffset < suboffset_end && !at_end) {
2018                                 suboffset += bootp_option(option_data->orig_tvb, pinfo, overload_tree, suboffset,
2019                                         suboffset_end, FALSE, &at_end,
2020                                         &option_data->dhcp_type, &option_data->vendor_class_id,
2021                                         &ignore_overload);
2022                         }
2023                         if (!at_end)
2024                         {
2025                                 expert_add_info(pinfo, oti, &hf_bootp_opt_overload_file_end_missing);
2026                         }
2027                 }
2028                 /* The final end option is not in overload */
2029                 *option_data->overload = 0;
2030         }
2031
2032         return tvb_captured_length(tvb);
2033 }
2034
2035 static int
2036 dissect_bootpopt_dhcp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2037 {
2038         guint32 type;
2039
2040         proto_tree_add_item_ret_uint(tree, hf_bootp_option_dhcp, tvb, 0, 1, ENC_NA, &type);
2041         /* Show the message type name on the Message Type option, and in the protocol root */
2042         proto_item_append_text(tree, " (%s)", val_to_str(type, opt53_text, "Unknown Message Type (0x%02x)"));
2043         proto_item_append_text(proto_item_get_parent(tree), " (%s)", val_to_str(type, opt53_text, "Unknown Message Type (0x%02x)"));
2044
2045         return tvb_captured_length(tvb);
2046 }
2047
2048 static int
2049 dissect_bootpopt_param_request_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2050 {
2051         int offset = 0;
2052         guint8 byte;
2053
2054         while (tvb_reported_length_remaining(tvb, offset) > 0) {
2055                 byte = tvb_get_guint8(tvb, offset);
2056                 proto_tree_add_uint_format_value(tree, hf_bootp_option_parameter_request_list_item,
2057                                 tvb, offset, 1, byte, "(%d) %s", byte, bootp_get_opt_text(byte));
2058                 offset++;
2059         }
2060
2061         return tvb_captured_length(tvb);
2062 }
2063
2064 static int
2065 dissect_bootpopt_vendor_class_identifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2066 {
2067         heur_dtbl_entry_t *hdtbl_entry;
2068
2069         /*
2070          * XXX - RFC 2132 says this is a string of octets;
2071          * should we check for non-printables?
2072          */
2073         proto_tree_add_item(tree, hf_bootp_option_vendor_class_id, tvb, 0, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
2074         dissector_try_heuristic(bootp_vendor_id_subdissector, tvb, pinfo, tree, &hdtbl_entry, data);
2075
2076         return tvb_captured_length(tvb);
2077 }
2078
2079 static int
2080 dissect_bootpopt_client_identifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2081 {
2082         int offset = 0;
2083         int length = tvb_reported_length(tvb);
2084         guchar byte;
2085
2086         if (length > 0)
2087                 byte = tvb_get_guint8(tvb, offset);
2088         else
2089                 byte = 0;
2090
2091         /* We *MAY* use hwtype/hwaddr. If we have 7 bytes, I'll
2092                 guess that the first is the hwtype, and the last 6
2093                 are the hw addr */
2094         /* See http://www.iana.org/assignments/arp-parameters */
2095         /* RFC2132 9.14 Client-identifier has the following to say:
2096                 A hardware type of 0 (zero) should be used when the value
2097                 field contains an identifier other than a hardware address
2098                 (e.g. a fully qualified domain name). */
2099
2100         if (length == 7 && byte > 0 && byte < 48) {
2101                 proto_tree_add_item(tree, hf_bootp_hw_type, tvb, offset, 1, ENC_NA);
2102
2103                 if (byte == ARPHRD_ETHER || byte == ARPHRD_IEEE802)
2104                         proto_tree_add_item(tree, hf_bootp_hw_ether_addr, tvb, offset+1, 6, ENC_NA);
2105                 else
2106                         proto_tree_add_string(tree, hf_bootp_client_hardware_address, tvb, offset+1, 6,
2107                                 tvb_arphrdaddr_to_str(tvb, offset+1, 6, byte));
2108         } else if (length == 17 && byte == 0) {
2109                 /* Identifier is a UUID */
2110                 proto_tree_add_item(tree, hf_bootp_client_identifier_uuid, tvb, offset + 1, 16, bootp_uuid_endian);
2111
2112         /* From RFC 4361 paragraph 6.1 DHCPv4 Client Behavior:
2113                 To send an RFC 3315-style binding identifier in a DHCPv4 'client
2114                 identifier' option, the type of the 'client identifier' option is set
2115                 to 255. */
2116         } else if (byte == 255) {
2117                 guint16 duidtype;
2118                 guint16 hwtype;
2119
2120                 /*      The type field is immediately followed by the IAID, which is
2121                         an opaque 32-bit quantity       */
2122                 proto_tree_add_string(tree, hf_bootp_client_id_iaid, tvb, offset+1, 4,
2123                         tvb_arphrdaddr_to_str(tvb, offset+1, 4, byte));
2124                 offset += 5;
2125                 duidtype = tvb_get_ntohs(tvb, offset);
2126                 proto_tree_add_item(tree, hf_bootp_client_id_duid_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2127                 switch (duidtype) {
2128                 case DUID_LLT:
2129                         if (length < 8) {
2130                                 expert_add_info(pinfo, tree, &ei_bootp_mal_duid);
2131                                 break;
2132                         }
2133                         hwtype=tvb_get_ntohs(tvb, offset + 2);
2134                         proto_tree_add_item(tree, hf_bootp_client_identifier_duid_llt_hw_type,
2135                                         tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2136
2137                         /* XXX seconds since Jan 1 2000 */
2138                         proto_tree_add_item(tree, hf_bootp_client_identifier_time, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2139                         if (length > 8) {
2140                                 proto_tree_add_string(tree, hf_bootp_client_identifier_link_layer_address, tvb, offset + 8,
2141                                         length - 13, tvb_arphrdaddr_to_str(tvb, offset+8, length-13, hwtype));
2142                         }
2143                         break;
2144                 case DUID_EN:
2145                         if (length < 6) {
2146                                 expert_add_info(pinfo, tree, &ei_bootp_mal_duid);
2147                                 break;
2148                         }
2149                         proto_tree_add_item(tree, hf_bootp_client_identifier_enterprise_num, tvb, offset + 2, 4, ENC_BIG_ENDIAN);
2150                         if (length > 6) {
2151                                 proto_tree_add_item(tree, hf_bootp_client_identifier, tvb, offset + 6, length - 11, ENC_NA);
2152                         }
2153                         break;
2154                 case DUID_LL:
2155                         if (length < 4) {
2156                                 expert_add_info(pinfo, tree, &ei_bootp_mal_duid);
2157                                 break;
2158                         }
2159                         hwtype=tvb_get_ntohs(tvb, offset + 2);
2160                         proto_tree_add_item(tree, hf_bootp_client_identifier_duid_ll_hw_type,
2161                                         tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2162
2163                         if (length > 4) {
2164                                 proto_tree_add_string(tree, hf_bootp_client_identifier_link_layer_address, tvb, offset + 4,
2165                                         length - 9, tvb_arphrdaddr_to_str(tvb, offset+4, length-9, hwtype));
2166                         }
2167                         break;
2168                 }
2169         } else if (byte == 0 && length > 1) {
2170                 /* identifier other than a hardware address (e.g. a fully qualified domain name) */
2171                 proto_tree_add_item(tree, hf_bootp_client_identifier_type, tvb, offset, 1, ENC_NA);
2172                 proto_tree_add_item(tree, hf_bootp_client_identifier_undef, tvb, offset+1, length-1, ENC_ASCII|ENC_NA);
2173         } else {
2174                 /* otherwise, it's opaque data */
2175         }
2176
2177         return tvb_captured_length(tvb);
2178 }
2179
2180 static int
2181 dissect_bootpopt_user_class_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2182 {
2183         guchar user_class_instance_index = 0;
2184         int offset = 0;
2185         guint32 class_length;
2186         proto_item *vtix, *len_item;
2187         proto_tree *o77_v_tree;
2188         if (tvb_reported_length(tvb) < 2) {
2189                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 2");
2190                 return 1;
2191         }
2192
2193         while (tvb_reported_length_remaining(tvb, offset) > 0) {
2194                 /* Create subtree for instance of User Class. */
2195                 vtix = proto_tree_add_uint_format_value(tree, hf_bootp_option77_user_class,
2196                                 tvb, offset, 1, user_class_instance_index, "[%d]", user_class_instance_index);
2197                 o77_v_tree = proto_item_add_subtree(vtix, ett_bootp_option77_instance);
2198
2199                 /* Add length for instance of User Class. */
2200                 len_item = proto_tree_add_item_ret_uint(o77_v_tree, hf_bootp_option77_user_class_length,
2201                                 tvb, offset, 1, ENC_BIG_ENDIAN, &class_length);
2202                 proto_item_set_len(vtix, class_length+1);
2203                 offset += 1;
2204
2205                 if (class_length == 0) {
2206                         expert_add_info_format(pinfo, len_item, &ei_bootp_bad_length, "UC_Len_%u isn't >= 1 (UC_Len_%u = 0)", user_class_instance_index, user_class_instance_index);
2207                         break;
2208                 }
2209
2210                 /* Add data for instance of User Class. */
2211                 proto_tree_add_item(o77_v_tree, hf_bootp_option77_user_class_data, tvb, offset, class_length, ENC_NA);
2212                 offset += class_length;
2213                 user_class_instance_index++;
2214         }
2215
2216         return tvb_captured_length(tvb);
2217 }
2218
2219 static int
2220 dissect_bootpopt_slp_directory_agent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2221 {
2222         int offset = 0;
2223         guint32 byte;
2224
2225         if (tvb_reported_length(tvb) < 1) {
2226                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 1");
2227                 return 1;
2228         }
2229
2230         proto_tree_add_item_ret_uint(tree, hf_bootp_option_slp_directory_agent_value, tvb, offset, 1, ENC_BIG_ENDIAN, &byte);
2231         offset++;
2232
2233         if (byte == 0x80) {
2234                 if (tvb_reported_length_remaining(tvb, offset) == 0)
2235                         return offset;
2236
2237                 offset++;
2238         }
2239
2240         while (tvb_reported_length_remaining(tvb, offset) >= 4) {
2241                 proto_tree_add_item(tree, hf_bootp_option_slp_directory_agent_slpda_address, tvb, offset, 4, ENC_BIG_ENDIAN);
2242                 offset += 4;
2243         }
2244
2245         if (tvb_reported_length_remaining(tvb, offset) > 0) {
2246                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Option length isn't a multiple of 4");
2247         }
2248
2249         return tvb_captured_length(tvb);
2250 }
2251
2252 static int
2253 dissect_bootpopt_slp_service_scope(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2254 {
2255         int offset = 0;
2256
2257         proto_tree_add_item(tree, hf_bootp_option_slp_service_scope_value, tvb, offset, 1, ENC_BIG_ENDIAN);
2258
2259         offset++;
2260         proto_tree_add_item(tree, hf_bootp_option_slp_service_scope_string, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII|ENC_NA);
2261
2262         return tvb_captured_length(tvb);
2263 }
2264
2265 static int
2266 dissect_bootpopt_client_full_domain_name(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2267 {
2268         static const int * fqdn_hf_flags[] = {
2269                 &hf_bootp_fqdn_mbz,
2270                 &hf_bootp_fqdn_n,
2271                 &hf_bootp_fqdn_e,
2272                 &hf_bootp_fqdn_o,
2273                 &hf_bootp_fqdn_s,
2274                 NULL
2275         };
2276         guint8 fqdn_flags;
2277         int offset = 0, length = tvb_reported_length(tvb);
2278         const guchar    *dns_name;
2279         guint                   dns_name_len;
2280
2281         if (length < 3) {
2282                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 3");
2283                 return 1;
2284         }
2285
2286         fqdn_flags = tvb_get_guint8(tvb, offset);
2287         proto_tree_add_bitmask(tree, tvb, offset, hf_bootp_fqdn_flags,
2288                                 ett_bootp_fqdn_flags, fqdn_hf_flags, ENC_BIG_ENDIAN);
2289
2290         /* XXX: use code from packet-dns for return code decoding */
2291         proto_tree_add_item(tree, hf_bootp_fqdn_rcode1, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2292         /* XXX: use code from packet-dns for return code decoding */
2293         proto_tree_add_item(tree, hf_bootp_fqdn_rcode2, tvb, offset+2, 1, ENC_BIG_ENDIAN);
2294
2295         if (length > 3) {
2296                 if (fqdn_flags & F_FQDN_E) {
2297                         get_dns_name(tvb, offset+3, length-3, offset+3, &dns_name, &dns_name_len);
2298                         proto_tree_add_string(tree, hf_bootp_fqdn_name,
2299                                 tvb, offset+3, length-3, format_text(wmem_packet_scope(), dns_name, dns_name_len));
2300                 } else {
2301                         proto_tree_add_item(tree, hf_bootp_fqdn_asciiname, tvb, offset+3, length-3, ENC_ASCII|ENC_NA);
2302                 }
2303         }
2304
2305         return tvb_captured_length(tvb);
2306 }
2307
2308 static int
2309 dissect_bootpopt_novell_servers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2310 {
2311         int offset = 0;
2312
2313         /* Option 85 can be sent as a string */
2314         /* Added by Greg Morris (gmorris[AT]novell.com) */
2315         if (novell_string) {
2316                 proto_tree_add_item(tree, hf_bootp_option_novell_dss_string, tvb, offset, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
2317         } else {
2318                 /* IP addresses */
2319                 while (tvb_reported_length_remaining(tvb, offset) >= 4) {
2320
2321                         proto_tree_add_item(tree, hf_bootp_option_novell_dss_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
2322                         offset += 4;
2323                 }
2324
2325                 if (tvb_reported_length_remaining(tvb, offset) > 0) {
2326                         expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Option length isn't a multiple of 4");
2327                 }
2328         }
2329
2330         return tvb_captured_length(tvb);
2331 }
2332
2333 static int
2334 dissect_bootpopt_dhcp_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2335 {
2336         int offset = 0;
2337         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
2338         guint32 protocol, rdm;
2339         guint8 algorithm;
2340
2341         if (tvb_reported_length(tvb) < 11) {
2342                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 11");
2343                 return 1;
2344         }
2345
2346         proto_tree_add_item_ret_uint(tree, hf_bootp_option_dhcp_authentication_protocol, tvb, offset, 1, ENC_BIG_ENDIAN, &protocol);
2347         offset++;
2348
2349         algorithm = tvb_get_guint8(tvb, offset);
2350         switch (protocol) {
2351
2352         case AUTHEN_PROTO_DELAYED_AUTHEN:
2353                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_alg_delay, tvb, offset, 1, ENC_BIG_ENDIAN);
2354                 break;
2355
2356         default:
2357                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_algorithm, tvb, offset, 1, ENC_BIG_ENDIAN);
2358                 break;
2359         }
2360         offset++;
2361
2362         proto_tree_add_item_ret_uint(tree, hf_bootp_option_dhcp_authentication_rdm, tvb, offset, 1, ENC_BIG_ENDIAN, &rdm);
2363         offset++;
2364
2365         switch (rdm) {
2366
2367         case AUTHEN_RDM_MONOTONIC_COUNTER:
2368                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_rdm_replay_detection, tvb, offset, 8, ENC_BIG_ENDIAN);
2369                 break;
2370
2371         default:
2372                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_rdm_rdv, tvb, offset, 8, ENC_ASCII|ENC_NA);
2373                 break;
2374         }
2375         offset += 8;
2376
2377         switch (protocol) {
2378
2379         case AUTHEN_PROTO_DELAYED_AUTHEN:
2380                 switch (algorithm) {
2381
2382                 case AUTHEN_DELAYED_ALGO_HMAC_MD5:
2383                         if (option_data->dhcp_type && !strcmp(option_data->dhcp_type, OPT53_DISCOVER)) {
2384                                 /* Discover has no Secret ID nor HMAC MD5 Hash */
2385                                 break;
2386                         } else {
2387                                 if (tvb_reported_length_remaining(tvb, offset) < 31) {
2388                                         expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 31");
2389                                         break;
2390                                 }
2391
2392                                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_secret_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2393                                 offset += 4;
2394                                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_hmac_md5_hash, tvb, offset, 16, ENC_ASCII|ENC_NA);
2395                                 break;
2396                         }
2397
2398                 default:
2399                         if (tvb_reported_length_remaining(tvb, offset) == 0)
2400                                 break;
2401
2402                         proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_information, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII|ENC_NA);
2403                         break;
2404                 }
2405                 break;
2406
2407         default:
2408                 if (tvb_reported_length_remaining(tvb, offset) == 0)
2409                         break;
2410
2411                 proto_tree_add_item(tree, hf_bootp_option_dhcp_authentication_information, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII|ENC_NA);
2412                 break;
2413         }
2414
2415         return tvb_captured_length(tvb);
2416 }
2417
2418 static int
2419 dissect_bootpopt_client_network_interface_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2420 {
2421         int offset = 0;
2422         guint8 id_type;
2423
2424         id_type = tvb_get_guint8(tvb, offset);
2425         offset++;
2426
2427         if (id_type == 0x01) {
2428                 proto_tree_add_item(tree, hf_bootp_option_client_network_id_major_ver,
2429                                                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
2430                 offset++;
2431                 proto_tree_add_item(tree, hf_bootp_option_client_network_id_minor_ver,
2432                                                         tvb, offset, 1, ENC_LITTLE_ENDIAN);
2433         }
2434
2435         return tvb_captured_length(tvb);
2436 }
2437
2438 static int
2439 dissect_bootpopt_client_identifier_uuid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2440 {
2441         int offset = 0, length = tvb_reported_length(tvb);
2442         guint8 byte;
2443
2444         if (length > 0)
2445                 byte = tvb_get_guint8(tvb, offset);
2446         else
2447                 byte = 0;
2448
2449         /* We *MAY* use hwtype/hwaddr. If we have 7 bytes, I'll
2450                 guess that the first is the hwtype, and the last 6
2451                 are the hw addr */
2452         /* See http://www.iana.org/assignments/arp-parameters */
2453         /* RFC2132 9.14 Client-identifier has the following to say:
2454                 A hardware type of 0 (zero) should be used when the value
2455                 field contains an identifier other than a hardware address
2456                 (e.g. a fully qualified domain name). */
2457
2458         if (length == 7 && byte > 0 && byte < 48) {
2459                 proto_tree_add_item(tree, hf_bootp_hw_type, tvb, offset, 1, ENC_NA);
2460                 if (byte == ARPHRD_ETHER || byte == ARPHRD_IEEE802)
2461                         proto_tree_add_item(tree, hf_bootp_hw_ether_addr, tvb, offset+1, 6, ENC_NA);
2462                 else
2463                         proto_tree_add_string(tree, hf_bootp_client_hardware_address, tvb, offset+1, 6,
2464                                 tvb_arphrdaddr_to_str(tvb, offset+1, 6, byte));
2465         } else if (length == 17 && byte == 0) {
2466                 /* Identifier is a UUID */
2467                 proto_tree_add_item(tree, hf_bootp_client_identifier_uuid, tvb, offset + 1, 16, bootp_uuid_endian);
2468         } else {
2469                 /* otherwise, it's opaque data */
2470         }
2471
2472         return tvb_captured_length(tvb);
2473 }
2474
2475 static int
2476 dissect_bootpopt_civic_location(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2477 {
2478         int offset = 0;
2479
2480         if (tvb_reported_length(tvb) >= 3)
2481         {
2482                 proto_tree_add_item(tree, hf_bootp_option_civic_location_what, tvb, offset, 1, ENC_BIG_ENDIAN);
2483                 offset++;
2484                 proto_tree_add_item(tree, hf_bootp_option_civic_location_country, tvb, offset, 2, ENC_ASCII|ENC_NA);
2485                 offset += 2;
2486
2487                 while (tvb_reported_length_remaining(tvb, offset) >= 2)
2488                 {
2489                         guint32 calength;
2490                         proto_tree_add_item(tree, hf_bootp_option_civic_location_ca_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2491                         offset++;
2492                         proto_tree_add_item_ret_uint(tree, hf_bootp_option_civic_location_ca_length, tvb, offset, 1, ENC_BIG_ENDIAN, &calength);
2493                         offset++;
2494
2495                         if (calength == 0)
2496                                 continue;
2497
2498                         if (tvb_reported_length_remaining(tvb, offset) >= (int)calength)
2499                         {
2500                                 proto_tree_add_item(tree, hf_bootp_option_civic_location_ca_value, tvb, offset, calength, ENC_ASCII|ENC_NA);
2501                                 offset += calength;
2502                         }
2503                         else
2504                         {
2505                                 expert_add_info(pinfo, tree, &ei_bootp_option_civic_location_bad_cattype);
2506                                 break;
2507                         }
2508                 }
2509         }
2510
2511         return tvb_captured_length(tvb);
2512 }
2513
2514 static int
2515 dissect_bootpopt_name_server_search(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2516 {
2517         int offset = 0, length = tvb_reported_length(tvb);
2518         guint16 ns;
2519
2520         if (length < 2) {
2521                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 2");
2522                 return 1;
2523         } else if (length & 1) {
2524                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length (%u) isn't even number", length);
2525                 return 1;
2526         }
2527
2528         while (tvb_reported_length_remaining(tvb, offset) > 0) {
2529                 ns = tvb_get_ntohs(tvb, offset);
2530                 /* XXX - Make this a value_string */
2531                 switch (ns) {
2532                 case RFC2937_LOCAL_NAMING_INFORMATION:
2533                         proto_tree_add_string(tree, hf_bootp_option_dhcp_name_service_search_option, tvb, offset, 2, "Local naming information (e.g., an /etc/hosts file on a UNIX machine) (0)");
2534                         break;
2535                 case RFC2937_DOMAIN_NAME_SERVER_OPTION:
2536                         proto_tree_add_string(tree, hf_bootp_option_dhcp_name_service_search_option, tvb, offset, 2, "Domain Name Server Option (6)");
2537                         break;
2538                 case RFC2937_NETWORK_INFORMATION_SERVERS_OPTION:
2539                         proto_tree_add_string(tree, hf_bootp_option_dhcp_name_service_search_option, tvb, offset, 2, "Network Information Servers Option (41)");
2540                         break;
2541                 case RFC2937_NETBIOS_OVER_TCP_IP_NAME_SERVER_OPTION:
2542                         proto_tree_add_string(tree, hf_bootp_option_dhcp_name_service_search_option, tvb, offset, 2, "NetBIOS over TCP/IP Name Server Option (44)");
2543                         break;
2544                 case RFC2937_NETWORK_INFORMATION_SERVICE_PLUS_SERVERS_OPTION:
2545                         proto_tree_add_string(tree, hf_bootp_option_dhcp_name_service_search_option, tvb, offset, 2, "Network Information Service+ Servers Option (65)");
2546                         break;
2547                 default:
2548                         expert_add_info_format(pinfo, tree, &ei_bootp_option_dhcp_name_service_invalid,
2549                                                 "Invalid Name Service (%u). RFC 2937 defines only 0, 6, 41, 44, and 65 as possible values.", ns);
2550                         break;
2551                 }
2552                 offset += 2;
2553         }
2554
2555         return tvb_captured_length(tvb);
2556 }
2557
2558 static int
2559 dissect_bootpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2560 {
2561         int length = tvb_reported_length(tvb);
2562         const guchar    *dns_name;
2563         guint                   dns_name_len;
2564
2565         /* Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4) (RFC 3396) */
2566         /* Domain Names - Implementation And Specification (RFC 1035) */
2567         rfc3396_dns_domain_search_list.index_current_block++;
2568         if (rfc3396_dns_domain_search_list.total_number_of_block > 1) {
2569                 proto_tree_add_string(tree, hf_bootp_option_dhcp_dns_domain_search_list_rfc_3396_detected, tvb, 0, length,
2570                                                                 wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_dns_domain_search_list.index_current_block, rfc3396_dns_domain_search_list.total_number_of_block));
2571                 if (rfc3396_dns_domain_search_list.index_current_block != rfc3396_dns_domain_search_list.total_number_of_block) {
2572                         proto_tree_add_string(tree, hf_bootp_option_dhcp_dns_domain_search_list_refer_last_option, tvb, 0, length,
2573                                                                 wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_dns_domain_search_list.total_number_of_block, rfc3396_dns_domain_search_list.total_number_of_block));
2574                 }
2575         }
2576
2577         if (rfc3396_dns_domain_search_list.tvb_composite == NULL && length) {
2578                 /* We use composite tvb for managing RFC 3396 */
2579                 rfc3396_dns_domain_search_list.tvb_composite = tvb_new_composite();
2580         }
2581
2582         /* Concatenate the block before being interpreted for managing RFC 3396 */
2583         if (length)
2584                 tvb_composite_append(rfc3396_dns_domain_search_list.tvb_composite, tvb_new_subset_length(tvb, 0, length));
2585
2586         if (rfc3396_dns_domain_search_list.index_current_block == rfc3396_dns_domain_search_list.total_number_of_block
2587                 && rfc3396_dns_domain_search_list.tvb_composite) {
2588                 /* Here, we are into the last (or unique) option 119. */
2589                 /* We will display the information about fqdn */
2590                 unsigned int consumedx = 0;
2591                 unsigned int composite_offset = 0;
2592                 tvb_composite_finalize(rfc3396_dns_domain_search_list.tvb_composite);
2593
2594                 while (composite_offset < tvb_reported_length(rfc3396_dns_domain_search_list.tvb_composite)) {
2595                         /* use the get_dns_name method that manages all techniques of RFC 1035 (compression pointer and so on) */
2596                         consumedx = get_dns_name(rfc3396_dns_domain_search_list.tvb_composite, composite_offset,
2597                                 tvb_reported_length(rfc3396_dns_domain_search_list.tvb_composite), 0, &dns_name, &dns_name_len);
2598                         if (rfc3396_dns_domain_search_list.total_number_of_block == 1) {
2599                                 /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */
2600                                 proto_tree_add_string(tree, hf_bootp_option_dhcp_dns_domain_search_list_fqdn, tvb, composite_offset, consumedx, dns_name);
2601                         } else {
2602                                 /* RFC 3396 is used, so the option is split into several option 119. We don't link fqdn with v_tree. */
2603                                 proto_tree_add_string(tree, hf_bootp_option_dhcp_dns_domain_search_list_fqdn, tvb, 0, 0, dns_name);
2604                         }
2605                         composite_offset += consumedx;
2606                 }
2607                 rfc3396_dns_domain_search_list.tvb_composite = NULL;
2608         }
2609
2610         return tvb_captured_length(tvb);
2611 }
2612
2613 static int
2614 dissect_bootpopt_sip_servers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2615 {
2616         int length = tvb_reported_length(tvb);
2617         const guchar    *dns_name;
2618         guint                   dns_name_len;
2619
2620         /* Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4) (RFC 3396) */
2621         /* Domain Names - Implementation And Specification (RFC 1035) */
2622         rfc3396_sip_server.index_current_block++;
2623         if (rfc3396_sip_server.total_number_of_block > 1) {
2624                 proto_tree_add_string(tree, hf_bootp_option_sip_server_rfc_3396_detected, tvb, 0, length,
2625                                                                 wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_sip_server.index_current_block, rfc3396_sip_server.total_number_of_block));
2626                 if (rfc3396_sip_server.index_current_block != rfc3396_sip_server.total_number_of_block) {
2627                         proto_tree_add_string(tree, hf_bootp_option_sip_server_refer_last_option, tvb, 0, length,
2628                                                                 wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_sip_server.total_number_of_block, rfc3396_sip_server.total_number_of_block));
2629                 }
2630         }
2631
2632         if (rfc3396_sip_server.tvb_composite == NULL && length) {
2633                 /* We use composite tvb for managing RFC 3396 */
2634                 rfc3396_sip_server.tvb_composite = tvb_new_composite();
2635         }
2636
2637         /* Concatenate the block before being interpreted for managing RFC 3396 */
2638         if (length)
2639                 tvb_composite_append(rfc3396_sip_server.tvb_composite, tvb_new_subset_length(tvb, 0, length));
2640
2641         if (rfc3396_sip_server.index_current_block == rfc3396_sip_server.total_number_of_block
2642                 && rfc3396_sip_server.tvb_composite) {
2643                 /* Here, we are into the last (or unique) option 120. */
2644                 /* We will display the information about SIP server */
2645                 guint8 enc;
2646                 unsigned int composite_offset = 1; /* ignore enc */
2647                 tvb_composite_finalize(rfc3396_sip_server.tvb_composite);
2648
2649                 enc = tvb_get_guint8(rfc3396_sip_server.tvb_composite, 0);
2650                 if (rfc3396_sip_server.total_number_of_block == 1) {
2651                         /* RFC 3396 is not used, so we can easily link the fqdn with tree. */
2652                         proto_tree_add_uint(tree, hf_bootp_option_sip_server_enc, tvb, 0, 1, enc);
2653                 } else {
2654                         /* RFC 3396 is used, so the option is split into several option 120. We don't link fqdn with tree. */
2655                         proto_tree_add_uint(tree, hf_bootp_option_sip_server_enc, tvb, 0, 0, enc);
2656                 }
2657
2658                 switch (enc) {
2659                 case RFC_3361_ENC_FQDN: {
2660                         unsigned int consumedx = 0;
2661                         if (tvb_reported_length(rfc3396_sip_server.tvb_composite) < 3) {
2662                                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 3 (len = %u)", tvb_reported_length(rfc3396_sip_server.tvb_composite));
2663                                 break;
2664                         }
2665
2666                         while (composite_offset < tvb_reported_length(rfc3396_sip_server.tvb_composite)) {
2667                                 /* use the get_dns_name method that manages all techniques of RFC 1035 (compression pointer and so on) */
2668                                 consumedx = get_dns_name(rfc3396_sip_server.tvb_composite, composite_offset, tvb_reported_length(rfc3396_sip_server.tvb_composite),
2669                                         1 /* ignore enc */, &dns_name, &dns_name_len);
2670
2671                                 if (rfc3396_sip_server.total_number_of_block == 1) {
2672                                         /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */
2673                                         proto_tree_add_string(tree, hf_bootp_option_sip_server_name, tvb, composite_offset, consumedx, dns_name);
2674                                 } else {
2675                                         /* RFC 3396 is used, so the option is split into several option 120. We don't link fqdn with v_tree. */
2676                                         proto_tree_add_string(tree, hf_bootp_option_sip_server_name, tvb, 0, 0, format_text(wmem_packet_scope(), dns_name, dns_name_len));
2677                                 }
2678                                 composite_offset += consumedx;
2679                         }
2680                         rfc3396_sip_server.tvb_composite = NULL;
2681                         break;
2682                 }
2683                 case RFC_3361_ENC_IPADDR:
2684                         if (tvb_reported_length(rfc3396_sip_server.tvb_composite) < 5) {
2685                                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 5 (len = %u)", tvb_reported_length(rfc3396_sip_server.tvb_composite));
2686                                 break;
2687                         }
2688                         /* x % 2^n == x & (2^n - 1) note : (assuming x is a positive integer) */
2689                         if ((tvb_reported_length(rfc3396_sip_server.tvb_composite) - 1) & 3) {
2690                                 if (rfc3396_sip_server.total_number_of_block == 1)
2691                                         expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't a multiple of 4 plus 1 (len = %u).", tvb_reported_length(rfc3396_sip_server.tvb_composite));
2692                                 else
2693                                         expert_add_info_format(pinfo, tree, &ei_bootp_bad_length,
2694                                                 "length isn't a multiple of 4 plus 1 (len = %u). For your information with RFC 3396, the length is the length sum of all options 120 into this BOOTP packet.",
2695                                                 tvb_reported_length(rfc3396_sip_server.tvb_composite));
2696                                 break;
2697                         }
2698                         while (composite_offset < tvb_reported_length(rfc3396_sip_server.tvb_composite)) {
2699                                 if (rfc3396_sip_server.total_number_of_block == 1) {
2700                                         /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */
2701                                         proto_tree_add_item(tree, hf_bootp_option_sip_server_address, rfc3396_sip_server.tvb_composite, composite_offset, 4, ENC_BIG_ENDIAN);
2702                                 } else {
2703                                         guint32 sip_server = tvb_get_ipv4(rfc3396_sip_server.tvb_composite, composite_offset);
2704                                         /* RFC 3396 is used, so the option is split into several option 120. We don't link fqdn with v_tree. */
2705                                         proto_tree_add_ipv4(tree, hf_bootp_option_sip_server_address, tvb, 0, 0, sip_server);
2706                                 }
2707                                 composite_offset += 4;
2708                         }
2709                         break;
2710                 default:
2711                         expert_add_info_format(pinfo, tree, &ei_bootp_option_sip_server_address_encoding, "RFC 3361 defines only 0 and 1 for Encoding byte (Encoding = %u).", enc);
2712                         break;
2713                 }
2714         }
2715
2716         return tvb_captured_length(tvb);
2717 }
2718
2719 static int
2720 dissect_bootpopt_classless_static_route(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2721 {
2722         int offset = 0;
2723         int i, mask_width, significant_octets;
2724         proto_item* route_item;
2725
2726         /* minimum length is 5 bytes */
2727         if (tvb_reported_length(tvb) < 5) {
2728                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length isn't >= 5");
2729                 return 1;
2730         }
2731         while (tvb_reported_length_remaining(tvb, offset) > 0) {
2732                 mask_width = tvb_get_guint8(tvb, offset);
2733                 /* mask_width <= 32 */
2734                 if (mask_width > 32) {
2735                         expert_add_info_format(pinfo, tree, &ei_bootp_option_classless_static_route, "Mask width (%d) > 32", mask_width);
2736                         break;
2737                 }
2738                 significant_octets = (mask_width + 7) / 8;
2739                 route_item = proto_tree_add_bytes_format(tree, hf_bootp_option_classless_static_route, tvb, offset,
2740                         1 + significant_octets + 4, NULL, " ");
2741                 offset++;
2742                 /* significant octets + router(4) */
2743                 if (tvb_reported_length_remaining(tvb, offset + significant_octets + 4) < 0) {
2744                         expert_add_info_format(pinfo, route_item, &ei_bootp_bad_length, "Remaining length (%d) < %d bytes", tvb_reported_length_remaining(tvb, offset), significant_octets + 4);
2745                         break;
2746                 }
2747                 if(mask_width == 0)
2748                         proto_item_append_text(route_item, "default");
2749                 else {
2750                         for(i = 0 ; i < significant_octets ; i++) {
2751                                 if (i > 0)
2752                                         proto_item_append_text(route_item, ".");
2753                                 proto_item_append_text(route_item, "%d", tvb_get_guint8(tvb, offset++));
2754                         }
2755                         for(i = significant_octets ; i < 4 ; i++)
2756                                 proto_item_append_text(route_item, ".0");
2757                         proto_item_append_text(route_item, "/%d", mask_width);
2758                 }
2759                 proto_item_append_text(route_item, "-%s", tvb_ip_to_str(tvb, offset));
2760                 offset += 4;
2761         }
2762
2763         return tvb_captured_length(tvb);
2764 }
2765
2766 static int
2767 dissect_bootpopt_coordinate_based_location(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2768 {
2769         int offset = 0, length = tvb_reported_length(tvb);
2770         proto_item* ti;
2771
2772         if (length == 16) {
2773                 int ret;
2774                 unsigned char lci[16];
2775                 struct rfc3825_location_fixpoint_t location_fp;
2776                 struct rfc3825_location_decimal_t location;
2777
2778                 tvb_memcpy(tvb, lci, offset, 16);
2779
2780                 /* convert lci encoding into fixpoint location */
2781                 rfc3825_lci_to_fixpoint(lci, &location_fp);
2782
2783                 /* convert location from decimal to fixpoint */
2784                 ret = rfc3825_fixpoint_to_decimal(&location_fp, &location);
2785
2786                 if (ret != RFC3825_NOERROR) {
2787                         ti = proto_tree_add_uint(tree, hf_bootp_option_rfc3825_error, tvb, offset, 1, ret);
2788                         proto_item_set_len(ti, length);
2789                 } else {
2790                         proto_tree_add_double_format_value(tree, hf_bootp_option_rfc3825_latitude, tvb, offset, 5, location.latitude, "%15.10f", location.latitude);
2791                         proto_tree_add_double_format_value(tree, hf_bootp_option_rfc3825_longitude, tvb, offset+5, 5, location.longitude, "%15.10f", location.longitude);
2792                         proto_tree_add_double_format_value(tree, hf_bootp_option_rfc3825_latitude_res, tvb, offset, 1, location.latitude_res, "%15.10f", location.latitude_res);
2793                         proto_tree_add_double_format_value(tree, hf_bootp_option_rfc3825_longitude_res, tvb, offset+5, 1, location.longitude_res, "%15.10f", location.longitude_res);
2794                         proto_tree_add_double_format_value(tree, hf_bootp_option_rfc3825_altitude, tvb, offset+12, 4, location.altitude, "%15.10f", location.altitude);
2795                         proto_tree_add_double_format_value(tree, hf_bootp_option_rfc3825_altitide_res, tvb, offset+10, 2, location.altitude_res, "%15.10f", location.altitude_res);
2796                         proto_tree_add_uint(tree, hf_bootp_option_rfc3825_altitude_type, tvb, offset+10, 1, location.altitude_type);
2797                         proto_tree_add_uint(tree, hf_bootp_option_rfc3825_map_datum, tvb, offset+15, 1, location.datum_type);
2798                 }
2799         } else if (length < 69) { /* CableLabs DSS_ID */
2800                 int s_len;
2801
2802                 proto_tree_add_item(tree, hf_bootp_option_cl_dss_id_option, tvb, offset, 1, ENC_BIG_ENDIAN);
2803                 proto_tree_add_item(tree, hf_bootp_option_cl_dss_id_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2804                 s_len = tvb_get_guint8(tvb, offset+1);
2805                 proto_tree_add_item(tree, hf_bootp_option_cl_dss_id, tvb, offset+2, s_len, ENC_ASCII|ENC_NA);
2806
2807                 if (length > s_len+2) { /* Second DSS_ID*/
2808
2809                         proto_tree_add_item(tree, hf_bootp_option_cl_dss_id_option, tvb, offset+2+s_len, 1, ENC_BIG_ENDIAN);
2810                         proto_tree_add_item(tree, hf_bootp_option_cl_dss_id_len, tvb, offset+1+2+s_len, 1, ENC_BIG_ENDIAN);
2811                         s_len = tvb_get_guint8(tvb, offset+1+2+s_len);
2812                         proto_tree_add_item(tree, hf_bootp_option_cl_dss_id, tvb, offset+2+2+s_len, s_len, ENC_ASCII|ENC_NA);
2813                 }
2814         } else {
2815                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Invalid length of DHCP option!");
2816         }
2817
2818         return tvb_captured_length(tvb);
2819 }
2820
2821 static int
2822 dissect_bootpopt_vi_vendor_class(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2823 {
2824         int offset = 0;
2825         int data_len;
2826
2827         if (tvb_reported_length(tvb) == 1) {
2828                 /* CableLab specific */
2829                 proto_tree_add_item(tree, hf_bootp_option_vi_class_cl_address_mode, tvb, 0, 1, ENC_BIG_ENDIAN);
2830                 return 1;
2831         }
2832
2833         while (tvb_reported_length_remaining(tvb, offset)  >= 5) {
2834
2835                 proto_tree_add_item(tree, hf_bootp_option_vi_class_enterprise, tvb, offset, 4, ENC_BIG_ENDIAN);
2836                 offset += 4;
2837                 proto_tree_add_item(tree, hf_bootp_option_vi_class_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2838                 data_len = tvb_get_guint8(tvb, offset);
2839                 offset += 1;
2840
2841                 proto_tree_add_item(tree, hf_bootp_option_vi_class_data, tvb, offset, data_len, ENC_ASCII|ENC_NA);
2842
2843                 /* look for next enterprise number */
2844                 offset += data_len;
2845         }
2846
2847         if (tvb_reported_length_remaining(tvb, offset) > 0) {
2848                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length < 5");
2849         }
2850
2851         return tvb_captured_length(tvb);
2852 }
2853
2854 static int
2855 dissect_bootpopt_dhcp_captive_portal(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2856 {
2857         proto_item *ti_cp;
2858         ti_cp = proto_tree_add_item(tree, hf_bootp_option_captive_portal, tvb, 0, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
2859         PROTO_ITEM_SET_URL(ti_cp);
2860
2861         return tvb_captured_length(tvb);
2862 }
2863
2864 static int
2865 dissect_bootpopt_6RD_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2866 {
2867         int offset = 0;
2868
2869         if (tvb_reported_length(tvb) < 22) {
2870                 expert_add_info(pinfo, tree, &ei_bootp_option_6RD_malformed);
2871                 return 1;
2872         }
2873
2874         proto_tree_add_item(tree, hf_bootp_option_6RD_ipv4_mask_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2875         proto_tree_add_item(tree, hf_bootp_option_6RD_prefix_len, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2876         proto_tree_add_item(tree, hf_bootp_option_6RD_prefix, tvb, offset+2, 16, ENC_NA);
2877         proto_tree_add_item(tree, hf_bootp_option_6RD_border_relay_ip, tvb, offset+18, 4, ENC_BIG_ENDIAN);
2878
2879         /* More Border Relay IPv4 addresses included */
2880         if (tvb_reported_length(tvb) > 22) {
2881                 offset += 22;
2882                 while (tvb_reported_length_remaining(tvb, offset) >= 4) {
2883                         proto_tree_add_item(tree, hf_bootp_option_6RD_border_relay_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
2884                         offset += 4;
2885                 }
2886                 if (tvb_reported_length_remaining(tvb, offset) > 0) {
2887                         expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Option length isn't a multiple of 4");
2888                 }
2889         }
2890
2891         return tvb_captured_length(tvb);
2892 }
2893
2894 static int
2895 dissect_bootpopt_avaya_ip_telephone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2896 {
2897         int offset = 0;
2898         proto_tree *o242avaya_v_tree;
2899         proto_item *avaya_ti;
2900         const guint8 *avaya_option = NULL;
2901         gchar *field = NULL;
2902         wmem_strbuf_t *avaya_param_buf = NULL;
2903
2904         /* minimum length is 5 bytes */
2905         if (tvb_reported_length(tvb) < 5) {
2906                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "Avaya IP Telephone option length isn't >= 5");
2907                 return 1;
2908         }
2909         avaya_ti = proto_tree_add_item_ret_string(tree, hf_bootp_option242_avaya, tvb, offset, tvb_reported_length(tvb), ENC_ASCII|ENC_NA, wmem_packet_scope(), &avaya_option);
2910         o242avaya_v_tree = proto_item_add_subtree(avaya_ti, ett_bootp_option242_suboption);
2911         avaya_param_buf = wmem_strbuf_new(wmem_packet_scope(), "");
2912         for ( field = strtok((char*)avaya_option, ","); field; field = strtok(NULL, ",") ) {
2913                 if (!strchr(field, '=')) {
2914                         if (wmem_strbuf_get_len(avaya_param_buf) == 0) {
2915                                 expert_add_info_format(pinfo, avaya_ti, &hf_bootp_subopt_unknown_type, "ERROR, Unknown parameter %s", field);
2916                                 offset += (int)strlen(field);
2917                                 break;
2918                         }
2919                         wmem_strbuf_append_printf(avaya_param_buf,",%s", field);
2920                 }
2921                 else {
2922                         if (wmem_strbuf_get_len(avaya_param_buf) > 0) {
2923                                 dissect_vendor_avaya_param(o242avaya_v_tree, pinfo, avaya_ti, tvb, offset, avaya_param_buf);
2924                                 offset += (int)wmem_strbuf_get_len(avaya_param_buf) + 1;
2925                                 wmem_strbuf_truncate(avaya_param_buf, 0);
2926                         }
2927                         wmem_strbuf_append(avaya_param_buf, field);
2928                 }
2929         }
2930         if (wmem_strbuf_get_len(avaya_param_buf) > 0) {
2931                 dissect_vendor_avaya_param(o242avaya_v_tree, pinfo, avaya_ti, tvb, offset, avaya_param_buf);
2932         }
2933
2934         return tvb_captured_length(tvb);
2935 }
2936
2937 static const value_string option82_suboption_vals[] = {
2938         {  0, "Padding" },
2939         {  1, "Agent Circuit ID" },
2940         {  2, "Agent Remote ID" },
2941         {  3, "Reserved" },
2942         {  4, "DOCSIS Device Class" },
2943         {  5, "Link selection" },
2944         {  6, "Subscriber ID" },
2945         {  7, "RADIUS Attributes" },
2946         {  8, "Authentication" },
2947         {  9, "Vendor-Specific Information" },
2948         { 10, "Flags" },
2949         { 11, "Server ID Override" },
2950         { 12, "Relay Agent Identifier" },
2951         { 150, "Link selection (Cisco proprietary)" },
2952         { 151, "VRF name/VPN ID" },
2953         { 152, "Server ID Override (Cisco proprietary)" },
2954         { 0, NULL }
2955 };
2956
2957 static int
2958 bootp_dhcp_decode_agent_info(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree, tvbuff_t *tvb, int optoff,
2959                              int optend)
2960 {
2961         int         suboptoff = optoff;
2962         guint8      subopt, idx, vs_opt, vs_len;
2963         int         subopt_len, subopt_end, datalen;
2964         guint32     enterprise;
2965         proto_item *vti, *ti;
2966         proto_tree *o82_v_tree, *o82_sub_tree;
2967         guint8      tag, tag_len;
2968
2969         struct basic_types_hfs default_hfs = {
2970                 &hf_bootp_option82_value,
2971                 &hf_bootp_option82_value_ip_address,
2972                 &hf_bootp_option82_value_ip_address,
2973                 &hf_bootp_option82_value_stringz,
2974                 NULL,
2975                 &hf_bootp_option82_value_8,
2976                 NULL,
2977                 NULL,
2978                 &hf_bootp_option82_value_32,
2979                 NULL,
2980                 NULL
2981         };
2982
2983         struct opt82_info {
2984                 int id;
2985                 struct opt_info info;
2986         };
2987         static struct opt82_info o82_opt[]= {
2988                 {0, {"nop", bytes, &hf_bootp_option82_padding}},        /* dummy */
2989                 {1, {"Agent Circuit ID", bytes, &hf_bootp_option82_agent_circuit_id}}, /* [RFC3046] */
2990                 {2, {"Agent Remote ID", bytes, &hf_bootp_option82_agent_remote_id}}, /* [RFC3046] */
2991                 {3, {"Reserved", bytes, &hf_bootp_option82_reserved}},
2992                 {4, {"DOCSIS Device Class", val_u_long, &hf_bootp_option82_docsis_device_class}}, /* [RFC3256] */
2993                 {5, {"Link selection", ipv4, &hf_bootp_option82_link_selection}}, /* [RFC3527] */
2994                 {6, {"Subscriber ID", string, &hf_bootp_option82_subscriber_id}},  /* [RFC3993] */ /***** CHECK STRING TYPE */
2995                 {7, {"RADIUS Attributes", bytes, &hf_bootp_option82_radius_attributes}}, /* [RFC4014] */
2996                 {8, {"Authentication", bytes, &hf_bootp_option82_authentication}}, /* [RFC4030] */
2997                 {9, {"Vendor-Specific Information", special, &hf_bootp_option82_vi}}, /* [RFC 4243] */
2998                 {10, {"Flags", val_u_byte, &hf_bootp_option82_flags}}, /* [RFC5010] */
2999                 {11, {"Server ID Override", ipv4, &hf_bootp_option82_server_id_override}}, /* [RFC 5107] */
3000                 {12, {"Relay Agent Identifier", bytes, &hf_bootp_option82_relay_agent_id}}, /* [RFC 6925] */
3001                 {150, {"Link selection (Cisco proprietary)", ipv4, &hf_bootp_option82_link_selection_cisco}}, /* [RFC3527] */
3002                 {151, {"VRF name/VPN ID", special, &hf_bootp_option82_vrf_name_vpn_id}}, /* [RFC2685] */
3003                 {152, {"Server ID Override (Cisco proprietary)", ipv4, &hf_bootp_option82_server_id_override_cisco}} /* [RFC 5107] */
3004         };
3005
3006         subopt = tvb_get_guint8(tvb, optoff);
3007         suboptoff++;
3008
3009         if (suboptoff >= optend) {
3010                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
3011                                                                         "Suboption %d: no room left in option for suboption length", subopt);
3012                 return (optend);
3013         }
3014
3015         subopt_len = tvb_get_guint8(tvb, suboptoff);
3016         vti = proto_tree_add_uint_format_value(v_tree, hf_bootp_option82_suboption,
3017                 tvb, optoff, subopt_len+2, subopt, "(%d) %s", subopt, val_to_str_const(subopt, option82_suboption_vals, "Unknown"));
3018
3019         o82_v_tree = proto_item_add_subtree(vti, ett_bootp_option82_suboption);
3020         proto_tree_add_item(o82_v_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3021         suboptoff++;
3022
3023         subopt_end = suboptoff+subopt_len;
3024         if (subopt_end > optend) {
3025                 expert_add_info_format(pinfo, vti, &ei_bootp_missing_subopt_value,
3026                                                 "Suboption %d: no room left in option for suboption value", subopt);
3027                 return (optend);
3028         }
3029
3030         for (idx = 0; idx < array_length(o82_opt); idx++) {
3031                 if (o82_opt[idx].id == subopt) {
3032                         break;
3033                 }
3034         }
3035
3036         ti = proto_tree_add_item(o82_v_tree, hf_bootp_option82_value, tvb, suboptoff, subopt_len, ENC_NA);
3037
3038         if ( (idx >= 1 ) && (idx < array_length(o82_opt)) ) {
3039                 PROTO_ITEM_SET_HIDDEN(ti);
3040                 if (o82_opt[idx].info.ftype == special) {
3041                         switch(subopt)
3042                         {
3043                         case 9:
3044                                 while (suboptoff < subopt_end) {
3045                                         enterprise = tvb_get_ntohl(tvb, suboptoff);
3046                                         vti = proto_tree_add_item(o82_v_tree, hf_bootp_option82_vi_enterprise, tvb, suboptoff, 4, ENC_BIG_ENDIAN);
3047                                         suboptoff += 4;
3048
3049                                         o82_sub_tree = proto_item_add_subtree(vti, ett_bootp_option82_suboption9);
3050                                         datalen = tvb_get_guint8(tvb, suboptoff);
3051                                         proto_tree_add_item(o82_sub_tree, hf_bootp_option82_vi_data_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3052                                         suboptoff++;
3053
3054                                         switch (enterprise) {
3055                                         case 4491: /* CableLab */
3056                                                 vs_opt = tvb_get_guint8(tvb, suboptoff);
3057                                                 proto_tree_add_item(o82_sub_tree, hf_bootp_option82_vi_cl_option, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3058                                                 suboptoff++;
3059                                                 vs_len = tvb_get_guint8(tvb, suboptoff);
3060                                                 proto_tree_add_item(o82_sub_tree, hf_bootp_option82_vi_cl_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3061                                                 suboptoff++;
3062
3063                                                 switch (vs_opt) {
3064
3065                                                 case 1:
3066                                                         if (vs_len == 4) {
3067                                                                 tag = tvb_get_guint8(tvb, suboptoff);
3068                                                                 proto_tree_add_item(o82_sub_tree, hf_bootp_option82_vi_cl_tag, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3069                                                                 tag_len = tvb_get_guint8(tvb, suboptoff+1);
3070                                                                 proto_tree_add_item(o82_sub_tree, hf_bootp_option82_vi_cl_tag_length, tvb, suboptoff+1, 1, ENC_BIG_ENDIAN);
3071                                                                 suboptoff+=2;
3072                                                                 if (tag == 1) {
3073                                                                         proto_tree_add_uint_format_value(o82_sub_tree, hf_bootp_option82_vi_cl_docsis_version,
3074                                                                                           tvb, suboptoff, 2, 0, "%d.%d",
3075                                                                                           tvb_get_guint8(tvb, suboptoff), tvb_get_guint8(tvb, suboptoff+1));
3076                                                                         suboptoff+=2;
3077                                                                 } else {
3078                                                                         expert_add_info_format(pinfo, vti, &ei_bootp_option82_vi_cl_tag_unknown, "Unknown tag %d (%d bytes)", tag, tag_len);
3079                                                                         suboptoff += tag_len;
3080                                                                 }
3081                                                         } else {
3082                                                                 suboptoff += vs_len;
3083                                                         }
3084                                                         break;
3085
3086                                                 default:
3087                                                         expert_add_info_format(pinfo, vti, &ei_bootp_suboption_invalid, "Invalid suboption %d (%d bytes)", vs_opt, vs_len);
3088                                                         suboptoff += vs_len;
3089                                                         break;
3090                                                 }
3091                                                 break;
3092                                         default:
3093                                                 proto_tree_add_item(o82_v_tree, hf_bootp_option82_value, tvb, suboptoff, datalen, ENC_NA);
3094                                                 suboptoff += datalen;
3095                                                 break;
3096                                         }
3097                                 }
3098                                 break;
3099                         case 151:
3100                                 if (subopt_len == 1) {
3101                                         proto_tree_add_item(o82_v_tree, hf_bootp_option82_vrf_name_global, tvb, suboptoff, 1, ENC_NA);
3102                                 }
3103                                 else if (subopt_len != 7) {
3104                                         proto_tree_add_item(o82_v_tree, hf_bootp_option82_vrf_name, tvb, suboptoff, subopt_len, ENC_ASCII|ENC_NA);
3105                                 } else {
3106                                         proto_tree_add_item(o82_v_tree, hf_bootp_option82_vrf_name_vpn_id_oui, tvb, suboptoff, 3, ENC_BIG_ENDIAN);
3107                                         proto_tree_add_item(o82_v_tree, hf_bootp_option82_vrf_name_vpn_id_index, tvb, suboptoff+3, 4, ENC_BIG_ENDIAN);
3108                                 }
3109                                 break;
3110                         default:
3111                                 if (o82_opt[idx].info.phf != NULL)
3112                                         proto_tree_add_item(o82_v_tree, *o82_opt[idx].info.phf, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3113                                 else
3114                                         proto_tree_add_item(o82_v_tree, hf_bootp_option82_value, tvb, suboptoff, subopt_len, ENC_NA);
3115                                 break;
3116                         }
3117                 }
3118                 else {
3119                         if (bootp_handle_basic_types(pinfo, o82_v_tree, vti, tvb, o82_opt[idx].info.ftype,
3120                                                      suboptoff, subopt_len, o82_opt[idx].info.phf, &default_hfs) == 0) {
3121                                 expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, please report: Unknown subopt type handler %d", subopt);
3122                         }
3123                 }
3124         }
3125
3126         optoff += (subopt_len + 2);
3127         return optoff;
3128 }
3129
3130 static int
3131 dissect_bootpopt_relay_agent_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3132 {
3133         int offset = 0;
3134
3135         while (tvb_reported_length_remaining(tvb, offset) > 0) {
3136                 offset = bootp_dhcp_decode_agent_info(pinfo, tree, tree, tvb, offset, tvb_reported_length(tvb));
3137         }
3138
3139         return tvb_captured_length(tvb);
3140 }
3141
3142 static const value_string option43_pxeclient_suboption_vals[] = {
3143         {  0, "Padding" },
3144         {  1, "PXE mtftp IP" },
3145         {  2, "PXE mtftp client port" },
3146         {  3, "PXE mtftp server port" },
3147         {  4, "PXE mtftp timeout" },
3148         {  5, "PXE mtftp delay" },
3149         {  6, "PXE discovery control" },
3150         {  7, "PXE multicast address" },
3151         {  8, "PXE boot servers" },
3152         {  9, "PXE boot menu" },
3153         { 10, "PXE menu prompt" },
3154         { 11, "PXE multicast address alloc", },
3155         { 12, "PXE credential types" },
3156         { 71, "PXE boot item" },
3157         { 255, "PXE End" },
3158         { 0, NULL}
3159 };
3160
3161 static int
3162 dissect_vendor_pxeclient_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
3163                                    tvbuff_t *tvb, int optoff, int optend)
3164 {
3165         int         suboptoff = optoff;
3166         guint8      subopt;
3167         guint8      subopt_len;
3168         proto_tree *o43pxeclient_v_tree;
3169         proto_item *vti, *ti;
3170
3171         struct basic_types_hfs default_hfs = {
3172                 NULL,
3173                 &hf_bootp_option43_value_ip_address,
3174                 &hf_bootp_option43_value_ip_address,
3175                 NULL,
3176                 NULL,
3177                 &hf_bootp_option43_value_8,
3178                 NULL,
3179                 NULL,
3180                 NULL,
3181                 NULL,
3182                 NULL
3183         };
3184
3185         static struct opt_info o43pxeclient_opt[]= {
3186                 /* 0 */ {"nop", special, &hf_bootp_option43_pxeclient_padding}, /* dummy */
3187                 /* 1 */ {"PXE mtftp IP", ipv4_list, &hf_bootp_option43_pxeclient_mtftp_ip},
3188                 /* 2 */ {"PXE mtftp client port", val_u_le_short, &hf_bootp_option43_pxeclient_mtftp_client_port},
3189                 /* 3 */ {"PXE mtftp server port",val_u_le_short, &hf_bootp_option43_pxeclient_mtftp_server_port},
3190                 /* 4 */ {"PXE mtftp timeout", val_u_byte, &hf_bootp_option43_pxeclient_mtftp_timeout},
3191                 /* 5 */ {"PXE mtftp delay", val_u_byte, &hf_bootp_option43_pxeclient_mtftp_delay},
3192                 /* 6 */ {"PXE discovery control", val_u_byte, &hf_bootp_option43_pxeclient_discovery_control},
3193                         /*
3194                          * Correct: b0 (lsb): disable broadcast discovery
3195                          *      b1: disable multicast discovery
3196                          *      b2: only use/accept servers in boot servers
3197                          *      b3: download bootfile without prompt/menu/disc
3198                          */
3199                 /* 7 */ {"PXE multicast address", ipv4_list, &hf_bootp_option43_pxeclient_multicast_address},
3200                 /* 8 */ {"PXE boot servers", special, &hf_bootp_option43_pxeclient_boot_servers},
3201                 /* 9 */ {"PXE boot menu", special, &hf_bootp_option43_pxeclient_boot_menu},
3202                 /* 10 */ {"PXE menu prompt", special, &hf_bootp_option43_pxeclient_menu_prompt},
3203                 /* 11 */ {"PXE multicast address alloc", special, &hf_bootp_option43_pxeclient_multicast_address_alloc},
3204                 /* 12 */ {"PXE credential types", special, &hf_bootp_option43_pxeclient_credential_types}
3205                 /* 71 {"PXE boot item", bytes, &hf_bootp_option43_pxeclient_boot_item}, */
3206                 /* 255 {"PXE end options", special, &hf_bootp_option43_pxeclient_end} */
3207         };
3208
3209         subopt = tvb_get_guint8(tvb, optoff);
3210         suboptoff++;
3211
3212         if (subopt == 0) {
3213                 proto_tree_add_item(v_tree, hf_bootp_option43_pxeclient_padding, tvb, optoff, 1, ENC_BIG_ENDIAN);
3214                 return (suboptoff);
3215         } else if (subopt == 255) {     /* End Option */
3216                 proto_tree_add_item(v_tree, hf_bootp_option43_pxeclient_end, tvb, optoff, 1, ENC_BIG_ENDIAN);
3217                 /* Make sure we skip any junk left this option */
3218                 return (optend);
3219         }
3220
3221         if (suboptoff >= optend) {
3222                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
3223                                                                         "Suboption %d: no room left in option for suboption length", subopt);
3224                 return (optend);
3225         }
3226
3227         subopt_len = tvb_get_guint8(tvb, suboptoff);
3228         vti = proto_tree_add_uint_format_value(v_tree, hf_bootp_option43_pxeclient_suboption,
3229                                 tvb, optoff, subopt_len+2, subopt, "(%d) %s",
3230                                 subopt, val_to_str_const(subopt, option43_pxeclient_suboption_vals, "Unknown"));
3231
3232         o43pxeclient_v_tree = proto_item_add_subtree(vti, ett_bootp_option43_suboption);
3233         proto_tree_add_item(o43pxeclient_v_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3234         suboptoff++;
3235
3236         ti = proto_tree_add_item(o43pxeclient_v_tree, hf_bootp_option43_value, tvb, suboptoff, subopt_len, ENC_NA);
3237         PROTO_ITEM_SET_HIDDEN(ti);
3238
3239         if ( subopt == 71 ) {   /* 71 {"PXE boot item", special} */
3240                 /* case special */
3241                 /* I may need to decode that properly one day */
3242                 proto_tree_add_item(o43pxeclient_v_tree, hf_bootp_option43_pxeclient_boot_item, tvb, suboptoff, subopt_len, ENC_NA);
3243         } else if ((subopt < 1) || (subopt >= array_length(o43pxeclient_opt))) {
3244                 expert_add_info_format(pinfo, vti, &ei_bootp_suboption_invalid, "Unknown suboption %d (%d bytes)", subopt, subopt_len);
3245         } else if (o43pxeclient_opt[subopt].ftype == special) {
3246                 /* I may need to decode that properly one day */
3247                 if (o43pxeclient_opt[subopt].phf != NULL)
3248                         proto_tree_add_item(o43pxeclient_v_tree, *o43pxeclient_opt[subopt].phf, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3249                 else
3250                         proto_tree_add_item(o43pxeclient_v_tree, hf_bootp_option43_value, tvb, suboptoff, subopt_len, ENC_NA);
3251         } else {
3252                 if (bootp_handle_basic_types(pinfo, o43pxeclient_v_tree, vti, tvb, o43pxeclient_opt[subopt].ftype,
3253                                                         suboptoff, subopt_len, o43pxeclient_opt[subopt].phf, &default_hfs) == 0)
3254                 {
3255                         expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, please report: Unknown subopt type handler %d", subopt);
3256                 }
3257         }
3258
3259         optoff += (subopt_len + 2);
3260         return optoff;
3261 }
3262
3263 static gboolean
3264 dissect_pxeclient_vendor_info_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3265 {
3266         int offset = 0;
3267         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
3268         proto_tree* vendor_tree;
3269
3270         /* PXE protocol 2.1 as described in the Intel specs */
3271         if ((option_data->vendor_class_id == NULL) ||
3272                 (strncmp((const gchar*)option_data->vendor_class_id, "PXEClient", strlen("PXEClient")) != 0))
3273                 return FALSE;
3274
3275         proto_item_append_text(tree, " (PXEClient)");
3276         vendor_tree = proto_item_add_subtree(tree, ett_bootp_option);
3277
3278         while (tvb_reported_length_remaining(tvb, offset) > 0) {
3279                 offset = dissect_vendor_pxeclient_suboption(pinfo, tree, vendor_tree,
3280                         tvb, offset, tvb_reported_length(tvb));
3281         }
3282
3283         return TRUE;
3284 }
3285
3286 static void
3287 dissect_vendor_avaya_param(proto_tree *tree, packet_info *pinfo, proto_item *vti,
3288                 tvbuff_t *tvb, int optoff, wmem_strbuf_t *avaya_param_buf)
3289 {
3290         const gchar *field;
3291         int len;
3292
3293         field = wmem_strbuf_get_str(avaya_param_buf);
3294         len = (int)wmem_strbuf_get_len(avaya_param_buf);
3295
3296         if((strncmp(field, "TLSSRVR=", 8) == 0) && ( len > 8 )) {
3297                 proto_tree_add_string(tree, hf_bootp_option242_avaya_tlssrvr, tvb, optoff, len, field + 8);
3298         }
3299         else if((strncmp(field, "HTTPSRVR=", 9) == 0) && ( len > 9)) {
3300                 proto_tree_add_string(tree, hf_bootp_option242_avaya_httpsrvr, tvb, optoff, len, field + 9);
3301         }
3302         else if((strncmp(field, "HTTPDIR=", 8) == 0) && ( len > 8)) {
3303                 proto_tree_add_string(tree, hf_bootp_option242_avaya_httpdir, tvb, optoff, len, field + 8);
3304         }
3305         else if((strncmp(field, "STATIC=", 7) == 0) && ( len > 7)) {
3306                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_static, tvb, optoff, len, field + 7, "%s (%s)", field + 7, str_to_str(field + 7, option242_avaya_static_vals, "Unknown (%s)"));
3307         }
3308         else if((strncmp(field, "MCIPADD=", 8) == 0) && ( len > 8)) {
3309                 proto_tree_add_string(tree, hf_bootp_option242_avaya_mcipadd, tvb, optoff, len, field + 8);
3310         }
3311         else if((strncmp(field, "DOT1X=", 6) == 0) && ( len > 6)) {
3312                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_dot1x, tvb, optoff, len, field + 6, "%s (%s)", field + 6, str_to_str(field + 6, option242_avaya_dot1x_vals, "Unknown (%s)"));
3313         }
3314         else if((strncmp(field, "ICMPDU=", 7) == 0) && ( len > 7)) {
3315                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_icmpdu, tvb, optoff, len, field + 7, "%s (%s)", field + 7, str_to_str(field + 7, option242_avaya_icmpdu_vals, "Unknown (%s)"));
3316         }
3317         else if((strncmp(field, "ICMPRED=", 8) == 0) && ( len > 8)) {
3318                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_icmpred, tvb, optoff, len, field + 8, "%s (%s)", field + 8, str_to_str(field + 8, option242_avaya_icmpred_vals, "Unknown (%s)"));
3319         }
3320         else if((strncmp(field, "L2Q=", 4) == 0) && ( len > 4)) {
3321                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_l2q, tvb, optoff, len, field + 4, "%s (%s)", field + 4, str_to_str(field + 4, option242_avaya_l2q_vals, "Unknown (%s)"));
3322         }
3323         else if((strncmp(field, "L2QVLAN=", 8) == 0) && ( len > 8)) {
3324                 gint32 val = -1;
3325                 gboolean val_valid;
3326                 proto_item* pi;
3327
3328                 val_valid = ws_strtoi32(field + 8, NULL, &val);
3329                 pi = proto_tree_add_int(tree, hf_bootp_option242_avaya_l2qvlan, tvb, optoff, len, val);
3330                 if (val_valid)
3331                         expert_add_info(pinfo, pi, &ei_bootp_option242_avaya_l2qvlan_invalid);
3332         }
3333         else if((strncmp(field, "LOGLOCAL=", 9) == 0) && ( len > 9)) {
3334                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_loglocal, tvb, optoff, len, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_loglocal_vals, "Unknown (%s)"));
3335         }
3336         else if((strncmp(field, "PHY1STAT=", 9) == 0) && ( len > 9)) {
3337                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_phy1stat, tvb, optoff, len, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_phystat_vals, "Unknown (%s)"));
3338         }
3339         else if((strncmp(field, "PHY2STAT=", 9) == 0) && ( len > 9)) {
3340                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_phy2stat, tvb, optoff, len, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_phystat_vals, "Unknown (%s)"));
3341         }
3342         else if((strncmp(field, "PROCPSWD=", 9) == 0) && ( len > 9)) {
3343                 proto_tree_add_string(tree, hf_bootp_option242_avaya_procpswd, tvb, optoff, len, field + 9);
3344         }
3345         else if((strncmp(field, "PROCSTAT=", 9) == 0) && ( len > 9)) {
3346                 proto_tree_add_string_format_value(tree, hf_bootp_option242_avaya_procstat, tvb, optoff, len, field + 9, "%s (%s)", field + 9, str_to_str(field + 9, option242_avaya_procstat_vals, "Unknown (%s)"));
3347         }
3348         else if((strncmp(field, "SNMPADD=", 8) == 0) && ( len > 8)) {
3349                 proto_tree_add_string(tree, hf_bootp_option242_avaya_snmpadd, tvb, optoff, len, field + 8);
3350         }
3351         else if((strncmp(field, "SNMPSTRING=", 11) == 0) && ( len > 11)) {
3352                 proto_tree_add_string(tree, hf_bootp_option242_avaya_snmpstring, tvb, optoff, len, field + 11);
3353         }
3354         else if((strncmp(field, "VLANTEST=", 9) == 0) && ( len > 9)) {
3355                 gint32 val = -1;
3356                 gboolean val_valid;
3357                 proto_item* pi;
3358
3359                 val_valid = ws_strtoi32(field + 9, NULL, &val);
3360                 pi = proto_tree_add_int(tree, hf_bootp_option242_avaya_vlantest, tvb, optoff, len, val);
3361                 if (!val_valid)
3362                         expert_add_info(pinfo, pi, &ei_bootp_option242_avaya_vlantest_invalid);
3363         }
3364         else {
3365                 expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, Unknown Avaya IP Telephone parameter %s", field);
3366         }
3367 }
3368
3369 /* RFC3825Decoder: http://www.enum.at/rfc3825encoder.529.0.html */
3370 static void
3371 rfc3825_lci_to_fixpoint(const unsigned char lci[16], struct rfc3825_location_fixpoint_t *fixpoint)
3372 {
3373         fixpoint->latitude_res = (lci[0]>>2) & 0x3F; /* make sure that right-shift does not copy sign bit */
3374         if (lci[0] & 2) { /* LSB<<1 contains the sign of the latitude */
3375                 /* Latitude is negative, expand two's complement */
3376                 fixpoint->latitude = (((gint64)lci[0] & 3)<<32) | ((gint64)lci[1]<<24) |
3377                                            ((gint64)lci[2]<<16) | ((gint64)lci[3]<<8)  |
3378                                             (gint64)lci[4]      | ((gint64)0x3FFFFFFF<<34);
3379
3380         } else {
3381                 /* Latitude is positive */
3382                 fixpoint->latitude = (((gint64)lci[0] & 3)<<32) | ((gint64)lci[1]<<24) |
3383                                            ((gint64)lci[2]<<16) | ((gint64)lci[3]<<8)  |
3384                                             (gint64)lci[4];
3385         }
3386         fixpoint->longitude_res = (lci[5]>>2) & 0x3F;  /* make sure that right-shift does not copy sign bit */
3387         if (lci[5] & 2) { /* LSB<<1 contains the sign of the latitude */
3388                 /* Longitude is negative, expand two's complement */
3389                 fixpoint->longitude = (((gint64)lci[5] & 3)<<32) | ((gint64)lci[6]<<24) |
3390                                             ((gint64)lci[7]<<16) | ((gint64)lci[8]<<8)  |
3391                                              (gint64)lci[9]      | ((gint64)0x3FFFFFFF<<34);
3392
3393         } else {
3394                 /* Longitude is positive */
3395                 fixpoint->longitude = (((gint64)lci[5] & 3)<<32) | ((gint64)lci[6]<<24) |
3396                                             ((gint64)lci[7]<<16) | ((gint64)lci[8]<<8)  |
3397                                              (gint64)lci[9];
3398         }
3399         fixpoint->altitude_type = (lci[10]>>4) & 0x0F;  /* make sure that right-shift does not copy sign bit */
3400         fixpoint->altitude_res  = ((lci[10] & 0x0F) << 2) | ((lci[11]>>6) & 0x03);
3401         if (lci[11] & 0x20) { /* LSB<<1 contains the sign of the latitude */
3402                 /* Altitude is negative, expand two's complement */
3403                 fixpoint->altitude = (((gint32)lci[11] & 0x3F)<<24) | ((gint32)lci[12]<<16) |
3404                                      ((gint32)lci[13]<<8) | ((gint32)lci[14]) |
3405                                       ((gint32)0x03<<30);
3406
3407         } else {
3408                 /* Altitude is positive */
3409                 fixpoint->altitude = (((gint32)lci[11] & 0x3F)<<24) | ((gint32)lci[12]<<16) |
3410                                      ((gint32)lci[13]<<8) | ((gint32)lci[14]);
3411         }
3412
3413         fixpoint->datum_type = lci[15];
3414
3415 }
3416
3417 /* RFC3825Decoder: http://www.enum.at/rfc3825encoder.529.0.html */
3418 static int
3419 rfc3825_fixpoint_to_decimal(struct rfc3825_location_fixpoint_t *fixpoint, struct rfc3825_location_decimal_t *decimal)
3420 {
3421         /* Latitude */
3422         decimal->latitude = (double) fixpoint->latitude / (1 << 25);
3423         if ((decimal->latitude > 90) || (decimal->latitude < -90)) {
3424                 return RFC3825_LATITUDE_OUTOFRANGE;
3425         }
3426
3427         /* Latitude Uncertainty */
3428         if (fixpoint->latitude_res > 34) {
3429                 return RFC3825_LATITUDE_UNCERTAINTY_OUTOFRANGE;
3430         }
3431         if (fixpoint->latitude_res > 8 ) {
3432                 decimal->latitude_res = (double) 1  / (G_GUINT64_CONSTANT(1) << (fixpoint->latitude_res - 8));
3433         } else {
3434                 decimal->latitude_res = (double) (G_GUINT64_CONSTANT(1) << (8 - fixpoint->latitude_res));
3435         }
3436
3437         /* Longitude */
3438         decimal->longitude = (double) fixpoint->longitude / (1 << 25);
3439         if ((decimal->longitude > 180) || (decimal->longitude < -180)) {
3440                 return RFC3825_LONGITUDE_OUTOFRANGE;
3441         }
3442
3443         /* Longitude Uncertainty */
3444         if (fixpoint->longitude_res > 34) {
3445                 return RFC3825_LONGITUDE_UNCERTAINTY_OUTOFRANGE;
3446         }
3447         if (fixpoint->longitude_res > 8 ) {
3448                 decimal->longitude_res = (double) 1 / (G_GUINT64_CONSTANT(1) << (fixpoint->longitude_res - 8));
3449         } else {
3450                 decimal->longitude_res = (double) (G_GUINT64_CONSTANT(1) << (8 - fixpoint->longitude_res));
3451         }
3452
3453         /* Altitude Type */
3454         decimal->altitude_type = fixpoint->altitude_type;
3455         decimal->altitude = 0;
3456         decimal->altitude_res = 0;
3457
3458         if (decimal->altitude_type == 0) { /* Unknown */
3459         } else if (decimal->altitude_type == 1) { /* Meters */
3460                 /* Altitude */
3461                 decimal->altitude = (double) fixpoint->altitude / (1 << 8);
3462                 if ((decimal->altitude > ((gint32) 1<<21)-1) || (decimal->altitude < ((gint32) -(1<<21))))
3463                         return RFC3825_ALTITUDE_OUTOFRANGE;
3464
3465                 /* Altitude Uncertainty */
3466                 if (fixpoint->altitude_res > 30) {
3467                         return RFC3825_ALTITUDE_UNCERTAINTY_OUTOFRANGE;
3468                 }
3469                 if (fixpoint->altitude_res > 21 ) {
3470                         decimal->altitude_res = (double) 1 / (G_GUINT64_CONSTANT(1) << (fixpoint->altitude_res - 21));
3471                 } else {
3472                         decimal->altitude_res = (double) (G_GUINT64_CONSTANT(1) << (21 - fixpoint->altitude_res));
3473                 }
3474         } else if (decimal->altitude_type == 2) { /* Floors */
3475                 /* Altitude */
3476                 if ((fixpoint->altitude_res != 30) && (fixpoint->altitude_res != 0)) {
3477                         return RFC3825_ALTITUDE_UNCERTAINTY_OUTOFRANGE;
3478                 }
3479                 decimal->altitude = (double) fixpoint->altitude / (1 << 8);
3480         } else { /* invalid type */
3481                 return RFC3825_ALTITUDE_TYPE_OUTOFRANGE;
3482         }
3483
3484         /* Datum Type */
3485         decimal->datum_type = 0;
3486         if ((fixpoint->datum_type > 3) || (fixpoint->datum_type < 1)) {
3487                 return RFC3825_DATUM_TYPE_OUTOFRANGE;
3488         }
3489         decimal->datum_type = fixpoint->datum_type;
3490
3491         return RFC3825_NOERROR;
3492 }
3493
3494 static int
3495 dissect_bootpopt_isns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3496 {
3497         static const int *isns_functions_hf_flags[] = {
3498                 &hf_bootp_option_isns_functions_enabled,
3499                 &hf_bootp_option_isns_functions_dd_authorization,
3500                 &hf_bootp_option_isns_functions_sec_policy_distibution,
3501                 &hf_bootp_option_isns_functions_reserved,
3502                 NULL
3503         };
3504
3505         static const int *isns_dda_hf_flags[] = {
3506                 &hf_bootp_option_isns_discovery_domain_access_enabled,
3507                 &hf_bootp_option_isns_discovery_domain_access_control_node,
3508                 &hf_bootp_option_isns_discovery_domain_access_iscsi_target,
3509                 &hf_bootp_option_isns_discovery_domain_access_iscsi_inititator,
3510                 &hf_bootp_option_isns_discovery_domain_access_ifcp_target_port,
3511                 &hf_bootp_option_isns_discovery_domain_access_ifcp_initiator_port,
3512                 &hf_bootp_option_isns_discovery_domain_access_reserved,
3513                 NULL
3514         };
3515
3516         static const int *isns_administrative_flags[] = {
3517                 &hf_bootp_option_isns_administrative_flags_enabled,
3518                 &hf_bootp_option_isns_administrative_flags_heartbeat,
3519                 &hf_bootp_option_isns_administrative_flags_management_scns,
3520                 &hf_bootp_option_isns_administrative_flags_default_dd,
3521                 &hf_bootp_option_isns_administrative_flags_reserved,
3522                 NULL
3523         };
3524
3525         static const int *isns_server_security_flags[] = {
3526                 &hf_bootp_option_isns_server_security_bitmap_enabled,
3527                 &hf_bootp_option_isns_server_security_bitmap_ike_ipsec_enabled,
3528                 &hf_bootp_option_isns_server_security_bitmap_main_mode,
3529                 &hf_bootp_option_isns_server_security_bitmap_aggressive_mode,
3530                 &hf_bootp_option_isns_server_security_bitmap_pfs,
3531                 &hf_bootp_option_isns_server_security_bitmap_transport_mode,
3532                 &hf_bootp_option_isns_server_security_bitmap_tunnel_mode,
3533                 &hf_bootp_option_isns_server_security_bitmap_reserved,
3534                 NULL
3535         };
3536
3537         guint16 function_flags, dd_access_flags, administrative_flags;
3538         guint32 server_security_flags;
3539         proto_tree *server_tree;
3540         proto_item *item;
3541         int length = tvb_reported_length(tvb);
3542         int offset = 0, heartbeat_set = 0;
3543
3544         if (length < 14) {
3545                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length must be >= 14");
3546                 return 1;
3547         }
3548
3549         item = proto_tree_add_bitmask(tree, tvb, offset, hf_bootp_option_isns_functions,
3550                                       ett_bootp_isns_functions, isns_functions_hf_flags, ENC_BIG_ENDIAN);
3551         function_flags = tvb_get_ntohs(tvb, offset);
3552         /* RFC 4174, section "2.1. iSNS Functions Field" specifies that if
3553          * the field "Function Fields Enabled" is set to 0, then "the contents
3554          * of all other iSNS Function fields MUST be ignored. We will display
3555          * the fields but add an informational expert info. This goes for all
3556          * the bitmasks: iSNS Functions, DD Access, Administrative Flags, iSNS
3557          * Server Security Bitmap */
3558         if (ISNS_BITFIELD_NZ_MUST_BE_IGNORED(function_flags, F_ISNS_FUNCTIONS_ENABLED))
3559                 expert_add_info(pinfo, item, &ei_bootp_option_isns_ignored_bitfield);
3560
3561         offset += 2;
3562         item = proto_tree_add_bitmask(tree, tvb, offset, hf_bootp_option_isns_discovery_domain_access,
3563                                       ett_bootp_isns_discovery_domain_access, isns_dda_hf_flags, ENC_BIG_ENDIAN);
3564         dd_access_flags = tvb_get_ntohs(tvb, offset);
3565         if (ISNS_BITFIELD_NZ_MUST_BE_IGNORED(dd_access_flags, F_ISNS_DD_ACCESS_ENABLED))
3566                 expert_add_info(pinfo, item, &ei_bootp_option_isns_ignored_bitfield);
3567
3568         offset += 2;
3569         administrative_flags = tvb_get_ntohs(tvb, offset);
3570         if (administrative_flags & F_ISNS_ADMIN_FLAGS_ENABLED) {
3571                 if ((administrative_flags & F_ISNS_ADMIN_FLAGS_HEARTBEAT)) {
3572                         if (length < 18) {
3573                                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length must be >= 18");
3574                                 return offset;
3575                         }
3576                         heartbeat_set = 1;
3577                 }
3578         }
3579         item = proto_tree_add_bitmask(tree, tvb, offset, hf_bootp_option_isns_administrative_flags,
3580                                       ett_bootp_isns_administrative_flags, isns_administrative_flags, ENC_BIG_ENDIAN);
3581         if (ISNS_BITFIELD_NZ_MUST_BE_IGNORED(administrative_flags, F_ISNS_ADMIN_FLAGS_ENABLED))
3582                 expert_add_info(pinfo, item, &ei_bootp_option_isns_ignored_bitfield);
3583
3584         offset += 2;
3585         item = proto_tree_add_bitmask(tree, tvb, offset, hf_bootp_option_isns_server_security_bitmap,
3586                                       ett_bootp_isns_server_security_bitmap, isns_server_security_flags, ENC_BIG_ENDIAN);
3587         server_security_flags = tvb_get_ntohl(tvb, offset);
3588         if (ISNS_BITFIELD_NZ_MUST_BE_IGNORED(server_security_flags, F_ISNS_SRV_SEC_BITMAP_ENABLED))
3589                 expert_add_info(pinfo, item, &ei_bootp_option_isns_ignored_bitfield);
3590
3591         offset += 4;
3592         if (heartbeat_set) {
3593                 proto_tree_add_item(tree, hf_bootp_option_isns_heartbeat_originator_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
3594                 offset += 4;
3595         }
3596
3597         proto_tree_add_item(tree, hf_bootp_option_isns_primary_server_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
3598
3599         offset += 4;
3600         if (tvb_reported_length_remaining(tvb, offset) > 0) {
3601                 server_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_bootp_isns_secondary_server_addr,
3602                                                 &item, "Secondary iSNS Servers");
3603                 bootp_handle_basic_types(pinfo, server_tree, item, tvb, ipv4_list, offset, tvb_reported_length_remaining(tvb, offset),
3604                                                    &hf_bootp_option_isns_secondary_server_addr_list, NULL);
3605         }
3606
3607         return tvb_captured_length(tvb);
3608 }
3609
3610 static const value_string option43_cl_suboption_vals[] = {
3611         {  0, "Padding" },
3612         {  1, "Suboption Request List" },
3613         {  2, "Device Type" },
3614         {  3, "eSAFE Types" },
3615         {  4, "Serial Number" },
3616         {  5, "Hardware Version" },
3617         {  6, "Software Version" },
3618         {  7, "Boot ROM version" },
3619         {  8, "Organizationally Unique Identifier" },
3620         {  9, "Model Number" },
3621         { 10, "Vendor Name" },
3622         { 11, "Address Realm" },
3623         { 12, "CM/PS System Description" },
3624         { 13, "CM/PS Firmware Revision" },
3625         { 14, "Firewall Policy File Version" },
3626         { 15, "eSafe Config File Devices" },
3627         { 18, "Video Security Type" },
3628         { 31, "MTA MAC Address" },
3629         { 32, "Correlation ID" },
3630         { 51, "Vendor Name" },
3631         { 52, "CableCARD Capability" },
3632         { 53, "Device Identification (CA)" },
3633         { 54, "Device Identification (X.509)" },
3634         { 255, "CL End" },
3635         { 0, NULL}
3636 };
3637
3638 static const value_string cablehome_subopt11_vals[] = {
3639         { 1, "PS WAN-Man" },
3640         { 2, "PS WAN-Data" },
3641         { 0, NULL }
3642 };
3643
3644 static int
3645 dissect_vendor_cablelabs_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
3646                                    tvbuff_t *tvb, int optoff, int optend)
3647 {
3648         int         suboptoff = optoff;
3649         guint8      subopt;
3650         guint8      subopt_len;
3651         proto_tree *o43cl_v_tree;
3652         proto_item *vti;
3653
3654         struct basic_types_hfs default_hfs = {
3655                 &hf_bootp_option43_value,
3656                 NULL,
3657                 NULL,
3658                 &hf_bootp_option43_value_stringz,
3659                 NULL,
3660                 &hf_bootp_option43_value_8,
3661                 NULL,
3662                 NULL,
3663                 &hf_bootp_option43_value_32,
3664                 NULL,
3665                 NULL
3666         };
3667
3668         static struct opt_info o43cablelabs_opt[]= {
3669                 /*  0 */ {"nop", special, &hf_bootp_option43_cl_padding},       /* dummy */
3670                 /*  1 */ {"Suboption Request List", string, &hf_bootp_option43_cl_suboption_request_list},
3671                 /*  2 */ {"Device Type", string, &hf_bootp_option43_cl_device_type},
3672                 /*  3 */ {"eSAFE Types", string, &hf_bootp_option43_cl_esafe_type},
3673                 /*  4 */ {"Serial Number", string, &hf_bootp_option43_cl_serial_number},
3674                 /*  5 */ {"Hardware Version", string, &hf_bootp_option43_cl_hardware_version},
3675                 /*  6 */ {"Software Version", string, &hf_bootp_option43_cl_software_version},
3676                 /*  7 */ {"Boot ROM version", string, &hf_bootp_option43_cl_boot_rom_version},
3677                 /*  8 */ {"Organizationally Unique Identifier", special, &hf_bootp_option43_cl_oui_bytes},
3678                 /*  9 */ {"Model Number", string, &hf_bootp_option43_cl_model_number},
3679                 /* 10 */ {"Vendor Name", string, &hf_bootp_option43_cl_vendor_name10},
3680                 /* *** 11-30: CableHome *** */
3681                 /* 11 */ {"Address Realm", val_u_byte, &hf_bootp_option43_cl_address_realm},
3682                 /* 12 */ {"CM/PS System Description", string, &hf_bootp_option43_cl_cm_ps_system_desc},
3683                 /* 13 */ {"CM/PS Firmware Revision", string, &hf_bootp_option43_cl_cm_ps_firmware_revision},
3684                 /* 14 */ {"Firewall Policy File Version", string, &hf_bootp_option43_cl_firewall_policy_file_version},
3685                 /* 15 */ {"eSafe Config File Devices", string, &hf_bootp_option43_cl_esafe_config_file_devices},
3686                 /* 16 */ {"Unassigned (CableHome)", special, NULL},
3687                 /* 17 */ {"Unassigned (CableHome)", special, NULL},
3688                 /* 18 */ {"Video Security Type", string, &hf_bootp_option43_cl_video_security_tape},
3689                 /* 19 */ {"Unassigned (CableHome)", special, NULL},
3690                 /* 20 */ {"Unassigned (CableHome)", special, NULL},
3691                 /* 21 */ {"Unassigned (CableHome)", special, NULL},
3692                 /* 22 */ {"Unassigned (CableHome)", special, NULL},
3693                 /* 23 */ {"Unassigned (CableHome)", special, NULL},
3694                 /* 24 */ {"Unassigned (CableHome)", special, NULL},
3695                 /* 25 */ {"Unassigned (CableHome)", special, NULL},
3696                 /* 26 */ {"Unassigned (CableHome)", special, NULL},
3697                 /* 27 */ {"Unassigned (CableHome)", special, NULL},
3698                 /* 28 */ {"Unassigned (CableHome)", special, NULL},
3699                 /* 29 */ {"Unassigned (CableHome)", special, NULL},
3700                 /* 30 */ {"Unassigned (CableHome)", special, NULL},
3701                 /* *** 31-50: PacketCable *** */
3702                 /* 31 */ {"MTA MAC Address", special, &hf_bootp_option43_cl_mta_mac_address},
3703                 /* 32 */ {"Correlation ID", val_u_long, &hf_bootp_option43_cl_correlation_ID},
3704                 /* 33 */ {"Unassigned (PacketCable)", special, NULL},
3705                 /* 34 */ {"Unassigned (PacketCable)", special, NULL},
3706                 /* 35 */ {"Unassigned (PacketCable)", special, NULL},
3707                 /* 36 */ {"Unassigned (PacketCable)", special, NULL},
3708                 /* 37 */ {"Unassigned (PacketCable)", special, NULL},
3709                 /* 38 */ {"Unassigned (PacketCable)", special, NULL},
3710                 /* 39 */ {"Unassigned (PacketCable)", special, NULL},
3711                 /* 40 */ {"Unassigned (PacketCable)", special, NULL},
3712                 /* 41 */ {"Unassigned (PacketCable)", special, NULL},
3713                 /* 42 */ {"Unassigned (PacketCable)", special, NULL},
3714                 /* 43 */ {"Unassigned (PacketCable)", special, NULL},
3715                 /* 44 */ {"Unassigned (PacketCable)", special, NULL},
3716                 /* 45 */ {"Unassigned (PacketCable)", special, NULL},
3717                 /* 46 */ {"Unassigned (PacketCable)", special, NULL},
3718                 /* 47 */ {"Unassigned (PacketCable)", special, NULL},
3719                 /* 48 */ {"Unassigned (PacketCable)", special, NULL},
3720                 /* 49 */ {"Unassigned (PacketCable)", special, NULL},
3721                 /* 50 */ {"Unassigned (PacketCable)", special, NULL},
3722                 /* *** 51-127: CableLabs *** */
3723                 /* 51 */ {"Vendor Name", string, &hf_bootp_option43_cl_vendor_name51},
3724                 /* 52 */ {"CableCARD Capability", special, &hf_bootp_option43_cl_cablecard_capability},
3725                 /* 53 */ {"Device Identification (CA)", special, &hf_bootp_option43_cl_device_id_ca},
3726                 /* 54 */ {"Device Identification (X.509)", string, &hf_bootp_option43_cl_device_id_x509},
3727                 /* 55 */ {"Unassigned (CableLabs)", special, NULL},
3728                 /* *** 128-254: Vendors *** */
3729                 /* 128-254 {"Unassigned (Vendors)", special, NULL}, */
3730                 /* 255 {"end options", special, &hf_bootp_option43_cl_end} */
3731         };
3732
3733         subopt = tvb_get_guint8(tvb, optoff);
3734         suboptoff++;
3735
3736         if (subopt == 0) {
3737                 proto_tree_add_item(v_tree, hf_bootp_option43_cl_padding, tvb, optoff, 1, ENC_BIG_ENDIAN);
3738                 return (suboptoff);
3739         } else if (subopt == 255) {     /* End Option */
3740                 proto_tree_add_item(v_tree, hf_bootp_option43_cl_end, tvb, optoff, 1, ENC_BIG_ENDIAN);
3741                 /* Make sure we skip any junk left this option */
3742                 return (optend);
3743         }
3744
3745         if (suboptoff >= optend) {
3746                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
3747                                                                         "Suboption %d: no room left in option for suboption length", subopt);
3748                 return (optend);
3749         }
3750
3751         subopt_len = tvb_get_guint8(tvb, suboptoff);
3752         vti = proto_tree_add_uint_format_value(v_tree, hf_bootp_option43_cl_suboption,
3753                                 tvb, optoff, subopt_len+2, subopt, "(%d) %s",
3754                                 subopt, val_to_str_const(subopt, option43_cl_suboption_vals, "Unknown"));
3755
3756         o43cl_v_tree = proto_item_add_subtree(vti, ett_bootp_option43_suboption);
3757         proto_tree_add_item(o43cl_v_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3758         suboptoff++;
3759
3760         if (suboptoff+subopt_len > optend) {
3761                 expert_add_info_format(pinfo, vti, &ei_bootp_missing_subopt_value,
3762                                                 "Suboption %d: no room left in option for suboption value", subopt);
3763                 return (optend);
3764         }
3765
3766         if ( (subopt < 1 ) || (subopt >= array_length(o43cablelabs_opt)) ) {
3767                 proto_tree_add_item(o43cl_v_tree, hf_bootp_option43_value, tvb, suboptoff, subopt_len, ENC_NA);
3768         } else if (o43cablelabs_opt[subopt].ftype == special) {
3769                 switch(subopt)
3770                 {
3771                 case 8:/* OUI */
3772                         /* CableLabs specs treat 43.8 inconsistently
3773                          * as either binary (3b) or string (6b) */
3774                         if (subopt_len == 3) {
3775                                 proto_tree_add_bytes_format_value(o43cl_v_tree, hf_bootp_option43_cl_oui_bytes, tvb, suboptoff, subopt_len, NULL,
3776                                         "%02x:%02x:%02x", tvb_get_guint8(tvb, suboptoff), tvb_get_guint8(tvb, suboptoff+1), tvb_get_guint8(tvb, suboptoff+2));
3777                         } else if (subopt_len == 6) {
3778                                 proto_tree_add_item(o43cl_v_tree, hf_bootp_option43_cl_oui_string, tvb, suboptoff, subopt_len, ENC_ASCII|ENC_NA);
3779                         } else {
3780                                 expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 3 or 6");
3781                         }
3782                         break;
3783                 case 31: /* MTA MAC address */
3784                         if (subopt_len != 6) {
3785                                 expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 6");
3786                                 break;
3787                         }
3788
3789                         proto_tree_add_item(o43cl_v_tree, hf_bootp_option43_cl_mta_mac_address, tvb, suboptoff, 6, ENC_NA);
3790                         break;
3791                 default:
3792                         if (o43cablelabs_opt[subopt].phf != NULL)
3793                                 proto_tree_add_item(o43cl_v_tree, *o43cablelabs_opt[subopt].phf, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3794                         else
3795                                 proto_tree_add_item(o43cl_v_tree, hf_bootp_option43_value, tvb, suboptoff, subopt_len, ENC_NA);
3796                 }
3797         }
3798         else {
3799                 if (bootp_handle_basic_types(pinfo, o43cl_v_tree, vti, tvb, o43cablelabs_opt[subopt].ftype,
3800                                                         suboptoff, subopt_len, o43cablelabs_opt[subopt].phf, &default_hfs) == 0) {
3801                         expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, please report: Unknown subopt type handler %d", subopt);
3802                 }
3803         }
3804
3805         optoff += (subopt_len + 2);
3806         return optoff;
3807 }
3808
3809 static gboolean
3810 dissect_cablelabs_vendor_info_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3811 {
3812         int offset = 0;
3813         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
3814         proto_tree* vendor_tree;
3815
3816         if ((option_data->vendor_class_id != NULL) &&
3817                 ((strncmp((const gchar*)option_data->vendor_class_id, "pktc", strlen("pktc")) == 0) ||
3818                  (strncmp((const gchar*)option_data->vendor_class_id, "docsis", strlen("docsis")) == 0) ||
3819                  (strncmp((const gchar*)option_data->vendor_class_id, "OpenCable2.0", strlen("OpenCable2.0")) == 0) ||
3820                  (strncmp((const gchar*)option_data->vendor_class_id, "CableHome", strlen("CableHome")) == 0))) {
3821                 /* CableLabs standard - see www.cablelabs.com/projects */
3822                 proto_item_append_text(tree, " (CableLabs)");
3823                 vendor_tree = proto_item_add_subtree(tree, ett_bootp_option);
3824
3825                 while (tvb_reported_length_remaining(tvb, offset) > 0) {
3826                         offset = dissect_vendor_cablelabs_suboption(pinfo, tree, vendor_tree,
3827                                 tvb, offset, tvb_reported_length(tvb));
3828                 }
3829                 return TRUE;
3830         }
3831
3832         return FALSE;
3833 }
3834
3835 static gboolean
3836 dissect_aruba_ap_vendor_info_heur( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
3837 {
3838         int offset = 0;
3839         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
3840         proto_tree* vendor_tree;
3841
3842         if ((option_data->vendor_class_id == NULL) ||
3843                 (strncmp((const gchar*)option_data->vendor_class_id, ARUBA_AP, strlen(ARUBA_AP)) != 0))
3844                 return FALSE;
3845
3846         proto_item_append_text(tree, " (Aruba AP)");
3847         vendor_tree = proto_item_add_subtree(tree, ett_bootp_option);
3848
3849         proto_tree_add_item(vendor_tree, hf_bootp_option43_arubaap_controllerip, tvb, offset, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
3850         return TRUE;
3851 }
3852
3853 static gboolean
3854 dissect_aruba_instant_ap_vendor_info_heur( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
3855 {
3856         int offset = 0;
3857         int reported_len = tvb_reported_length(tvb);
3858         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
3859         proto_tree* vendor_tree;
3860         proto_item* vendor_item;
3861         gint32 nameorglen, ampiplen;
3862
3863         /* Aruba  Instant AP */
3864         if ((option_data->vendor_class_id == NULL) ||
3865                 (strncmp((const gchar*)option_data->vendor_class_id, ARUBA_INSTANT_AP, strlen(ARUBA_INSTANT_AP)) != 0))
3866                 return FALSE;
3867
3868         proto_item_append_text(tree, " (Aruba Instant AP)");
3869
3870         vendor_item = proto_tree_add_item(tree, hf_bootp_option43_arubaiap, tvb, offset, reported_len, ENC_ASCII|ENC_NA);
3871         vendor_tree = proto_item_add_subtree(vendor_item, ett_bootp_option43_suboption);
3872         nameorglen = tvb_find_guint8(tvb, offset, tvb_reported_length(tvb), ',');
3873         proto_tree_add_item(vendor_tree, hf_bootp_option43_arubaiap_nameorg, tvb, offset, nameorglen, ENC_ASCII|ENC_NA);
3874         offset += (nameorglen+1);
3875         ampiplen = tvb_find_guint8(tvb, offset, reported_len-nameorglen-1, ',') - offset;
3876         proto_tree_add_item(vendor_tree, hf_bootp_option43_arubaiap_ampip, tvb, offset, ampiplen, ENC_ASCII|ENC_NA);
3877         offset += (ampiplen+1);
3878         proto_tree_add_item(vendor_tree, hf_bootp_option43_arubaiap_password, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII|ENC_NA);
3879
3880         return TRUE;
3881 }
3882
3883 static const value_string option43_bsdp_suboption_vals[] = {
3884         {  1, "Message Type" },
3885         {  2, "Version" },
3886         {  3, "Server Identifier" },
3887         {  4, "Server Priority" },
3888         {  5, "Reply Port" },
3889         {  6, "Boot Image List Path" },
3890         {  7, "Default Boot Image" },
3891         {  8, "Selected Boot Image" },
3892         {  9, "Boot Image List" },
3893         { 10, "NetBoot 1.0 Firmware" },
3894         { 11, "Boot Image Attributes Filter List" },
3895         { 12, "Maximum Message Size" },
3896         { 0, NULL}
3897 };
3898
3899 static void
3900 dissect_vendor_bsdp_boot_image(proto_tree *v_tree, tvbuff_t *tvb, int optoff)
3901 {
3902         static const int * bootp_o43_bsdp_attributes_flags[] = {
3903                 &hf_bootp_option43_bsdp_boot_image_attribute_install,
3904                 &hf_bootp_option43_bsdp_boot_image_attribute_kind,
3905                 &hf_bootp_option43_bsdp_boot_image_attribute_reserved,
3906                 NULL
3907         };
3908
3909         proto_tree_add_bitmask(v_tree, tvb, optoff, hf_bootp_option43_bsdp_boot_image_attribute, ett_bootp_o43_bsdp_attributes_flags, bootp_o43_bsdp_attributes_flags, ENC_NA);
3910 }
3911
3912 static int
3913 dissect_vendor_bsdp_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
3914                                    tvbuff_t *tvb, int optoff, int optend)
3915 {
3916         int         suboptoff = optoff;
3917         int         attributes_off;
3918         guint8      subopt, string_len;
3919         guint8      subopt_len, attributes_len;
3920         proto_tree *o43bsdp_v_tree, *o43bsdp_va_tree, *o43bsdp_vb_tree, *o43bsdp_vc_tree, *o43bsdp_vd_tree;
3921         proto_item *vti, *ti, *tj;
3922
3923         subopt = tvb_get_guint8(tvb, optoff);
3924         suboptoff++;
3925
3926         if (suboptoff >= optend) {
3927                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
3928                                                                         "Suboption %d: no room left in option for suboption length", subopt);
3929                 return (optend);
3930         }
3931
3932         subopt_len = tvb_get_guint8(tvb, suboptoff);
3933         vti = proto_tree_add_uint_format_value(v_tree, hf_bootp_option43_bsdp_suboption,
3934                                 tvb, optoff, subopt_len+2, subopt, "(%d) %s",
3935                                 subopt, val_to_str_const(subopt, option43_bsdp_suboption_vals, "Unknown"));
3936
3937         o43bsdp_v_tree = proto_item_add_subtree(vti, ett_bootp_option43_suboption);
3938         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
3939         suboptoff++;
3940
3941         if (suboptoff+subopt_len > optend) {
3942                 expert_add_info_format(pinfo, vti, &ei_bootp_missing_subopt_value,
3943                                                 "Suboption %d: no room left in option for suboption value", subopt);
3944                 return (optend);
3945         }
3946
3947         switch(subopt)
3948         {
3949                 case 1:
3950                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_message_type, tvb, suboptoff, subopt_len, ENC_ASCII|ENC_NA);
3951                         break;
3952                 case 2:
3953                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_version, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3954                         break;
3955                 case 3:
3956                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_server_identifier, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3957                         break;
3958                 case 4:
3959                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_server_priority, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3960                         break;
3961                 case 5:
3962                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_reply_port, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN);
3963                         break;
3964                 case 6:
3965                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_boot_image_list_path, tvb, suboptoff, subopt_len, ENC_ASCII|ENC_NA);
3966                         break;
3967                 case 7:
3968                         ti = proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_default_boot_image_id, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN|ENC_NA);
3969                         o43bsdp_va_tree = proto_item_add_subtree(ti, ett_bootp_o43_bsdp_boot_image);
3970                         dissect_vendor_bsdp_boot_image(o43bsdp_va_tree, tvb, suboptoff);
3971                         proto_tree_add_item(o43bsdp_va_tree, hf_bootp_option43_bsdp_boot_image_index, tvb, suboptoff+2, subopt_len-2, ENC_BIG_ENDIAN|ENC_NA);
3972                         break;
3973                 case 8:
3974                         ti = proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_selected_boot_image_id, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN|ENC_NA);
3975                         o43bsdp_vc_tree = proto_item_add_subtree(ti, ett_bootp_o43_bsdp_boot_image);
3976                         dissect_vendor_bsdp_boot_image(o43bsdp_vc_tree, tvb, suboptoff);
3977                         proto_tree_add_item(o43bsdp_vc_tree, hf_bootp_option43_bsdp_boot_image_index, tvb, suboptoff+2, subopt_len-2, ENC_BIG_ENDIAN|ENC_NA);
3978                         break;
3979                 case 9:
3980                         ti = proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_boot_image_list, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN|ENC_NA);
3981                         attributes_len = subopt_len;
3982                         attributes_off = suboptoff;
3983                         o43bsdp_vd_tree = proto_item_add_subtree(ti, ett_bootp_o43_bsdp_image_desc_list);
3984                         while (attributes_len >= 5) {
3985                                 string_len = tvb_get_guint8(tvb, attributes_off+4);
3986                                 if (string_len > 0) {
3987                                         tj = proto_tree_add_item(o43bsdp_vd_tree, hf_bootp_option43_bsdp_image_desc, tvb, attributes_off, string_len+5, ENC_BIG_ENDIAN|ENC_NA);
3988                                         o43bsdp_vb_tree = proto_item_add_subtree(tj, ett_bootp_o43_bsdp_image_desc);
3989                                         dissect_vendor_bsdp_boot_image(o43bsdp_vb_tree, tvb, attributes_off);
3990                                         proto_tree_add_item(o43bsdp_vb_tree, hf_bootp_option43_bsdp_boot_image_index, tvb, attributes_off+2, 2, ENC_BIG_ENDIAN|ENC_NA);
3991                                         proto_tree_add_item(o43bsdp_vb_tree, hf_bootp_option43_bsdp_boot_image_name_len, tvb, attributes_off+4, 1, ENC_BIG_ENDIAN|ENC_NA);
3992                                         proto_tree_add_item(o43bsdp_vb_tree, hf_bootp_option43_bsdp_boot_image_name, tvb, attributes_off+5, string_len, ENC_UTF_8|ENC_NA);
3993                                 }
3994                                 attributes_off += 5 + string_len;
3995                                 attributes_len -= 5 + string_len;
3996                         }
3997                         break;
3998                 case 10:
3999                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_netboot_firmware, tvb, suboptoff, subopt_len, ENC_NA);
4000                         break;
4001                 case 11:
4002                         ti = proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_attributes_filter_list, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN|ENC_NA);
4003                         attributes_len = subopt_len;
4004                         attributes_off = suboptoff;
4005                         o43bsdp_va_tree = proto_item_add_subtree(ti, ett_bootp_o43_bsdp_attributes);
4006                         while (attributes_len >= 2) {
4007                                 dissect_vendor_bsdp_boot_image(o43bsdp_va_tree, tvb, attributes_off);
4008                                 attributes_off+=2;
4009                                 attributes_len-=2;
4010                         }
4011                         break;
4012                 case 12:
4013                         proto_tree_add_item(o43bsdp_v_tree, hf_bootp_option43_bsdp_message_size, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN|ENC_NA);
4014                         break;
4015         }
4016
4017         optoff += (subopt_len + 2);
4018         return optoff;
4019 }
4020
4021 static gboolean
4022 dissect_packetcable_bsdpd_vendor_info_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
4023 {
4024         int offset = 0;
4025         bootp_option_data_t *option_data = (bootp_option_data_t*)data;
4026         proto_tree* vendor_tree;
4027
4028         if ((option_data->vendor_class_id == NULL) ||
4029                 (strncmp((const gchar*)option_data->vendor_class_id, PACKETCABLE_BSDP, strlen(PACKETCABLE_BSDP)) != 0))
4030                 return FALSE;
4031
4032         /* Apple BSDP */
4033         proto_item_append_text(tree, " (Boot Server Discovery Protocol (BSDP))");
4034         vendor_tree = proto_item_add_subtree(tree, ett_bootp_option);
4035
4036         while (tvb_reported_length_remaining(tvb, offset) > 0) {
4037                 offset = dissect_vendor_bsdp_suboption(pinfo, tree, vendor_tree,
4038                         tvb, offset, tvb_reported_length(tvb));
4039         }
4040
4041         return TRUE;
4042 }
4043
4044
4045 static int
4046 dissect_vendor_generic_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
4047                                  tvbuff_t *tvb, int optoff, int optend)
4048 {
4049         int         suboptoff = optoff;
4050         guint8  subopt;
4051         int         subopt_len;
4052         proto_item *item;
4053         proto_tree *sub_tree;
4054
4055         item = proto_tree_add_item(v_tree, hf_bootp_vendor_unknown_suboption, tvb, optoff, 1, ENC_NA);
4056         subopt = tvb_get_guint8(tvb, optoff);
4057
4058         suboptoff+=1;
4059
4060         if (suboptoff >= optend) {
4061                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
4062                                                                         "Suboption %d: no room left in option for suboption length", subopt);
4063                 return (optend);
4064         }
4065
4066         sub_tree = proto_item_add_subtree(item, ett_bootp_option125_suboption);
4067         proto_tree_add_item_ret_uint(sub_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_NA, &subopt_len);
4068         suboptoff++;
4069
4070         if (suboptoff+subopt_len > optend) {
4071                 expert_add_info_format(pinfo, item, &ei_bootp_missing_subopt_value,
4072                                                 "Suboption %d: no room left in option for suboption value", subopt);
4073                 return (optend);
4074         }
4075
4076         proto_tree_add_item(sub_tree, hf_bootp_suboption_data, tvb, suboptoff, subopt_len, ENC_NA);
4077         suboptoff+= subopt_len;
4078
4079         return suboptoff;
4080
4081 }
4082
4083 static int
4084 dissect_bootpopt_vi_vendor_specific_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
4085 {
4086         int offset = 0;
4087         int enterprise = 0;
4088         int s_end = 0;
4089         int option_data_len = 0;
4090         proto_item *vti;
4091         proto_tree *e_tree;
4092
4093         while (tvb_reported_length_remaining(tvb, offset) >= 5) {
4094
4095                 vti = proto_tree_add_item_ret_uint(tree, hf_bootp_option125_enterprise, tvb, offset, 4, ENC_BIG_ENDIAN, &enterprise);
4096                 e_tree = proto_item_add_subtree(vti, ett_bootp_option);
4097                 offset += 4;
4098
4099                 proto_tree_add_item_ret_uint(e_tree, hf_bootp_option125_length, tvb, offset, 1, ENC_NA, &option_data_len);
4100                 offset += 1;
4101
4102                 s_end = offset + option_data_len;
4103                 if ( tvb_reported_length_remaining(tvb, s_end) < 0 ) {
4104                         expert_add_info_format(pinfo, vti, &ei_bootp_option125_enterprise_malformed, "no room left in option for enterprise %u data", enterprise);
4105                         break;
4106                 }
4107
4108                 while (offset < s_end) {
4109                         tvbuff_t *enterprise_tvb = tvb_new_subset_length(tvb, offset, option_data_len);
4110                         int bytes_dissected = dissector_try_uint(bootp_enterprise_table, enterprise, enterprise_tvb, pinfo, e_tree);
4111                         if (bytes_dissected == 0) {
4112                                 offset = dissect_vendor_generic_suboption(pinfo, vti, e_tree, tvb, offset, s_end);
4113                         } else{
4114                                 offset += bytes_dissected;
4115                         }
4116                 }
4117         }
4118
4119         if (tvb_reported_length_remaining(tvb, offset) > 0) {
4120                 expert_add_info_format(pinfo, tree, &ei_bootp_bad_length, "length < 5");
4121         }
4122
4123         return tvb_captured_length(tvb);
4124 }
4125
4126 static const value_string option43_alcatel_suboption_vals[] = {
4127         {  0, "Padding" },
4128         { 58, "Voice VLAN ID" },
4129         { 64, "Spatial Redundancy TFTP1" },
4130         { 65, "Spatial Redundancy TFTP2" },
4131         { 66, "Application Type" },
4132         { 67, "SIP URL" },
4133         { 255, "Alcatel-Lucent End" },
4134         { 0, NULL}
4135 };
4136
4137 static const value_string option43_alcatel_app_type_vals[] = {
4138         { 0, "NOE" },
4139         { 1, "SIP" },
4140         { 0, NULL}
4141 };
4142
4143 /* Look for 'encapsulated vendor-specific options' */
4144 static gboolean
4145 test_encapsulated_vendor_options(tvbuff_t *tvb, int optoff, int optend)
4146 {
4147         guint8  subopt;
4148         guint8  subopt_len;
4149
4150         while (optoff < optend) {
4151                 subopt = tvb_get_guint8(tvb, optoff);
4152                 optoff++;
4153
4154                 /* Skip padding */
4155                 if (subopt == 0)
4156                         continue;
4157                 /* We are done, skip any remaining bytes */
4158                 if (subopt == 255)
4159                         break;
4160
4161                 /* We expect a length byte next */
4162                 if (optoff >= optend)
4163                         return FALSE;
4164                 subopt_len = tvb_get_guint8(tvb, optoff);
4165                 optoff++;
4166
4167                 /* Check remaining room for suboption in option */
4168                 if (optoff + subopt_len > optend)
4169                         return FALSE;
4170                 optoff += subopt_len;
4171         }
4172         return TRUE;
4173 }
4174
4175 static int
4176 dissect_vendor_alcatel_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
4177                                  tvbuff_t *tvb, int optoff, int optend)
4178 {
4179         int         suboptoff = optoff;
4180         guint8      subopt;
4181         guint8      subopt_len;
4182         proto_item *vti;
4183         proto_tree *o43alcatel_v_tree;
4184
4185         subopt = tvb_get_guint8(tvb, optoff);
4186         suboptoff++;
4187
4188         if (subopt == 0) {
4189                 proto_tree_add_item(v_tree, hf_bootp_option43_alcatel_padding, tvb, optoff, 1, ENC_BIG_ENDIAN);
4190                 return (suboptoff);
4191         } else if (subopt == 255) {     /* End Option */
4192                 proto_tree_add_item(v_tree, hf_bootp_option43_alcatel_end, tvb, optoff, 1, ENC_BIG_ENDIAN);
4193                 /* Make sure we skip any junk left this option */
4194                 return (optend);
4195         }
4196
4197         if (suboptoff >= optend) {
4198                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
4199                                                                         "Suboption %d: no room left in option for suboption length", subopt);
4200                 return (optend);
4201         }
4202
4203         subopt_len = tvb_get_guint8(tvb, suboptoff);
4204         vti = proto_tree_add_uint_format_value(v_tree, hf_bootp_option43_alcatel_suboption,
4205                                 tvb, optoff, subopt_len+2, subopt, "(%d) %s",
4206                                 subopt, val_to_str_const(subopt, option43_alcatel_suboption_vals, "Unknown"));
4207
4208         o43alcatel_v_tree = proto_item_add_subtree(vti, ett_bootp_option43_suboption);
4209         proto_tree_add_item(o43alcatel_v_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
4210         suboptoff++;
4211
4212         if (suboptoff+subopt_len > optend) {
4213                 expert_add_info_format(pinfo, vti, &ei_bootp_missing_subopt_value,
4214                                                 "Suboption %d: no room left in option for suboption value", subopt);
4215                 return (optend);
4216         }
4217
4218         switch (subopt)
4219         {
4220         case 58: /* 0x3A - Alcatel-Lucent AVA VLAN Id */
4221                 if (subopt_len != 2) {
4222                         expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 2");
4223                         return (optend);
4224                 }
4225
4226                 proto_tree_add_item(o43alcatel_v_tree, hf_bootp_option43_alcatel_vlan_id, tvb, suboptoff, 2, ENC_BIG_ENDIAN);
4227                 break;
4228         case 64: /* 0x40 - Alcatel-Lucent TFTP1 */
4229                 if (subopt_len != 4) {
4230                         expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 4");
4231                         return (optend);
4232                 }
4233
4234                 proto_tree_add_item(o43alcatel_v_tree, hf_bootp_option43_alcatel_tftp1, tvb, suboptoff, 4, ENC_BIG_ENDIAN);
4235                 break;
4236         case 65: /* 0x41 - Alcatel-Lucent TFTP2 */
4237                 if (subopt_len != 4) {
4238                         expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 4");
4239                         return (optend);
4240                 }
4241
4242                 proto_tree_add_item(o43alcatel_v_tree, hf_bootp_option43_alcatel_tftp2, tvb, suboptoff, 4, ENC_BIG_ENDIAN);
4243                 break;
4244         case 66: /* 0x42 - Alcatel-Lucent APPLICATION TYPE */
4245                 if (subopt_len != 1) {
4246                         expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 1");
4247                         return (optend);
4248                 }
4249                 proto_tree_add_item(o43alcatel_v_tree, hf_bootp_option43_alcatel_app_type, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
4250                 break;
4251         case 67: /* 0x43 - Alcatel-Lucent SIP URL */
4252                 proto_tree_add_item(o43alcatel_v_tree, hf_bootp_option43_alcatel_sip_url, tvb, suboptoff, subopt_len, ENC_ASCII|ENC_NA);
4253                 break;
4254         default:
4255                 expert_add_info_format(pinfo, vti, &hf_bootp_subopt_unknown_type, "ERROR, please report: Unknown subopt type handler %d", subopt);
4256                 return optend;
4257         }
4258
4259         optoff += (subopt_len + 2);
4260         return optoff;
4261 }
4262
4263 static gboolean
4264 dissect_alcatel_lucent_vendor_info_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
4265 {
4266         int offset = 0;
4267         guint8 s_option;
4268         proto_tree* vendor_tree;
4269
4270         if (tvb_reported_length(tvb) < 1)
4271                 return FALSE;
4272
4273         s_option = tvb_get_guint8(tvb, offset);
4274         if ((s_option==58 || s_option==64 || s_option==65
4275                 || s_option==66 || s_option==67)
4276                 && test_encapsulated_vendor_options(tvb, offset, tvb_reported_length(tvb))) {
4277
4278                 /* Alcatel-Lucent DHCP Extensions */
4279                 proto_item_append_text(tree, " (Alcatel-Lucent)");
4280                 vendor_tree = proto_item_add_subtree(tree, ett_bootp_option);
4281
4282                 while (tvb_reported_length_remaining(tvb, offset) > 0) {
4283                         offset = dissect_vendor_alcatel_suboption(pinfo, tree, vendor_tree,
4284                                 tvb, offset, tvb_reported_length(tvb));
4285                 }
4286                 return TRUE;
4287         }
4288
4289         return FALSE;
4290 }
4291
4292 static const value_string option63_suboption_vals[] = {
4293         { 1, "NWIP does not exist on subnet" },
4294         { 2, "NWIP exists in options area" },
4295         { 3, "NWIP exists in sname/file" },
4296         { 4, "NWIP exists, but too big" },
4297         { 5, "Broadcast for nearest Netware server" },
4298         { 6, "Preferred DSS server" },
4299         { 7, "Nearest NWIP server" },
4300         { 8, "Autoretries" },
4301         { 9, "Autoretry delay, secs" },
4302         { 10, "Support NetWare/IP v1.1" },
4303         { 11, "Primary DSS" },
4304         { 0, NULL }
4305 };
4306
4307 static int
4308 dissect_netware_ip_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
4309                              tvbuff_t *tvb, int optoff, int optend)
4310 {
4311         int         suboptoff = optoff;
4312         guint8      subopt, subopt_len;
4313         proto_tree *o63_v_tree;
4314         proto_item *vti, *ti;
4315
4316         struct basic_types_hfs default_hfs = {
4317                 NULL,
4318                 &hf_bootp_option63_value_ip_address,
4319                 &hf_bootp_option63_value_ip_address,
4320                 NULL,
4321                 &hf_bootp_option63_value_boolean,
4322                 &hf_bootp_option63_value_8,
4323                 NULL,
4324                 NULL,
4325                 NULL,
4326                 NULL,
4327                 NULL
4328         };
4329
4330         static struct opt_info o63_opt[]= {
4331                 /* 0 */ {"",none,NULL},
4332                 /* 1 */ {"NWIP does not exist on subnet",presence,NULL},
4333                 /* 2 */ {"NWIP exists in options area",presence,NULL},
4334                 /* 3 */ {"NWIP exists in sname/file",presence,NULL},
4335                 /* 4 */ {"NWIP exists, but too big",presence,NULL},
4336                 /* 5 */ {"Broadcast for nearest Netware server",val_boolean, &hf_bootp_option63_broadcast},
4337                 /* 6 */ {"Preferred DSS server",ipv4_list,&hf_bootp_option63_preferred_dss_server},
4338                 /* 7 */ {"Nearest NWIP server",ipv4_list,&hf_bootp_option63_nearest_nwip_server},
4339                 /* 8 */ {"Autoretries",val_u_byte,&hf_bootp_option63_autoretries},
4340                 /* 9 */ {"Autoretry delay, secs",val_u_byte,&hf_bootp_option63_autoretry_delay},
4341                 /* 10*/ {"Support NetWare/IP v1.1",val_boolean,&hf_bootp_option63_support_netware_v1_1},
4342                 /* 11*/ {"Primary DSS",ipv4,&hf_bootp_option63_primary_dss}
4343         };
4344
4345         subopt = tvb_get_guint8(tvb, optoff);
4346         suboptoff++;
4347
4348         if (suboptoff >= optend) {
4349                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
4350                                                                         "Suboption %d: no room left in option for suboption length", subopt);
4351                 return (optend);
4352         }
4353
4354         subopt_len = tvb_get_guint8(tvb, suboptoff);
4355         vti = proto_tree_add_uint_format_value(v_tree, hf_bootp_option63_suboption,
4356                                 tvb, optoff, subopt_len+2, subopt, "(%d) %s",
4357                                 subopt, val_to_str_const(subopt, option63_suboption_vals, "Unknown"));
4358
4359         o63_v_tree = proto_item_add_subtree(vti, ett_bootp_option63_suboption);
4360         proto_tree_add_item(o63_v_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN);
4361         suboptoff++;
4362
4363         ti = proto_tree_add_item(o63_v_tree, hf_bootp_option63_value, tvb, suboptoff, subopt_len, ENC_NA);
4364         PROTO_ITEM_SET_HIDDEN(ti);
4365
4366         if (subopt < array_length(o63_opt)) {
4367                 if (bootp_handle_basic_types(pinfo, o63_v_tree, vti, tvb, o63_opt[subopt].ftype,
4368                                                         suboptoff, subopt_len, o63_opt[subopt].phf, &default_hfs) == 0) {
4369                         switch(o63_opt[subopt].ftype)
4370                         {
4371                         case presence:
4372                                 if (subopt_len != 0) {
4373                                         expert_add_info_format(pinfo, vti, &ei_bootp_bad_length, "length isn't 0");
4374                                 }
4375                                 break;
4376                         default:
4377                                 if (o63_opt[subopt].phf == NULL)
4378                                         proto_tree_add_item(o63_v_tree, hf_bootp_option63_value, tvb, suboptoff, subopt_len, ENC_NA);
4379                                 break;
4380                         }
4381                 }
4382         }
4383         optoff += (subopt_len + 2);
4384         return optoff;
4385 }
4386
4387 static int
4388 dissect_bootpopt_netware_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
4389 {
4390         int offset = 0;
4391
4392         while (tvb_reported_length_remaining(tvb, offset) > 0) {
4393                 offset = dissect_netware_ip_suboption(pinfo, tree, tree, tvb, offset, tvb_reported_length(tvb));
4394         }
4395
4396         return tvb_captured_length(tvb);
4397 }
4398
4399 static const value_string option125_tr111_suboption_vals[] = {
4400         { 1, "DeviceManufacturerOUI" },
4401         { 2, "DeviceSerialNumber" },
4402         { 3, "DeviceProductClass" },
4403         { 4, "GatewayManufacturerOUI" },
4404         { 5, "GatewaySerialNumber" },
4405         { 6, "GatewayProductClass" },
4406         { 0, NULL }
4407 };
4408
4409 static int
4410 dissect_vendor_tr111_suboption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
4411 {
4412         int offset = 0;
4413         proto_tree *o125_v_tree;
4414         proto_item *vti, *ti;
4415         guint8 subopt, subopt_len;
4416
4417         struct basic_types_hfs default_hfs = {
4418                 NULL,
4419                 NULL,
4420                 NULL,
4421                 &hf_bootp_option125_value_stringz,
4422                 NULL,
4423                 NULL,
4424                 NULL,
4425                 NULL,
4426                 NULL,
4427                 NULL,
4428                 NULL
4429         };
4430
4431         /* Reference: TR-111 DHCP Option 125 Sub-Option Data Fields
4432            Page 10.
4433         */
4434
4435         static struct opt_info o125_tr111_opt[]= {
4436                 /* 0 */ {"nop", special, NULL}, /* dummy */
4437                 /* 1 */ {"DeviceManufacturerOUI",  oui,    &hf_bootp_option125_tr111_device_manufacturer_oui},
4438                 /* 2 */ {"DeviceSerialNumber",     string, &hf_bootp_option125_tr111_device_serial_number},
4439                 /* 3 */ {"DeviceProductClass",     string, &hf_bootp_option125_tr111_device_product_class},
4440                 /* 4 */ {"GatewayManufacturerOUI", string, &hf_bootp_option125_tr111_gateway_manufacturer_oui},
4441                 /* 5 */ {"GatewaySerialNumber",    string, &hf_bootp_option125_tr111_gateway_serial_number},
4442                 /* 6 */ {"GatewayProductClass",    string, &hf_bootp_option125_tr111_gateway_product_class},
4443         };
4444
4445         subopt = tvb_get_guint8(tvb, offset);
4446         offset++;
4447
4448         if (tvb_reported_length_remaining(tvb, offset) < 1) {
4449                 expert_add_info_format(pinfo, tree, &ei_bootp_missing_subopt_length,
4450                                        "Suboption %d: no room left in option for suboption length", subopt);
4451                 return offset;
4452         }
4453
4454         subopt_len = tvb_get_guint8(tvb, offset);
4455         vti = proto_tree_add_uint_format_value(tree, hf_bootp_option125_tr111_suboption,
4456                                 tvb, offset, subopt_len+2, subopt, "(%d) %s",
4457                                 subopt, val_to_str_const(subopt, option125_tr111_suboption_vals, "Unknown"));
4458
4459         o125_v_tree = proto_item_add_subtree(vti, ett_bootp_option125_tr111_suboption);
4460         proto_tree_add_item(o125_v_tree, hf_bootp_suboption_length, tvb, offset, 1, ENC_BIG_ENDIAN);
4461         offset++;
4462
4463         if (tvb_reported_length_remaining(tvb, offset) < subopt_len) {
4464                 expert_add_info_format(pinfo, vti, &ei_bootp_missing_subopt_value,
4465                                                 "Suboption %d: no room left in option for suboption value", subopt);
4466                 return offset;
4467         }
4468
4469         ti = proto_tree_add_item(tree, hf_bootp_option125_value, tvb, offset, subopt_len, ENC_NA);
4470         PROTO_ITEM_SET_HIDDEN(ti);
4471
4472         if (subopt < array_length(o125_tr111_opt)) {
4473                 if (bootp_handle_basic_types(pinfo, o125_v_tree, vti, tvb, o125_tr111_opt[subopt].ftype, offset, subopt_len, o125_tr111_opt[subopt].phf, &default_hfs) == 0) {
4474                         if (o125_tr111_opt[subopt].ftype == special) {
4475                                 if (o125_tr111_opt[subopt].phf != NULL)
4476                                    proto_tree_add_item(o125_v_tree, *o125_tr111_opt[subopt].phf, tvb, offset, subopt_len, ENC_BIG_ENDIAN);
4477                                 else
4478                                    proto_tree_add_item(o125_v_tree, hf_bootp_option125_value, tvb, offset, subopt_len, ENC_NA);
4479                         }
4480                         else if (o125_tr111_opt[subopt].ftype == oui) {
4481                                 /* Get hex string.  Expecting 6 characters. */
4482                                 gchar   *oui_string =  tvb_get_string_enc(wmem_packet_scope(), tvb, offset, subopt_len, ENC_ASCII);
4483                                 /* Convert to OUI number.  Only 3 bytes so no data lost in downcast. */
4484                                 guint32 oui_number = (guint32)strtol(oui_string, NULL, 16);
4485                                 /* Add item using oui_vals */
4486                                 proto_tree_add_uint(o125_v_tree, *o125_tr111_opt[subopt].phf, tvb, offset, subopt_len, oui_number);
4487                         } else if (o125_tr111_opt[subopt].phf == NULL)
4488                                 proto_tree_add_item(o125_v_tree, hf_bootp_option125_value, tvb, offset, subopt_len, ENC_NA);
4489                 }
4490         }
4491
4492         return subopt_len + 2;
4493 }
4494
4495 static const value_string option125_cl_suboption_vals[] = {
4496         { 1, "Option Request" },
4497         { 2, "TFTP Server Addresses" },
4498         { 3, "eRouter Container Option" },
4499         { 4, "MIB Environment Indicator Option" },
4500         { 5, "Modem Capabilities" },
4501         { 0, NULL }
4502 };
4503
4504 static const value_string pkt_mib_env_ind_opt_vals[] = {
4505         { 0x00, "Reserved" },
4506         { 0x01, "CableLabs" },
4507         { 0x02, "IETF" },
4508         { 0x03, "EuroCableLabs" },
4509         { 0, NULL }
4510 };
4511
4512 static int
4513 dissect_vendor_cl_suboption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
4514 {
4515         int offset = 0;
4516         guint8 subopt, subopt_len;
4517         proto_tree *o125_v_tree;
4518         proto_item *vti;
4519
4520         struct basic_types_hfs default_hfs = {
4521                 &hf_bootp_option125_value,
4522                 &hf_bootp_option125_value_ip_address,
4523                 &hf_bootp_option125_value_ip_address,
4524                 &hf_bootp_option125_value_stringz,
4525                 NULL,
4526                 &hf_bootp_option125_value_8,
4527                 &hf_bootp_option125_value_16,
4528                 NULL,
4529                 NULL,
4530                 NULL,
4531                 NULL
4532         };
4533
4534         static struct opt_info o125_cl_opt[]= {
4535                 /* 0 */ {"nop", special, NULL}, /* dummy */
4536                 /* 1 */ {"Option Request = ", bytes, &hf_bootp_option125_cl_option_request},
4537                 /* 2 */ {"TFTP Server Addresses : ", ipv4_list, &hf_bootp_option125_cl_tftp_server_addresses},
4538                 /* 3 */ {"eRouter Container Option : ", bytes, &hf_bootp_option125_cl_erouter_container_option},
4539                 /* 4 */ {"MIB Environment Indicator Option = ", val_u_byte, &hf_bootp_option125_cl_mib_environment_indicator_option},
4540                 /* 5 */ {"Modem Capabilities : ", special, &hf_bootp_option125_cl_modem_capabilities},
4541         };
4542
4543         subopt = tvb_get_guint8(tvb, offset);
4544         offset++;
4545
4546         if (tvb_reported_length_remaining(tvb, offset) < 1) {
4547                 expert_add_info_format(pinfo, tree, &ei_bootp_missing_subopt_length,
4548                                                                         "Suboption %d: no room left in option for suboption length", subopt);
4549                 return offset;
4550         }
4551
4552         subopt_len = tvb_get_guint8(tvb, offset);
4553         vti = proto_tree_add_uint_format_value(tree, hf_bootp_option125_cl_suboption,
4554                                 tvb, offset, subopt_len+2, subopt, "(%d) %s",
4555                                 subopt, val_to_str_const(subopt, option125_cl_suboption_vals, "Unknown"));
4556
4557         o125_v_tree = proto_item_add_subtree(vti, ett_bootp_option125_cl_suboption);
4558         proto_tree_add_item(o125_v_tree, hf_bootp_suboption_length, tvb, offset, 1, ENC_BIG_ENDIAN);
4559         offset++;
4560
4561         if (tvb_reported_length_remaining(tvb, offset) < subopt_len) {
4562                 expert_add_info_format(pinfo, vti, &ei_bootp_missing_subopt_value,
4563                                                 "Suboption %d: no room left in option for suboption value", subopt);
4564                 return offset;
4565         }
4566
4567         if (subopt < array_length(o125_cl_opt)) {
4568                 if (bootp_handle_basic_types(pinfo, o125_v_tree, vti, tvb, o125_cl_opt[subopt].ftype,
4569                                                         offset, subopt_len, o125_cl_opt[subopt].phf, &default_hfs) == 0) {
4570
4571                         switch(o125_cl_opt[subopt].ftype) {
4572                         case special:
4573                                 if (o125_cl_opt[subopt].phf != NULL)
4574                                         proto_tree_add_item(o125_v_tree, *o125_cl_opt[subopt].phf, tvb, offset, subopt_len, ENC_BIG_ENDIAN);
4575                                 else
4576                                         proto_tree_add_item(o125_v_tree, hf_bootp_option125_value, tvb, offset, subopt_len, ENC_NA);
4577                                 switch(subopt){
4578                                         case 5: /* Modem Capabilities */
4579                                                 dissect_docsis_cm_cap(o125_v_tree, tvb, offset-2, subopt_len+2, TRUE);
4580                                         break;
4581                                 }
4582                                 break;
4583                         default:
4584                                 if (o125_cl_opt[subopt].phf == NULL)
4585                                         proto_tree_add_item(o125_v_tree, hf_bootp_option125_value, tvb, offset, subopt_len, ENC_NA);
4586                                 break;
4587                         }
4588                 }
4589         }
4590
4591         return subopt_len + 2;
4592 }
4593
4594 /* PacketCable Multimedia Terminal Adapter device capabilities (option 60).
4595    Ref: PKT-SP-I05-021127 sections 8.2 and 10 */
4596
4597 #define PKT_MDC_TLV_OFF 10
4598
4599
4600 /* These are ASCII-encoded hexadecimal digits.  We use the raw hex equivalent for
4601    convenience. */
4602 #define PKT_MDC_VERSION                 0x3031  /* "01" */
4603 #define PKT_MDC_TEL_END                 0x3032  /* "02" */
4604 #define PKT_MDC_TGT                     0x3033  /* "03" */
4605 #define PKT_MDC_HTTP_ACC                0x3034  /* "04" */
4606 #define PKT_MDC_SYSLOG                  0x3035  /* "05" */
4607 #define PKT_MDC_NCS                     0x3036  /* "06" */
4608 #define PKT_MDC_PRI_LINE                0x3037  /* "07" */
4609 #define PKT_MDC_VENDOR_TLV              0x3038  /* "08" */
4610 #define PKT_MDC_NVRAM_STOR              0x3039  /* "09" */
4611 #define PKT_MDC_PROV_REP                0x3041  /* "0A" */
4612 #define PKT_MDC_PROV_REP_LC             0x3061  /* "0a" */
4613 #define PKT_MDC_SUPP_CODECS             0x3042  /* "0B" */
4614 #define PKT_MDC_SUPP_CODECS_LC          0x3062  /* "0b" */
4615 #define PKT_MDC_SILENCE                 0x3043  /* "0C" */
4616 #define PKT_MDC_SILENCE_LC              0x3063  /* "0c" */
4617 #define PKT_MDC_ECHO_CANCEL             0x3044  /* "0D" */
4618 #define PKT_MDC_ECHO_CANCEL_LC          0x3064  /* "0d" */
4619 #define PKT_MDC_RSVP                    0x3045  /* "0E" */
4620 #define PKT_MDC_RSVP_LC                 0x3065  /* "0e" */
4621 #define PKT_MDC_UGS_AD                  0x3046  /* "0F" */
4622 #define PKT_MDC_UGS_AD_LC               0x3066  /* "0f" */
4623 #define PKT_MDC_IF_INDEX                0x3130  /* "10" */
4624 #define PKT_MDC_FLOW_LOG                0x3131  /* "11" */
4625 #define PKT_MDC_PROV_FLOWS              0x3132  /* "12" */
4626 /* PacketCable 1.5: */
4627 #define PKT_MDC_T38_VERSION             0x3133  /* "13" */
4628 #define PKT_MDC_T38_EC                  0x3134  /* "14" */
4629 #define PKT_MDC_RFC2833_DTMF            0x3135  /* "15" */
4630 #define PKT_MDC_VOICE_METRICS           0x3136  /* "16" */
4631 #define PKT_MDC_MIBS                    0x3137  /* "17" */
4632 #define PKT_MDC_MGPI                    0x3138  /* "18" */
4633 #define PKT_MDC_V152                    0x3139  /* "19" */
4634 #define PKT_MDC_CBS                     0x3141  /* "1A" */
4635 #define PKT_MDC_CBS_LC                  0x3161  /* "1a" */
4636
4637 static const value_string pkt_mdc_type_vals[] = {
4638         { PKT_MDC_VERSION,              "PacketCable Version" },
4639         { PKT_MDC_TEL_END,              "Number Of Telephony Endpoints" },
4640         { PKT_MDC_TGT,                  "TGT Support" },
4641         { PKT_MDC_HTTP_ACC,             "HTTP Download File Access Method Support" },
4642         { PKT_MDC_SYSLOG,               "MTA-24 Event SYSLOG Notification Support" },
4643         { PKT_MDC_NCS,                  "NCS Service Flow Support" },
4644         { PKT_MDC_PRI_LINE,             "Primary Line Support" },
4645         { PKT_MDC_VENDOR_TLV,           "Vendor Specific TLV Type(s)" },
4646         { PKT_MDC_NVRAM_STOR,           "NVRAM Ticket/Session Keys Storage Support" },
4647         { PKT_MDC_PROV_REP,             "Provisioning Event Reporting Support" },
4648         { PKT_MDC_PROV_REP_LC,          "Provisioning Event Reporting Support" },
4649         { PKT_MDC_SUPP_CODECS,          "Supported CODEC(s)" },
4650         { PKT_MDC_SUPP_CODECS_LC,       "Supported CODEC(s)" },
4651         { PKT_MDC_SILENCE,              "Silence Suppression Support" },
4652         { PKT_MDC_SILENCE_LC,           "Silence Suppression Support" },
4653         { PKT_MDC_ECHO_CANCEL,          "Echo Cancellation Support" },
4654         { PKT_MDC_ECHO_CANCEL_LC,       "Echo Cancellation Support" },
4655         { PKT_MDC_RSVP,                 "RSVP Support/ Reserved" },
4656         { PKT_MDC_RSVP_LC,              "RSVP Support/ Reserved" },
4657         { PKT_MDC_UGS_AD,               "UGS-AD Support" },
4658         { PKT_MDC_UGS_AD_LC,            "UGS-AD Support" },
4659         { PKT_MDC_IF_INDEX,             "MTA's \"ifIndex\" starting number in \"ifTable\"" },
4660         { PKT_MDC_FLOW_LOG,             "Provisioning Flow Logging Support" },
4661         { PKT_MDC_PROV_FLOWS,           "Supported Provisioning Flows" },
4662         /* PacketCable 1.5: */
4663         { PKT_MDC_T38_VERSION,          "T38 Version Support" },
4664         { PKT_MDC_T38_EC,               "T38 Error Correction Support" },
4665         { PKT_MDC_RFC2833_DTMF,         "RFC 2833 DTMF Support" },
4666         { PKT_MDC_VOICE_METRICS,        "Voice Metrics Support" },
4667         { PKT_MDC_MIBS,                 "MIB Support" },
4668         { PKT_MDC_MGPI,                 "Multiple Grants Per Interval Support" },
4669         { PKT_MDC_V152,                 "V.152 Support" },
4670         /* PacketCable 2.0: */
4671         { PKT_MDC_CBS,                  "Certificate Bootstrapping Support" },
4672         { PKT_MDC_CBS_LC,               "Certificate Bootstrapping Support" },
4673         { 0,                            NULL }
4674 };
4675
4676 static const value_string pkt_mdc_version_vals[] = {
4677         { 0x3030,       "PacketCable 1.0" },
4678         { 0x3031,       "PacketCable 1.1/1.5" }, /* 1.5 replaces 1.1-1.3 */
4679         { 0x3032,       "PacketCable 2.0" },
4680         { 0,            NULL }
4681 };
4682
4683 static const value_string pkt_mdc_boolean_vals[] = {
4684         { 0x3030,       "No" },
4685         { 0x3031,       "Yes" },
4686         { 0,            NULL }
4687 };
4688
4689 static const value_string pkt_mdc_codec_vals[] = {
4690         { 0x3031,       "other" },           /* "01" */
4691         { 0x3032,       "unknown" },
4692         { 0x3033,       "G.729" },
4693         { 0x3034,       "reserved" },
4694         { 0x3035,       "G.729E" },
4695         { 0x3036,       "PCMU" },
4696         { 0x3037,       "G.726-32" },
4697         { 0x3038,       "G.728" },
4698         { 0x3039,       "PCMA" },            /* "09" */
4699         { 0x3041,       "G.726-16" },        /* "0A" */
4700         { 0x3042,       "G.726-24" },
4701         { 0x3043,       "G.726-40" },
4702         { 0x3044,       "iLBC" },
4703         { 0x3045,       "BV16" },
4704         { 0x3046,       "telephone-event" }, /* "0F" */
4705         { 0,            NULL }
4706 };
4707
4708 static const value_string pkt_mdc_t38_version_vals[] = {
4709         { 0x3030,       "Unsupported" },
4710         { 0x3031,       "T.38 Version Zero" }, /* default */
4711         { 0x3032,       "T.38 Version One" },
4712         { 0x3033,       "T.38 Version Two" },
4713         { 0x3035,       "T.38 Version Three" },
4714         { 0,            NULL }
4715 };
4716
4717 static const value_string pkt_mdc_t38_ec_vals[] = {
4718         { 0x3030,       "None" },
4719         { 0x3031,       "Redundancy" }, /* default */
4720         { 0x3032,       "FEC" },
4721         { 0,            NULL }
4722 };
4723
4724 static const value_string pkt_mdc_mib_orgs[] = {
4725         { 0x3030,       "CableLabs" },
4726         { 0x3031,       "IETF" },
4727         { 0x3032,       "EuroCableLabs" },
4728         { 0x3033,       "Reserved" },
4729         { 0x3034,       "Reserved" },
4730         { 0x3035,       "Reserved" },
4731         { 0x3036,       "Reserved" },
4732         { 0x3037,       "Reserved" },
4733         { 0x3038,       "Reserved" },
4734         { 0x3039,       "Reserved" },
4735         { 0,            NULL }
4736 };
4737
4738 static int hf_bootp_pkt_mdc_supp_flow_secure = -1;
4739 static int hf_bootp_pkt_mdc_supp_flow_hybrid = -1;
4740 static int hf_bootp_pkt_mdc_supp_flow_basic = -1;
4741
4742 #define PKT_MDC_MIB_CL 0x3030
4743 static int hf_bootp_pkt_mdc_mib_cl_mta = -1;
4744 static int hf_bootp_pkt_mdc_mib_cl_signaling = -1;
4745 static int hf_bootp_pkt_mdc_mib_cl_management_event = -1;
4746 static int hf_bootp_pkt_mdc_mib_cl_mta_extension = -1;
4747 static int hf_bootp_pkt_mdc_mib_cl_mta_signaling_extension = -1;
4748 static int hf_bootp_pkt_mdc_mib_cl_mta_mem_extention = -1;
4749 static int hf_bootp_pkt_mdc_mib_cl_reserved = -1;
4750
4751 #define PKT_MDC_MIB_IETF 0x3031
4752 static int hf_bootp_pkt_mdc_mib_ietf_mta = -1;
4753 static int hf_bootp_pkt_mdc_mib_ietf_signaling = -1;
4754 static int hf_bootp_pkt_mdc_mib_ietf_management_event = -1;
4755 static int hf_bootp_pkt_mdc_mib_ietf_reserved = -1;
4756
4757 #define PKT_MDC_MIB_EURO 0x3032
4758 static int hf_bootp_pkt_mdc_mib_euro_mta = -1;
4759 static int hf_bootp_pkt_mdc_mib_euro_signaling = -1;
4760 static int hf_bootp_pkt_mdc_mib_euro_management_event = -1;
4761 static int hf_bootp_pkt_mdc_mib_euro_mta_extension = -1;
4762 static int hf_bootp_pkt_mdc_mib_euro_mta_signaling_extension = -1;
4763 static int hf_bootp_pkt_mdc_mib_euro_mta_mem_extention = -1;
4764 static int hf_bootp_pkt_mdc_mib_euro_reserved = -1;
4765
4766
4767 static void
4768 dissect_packetcable_mta_cap(proto_tree *v_tree, packet_info *pinfo, tvbuff_t *tvb, int voff, int len)
4769 {
4770         guint16        raw_val;
4771         guint32        flow_val   = 0;
4772         int                off    = PKT_MDC_TLV_OFF + voff;
4773         int                subopt_off, max_len;
4774         guint          tlv_len, i, mib_val;
4775         guint8         asc_val[3] = "  ", flow_val_str[5];
4776         proto_item    *ti, *mib_ti;
4777         proto_tree    *subtree, *subtree2;
4778
4779         tvb_memcpy (tvb, asc_val, off, 2);
4780         if (sscanf((gchar*)asc_val, "%x", &tlv_len) != 1 || tlv_len > 0xff) {
4781                 proto_tree_add_expert_format(v_tree, pinfo, &ei_bootp_bad_length, tvb, off, len - off,
4782                         "Bogus length: %s", asc_val);
4783                 return;
4784         } else {
4785                 proto_tree_add_uint(v_tree, hf_bootp_pkt_mta_cap_len, tvb, off, 2, tlv_len);
4786                 off += 2;
4787
4788                 while (off - voff < len) {
4789                         /* Type */
4790                         raw_val = tvb_get_ntohs (tvb, off);
4791
4792                         /* Length */
4793                         tvb_memcpy(tvb, asc_val, off + 2, 2);
4794                         if (sscanf((gchar*)asc_val, "%x", &tlv_len) != 1
4795                             || tlv_len < 1 || tlv_len > G_MAXUINT16) {
4796                                 proto_tree_add_expert_format(v_tree, pinfo, &ei_bootp_bad_length, tvb, off, len - off,
4797                                                     "Bogus length: %s", asc_val);
4798                                 return;
4799                         } else {
4800                                 /* Value(s) */
4801
4802                                 ti = proto_tree_add_uint_format(v_tree, hf_bootp_pkt_mta_cap_type,
4803                                     tvb, off, 2, raw_val, "0x%s: %s = ",
4804                                     tvb_format_text(tvb, off, 2),
4805                                     val_to_str_const(raw_val, pkt_mdc_type_vals, "unknown"));
4806                                 proto_item_set_len(ti, (tlv_len * 2) + 4);
4807                                 switch (raw_val) {
4808
4809                                 case PKT_MDC_VERSION:
4810                                         raw_val = tvb_get_ntohs(tvb, off + 4);
4811                                         proto_item_append_text(ti,
4812                                                                "%s (%s)",
4813                                                                val_to_str_const(raw_val, pkt_mdc_version_vals, "Reserved"),
4814                                                                tvb_format_stringzpad(tvb, off + 4, 2) );
4815                                         break;
4816
4817                                 case PKT_MDC_TEL_END:
4818                                 case PKT_MDC_IF_INDEX:
4819                                         proto_item_append_text(ti,
4820                                                                "%s",
4821                                                                tvb_format_stringzpad(tvb, off + 4, 2) );
4822                                         break;
4823
4824                                 case PKT_MDC_TGT:
4825                                 case PKT_MDC_HTTP_ACC:
4826                                 case PKT_MDC_SYSLOG:
4827                                 case PKT_MDC_NCS:
4828                                 case PKT_MDC_PRI_LINE:
4829                                 case PKT_MDC_NVRAM_STOR:
4830                                 case PKT_MDC_PROV_REP:
4831                                 case PKT_MDC_PROV_REP_LC:
4832                                 case PKT_MDC_SILENCE:
4833                                 case PKT_MDC_SILENCE_LC:
4834                                 case PKT_MDC_ECHO_CANCEL:
4835                                 case PKT_MDC_ECHO_CANCEL_LC:
4836                                 case PKT_MDC_RSVP:
4837                                 case PKT_MDC_RSVP_LC:
4838                                 case PKT_MDC_UGS_AD:
4839                                 case PKT_MDC_UGS_AD_LC:
4840                                 case PKT_MDC_FLOW_LOG:
4841                                 case PKT_MDC_RFC2833_DTMF:
4842                                 case PKT_MDC_VOICE_METRICS:
4843                                 case PKT_MDC_MGPI:
4844                                 case PKT_MDC_V152:
4845                                 case PKT_MDC_CBS:
4846                                 case PKT_MDC_CBS_LC:
4847                                         raw_val = tvb_get_ntohs(tvb, off + 4);
4848                                         proto_item_append_text(ti,
4849                                                                "%s (%s)",
4850                                                                val_to_str_const(raw_val, pkt_mdc_boolean_vals, "unknown"),
4851                                                                tvb_format_stringzpad(tvb, off + 4, 2) );
4852                                         break;
4853
4854                                 case PKT_MDC_SUPP_CODECS:
4855                                 case PKT_MDC_SUPP_CODECS_LC:
4856                                         for (i = 0; i < tlv_len; i++) {
4857                                                 raw_val = tvb_get_ntohs(tvb, off + 4 + (i * 2) );
4858                                                 proto_item_append_text(ti,
4859                                                                        "%s%s (%s)",
4860                                                                        plurality(i + 1, "", ", "),
4861                                                                        val_to_str_const(raw_val, pkt_mdc_codec_vals, "unknown"),
4862                                                                        tvb_format_stringzpad(tvb, off + 4 + (i * 2), 2) );
4863                                         }
4864                                         break;
4865
4866                                 case PKT_MDC_PROV_FLOWS:
4867                                         tvb_memcpy(tvb, flow_val_str, off + 4, 4);
4868                                         flow_val_str[4] = '\0';
4869                                         /* We are only reading 4 digits which should fit in 32 bits */
4870                                         flow_val = (guint32)strtoul((gchar*)flow_val_str, NULL, 16);
4871                                         proto_item_append_text(ti,
4872                                                                "0x%04x", flow_val);
4873                                         break;
4874
4875                                 case PKT_MDC_T38_VERSION:
4876                                         raw_val = tvb_get_ntohs(tvb, off + 4);
4877                                         proto_item_append_text(ti,
4878                                                                "%s (%s)",
4879                                                                val_to_str_const(raw_val, pkt_mdc_t38_version_vals, "unknown"),
4880                                                                tvb_format_stringzpad(tvb, off + 4, 2) );
4881                                         break;
4882
4883                                 case PKT_MDC_T38_EC:
4884                                         raw_val = tvb_get_ntohs(tvb, off + 4);
4885                                         proto_item_append_text(ti,
4886                                                                "%s (%s)",
4887                                                                val_to_str_const(raw_val, pkt_mdc_t38_ec_vals, "unknown"),
4888                                                                tvb_format_stringzpad(tvb, off + 4, 2) );
4889                                         break;
4890
4891                                 case PKT_MDC_MIBS:
4892                                         break;
4893
4894                                 case PKT_MDC_VENDOR_TLV:
4895                                 default:
4896                                         proto_item_append_text(ti,
4897                                                                "%s",
4898                                                                tvb_format_stringzpad(tvb, off + 4, tlv_len * 2) );
4899                                         break;
4900                                 }
4901                         }
4902                         subtree = proto_item_add_subtree(ti, ett_bootp_option);
4903                         if (raw_val == PKT_MDC_PROV_FLOWS) {
4904                                 static const int * flows[] = {
4905                                         &hf_bootp_pkt_mdc_supp_flow_secure,
4906                                         &hf_bootp_pkt_mdc_supp_flow_hybrid,
4907                                         &hf_bootp_pkt_mdc_supp_flow_basic,
4908                                         NULL
4909                                 };
4910
4911                                 proto_tree_add_bitmask_list_value(subtree, tvb, off + 4, 4, flows, flow_val);
4912                         } else if (raw_val == PKT_MDC_MIBS) {
4913                         /* 17 06 02 00 38 02 01 07 */
4914                                 subopt_off = off + 4;
4915                                 max_len = subopt_off + (tlv_len * 2);
4916                                 while (subopt_off < max_len) {
4917                                         raw_val = tvb_get_ntohs(tvb, subopt_off);
4918                                         if (raw_val != 0x3032) { /* We only know how to handle a length of 2 */
4919                                                 tvb_memcpy(tvb, asc_val, subopt_off, 2);
4920                                                 proto_tree_add_expert_format(subtree, pinfo, &ei_bootp_bad_length, tvb, subopt_off, 2,
4921                                                                         "Bogus length: %s", asc_val);
4922                                                 return;
4923                                         }
4924
4925                                         subopt_off += 2;
4926                                         raw_val = tvb_get_ntohs(tvb, subopt_off);
4927                                         tvb_memcpy(tvb, asc_val, subopt_off, 2);
4928
4929                                         subtree2 = proto_tree_add_subtree_format(subtree, tvb, subopt_off, 2,
4930                                                 ett_bootp_option, &mib_ti, "%s (%s)",
4931                                                 val_to_str_const(raw_val, pkt_mdc_mib_orgs, "Unknown"), asc_val);
4932                                         if (subopt_off > off + 4 + 2) {
4933                                                 proto_item_append_text(ti, ", ");
4934                                         }
4935                                         proto_item_append_text(ti, "%s", val_to_str_const(raw_val, pkt_mdc_mib_orgs, "Unknown"));
4936
4937                                         subopt_off += 2;
4938                                         tvb_memcpy(tvb, asc_val, subopt_off, 2);
4939                                         if (sscanf((gchar*)asc_val, "%x", &mib_val) != 1) {
4940                                                 proto_tree_add_expert_format(v_tree, pinfo, &ei_bootp_bad_bitfield, tvb, subopt_off, 2,
4941                                                                         "Bogus bitfield: %s", asc_val);
4942                                                 return;
4943                                         }
4944                                         switch (raw_val) {
4945
4946                                         case PKT_MDC_MIB_CL: {
4947                                                 static const int * cl_flags[] = {
4948                                                         &hf_bootp_pkt_mdc_mib_cl_mta,
4949                                                         &hf_bootp_pkt_mdc_mib_cl_signaling,
4950                                                         &hf_bootp_pkt_mdc_mib_cl_management_event,
4951                                                         &hf_bootp_pkt_mdc_mib_cl_mta_extension,
4952                                                         &hf_bootp_pkt_mdc_mib_cl_mta_signaling_extension,
4953                                                         &hf_bootp_pkt_mdc_mib_cl_mta_mem_extention,
4954                                                         &hf_bootp_pkt_mdc_mib_cl_reserved,
4955                                                         NULL
4956                                                 };
4957
4958                                                 proto_tree_add_bitmask_list_value(subtree2, tvb, subopt_off, 2, cl_flags, mib_val);
4959                         }
4960                                                 break;
4961
4962                                         case PKT_MDC_MIB_IETF: {
4963                                                 static const int * ietf_flags[] = {
4964                                                         &hf_bootp_pkt_mdc_mib_ietf_mta,
4965                                                         &hf_bootp_pkt_mdc_mib_ietf_signaling,
4966                                                         &hf_bootp_pkt_mdc_mib_ietf_management_event,
4967                                                         &hf_bootp_pkt_mdc_mib_ietf_reserved,
4968                                                         NULL
4969                                                 };
4970
4971                                                 proto_tree_add_bitmask_list_value(subtree2, tvb, subopt_off, 2, ietf_flags, mib_val);
4972                         }
4973                                                 break;
4974
4975                                         case PKT_MDC_MIB_EURO: {
4976                                                 static const int * euro_flags[] = {
4977                                                         &hf_bootp_pkt_mdc_mib_euro_mta,
4978                                                         &hf_bootp_pkt_mdc_mib_euro_signaling,
4979                                                         &hf_bootp_pkt_mdc_mib_euro_management_event,
4980                                                         &hf_bootp_pkt_mdc_mib_euro_mta_extension,
4981                                                         &hf_bootp_pkt_mdc_mib_euro_mta_signaling_extension,
4982                                                         &hf_bootp_pkt_mdc_mib_euro_mta_mem_extention,
4983                                                         &hf_bootp_pkt_mdc_mib_euro_reserved,
4984                                                         NULL
4985                                                 };
4986
4987                                                 proto_tree_add_bitmask_list_value(subtree2, tvb, subopt_off, 2, euro_flags, mib_val);
4988                         }
4989                                                 break;
4990
4991                                         default:
4992                                                 break;
4993                                         }
4994                                         subopt_off += 2;
4995                                 }
4996
4997                         }
4998                         off += (tlv_len * 2) + 4;
4999                 }
5000         }
5001 }
5002
5003 static gboolean
5004 dissect_packetcable_mta_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ )
5005 {
5006         guint8* vendor_id;
5007
5008         if (tvb_reported_length(tvb) < 8) {
5009                 return FALSE;
5010         }
5011
5012         vendor_id = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 8, ENC_ASCII|ENC_NA);
5013         if ((strcmp((const char*)vendor_id, PACKETCABLE_MTA_CAP10) == 0) ||
5014                 (strcmp((const char*)vendor_id, PACKETCABLE_MTA_CAP15) == 0) ||
5015                 (strcmp((const char*)vendor_id, PACKETCABLE_MTA_CAP20) == 0)) {
5016                 dissect_packetcable_mta_cap(tree, pinfo, tvb, 0, tvb_reported_length(tvb));
5017                 return TRUE;
5018         }
5019
5020         return FALSE;
5021 }
5022
5023 /* DOCSIS Cable Modem device capabilities (option 60/option 125). */
5024 #define DOCSIS_CM_CAP_TLV_OFF 12
5025
5026 #define DOCSIS_CM_CAP_CONCAT_SUP        0x01
5027 #define DOCSIS_CM_CAP_DOCSIS_VER        0x02
5028 #define DOCSIS_CM_CAP_FRAG_SUP          0x03
5029 #define DOCSIS_CM_CAP_PHS_SUP           0x04
5030 #define DOCSIS_CM_CAP_IGMP_SUP          0x05
5031 #define DOCSIS_CM_CAP_PRIV_SUP          0x06
5032 #define DOCSIS_CM_CAP_DSAID_SUP         0x07
5033 #define DOCSIS_CM_CAP_USSF_SUP          0x08
5034 #define DOCSIS_CM_CAP_FILT_SUP          0x09
5035 #define DOCSIS_CM_CAP_TET_MI            0x0a
5036 #define DOCSIS_CM_CAP_TET               0x0b
5037 #define DOCSIS_CM_CAP_DCC_SUP           0x0c
5038 #define DOCSIS_CM_CAP_IPFILT_SUP        0x0d
5039 #define DOCSIS_CM_CAP_LLCFILT_SUP       0x0e
5040 #define DOCSIS_CM_CAP_EXPUNI_SPACE      0x0f
5041 #define DOCSIS_CM_CAP_RNGHLDOFF_SUP     0x10
5042 #define DOCSIS_CM_CAP_L2VPN_SUP         0x11
5043 #define DOCSIS_CM_CAP_L2VPN_HOST_SUP    0x12
5044 #define DOCSIS_CM_CAP_DUTFILT_SUP       0x13
5045 #define DOCSIS_CM_CAP_USFREQRNG_SUP     0x14
5046 #define DOCSIS_CM_CAP_USSYMRATE_SUP     0x15
5047 #define DOCSIS_CM_CAP_SACM2_SUP         0x16
5048 #define DOCSIS_CM_CAP_SACM2HOP_SUP      0x17
5049 #define DOCSIS_CM_CAP_MULTTXCHAN_SUP    0x18
5050 #define DOCSIS_CM_CAP_512USTXCHAN_SUP   0x19
5051 #define DOCSIS_CM_CAP_256USTXCHAN_SUP   0x1a
5052 #define DOCSIS_CM_CAP_TOTALSIDCLU_SUP   0x1b
5053 #define DOCSIS_CM_CAP_SIDCLUPERSF_SUP   0x1c
5054 #define DOCSIS_CM_CAP_MULTRXCHAN_SUP    0x1d
5055 #define DOCSIS_CM_CAP_TOTALDSID_SUP     0x1e
5056 #define DOCSIS_CM_CAP_RESEQDSID_SUP     0x1f
5057 #define DOCSIS_CM_CAP_MULTDSID_SUP      0x20
5058 #define DOCSIS_CM_CAP_MULTDSIDFW_SUP    0x21
5059 #define DOCSIS_CM_CAP_FCTF_SUP          0x22
5060 #define DOCSIS_CM_CAP_DPV_SUP           0x23
5061 #define DOCSIS_CM_CAP_UGSPERUSFLOW_SUP  0x24
5062 #define DOCSIS_CM_CAP_MAPUCDRECEIPT_SUP 0x25
5063 #define DOCSIS_CM_CAP_USDROPCLASSIF_SUP 0x26
5064 #define DOCSIS_CM_CAP_IPV6_SUP          0x27
5065 #define DOCSIS_CM_CAP_ExUsTrPow         0x28
5066 #define DOCSIS_CM_CAP_Opt802MPLSSup             0x29
5067 #define DOCSIS_CM_CAP_DounEnc           0x2a
5068 #define DOCSIS_CM_CAP_EnrgMang          0x2c
5069
5070 static const value_string docsis_cm_cap_type_vals[] = {
5071         { DOCSIS_CM_CAP_CONCAT_SUP,             "Concatenation Support" },
5072         { DOCSIS_CM_CAP_DOCSIS_VER,             "DOCSIS Version" },
5073         { DOCSIS_CM_CAP_FRAG_SUP,               "Fragmentation Support" },
5074         { DOCSIS_CM_CAP_PHS_SUP,                "Payload Header Suppression Support" },
5075         { DOCSIS_CM_CAP_IGMP_SUP,               "IGMP Support" },
5076         { DOCSIS_CM_CAP_PRIV_SUP,               "Privacy Support" },
5077         { DOCSIS_CM_CAP_DSAID_SUP,              "Downstream SAID Support" },
5078         { DOCSIS_CM_CAP_USSF_SUP,               "Upstream Service Flow Support" },
5079         { DOCSIS_CM_CAP_FILT_SUP,               "Optional Filtering Support" },
5080         { DOCSIS_CM_CAP_TET_MI,                 "Transmit Equalizer Taps per Modulation Interval" },
5081         { DOCSIS_CM_CAP_TET,                    "Number of Transmit Equalizer Taps" },
5082         { DOCSIS_CM_CAP_DCC_SUP,                "DCC Support" },
5083         { DOCSIS_CM_CAP_IPFILT_SUP,             "IP Filters Support" },
5084         { DOCSIS_CM_CAP_LLCFILT_SUP,            "LLC Filters Support" },
5085         { DOCSIS_CM_CAP_EXPUNI_SPACE,           "Expanded Unicast SID Space" },
5086         { DOCSIS_CM_CAP_RNGHLDOFF_SUP,          "Ranging Hold-Off Support" },
5087         { DOCSIS_CM_CAP_L2VPN_SUP,              "L2VPN Capability" },
5088         { DOCSIS_CM_CAP_L2VPN_HOST_SUP,         "L2VPN eSAFE Host Capability" },
5089         { DOCSIS_CM_CAP_DUTFILT_SUP,            "Downstream Unencrypted Traffic (DUT) Filtering" },
5090         { DOCSIS_CM_CAP_USFREQRNG_SUP,          "Upstream Frequency Range Support" },
5091         { DOCSIS_CM_CAP_USSYMRATE_SUP,          "Upstream Symbol Rate Support" },
5092         { DOCSIS_CM_CAP_SACM2_SUP,              "Selectable Active Code Mode 2 Support" },
5093         { DOCSIS_CM_CAP_SACM2HOP_SUP,           "Code Hopping Mode 2 Support" },
5094         { DOCSIS_CM_CAP_MULTTXCHAN_SUP,         "Multiple Transmit Channel Support" },
5095         { DOCSIS_CM_CAP_512USTXCHAN_SUP,        "5.12 Msps Upstream Transmit Channel Support" },
5096         { DOCSIS_CM_CAP_256USTXCHAN_SUP,        "2.56 Msps Upstream Transmit Channel Support" },
5097         { DOCSIS_CM_CAP_TOTALSIDCLU_SUP,        "Total SID Cluster Support" },
5098         { DOCSIS_CM_CAP_SIDCLUPERSF_SUP,        "SID Clusters per Service Flow Support" },
5099         { DOCSIS_CM_CAP_MULTRXCHAN_SUP,         "Multiple Receive Channel Support" },
5100         { DOCSIS_CM_CAP_TOTALDSID_SUP,          "Total Downstream Service ID (DSID) Support" },
5101         { DOCSIS_CM_CAP_RESEQDSID_SUP,          "Resequencing Downstream Service ID (DSID) Support" },
5102         { DOCSIS_CM_CAP_MULTDSID_SUP,           "Multicast Downstream Service ID (DSID) Support" },
5103         { DOCSIS_CM_CAP_MULTDSIDFW_SUP,         "Multicast DSID Forwarding" },
5104         { DOCSIS_CM_CAP_FCTF_SUP,               "Frame Control Type Forwarding Capability" },
5105         { DOCSIS_CM_CAP_DPV_SUP,                "DPV Capability" },
5106         { DOCSIS_CM_CAP_UGSPERUSFLOW_SUP,       "Unsolicited Grant Service/Upstream Service Flow Support" },
5107         { DOCSIS_CM_CAP_MAPUCDRECEIPT_SUP,      "MAP and UCD Receipt Support" },
5108         { DOCSIS_CM_CAP_USDROPCLASSIF_SUP,      "Upstream Drop Classifier Support" },
5109         { DOCSIS_CM_CAP_IPV6_SUP,               "IPv6 Support" },
5110         { DOCSIS_CM_CAP_ExUsTrPow,              "Extended Upstream Transmit Power Capability (1/4 dB)" },
5111         { DOCSIS_CM_CAP_Opt802MPLSSup,          "Optional 802.1ad, 802.1ah, MPLS Classification Support" },
5112         { DOCSIS_CM_CAP_DounEnc,                "D-ONU Capabilities Encoding" },
5113         { DOCSIS_CM_CAP_EnrgMang,               "Energy Management Capabilities" },
5114         { 0, NULL }
5115 };
5116
5117 static const value_string docsis_cm_cap_supported_vals[] = {
5118         { 0x00, "Not Support" },
5119         { 0x01, "Supported" },
5120         { 0,            NULL }
5121 };
5122
5123 static const value_string docsis_cm_cap_version_vals[] = {
5124         { 0x00, "DOCSIS 1.0" },
5125         { 0x01, "DOCSIS 1.1" },
5126         { 0x02, "DOCSIS 2.0" },
5127         { 0x03, "DOCSIS 3.0" },
5128         { 0,            NULL }
5129 };
5130
5131 static const value_string docsis_cm_cap_privacy_vals[] = {
5132         { 0x00, "BPI Support" },
5133         { 0x01, "BPI Plus Support" },
5134         { 0,            NULL }
5135 };
5136
5137 static int hf_bootp_docsis_cm_cap_ranging_hold_off_cm = -1;
5138 static int hf_bootp_docsis_cm_cap_ranging_hold_off_eps = -1;
5139 static int hf_bootp_docsis_cm_cap_ranging_hold_off_emta = -1;
5140 static int hf_bootp_docsis_cm_cap_ranging_hold_off_dsg = -1;
5141
5142 static const value_string docsis_cm_cap_l2vpn_vals[] = {
5143         { 0x00, "CM not compliant with DOCSIS L2VPN Section 7 (default)" },
5144         { 0x01, "CM compliant with DOCSIS L2VPN Section 7" },
5145         { 0,            NULL }
5146 };
5147
5148 static const value_string docsis_cm_cap_filt_vals[] = {
5149         { 0x00, "802.1P Filtering" },
5150         { 0x01, "802.1Q Filtering" },
5151         { 0,            NULL }
5152 };
5153
5154 static int hf_bootp_docsis_cm_cap_mpls_stpid = -1;
5155 static int hf_bootp_docsis_cm_cap_mpls_svid = -1;
5156 static int hf_bootp_docsis_cm_cap_mpls_spcp = -1;
5157 static int hf_bootp_docsis_cm_cap_mpls_sdei = -1;
5158 static int hf_bootp_docsis_cm_cap_mpls_ctpid = -1;
5159 static int hf_bootp_docsis_cm_cap_mpls_cvid = -1;
5160 static int hf_bootp_docsis_cm_cap_mpls_cpcp = -1;
5161 static int hf_bootp_docsis_cm_cap_mpls_ccfi = -1;
5162 static int hf_bootp_docsis_cm_cap_mpls_stci = -1;
5163 static int hf_bootp_docsis_cm_cap_mpls_ctci = -1;
5164 static int hf_bootp_docsis_cm_cap_mpls_itpid = -1;
5165 static int hf_bootp_docsis_cm_cap_mpls_isid = -1;
5166 static int hf_bootp_docsis_cm_cap_mpls_itci = -1;
5167 static int hf_bootp_docsis_cm_cap_mpls_ipcp = -1;
5168 static int hf_bootp_docsis_cm_cap_mpls_idei = -1;
5169 static int hf_bootp_docsis_cm_cap_mpls_iuca = -1;
5170 static int hf_bootp_docsis_cm_cap_mpls_btpid = -1;
5171 static int hf_bootp_docsis_cm_cap_mpls_btci = -1;
5172 static int hf_bootp_docsis_cm_cap_mpls_bpcp = -1;
5173 static int hf_bootp_docsis_cm_cap_mpls_bdei = -1;
5174 static int hf_bootp_docsis_cm_cap_mpls_bvid = -1;
5175 static int hf_bootp_docsis_cm_cap_mpls_bda = -1;
5176 static int hf_bootp_docsis_cm_cap_mpls_bsa = -1;
5177 static int hf_bootp_docsis_cm_cap_mpls_tc = -1;
5178 static int hf_bootp_docsis_cm_cap_mpls_label = -1;
5179
5180 static const value_string docsis_cm_cap_enrgmang_vals[] = {
5181         { 0x00, "Energy Management 1x1 Feature" },
5182         { 0,            NULL }
5183 };
5184
5185 static const value_string docsis_cm_cap_usfreqrng_vals[] = {
5186         { 0x00, "Standard Upstream Frequency Range" },
5187         { 0x01, "Standard Upstream Frequency Range and Extended Upstream Frequency Range" },
5188         { 0,            NULL }
5189 };
5190
5191 static const value_string docsis_cm_cap_map_ucd_receipt_vals[] = {
5192         { 0x00, "CM cannot support the receipt of MAPs and UCDs on downstreams other than the Primary Downstream Channel" },
5193         { 0x01, "CM can support the receipt of MAPs and UCDs on downstreams other than the Primary Downstream Channel" },
5194         { 0,            NULL }
5195 };
5196
5197 static const value_string docsis_cm_cap_map_dpv_support_vals[] = {
5198         { 0x00, "U1 supported as a Start Reference Point for DPV per Path" },
5199         { 0x01, "U1 supported as a Start Reference Point for DPV per Packet" },
5200         { 0,            NULL }
5201 };
5202
5203 static const value_string docsis_cm_cap_map_multDsidForward_support_vals[] = {
5204         { 0x00, "No support for multicast DSID forwarding" },
5205         { 0x01, "Support for GMAC explicit multicast DSID forwarding" },
5206         { 0x02, "Support for GMAC promiscuous multicast DSID forwarding" },
5207         { 0,            NULL }
5208 };
5209
5210 static const value_string docsis_cm_cap_map_fctfc_support_vals[] = {
5211         { 0x00, "Isolation Packet PDU MAC Header (FC_Type of 10) is not forwarded" },
5212         { 0x01, "Isolation Packet PDU MAC Header (FC_Type of 10) is forwarded" },
5213         { 0,            NULL }
5214 };
5215
5216 static const value_string docsis_cm_cap_map_l2vpn_esafe_index_support_vals[] = {
5217         { 0x01, "ePs or eRouter" },
5218         { 0x10, "eMTA" },
5219         { 0x11, "eSTB-IP" },
5220         { 0x12, "eSTB-DSG" },
5221         { 0x13, "eTEA" },
5222         { 0,            NULL }
5223 };
5224
5225 static int hf_bootp_docsis_cm_cap_ussymrate_160 = -1;
5226 static int hf_bootp_docsis_cm_cap_ussymrate_320 = -1;
5227 static int hf_bootp_docsis_cm_cap_ussymrate_640 = -1;
5228 static int hf_bootp_docsis_cm_cap_ussymrate_1280 = -1;
5229 static int hf_bootp_docsis_cm_cap_ussymrate_2560 = -1;
5230 static int hf_bootp_docsis_cm_cap_ussymrate_5120 = -1;
5231
5232 static void
5233 display_uint_with_range_checking(proto_item *ti, guint8 val_byte, guint16 val_uint16, int min_value, int max_value)
5234 {
5235         guint16 value;
5236
5237         if (0 != val_byte)
5238         {
5239                 value = val_byte;
5240         }
5241         else
5242         {
5243                 value = val_uint16;
5244         }
5245         proto_item_append_text(ti, "%i", value);
5246         if ((value < min_value) ||
5247             (value > max_value))
5248         {
5249                 proto_item_append_text(ti, " (Value Out-of-Range [%i..%i])", min_value, max_value);
5250         }
5251 }
5252
5253 static void get_opt125_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlvlen, guint8 **value)
5254 {
5255         /* Type */
5256         *tlvtype = tvb_get_guint8(tvb, off);
5257         /* Length */
5258         *tlvlen  = tvb_get_guint8(tvb, off+1);
5259         /* Value */
5260         *value = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, off + 2, *tlvlen);
5261 }
5262
5263 static void get_opt60_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlvlen, guint8 **value)
5264 {
5265         guint   i;
5266         guint8 *val_asc;
5267
5268         val_asc = (guint8 *)wmem_alloc0(wmem_packet_scope(), 4);
5269         /* Type */
5270         tvb_memcpy(tvb, val_asc, off, 2);
5271         *tlvtype = (guint8)strtoul((gchar*)val_asc, NULL, 16);
5272         /* Length */
5273         tvb_memcpy(tvb, val_asc, off + 2, 2);
5274         *tlvlen = (guint8)strtoul((gchar*)val_asc, NULL, 16);
5275         /* Value */
5276         *value = (guint8 *)wmem_alloc0(wmem_packet_scope(), *tlvlen);
5277         for (i=0; i<*tlvlen; i++)
5278         {
5279                 memset(val_asc, 0, 4);
5280                 tvb_memcpy(tvb, val_asc, off + ((i*2) + 4), 2);
5281                 (*value)[i] = (guint8)strtoul((gchar*)val_asc, NULL, 16);
5282         }
5283 }
5284
5285 static void
5286 dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboolean opt125)
5287 {
5288         guint8     *asc_val;
5289         proto_item *ti;
5290         proto_tree *subtree;
5291         guint8      tlv_type;
5292         guint8      tlv_len;
5293         guint8      val_byte   = 0;
5294         guint16     val_uint16 = 0;
5295         guint8     *val_other  = NULL;
5296         guint       off        = voff;
5297
5298         asc_val = (guint8*)wmem_alloc0(wmem_packet_scope(), 4);
5299
5300         if (opt125)
5301         {
5302                 /* Option 125 is formatted as uint8's */
5303                 /* Type */
5304                 tlv_type = tvb_get_guint8(tvb, off);
5305                 /* Length */
5306                 tlv_len  = tvb_get_guint8(tvb, off+1);
5307                 proto_tree_add_uint(v_tree, hf_bootp_docsis_cm_cap_len, tvb, off+1, 1, tlv_len);
5308         }
5309         else
5310         {
5311                 /* Option 60 is formatted as an ASCII string.
5312                    Since the capabilities are the same for both options
5313                    I am converting the Option 60 values from ASCII to
5314                    uint8s to allow the same parser to work for both */
5315                 off += DOCSIS_CM_CAP_TLV_OFF;
5316                 tvb_memcpy (tvb, asc_val, off, 2);
5317                 tlv_len = (guint8)strtoul((gchar*)asc_val, NULL, 16);
5318                 proto_tree_add_uint_format_value(v_tree, hf_bootp_docsis_cm_cap_len, tvb, off+2, 2,
5319                                                  tlv_len, "%d", tlv_len);
5320         }
5321
5322         off+=2;
5323
5324         while (off - ((guint) voff) < ((guint) len))
5325         {
5326                 tlv_type = 0;
5327                 tlv_len = 0;
5328                 val_byte = 0;
5329                 val_uint16 = 0;
5330
5331                 if (opt125)
5332                 {
5333                         get_opt125_tlv(tvb, off, &tlv_type, &tlv_len, &val_other);
5334                         ti =  proto_tree_add_uint_format(v_tree, hf_bootp_docsis_cm_cap_type, tvb, off,
5335                                                          tlv_len + 2,
5336                                                          tlv_type,
5337                                                          "0x%02x: %s = ",
5338                                                          tlv_type,
5339                                                          val_to_str_const(tlv_type, docsis_cm_cap_type_vals, "unknown"));
5340                 }
5341                 else
5342                 {
5343                         /* Option 60 is formatted as an ASCII string.  Since the capabilities
5344                            are the same for both options I am converting the Option 60 values
5345                            from ASCII to uint8s to allow the same parser to work for both */
5346                         get_opt60_tlv(tvb, off, &tlv_type, &tlv_len, &val_other);
5347                         ti =  proto_tree_add_uint_format(v_tree, hf_bootp_docsis_cm_cap_type, tvb, off,
5348                                                          (tlv_len * 2) + 4,
5349                                                          tlv_type,
5350                                                          "0x%02x: %s = ",
5351                                                          tlv_type,
5352                                                          val_to_str_const(tlv_type, docsis_cm_cap_type_vals, "unknown"));
5353                 }
5354
5355                 if (tlv_len == 1)
5356                 {
5357                         /* The value refers to a byte. */
5358                         val_byte = val_other[0];
5359                 }
5360                 else
5361                 {
5362                         if (tlv_len == 2)
5363                         {
5364                                 /* The value refers to a uint16. */
5365                                 val_uint16 = (val_other[0] << 8) + val_other[1];
5366                         }
5367                 }
5368
5369                 switch (tlv_type)
5370                 {
5371                 case DOCSIS_CM_CAP_CONCAT_SUP:
5372                 case DOCSIS_CM_CAP_FRAG_SUP:
5373                 case DOCSIS_CM_CAP_PHS_SUP:
5374                 case DOCSIS_CM_CAP_IGMP_SUP:
5375                 case DOCSIS_CM_CAP_DCC_SUP:
5376                 case DOCSIS_CM_CAP_EXPUNI_SPACE:
5377                 case DOCSIS_CM_CAP_DUTFILT_SUP:
5378                 case DOCSIS_CM_CAP_SACM2_SUP:
5379                 case DOCSIS_CM_CAP_SACM2HOP_SUP:
5380                 case DOCSIS_CM_CAP_IPV6_SUP:
5381                         proto_item_append_text(ti,
5382                                                "%s",
5383                                                val_to_str_const(val_byte, docsis_cm_cap_supported_vals, "Reserved"));
5384                         break;
5385                 case DOCSIS_CM_CAP_DOCSIS_VER:
5386                         proto_item_append_text(ti,
5387                                                "%s",
5388                                                val_to_str_const(val_byte, docsis_cm_cap_version_vals, "Reserved"));
5389                         break;
5390                 case DOCSIS_CM_CAP_PRIV_SUP:
5391                         proto_item_append_text(ti,
5392                                                "%s",
5393                                                val_to_str_const(val_byte, docsis_cm_cap_privacy_vals, "Reserved"));
5394                         break;
5395                 case DOCSIS_CM_CAP_FILT_SUP:
5396                         proto_item_append_text(ti,
5397                                                "%s",
5398                                                val_to_str_const(val_byte, docsis_cm_cap_filt_vals, "Reserved"));
5399                         break;
5400                 case DOCSIS_CM_CAP_L2VPN_SUP:
5401                         proto_item_append_text(ti,
5402                                                "%s",
5403                                                val_to_str_const(val_byte, docsis_cm_cap_l2vpn_vals, "Reserved"));
5404                         break;
5405                 case DOCSIS_CM_CAP_L2VPN_HOST_SUP:
5406                         if (tlv_len == 7) {
5407                                 proto_item_append_text(ti,
5408                                                        "eSAFE ifIndex %s (%i)/eSAFE MAC %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
5409                                                        val_to_str_const(val_other[0], docsis_cm_cap_map_l2vpn_esafe_index_support_vals, "Reserved"),
5410                                                        val_other[0],
5411                                                        val_other[1],
5412                                                        val_other[2],
5413                                                        val_other[3],
5414                                                        val_other[4],
5415                                                        val_other[5],
5416                                                        val_other[6]);
5417                         } else {
5418                                 proto_item_append_text(ti,
5419                                                        "Invalid (length should be 7, is %d)",
5420                                                        tlv_len);
5421                         }
5422                         break;
5423                 case DOCSIS_CM_CAP_USFREQRNG_SUP:
5424                         proto_item_append_text(ti,
5425                                                "%s",
5426                                                val_to_str_const(val_byte, docsis_cm_cap_usfreqrng_vals, "Reserved"));
5427                         break;
5428                 case DOCSIS_CM_CAP_MAPUCDRECEIPT_SUP:
5429                         proto_item_append_text(ti,
5430                                                "%s",
5431                                                val_to_str_const(val_byte, docsis_cm_cap_map_ucd_receipt_vals, "Reserved"));
5432                         break;
5433                 case DOCSIS_CM_CAP_DPV_SUP:
5434                         proto_item_append_text(ti,
5435                                                "%s",
5436                                                val_to_str_const(val_byte, docsis_cm_cap_map_dpv_support_vals, "Reserved"));
5437                         break;
5438                 case DOCSIS_CM_CAP_DSAID_SUP:
5439                 case DOCSIS_CM_CAP_MULTTXCHAN_SUP:
5440                 case DOCSIS_CM_CAP_512USTXCHAN_SUP:
5441                 case DOCSIS_CM_CAP_256USTXCHAN_SUP:
5442                 case DOCSIS_CM_CAP_TOTALSIDCLU_SUP:
5443                 case DOCSIS_CM_CAP_MULTRXCHAN_SUP:
5444                 case DOCSIS_CM_CAP_UGSPERUSFLOW_SUP:
5445                 case DOCSIS_CM_CAP_USSF_SUP:
5446                         display_uint_with_range_checking(ti, val_byte, val_uint16, 0, 255);
5447                         break;
5448                 case DOCSIS_CM_CAP_RESEQDSID_SUP:
5449                 case DOCSIS_CM_CAP_MULTDSID_SUP:
5450                         display_uint_with_range_checking(ti, val_byte, val_uint16, 16, 255);
5451                         break;
5452                 case DOCSIS_CM_CAP_SIDCLUPERSF_SUP:
5453                         display_uint_with_range_checking(ti, val_byte, val_uint16, 2, 8);
5454                         break;
5455                 case DOCSIS_CM_CAP_TOTALDSID_SUP:
5456                         display_uint_with_range_checking(ti, val_byte, val_uint16, 32, 255);
5457                         break;
5458                 case DOCSIS_CM_CAP_TET:
5459                         display_uint_with_range_checking(ti, val_byte, val_uint16, 8, 64);
5460                         break;
5461                 case DOCSIS_CM_CAP_TET_MI:
5462                         if ((val_byte == 1) ||
5463                             (val_byte == 2) ||
5464                             (val_byte == 4))
5465                         {
5466                                 proto_item_append_text(ti,
5467                                                        " %i",
5468                                                        val_byte);
5469                         }
5470                         else
5471                         {
5472                                 proto_item_append_text(ti,
5473                                                        " (Invalid Value %i : Should be [1,2,4]",
5474                                                        val_byte);
5475                         }
5476                         break;
5477                 case DOCSIS_CM_CAP_IPFILT_SUP:
5478                 case DOCSIS_CM_CAP_USDROPCLASSIF_SUP:
5479                         display_uint_with_range_checking(ti, val_byte, val_uint16, 64, 65535);
5480                         break;
5481                 case DOCSIS_CM_CAP_LLCFILT_SUP:
5482                         display_uint_with_range_checking(ti, val_byte, val_uint16, 10, 65535);
5483                         break;
5484                 case DOCSIS_CM_CAP_ExUsTrPow:
5485                         if (val_byte == 0)
5486                         {
5487                                 proto_item_append_text(ti, "%i", val_byte);
5488                         }
5489                         else
5490                         {
5491                                 display_uint_with_range_checking(ti, val_byte, val_uint16, 205, 244);
5492                         }
5493                         break;
5494                 case DOCSIS_CM_CAP_Opt802MPLSSup:
5495                         proto_item_append_text(ti,
5496                                                "0x%02x", val_byte);
5497                 case DOCSIS_CM_CAP_DounEnc:
5498                         /* TODO: add D-ONU Capabilities Encoding according DPoE-SP-MULPIv1.0-I02-120607 */
5499                         break;
5500                 case DOCSIS_CM_CAP_EnrgMang:
5501                         proto_item_append_text(ti,
5502                                                "%s",
5503                                                val_to_str_const(val_byte, docsis_cm_cap_enrgmang_vals, "Reserved"));
5504                         break;
5505                 case DOCSIS_CM_CAP_RNGHLDOFF_SUP:
5506                         proto_item_append_text(ti,
5507                                                "Ranging ID ");
5508                         if (tlv_len == 4)
5509                         {
5510                                 proto_item_append_text(ti,
5511                                                 "(0x%04x)", (val_other[0] << sizeof(guint8)) + val_other[1]);
5512                                 proto_item_append_text(ti,
5513                                                 " Component Bit Mask ");
5514                                 proto_item_append_text(ti,
5515                                                 "(0x%04x)", (val_other[2] << sizeof(guint8)) + val_other[3]);
5516                         }
5517                         else
5518                         {
5519                                 proto_item_append_text(ti,
5520                                                 " (Invalid Length %u : Should be 4",
5521                                                 tlv_len);
5522                         }
5523                         break;
5524                 case DOCSIS_CM_CAP_USSYMRATE_SUP:
5525                         proto_item_append_text(ti,
5526                                                "0x%02x", val_byte);
5527                         break;
5528                 case DOCSIS_CM_CAP_FCTF_SUP:
5529                         proto_item_append_text(ti,
5530                                                "%s",
5531                                                val_to_str_const(val_byte, docsis_cm_cap_map_fctfc_support_vals, "Reserved"));
5532                         break;
5533                 case DOCSIS_CM_CAP_MULTDSIDFW_SUP:
5534                         proto_item_append_text(ti,
5535                                                "%s",
5536                                                val_to_str_const(val_byte, docsis_cm_cap_map_multDsidForward_support_vals, "Reserved"));
5537                         break;
5538                 }
5539
5540                 subtree = proto_item_add_subtree(ti, ett_bootp_option);
5541                 if (tlv_type == DOCSIS_CM_CAP_RNGHLDOFF_SUP && tlv_len >= 4)
5542                 {
5543                         const int * flags[] = {
5544                                 &hf_bootp_docsis_cm_cap_ranging_hold_off_cm,
5545                                 &hf_bootp_docsis_cm_cap_ranging_hold_off_eps,
5546                                 &hf_bootp_docsis_cm_cap_ranging_hold_off_emta,
5547                                 &hf_bootp_docsis_cm_cap_ranging_hold_off_dsg,
5548                                 NULL
5549                         };
5550                         val_uint16 = (val_other[2] << sizeof(guint8)) + val_other[3];
5551
5552                         proto_tree_add_bitmask_list_value(subtree, tvb, off + 2, 4, flags, val_uint16);
5553                 }
5554                 if (tlv_type == DOCSIS_CM_CAP_USSYMRATE_SUP)
5555                 {
5556                         const int * flags[] = {
5557                                 &hf_bootp_docsis_cm_cap_ussymrate_160,
5558                                 &hf_bootp_docsis_cm_cap_ussymrate_320,
5559                                 &hf_bootp_docsis_cm_cap_ussymrate_640,
5560                                 &hf_bootp_docsis_cm_cap_ussymrate_1280,
5561                                 &hf_bootp_docsis_cm_cap_ussymrate_2560,
5562                                 &hf_bootp_docsis_cm_cap_ussymrate_5120,
5563                                 NULL
5564                         };
5565
5566                         proto_tree_add_bitmask_list_value(subtree, tvb, off + 2, 1, flags, val_byte);
5567                 }
5568                 if (tlv_type == DOCSIS_CM_CAP_Opt802MPLSSup && tlv_len >= 4)
5569                 {
5570                         const int * flags[] = {
5571                                 &hf_bootp_docsis_cm_cap_mpls_stpid,
5572                                 &hf_bootp_docsis_cm_cap_mpls_svid,
5573                                 &hf_bootp_docsis_cm_cap_mpls_spcp,
5574                                 &hf_bootp_docsis_cm_cap_mpls_sdei,
5575                                 &hf_bootp_docsis_cm_cap_mpls_ctpid,
5576                                 &hf_bootp_docsis_cm_cap_mpls_cvid,
5577                                 &hf_bootp_docsis_cm_cap_mpls_cpcp,
5578                                 &hf_bootp_docsis_cm_cap_mpls_ccfi,
5579                                 &hf_bootp_docsis_cm_cap_mpls_stci,
5580                                 &hf_bootp_docsis_cm_cap_mpls_ctci,
5581                                 &hf_bootp_docsis_cm_cap_mpls_itpid,
5582                                 &hf_bootp_docsis_cm_cap_mpls_isid,
5583                                 &hf_bootp_docsis_cm_cap_mpls_itci,
5584                                 &hf_bootp_docsis_cm_cap_mpls_ipcp,
5585                                 &hf_bootp_docsis_cm_cap_mpls_idei,
5586                                 &hf_bootp_docsis_cm_cap_mpls_iuca,
5587                                 &hf_bootp_docsis_cm_cap_mpls_btpid,
5588                                 &hf_bootp_docsis_cm_cap_mpls_btci,
5589                                 &hf_bootp_docsis_cm_cap_mpls_bpcp,
5590                                 &hf_bootp_docsis_cm_cap_mpls_bdei,
5591                                 &hf_bootp_docsis_cm_cap_mpls_bvid,
5592                                 &hf_bootp_docsis_cm_cap_mpls_bda,
5593                                 &hf_bootp_docsis_cm_cap_mpls_bsa,
5594                                 &hf_bootp_docsis_cm_cap_mpls_tc,
5595                                 &hf_bootp_docsis_cm_cap_mpls_label,
5596                                 NULL
5597                         };
5598                         val_uint16 = (val_other[2] << sizeof(guint8)) + val_other[3];
5599
5600                         proto_tree_add_bitmask_list_value(subtree, tvb, off + 2, 4, flags, val_uint16);
5601                 }
5602                 if (opt125)
5603                 {
5604                         off += (tlv_len) + 2;
5605                 }
5606                 else
5607                 {
5608                         off += (tlv_len *2) + 4;
5609                 }
5610
5611         }
5612 }
5613
5614 static gboolean
5615 dissect_packetcable_cm_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_ )
5616 {
5617         guint8* vendor_id;
5618
5619         if (tvb_reported_length(tvb) < 10) {
5620                 return FALSE;
5621         }
5622
5623         vendor_id = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 10, ENC_ASCII|ENC_NA);
5624         if ((strcmp((const char*)vendor_id, PACKETCABLE_CM_CAP11) == 0) ||
5625                 (strcmp((const char*)vendor_id, PACKETCABLE_CM_CAP20) == 0)) {
5626                 dissect_docsis_cm_cap(tree, tvb, 0, tvb_reported_length(tvb), FALSE);
5627                 return TRUE;
5628         }
5629
5630         if ((strcmp((const char*)vendor_id, PACKETCABLE_CM_CAP30) == 0)) {
5631                 proto_tree_add_item(tree, hf_bootp_option_vendor_class_data, tvb, 0, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
5632                 return TRUE;
5633         }
5634
5635         return FALSE;
5636 }
5637
5638 static gboolean
5639 dissect_packetcable_bsdpd_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_ )
5640 {
5641         int vendor_id_len = (int)strlen(PACKETCABLE_BSDPD);
5642         if ((int)tvb_reported_length(tvb) < vendor_id_len) {
5643                 return FALSE;
5644         }
5645
5646         if (tvb_memeql(tvb, 0, (const guint8*)PACKETCABLE_BSDPD, vendor_id_len) == 0 ) {
5647                 proto_tree_add_item(tree, hf_bootp_option_vendor_class_data, tvb, vendor_id_len, tvb_reported_length_remaining(tvb, vendor_id_len), ENC_ASCII|ENC_NA);
5648                 return TRUE;
5649         }
5650
5651         return FALSE;
5652 }
5653
5654
5655 /* Definitions specific to PKT-SP-PROV-I05-021127 begin with "PKT_CCC_I05".
5656    Definitions specific to IETF draft 5 and RFC 3495 begin with "PKT_CCC_IETF".
5657    Shared definitions begin with "PKT_CCC".
5658  */
5659 #define PKT_CCC_PRI_DHCP       1
5660 #define PKT_CCC_SEC_DHCP       2
5661 #define PKT_CCC_I05_SNMP       3
5662 #define PKT_CCC_IETF_PROV_SRV  3
5663 #define PKT_CCC_I05_PRI_DNS    4
5664 #define PKT_CCC_IETF_AS_KRB    4
5665 #define PKT_CCC_I05_SEC_DNS    5
5666 #define PKT_CCC_IETF_AP_KRB    5
5667 #define PKT_CCC_KRB_REALM      6
5668 #define PKT_CCC_TGT_FLAG       7
5669 #define PKT_CCC_PROV_TIMER     8
5670 #define PKT_CCC_CMS_FQDN       9
5671 #define PKT_CCC_IETF_SEC_TKT   9
5672 #define PKT_CCC_AS_KRB        10
5673 #define PKT_CCC_AP_KRB        11
5674 #define PKT_CCC_MTA_KRB_CLEAR 12
5675
5676 static const value_string pkt_i05_ccc_opt_vals[] = {
5677         { PKT_CCC_PRI_DHCP,             "Primary DHCP Server" },
5678         { PKT_CCC_SEC_DHCP,             "Secondary DHCP Server" },
5679         { PKT_CCC_I05_SNMP,             "SNMP Entity" },
5680         { PKT_CCC_I05_PRI_DNS,          "Primary DNS Server" },
5681         { PKT_CCC_I05_SEC_DNS,          "Secondary DNS Server" },
5682         { PKT_CCC_KRB_REALM,            "Kerberos Realm" },
5683         { PKT_CCC_TGT_FLAG,             "MTA should fetch TGT?" },
5684         { PKT_CCC_PROV_TIMER,           "Provisioning Timer" },
5685         { PKT_CCC_CMS_FQDN,             "CMS FQDN" },
5686         { PKT_CCC_AS_KRB,               "AS-REQ/AS-REP Backoff and Retry" },
5687         { PKT_CCC_AP_KRB,               "AP-REQ/AP-REP Backoff and Retry" },
5688         { PKT_CCC_MTA_KRB_CLEAR,        "MTA should clear Kerberos tickets?" },
5689         { 0, NULL },
5690 };
5691
5692 static const value_string pkt_draft5_ccc_opt_vals[] = {
5693         { PKT_CCC_PRI_DHCP,             "TSP's Primary DHCP Server" },
5694         { PKT_CCC_SEC_DHCP,             "TSP's Secondary DHCP Server" },
5695         { PKT_CCC_IETF_PROV_SRV,        "TSP's Provisioning Server" },
5696         { PKT_CCC_IETF_AS_KRB,          "TSP's AS-REQ/AS-REP Backoff and Retry" },
5697         { PKT_CCC_IETF_AP_KRB,          "TSP's AP-REQ/AP-REP Backoff and Retry" },
5698         { PKT_CCC_KRB_REALM,            "TSP's Kerberos Realm Name" },
5699         { PKT_CCC_TGT_FLAG,             "TSP's Ticket Granting Server Utilization" },
5700         { PKT_CCC_PROV_TIMER,           "TSP's Provisioning Timer Value" },
5701         { PKT_CCC_IETF_SEC_TKT,         "PacketCable Security Ticket Control" },
5702         { 0, NULL },
5703 };
5704
5705 static const value_string pkt_i05_ccc_ticket_ctl_vals[] = {
5706         { 1, "Invalidate Provisioning Application Server's ticket" },
5707         { 2, "Invalidate all CMS Application Server tickets" },
5708         { 3, "Invalidate all Application Server tickets" },
5709         { 0, NULL },
5710 };
5711
5712 static int
5713 dissect_packetcable_i05_ccc(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
5714                             tvbuff_t *tvb, int optoff, int optend)
5715 {
5716         int         suboptoff = optoff;
5717         guint8      subopt, subopt_len, fetch_tgt, timer_val, ticket_ctl;
5718         proto_tree *pkt_s_tree;
5719         proto_item *vti;
5720
5721         subopt = tvb_get_guint8(tvb, optoff);
5722         suboptoff++;
5723
5724         if (suboptoff >= optend) {
5725                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
5726                                                                         "Suboption %d: no room left in option for suboption length", subopt);
5727                 return (optend);
5728         }
5729
5730         subopt_len = tvb_get_guint8(tvb, optoff);
5731         suboptoff++;
5732
5733         vti = proto_tree_add_uint(v_tree, hf_bootp_pc_i05_ccc_suboption, tvb, optoff, 1, subopt);
5734         proto_item_set_len(vti, subopt_len + 2);
5735         proto_item_append_text(vti, ": ");
5736
5737         switch (subopt) {
5738
5739         case PKT_CCC_PRI_DHCP:  /* String values */
5740         case PKT_CCC_SEC_DHCP:
5741         case PKT_CCC_I05_SNMP:
5742         case PKT_CCC_I05_PRI_DNS:
5743         case PKT_CCC_I05_SEC_DNS:
5744         case PKT_CCC_KRB_REALM:
5745         case PKT_CCC_CMS_FQDN:
5746                 proto_item_append_text(vti, "%s (%u byte%s)",
5747                                        tvb_format_stringzpad(tvb, suboptoff, subopt_len),
5748                                        subopt_len,
5749                                        plurality(subopt_len, "", "s") );
5750                 suboptoff += subopt_len;
5751                 break;
5752
5753         case PKT_CCC_TGT_FLAG:
5754                 if (suboptoff+1 > optend) {
5755                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5756                         return (optend);
5757                 }
5758                 fetch_tgt = tvb_get_guint8(tvb, suboptoff);
5759                 proto_item_append_text(vti, "%s (%u byte%s%s)",
5760                                        fetch_tgt ? "Yes" : "No",
5761                                        subopt_len,
5762                                        plurality(subopt_len, "", "s"),
5763                                        subopt_len != 1 ? " [Invalid]" : "");
5764                 suboptoff += subopt_len;
5765                 break;
5766
5767         case PKT_CCC_PROV_TIMER:
5768                 if (suboptoff+1 > optend) {
5769                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5770                         return (optend);
5771                 }
5772                 timer_val = tvb_get_guint8(tvb, suboptoff);
5773                 proto_item_append_text(vti, "%u%s (%u byte%s%s)", timer_val,
5774                                        timer_val > 30 ? " [Invalid]" : "",
5775                                        subopt_len,
5776                                        plurality(subopt_len, "", "s"),
5777                                        subopt_len != 1 ? " [Invalid]" : "");
5778                 suboptoff += subopt_len;
5779                 break;
5780
5781         case PKT_CCC_AS_KRB:
5782                 if (suboptoff+12 > optend) {
5783                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5784                         return (optend);
5785                 }
5786                 proto_item_append_text(vti, "(%u byte%s%s)", subopt_len,
5787                                        plurality(subopt_len, "", "s"),
5788                                        subopt_len != 12 ? " [Invalid]" : "");
5789                 if (subopt_len == 12) {
5790                         pkt_s_tree = proto_item_add_subtree(vti, ett_bootp_option);
5791                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_realm_unc_key_nom_timeout, tvb, suboptoff, 4, ENC_BIG_ENDIAN);
5792                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_timeout, tvb, suboptoff + 4, 4, ENC_BIG_ENDIAN);
5793                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_retries, tvb, suboptoff + 8, 4, ENC_BIG_ENDIAN);
5794                 }
5795                 suboptoff += subopt_len;
5796                 break;
5797
5798         case PKT_CCC_AP_KRB:
5799                 if (suboptoff+12 > optend) {
5800                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5801                         return (optend);
5802                 }
5803                 proto_item_append_text(vti, "(%u byte%s%s)", subopt_len,
5804                                        plurality(subopt_len, "", "s"),
5805                                        subopt_len != 12 ? " [Invalid]" : "");
5806                 if (subopt_len == 12) {
5807                         pkt_s_tree = proto_item_add_subtree(vti, ett_bootp_option);
5808                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_prov_unc_key_nom_timeout, tvb, suboptoff + 8, 4, ENC_BIG_ENDIAN);
5809                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_timeout, tvb, suboptoff + 8, 4, ENC_BIG_ENDIAN);
5810                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_retries, tvb, suboptoff + 8, 4, ENC_BIG_ENDIAN);
5811                 }
5812                 suboptoff += subopt_len;
5813                 break;
5814
5815         case PKT_CCC_MTA_KRB_CLEAR:
5816                 if (suboptoff+1 > optend) {
5817                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5818                         return (optend);
5819                 }
5820                 ticket_ctl = tvb_get_guint8(tvb, suboptoff);
5821                 proto_item_append_text(vti, "%s (%u) (%u byte%s%s)",
5822                                        val_to_str_const (ticket_ctl, pkt_i05_ccc_ticket_ctl_vals, "unknown/invalid"),
5823                                        ticket_ctl,
5824                                        subopt_len,
5825                                        plurality(subopt_len, "", "s"),
5826                                        subopt_len != 1 ? " [Invalid]" : "");
5827                 suboptoff += subopt_len;
5828                 break;
5829
5830         default:
5831                 suboptoff += subopt_len;
5832                 break;
5833
5834         }
5835         return suboptoff;
5836 }
5837
5838 static int hf_bootp_ccc_ietf_sec_tkt_pc_provision_server = -1;
5839 static int hf_bootp_ccc_ietf_sec_tkt_all_pc_call_management = -1;
5840
5841 static int
5842 dissect_packetcable_ietf_ccc(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree,
5843                              tvbuff_t *tvb, int optoff, int optend, int revision)
5844 {
5845         int           suboptoff     = optoff;
5846         guint8        subopt, subopt_len;
5847         guint8        prov_type, fetch_tgt, timer_val;
5848         guint16       sec_tcm;
5849         proto_tree   *pkt_s_tree;
5850         proto_item   *vti;
5851         int           max_timer_val = 255;
5852         const guchar *dns_name;
5853         guint         dns_name_len;
5854
5855         subopt = tvb_get_guint8(tvb, suboptoff);
5856         suboptoff++;
5857
5858         if (suboptoff >= optend) {
5859                 expert_add_info_format(pinfo, v_ti, &ei_bootp_missing_subopt_length,
5860                                                                         "Suboption %d: no room left in option for suboption length", subopt);
5861                 return (optend);
5862         }
5863         subopt_len = tvb_get_guint8(tvb, suboptoff);
5864         suboptoff++;
5865
5866         vti = proto_tree_add_uint(v_tree, hf_bootp_pc_ietf_ccc_suboption, tvb, optoff, 1, subopt);
5867         proto_item_set_len(vti, subopt_len + 2);
5868         proto_item_append_text(vti, ": ");
5869
5870         switch (subopt) {
5871
5872         case PKT_CCC_PRI_DHCP:  /* IPv4 values */
5873         case PKT_CCC_SEC_DHCP:
5874                 if (suboptoff+4 > optend) {
5875                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5876                         return (optend);
5877                 }
5878                 proto_item_append_text(vti, "%s (%u byte%s%s)",
5879                                        tvb_ip_to_str(tvb, suboptoff),
5880                                        subopt_len,
5881                                        plurality(subopt_len, "", "s"),
5882                                        subopt_len != 4 ? " [Invalid]" : "");
5883                 suboptoff += subopt_len;
5884                 break;
5885
5886         case PKT_CCC_IETF_PROV_SRV:
5887                 if (suboptoff+1 > optend) {
5888                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5889                         return (optend);
5890                 }
5891                 prov_type = tvb_get_guint8(tvb, suboptoff);
5892                 suboptoff += 1;
5893                 switch (prov_type) {
5894
5895                 case 0:
5896                         get_dns_name(tvb, suboptoff, subopt_len, suboptoff, &dns_name, &dns_name_len);
5897                         proto_item_append_text(vti, "%s (%u byte%s)", format_text(wmem_packet_scope(), dns_name, dns_name_len),
5898                                                subopt_len - 1, plurality(subopt_len, "", "s") );
5899                         break;
5900
5901                 case 1:
5902                         if (suboptoff+4 > optend) {
5903                                 expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5904                                 return (optend);
5905                         }
5906                         proto_item_append_text(vti, "%s (%u byte%s%s)",
5907                                                tvb_ip_to_str(tvb, suboptoff),
5908                                                subopt_len,
5909                                                plurality(subopt_len, "", "s"),
5910                                                subopt_len != 5 ? " [Invalid]" : "");
5911                         break;
5912
5913                 default:
5914                         proto_item_append_text(vti, "Invalid type: %u (%u byte%s)",
5915                                                prov_type,
5916                                                subopt_len,
5917                                                plurality(subopt_len, "", "s") );
5918                         break;
5919                 }
5920                 suboptoff += subopt_len - 1;
5921                 break;
5922
5923         case PKT_CCC_IETF_AS_KRB:
5924                 if (suboptoff+12 > optend) {
5925                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5926                         return (optend);
5927                 }
5928                 proto_item_append_text(vti, "(%u byte%s%s)", subopt_len,
5929                                        plurality(subopt_len, "", "s"),
5930                                        subopt_len != 12 ? " [Invalid]" : "");
5931                 if (subopt_len == 12) {
5932                         pkt_s_tree = proto_item_add_subtree(vti, ett_bootp_option);
5933                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_realm_unc_key_nom_timeout, tvb, suboptoff, 4, ENC_BIG_ENDIAN);
5934                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_timeout, tvb, suboptoff + 4, 4, ENC_BIG_ENDIAN);
5935                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_retries, tvb, suboptoff + 8, 4, ENC_BIG_ENDIAN);
5936                 }
5937                 suboptoff += subopt_len;
5938                 break;
5939
5940         case PKT_CCC_IETF_AP_KRB:
5941                 proto_item_append_text(vti, "(%u byte%s%s)", subopt_len,
5942                                        plurality(subopt_len, "", "s"),
5943                                        subopt_len != 12 ? " [Invalid]" : "");
5944                 if (subopt_len == 12) {
5945                         pkt_s_tree = proto_item_add_subtree(vti, ett_bootp_option);
5946                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_prov_unc_key_nom_timeout, tvb, suboptoff, 4, ENC_BIG_ENDIAN);
5947                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_timeout, tvb, suboptoff + 4, 4, ENC_BIG_ENDIAN);
5948                         proto_tree_add_item(pkt_s_tree, hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_retries, tvb, suboptoff + 8, 4, ENC_BIG_ENDIAN);
5949                 }
5950                 suboptoff += subopt_len;
5951                 break;
5952
5953         case PKT_CCC_KRB_REALM: /* String values */
5954                 get_dns_name(tvb, suboptoff, subopt_len, suboptoff, &dns_name, &dns_name_len);
5955                 proto_item_append_text(vti, "%s (%u byte%s)", format_text(wmem_packet_scope(), dns_name, dns_name_len),
5956                                        subopt_len, plurality(subopt_len, "", "s") );
5957                 suboptoff += subopt_len;
5958                 break;
5959
5960         case PKT_CCC_TGT_FLAG:
5961                 if (suboptoff+1 > optend) {
5962                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5963                         return (optend);
5964                 }
5965                 fetch_tgt = tvb_get_guint8(tvb, suboptoff);
5966                 proto_item_append_text(vti, "%s (%u byte%s%s)",
5967                                        fetch_tgt ? "Yes" : "No",
5968                                        subopt_len,
5969                                        plurality(subopt_len, "", "s"),
5970                                        subopt_len != 1 ? " [Invalid]" : "");
5971                 suboptoff += 1;
5972                 break;
5973
5974         case PKT_CCC_PROV_TIMER:
5975                 if (suboptoff+1 > optend) {
5976                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5977                         return (optend);
5978                 }
5979                 if (revision == PACKETCABLE_CCC_DRAFT5)
5980                         max_timer_val = 30;
5981                 timer_val = tvb_get_guint8(tvb, suboptoff);
5982                 proto_item_append_text(vti, "%u%s (%u byte%s%s)", timer_val,
5983                                        timer_val > max_timer_val ? " [Invalid]" : "",
5984                                        subopt_len,
5985                                        plurality(subopt_len, "", "s"),
5986                                        subopt_len != 1 ? " [Invalid]" : "");
5987                 suboptoff += 1;
5988                 break;
5989
5990         case PKT_CCC_IETF_SEC_TKT:
5991                 if (suboptoff+2 > optend) {
5992                         expert_add_info(pinfo, vti, &ei_bootp_missing_subopt_value);
5993                         return (optend);
5994                 }
5995                 sec_tcm = tvb_get_ntohs(tvb, suboptoff);
5996                 proto_item_append_text(vti, "0x%04x (%u byte%s%s)", sec_tcm, subopt_len,
5997                                        plurality(subopt_len, "", "s"),
5998                                        subopt_len != 2 ? " [Invalid]" : "");
5999                 if (subopt_len == 2) {
6000                         pkt_s_tree = proto_item_add_subtree(vti, ett_bootp_option);
6001                         proto_tree_add_boolean(pkt_s_tree, hf_bootp_ccc_ietf_sec_tkt_pc_provision_server, tvb, suboptoff, 2, sec_tcm);
6002                         proto_tree_add_boolean(pkt_s_tree, hf_bootp_ccc_ietf_sec_tkt_all_pc_call_management, tvb, suboptoff, 2, sec_tcm);
6003                 }
6004                 suboptoff += subopt_len;
6005                 break;
6006
6007         default:
6008                 suboptoff += subopt_len;
6009                 break;
6010         }
6011         return suboptoff;
6012 }
6013
6014 static int
6015 dissect_bootpopt_packetcable_ccc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
6016 {
6017         int offset = 0;
6018
6019         while (tvb_reported_length_remaining(tvb, offset) > 0) {
6020                 switch (pkt_ccc_protocol_version) {
6021
6022                 case PACKETCABLE_CCC_I05:
6023                         offset = dissect_packetcable_i05_ccc(pinfo, tree, tree, tvb, offset, tvb_reported_length(tvb));
6024                         break;
6025                 case PACKETCABLE_CCC_DRAFT5:
6026                 case PACKETCABLE_CCC_RFC_3495:
6027                         offset = dissect_packetcable_ietf_ccc(pinfo, tree, tree, tvb, offset, tvb_reported_length(tvb), pkt_ccc_protocol_version);
6028                         break;
6029                 default: /* XXX Should we do something here? */
6030                         break;
6031                 }
6032         }
6033
6034         return tvb_captured_length(tvb);
6035 }
6036
6037 #define BOOTREQUEST     1
6038 #define BOOTREPLY       2
6039
6040 static const value_string op_vals[] = {
6041         { BOOTREQUEST,  "Boot Request" },
6042         { BOOTREPLY,    "Boot Reply" },
6043         { 0,            NULL }
6044 };
6045
6046 static int
6047 dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
6048 {
6049         proto_tree   *bp_tree;
6050         proto_item   *bp_ti, *ti;
6051         proto_item   *fi, *hidden_item;
6052         guint8        op;
6053         guint8        htype, hlen;
6054         int           voff, eoff, tmpvoff; /* vendor offset, end offset */
6055         guint32       ip_addr;
6056         gboolean      at_end;
6057         const char   *dhcp_type                              = NULL;
6058         const guint8 *vendor_class_id                        = NULL;
6059         guint16       flags, secs;
6060         int           offset_delta;
6061         guint8        overload                               = 0; /* DHCP option overload */
6062         static const int * bootp_flags[] = {
6063                 &hf_bootp_flags_broadcast,
6064                 &hf_bootp_flags_reserved,
6065                 NULL
6066         };
6067
6068         rfc3396_dns_domain_search_list.total_number_of_block = 0;
6069         rfc3396_dns_domain_search_list.tvb_composite         = NULL;
6070         rfc3396_sip_server.total_number_of_block             = 0;
6071         rfc3396_sip_server.tvb_composite                     = NULL;
6072
6073         col_set_str(pinfo->cinfo, COL_PROTOCOL, "BOOTP");
6074         /*
6075          * In case we throw an exception fetching the opcode, etc.
6076          */
6077         col_clear(pinfo->cinfo, COL_INFO);
6078
6079         op = tvb_get_guint8(tvb, 0);
6080         htype = tvb_get_guint8(tvb, 1);
6081         hlen = tvb_get_guint8(tvb, 2);
6082         switch (op) {
6083
6084         case BOOTREQUEST:
6085                 if ((htype == ARPHRD_ETHER || htype == ARPHRD_IEEE802)
6086                     && hlen == 6) {
6087                         col_add_fstr(pinfo->cinfo, COL_INFO, "Boot Request from %s (%s)",
6088                                      tvb_arphrdaddr_to_str(tvb, 28, hlen, htype),
6089                                      tvb_get_ether_name(tvb, 28));
6090                 }
6091                 else {
6092                         col_add_fstr(pinfo->cinfo, COL_INFO, "Boot Request from %s",
6093                                      tvb_arphrdaddr_to_str(tvb, 28, hlen, htype));
6094                 }
6095                 break;
6096
6097         case BOOTREPLY:
6098                 col_set_str(pinfo->cinfo, COL_INFO, "Boot Reply");
6099                 break;
6100
6101         default:
6102                 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown BOOTP message type (%u)", op);
6103                 break;
6104         }
6105
6106         voff = VENDOR_INFO_OFFSET;
6107
6108         /* rfc2132 says it SHOULD exist, not that it MUST exist */
6109         if (tvb_bytes_exist(tvb, voff, 4) &&
6110             (tvb_get_ntohl(tvb, voff) == 0x63825363)) {
6111                 voff += 4;
6112         } else {
6113                 voff += 64;
6114         }
6115         eoff = tvb_reported_length(tvb);
6116
6117         bp_ti = proto_tree_add_item(tree, proto_bootp, tvb, 0, -1, ENC_NA);
6118         bp_tree = proto_item_add_subtree(bp_ti, ett_bootp);
6119
6120         /*
6121          * In the first pass, we just look for the DHCP message type
6122          * and Vendor class identifier options.
6123          */
6124         tmpvoff = voff;
6125         at_end = FALSE;
6126         rfc3396_dns_domain_search_list.index_current_block = 0;
6127         rfc3396_sip_server.index_current_block = 0;
6128         while (tmpvoff < eoff && !at_end) {
6129                 offset_delta = bootp_option(tvb, pinfo, NULL, tmpvoff, eoff, TRUE, &at_end,
6130                     &dhcp_type, &vendor_class_id, &overload);
6131                 if (offset_delta <= 0) {
6132                         proto_tree_add_expert(bp_tree, pinfo, &ei_bootp_option_parse_err,
6133                                         tvb, tmpvoff, eoff);
6134                         return tmpvoff;
6135                 }
6136                 tmpvoff += offset_delta;
6137         }
6138
6139         /*
6140          * If there was a DHCP message type option, flag this packet
6141          * as DHCP.
6142          */
6143         if (dhcp_type != NULL) {
6144                 /*
6145                  * Yes, this is a DHCP packet, and "dhcp_type" is the
6146                  * packet type.
6147                  */
6148                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DHCP");
6149
6150                 col_add_fstr(pinfo->cinfo, COL_INFO, "DHCP %-8s - Transaction ID 0x%x",
6151                              dhcp_type, tvb_get_ntohl(tvb, 4));
6152                 tap_queue_packet( bootp_dhcp_tap, pinfo, dhcp_type);
6153         }
6154
6155         /*
6156          * OK, now populate the protocol tree.
6157          */
6158
6159         proto_tree_add_uint(bp_tree, hf_bootp_type, tvb,
6160                                    0, 1,
6161                                    op);
6162         proto_tree_add_item(bp_tree, hf_bootp_hw_type, tvb,
6163                                          1, 1, ENC_BIG_ENDIAN);
6164         proto_tree_add_uint(bp_tree, hf_bootp_hw_len, tvb,
6165                             2, 1, hlen);
6166         proto_tree_add_item(bp_tree, hf_bootp_hops, tvb,
6167                             3, 1, ENC_BIG_ENDIAN);
6168         proto_tree_add_item(bp_tree, hf_bootp_id, tvb,
6169                             4, 4, ENC_BIG_ENDIAN);
6170         /*
6171          * Windows (98, XP and Vista tested) sends the "secs" value on
6172          * the wire formatted as little-endian. See if the LE value
6173          * makes sense.
6174          */
6175         secs = tvb_get_letohs(tvb, 8);
6176         if (secs > 0 && secs <= 0xff) {
6177                 ti = proto_tree_add_uint(bp_tree, hf_bootp_secs, tvb, 8, 2, secs);
6178                 expert_add_info_format(pinfo, ti, &ei_bootp_secs_le, "Seconds elapsed appears to be encoded as little-endian");
6179         } else {
6180                 proto_tree_add_item(bp_tree, hf_bootp_secs, tvb,
6181                             8, 2, ENC_BIG_ENDIAN);
6182         }
6183         flags = tvb_get_ntohs(tvb, 10);
6184         fi = proto_tree_add_bitmask(bp_tree, tvb, 10, hf_bootp_flags,
6185                                ett_bootp_flags, bootp_flags, ENC_NA);
6186         proto_item_append_text(fi, " (%s)",
6187             (flags & BOOTP_BC) ? "Broadcast" : "Unicast");
6188
6189         proto_tree_add_item(bp_tree, hf_bootp_ip_client, tvb,
6190                             12, 4, ENC_BIG_ENDIAN);
6191         proto_tree_add_item(bp_tree, hf_bootp_ip_your, tvb,
6192                             16, 4, ENC_BIG_ENDIAN);
6193         proto_tree_add_item(bp_tree, hf_bootp_ip_server, tvb,
6194                             20, 4, ENC_BIG_ENDIAN);
6195         proto_tree_add_item(bp_tree, hf_bootp_ip_relay, tvb,
6196                             24, 4, ENC_BIG_ENDIAN);
6197
6198         if (hlen > 0 && hlen <= 16) {
6199                 if ((htype == ARPHRD_ETHER || htype == ARPHRD_IEEE802)
6200                     && hlen == 6)
6201                         proto_tree_add_item(bp_tree, hf_bootp_hw_ether_addr, tvb, 28, 6, ENC_NA);
6202                 else
6203                         /* The chaddr element is 16 bytes in length,
6204                            although only the first hlen bytes are used */
6205                         proto_tree_add_bytes_format_value(bp_tree, hf_bootp_hw_addr, tvb, 28, 16,
6206                                            NULL, "%s", tvb_arphrdaddr_to_str(tvb, 28, hlen, htype));
6207                 if ((16 - hlen) > 0)
6208                         proto_tree_add_item(bp_tree, hf_bootp_hw_addr_padding, tvb, 28+hlen, 16-hlen, ENC_NA);
6209         } else {
6210                 proto_tree_add_expert(bp_tree, pinfo, &ei_bootp_client_address_not_given, tvb, 28, 16);
6211         }
6212
6213         if (overload & OPT_OVERLOAD_SNAME) {
6214                 proto_tree_add_expert(bp_tree, pinfo, &ei_bootp_server_name_overloaded_by_dhcp, tvb,
6215                         SERVER_NAME_OFFSET, SERVER_NAME_LEN);
6216         } else {
6217                 /* The server host name is optional */
6218                 if (tvb_get_guint8(tvb, SERVER_NAME_OFFSET) != '\0') {
6219                         proto_tree_add_item(bp_tree, hf_bootp_server, tvb,
6220                                            SERVER_NAME_OFFSET,
6221                                            SERVER_NAME_LEN, ENC_ASCII|ENC_NA);
6222
6223                 } else {
6224                         proto_tree_add_string_format(bp_tree, hf_bootp_server, tvb,
6225                                                    SERVER_NAME_OFFSET,
6226                                                    SERVER_NAME_LEN,
6227                                                    "", "Server host name not given");
6228                 }
6229         }
6230
6231         if (overload & OPT_OVERLOAD_FILE) {
6232                 proto_tree_add_expert(bp_tree, pinfo, &ei_bootp_boot_filename_overloaded_by_dhcp, tvb,
6233                         FILE_NAME_OFFSET, FILE_NAME_LEN);
6234         } else {
6235                 /* Boot file is optional */
6236                 if (tvb_get_guint8(tvb, FILE_NAME_OFFSET) != '\0') {
6237                         proto_tree_add_item(bp_tree, hf_bootp_file, tvb,
6238                                            FILE_NAME_OFFSET,
6239                                            FILE_NAME_LEN, ENC_ASCII|ENC_NA);
6240                 } else {
6241                         proto_tree_add_string_format(bp_tree, hf_bootp_file, tvb,
6242                                                    FILE_NAME_OFFSET,
6243                                                    FILE_NAME_LEN,
6244                                                    "", "Boot file name not given");
6245                 }
6246         }
6247
6248         voff = VENDOR_INFO_OFFSET;
6249         if (dhcp_type != NULL) {
6250                 hidden_item = proto_tree_add_boolean(bp_tree, hf_bootp_dhcp, tvb, 0, 0, 1);
6251                 PROTO_ITEM_SET_HIDDEN(hidden_item);
6252         }
6253         if (tvb_bytes_exist(tvb, voff, 4) &&
6254             (tvb_get_ntohl(tvb, voff) == 0x63825363)) {
6255                 ip_addr = tvb_get_ipv4(tvb, voff);
6256                 proto_tree_add_ipv4_format_value(bp_tree, hf_bootp_cookie, tvb,
6257                         voff, 4, ip_addr, "DHCP");
6258                 voff += 4;
6259         } else {
6260                 proto_tree_add_item(bp_tree, hf_bootp_vendor_specific_options, tvb,
6261                         voff, 64, ENC_NA);
6262                 voff += 64;
6263         }
6264
6265         at_end = FALSE;
6266         rfc3396_dns_domain_search_list.index_current_block = 0;
6267         rfc3396_sip_server.index_current_block = 0;
6268         while (voff < eoff && !at_end) {
6269                 offset_delta = bootp_option(tvb, pinfo, bp_tree, voff, eoff, FALSE, &at_end,
6270                     &dhcp_type, &vendor_class_id, &overload);
6271                 if (offset_delta <= 0) {
6272                         proto_tree_add_expert(bp_tree, pinfo, &ei_bootp_option_parse_err,
6273                                         tvb, voff, eoff);
6274                         return voff;
6275                 }
6276                 voff += offset_delta;
6277         }
6278         if ((dhcp_type != NULL) && (!at_end))
6279         {
6280                 expert_add_info(pinfo, bp_ti, &ei_bootp_end_option_missing);
6281         }
6282         if (voff < eoff) {
6283                 /*
6284                  * Padding after the end option.
6285                  */
6286                 proto_tree_add_item(bp_tree, hf_bootp_option_padding, tvb, voff, eoff - voff, ENC_NA);
6287         }
6288
6289         return tvb_captured_length(tvb);
6290 }
6291
6292 static void
6293 bootp_init_protocol(void)
6294 {
6295         guint i;
6296
6297         /* first copy default_bootp_opt[] to bootp_opt[].  This resets all values to default */
6298         memcpy(bootp_opt, default_bootp_opt, sizeof(bootp_opt));
6299
6300         if ((num_bootp_records_uat > 0) && (saved_uat_opts == NULL))
6301         {
6302                 saved_uat_opts = wmem_list_new(NULL);
6303         }
6304
6305         /* Now apply the custom options */
6306         for (i = 0; i < num_bootp_records_uat; i++)
6307         {
6308                 bootp_opt[uat_bootp_records[i].opt].text = wmem_strdup(wmem_file_scope(), uat_bootp_records[i].text);
6309                 bootp_opt[uat_bootp_records[i].opt].ftype = uat_bootp_records[i].ftype;
6310                 bootp_opt[uat_bootp_records[i].opt].phf = NULL;
6311
6312                 /* Apply the custom option to the dissection table*/
6313                 dissector_change_uint("bootp.option", uat_bootp_records[i].opt, bootpopt_basic_handle);
6314
6315                 /* Save the option so it can be cleared later */
6316                 wmem_list_append(saved_uat_opts, GUINT_TO_POINTER(uat_bootp_records[i].opt));
6317         }
6318 }
6319
6320 static void
6321 bootp_clear_uat_bootpopt(gpointer data, gpointer user_data _U_)
6322 {
6323         dissector_reset_uint("bootp.option", GPOINTER_TO_UINT(data));
6324 }
6325
6326 static void
6327 bootp_cleanup_protocol(void)
6328 {
6329         if (saved_uat_opts != NULL) {
6330                 wmem_list_foreach(saved_uat_opts, bootp_clear_uat_bootpopt,
6331                     NULL);
6332
6333                 wmem_destroy_list(saved_uat_opts);
6334                 saved_uat_opts = NULL;
6335         }
6336 }
6337
6338
6339 /* TAP STAT INFO */
6340 typedef enum
6341 {
6342         MESSAGE_TYPE_COLUMN = 0,
6343         PACKET_COLUMN
6344 } bootp_stat_columns;
6345
6346 static stat_tap_table_item bootp_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "DHCP Message Type", "%-25s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Packets", "%d"}};
6347
6348 static void bootp_stat_init(stat_tap_table_ui* new_stat, new_stat_tap_gui_init_cb gui_callback, void* gui_data)
6349 {
6350         int num_fields = sizeof(bootp_stat_fields)/sizeof(stat_tap_table_item);
6351         stat_tap_table* table = new_stat_tap_init_table("DHCP Statistics", num_fields, 0, NULL, gui_callback, gui_data);
6352         int i = 0;
6353         stat_tap_table_item_type items[sizeof(bootp_stat_fields)/sizeof(stat_tap_table_item)];
6354
6355         new_stat_tap_add_table(new_stat, table);
6356
6357         /* Add a row for each value type */
6358         while (opt53_text[i].strptr)
6359         {
6360                 items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING;
6361                 items[MESSAGE_TYPE_COLUMN].value.string_value = opt53_text[i].strptr;
6362                 items[PACKET_COLUMN].type = TABLE_ITEM_UINT;
6363                 items[PACKET_COLUMN].value.uint_value = 0;
6364
6365                 new_stat_tap_init_table_row(table, i, num_fields, items);
6366                 i++;
6367         }
6368 }
6369
6370 static gboolean
6371 bootp_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *data)
6372 {
6373         new_stat_data_t* stat_data = (new_stat_data_t*)tapdata;
6374         const char* value = (const char*)data;
6375         stat_tap_table* table;
6376         stat_tap_table_item_type* msg_data;
6377         guint i = 0;
6378         gint idx;
6379
6380         idx = str_to_val_idx(value, opt53_text);
6381         if (idx < 0)
6382                 return FALSE;
6383
6384         table = g_array_index(stat_data->stat_tap_data->tables, stat_tap_table*, i);
6385         msg_data = new_stat_tap_get_field_data(table, idx, PACKET_COLUMN);
6386         msg_data->value.uint_value++;
6387         new_stat_tap_set_field_data(table, idx, PACKET_COLUMN, msg_data);
6388
6389         return TRUE;
6390 }
6391
6392 static void
6393 bootp_stat_reset(stat_tap_table* table)
6394 {
6395         guint element;
6396         stat_tap_table_item_type* item_data;
6397
6398         for (element = 0; element < table->num_elements; element++)
6399         {
6400                 item_data = new_stat_tap_get_field_data(table, element, PACKET_COLUMN);
6401                 item_data->value.uint_value = 0;
6402                 new_stat_tap_set_field_data(table, element, PACKET_COLUMN, item_data);
6403         }
6404 }
6405
6406 void
6407 proto_register_bootp(void)
6408 {
6409         static const value_string bootp_custom_type_vals[] = {
6410                 { ipv4,             "IP Address"},
6411                 { ipv4_list,        "IP Address List" },
6412                 { string,           "string" },
6413                 { bytes,            "bytes" },
6414                 { val_boolean,      "boolean" },
6415                 { val_u_byte,       "byte" },
6416                 { val_u_short,      "unsigned short" },
6417                 { val_u_short_list, "unsigned short list" },
6418                 { val_u_long,       "unsigned long" },
6419                 { time_in_s_secs,   "integer time in seconds" },
6420                 { time_in_u_secs,   "unsigned integer time in seconds" },
6421                 { 0x00, NULL }
6422         };
6423
6424         static hf_register_info hf[] = {
6425                 { &hf_bootp_dhcp,
6426                   { "Frame is DHCP", "bootp.dhcp",
6427                     FT_BOOLEAN, BASE_NONE, NULL, 0x0,
6428                     NULL, HFILL }},
6429
6430                 { &hf_bootp_type,
6431                   { "Message type", "bootp.type",
6432                     FT_UINT8, BASE_DEC, VALS(op_vals), 0x0,
6433                     NULL, HFILL }},
6434
6435                 { &hf_bootp_hw_type,
6436                   { "Hardware type", "bootp.hw.type",
6437                     FT_UINT8, BASE_HEX, VALS(arp_hrd_vals), 0x0,
6438                     NULL, HFILL }},
6439
6440                 { &hf_bootp_hw_len,
6441                   { "Hardware address length", "bootp.hw.len",
6442                     FT_UINT8, BASE_DEC, NULL, 0x0,
6443                     NULL, HFILL }},
6444
6445                 { &hf_bootp_hops,
6446                   { "Hops", "bootp.hops",
6447                     FT_UINT8, BASE_DEC, NULL, 0x0,
6448                     NULL, HFILL }},
6449
6450                 { &hf_bootp_id,
6451                   { "Transaction ID", "bootp.id",
6452                     FT_UINT32, BASE_HEX, NULL, 0x0,
6453                     NULL, HFILL }},
6454
6455                 { &hf_bootp_secs,
6456                   { "Seconds elapsed", "bootp.secs",
6457                     FT_UINT16, BASE_DEC, NULL, 0x0,
6458                     NULL, HFILL }},
6459
6460                 { &hf_bootp_flags,
6461                   { "Bootp flags", "bootp.flags",
6462                     FT_UINT16, BASE_HEX, NULL, 0x0,
6463                     NULL, HFILL }},
6464
6465                 { &hf_bootp_flags_broadcast,
6466                   { "Broadcast flag", "bootp.flags.bc",
6467                     FT_BOOLEAN, 16, TFS(&flag_set_broadcast), BOOTP_BC,
6468                     NULL, HFILL }},
6469
6470                 { &hf_bootp_flags_reserved,
6471                   { "Reserved flags", "bootp.flags.reserved",
6472                     FT_UINT16, BASE_HEX, NULL, BOOTP_MBZ,
6473                     NULL, HFILL }},
6474
6475                 { &hf_bootp_ip_client,
6476                   { "Client IP address", "bootp.ip.client",
6477                     FT_IPv4, BASE_NONE, NULL, 0x0,
6478                     NULL, HFILL }},
6479
6480                 { &hf_bootp_ip_your,
6481                   { "Your (client) IP address", "bootp.ip.your",
6482                     FT_IPv4, BASE_NONE, NULL, 0x0,
6483                     NULL, HFILL }},
6484
6485                 { &hf_bootp_ip_server,
6486                   { "Next server IP address", "bootp.ip.server",
6487                     FT_IPv4, BASE_NONE, NULL, 0x0,
6488                     NULL, HFILL }},
6489
6490                 { &hf_bootp_ip_relay,
6491                   { "Relay agent IP address", "bootp.ip.relay",
6492                     FT_IPv4, BASE_NONE, NULL, 0x0,
6493                     NULL, HFILL }},
6494
6495                 { &hf_bootp_hw_addr,
6496                   { "Client hardware address", "bootp.hw.addr",
6497                     FT_BYTES, BASE_NONE, NULL, 0x0,
6498                     NULL, HFILL }},
6499
6500                 { &hf_bootp_hw_addr_padding,
6501                   { "Client hardware address padding", "bootp.hw.addr_padding",
6502                     FT_BYTES, BASE_NONE, NULL, 0x0,
6503                     NULL, HFILL }},
6504
6505                 { &hf_bootp_hw_ether_addr,
6506                   { "Client MAC address", "bootp.hw.mac_addr",
6507                     FT_ETHER, BASE_NONE, NULL, 0x0,
6508                     NULL, HFILL }},
6509
6510                 { &hf_bootp_server,
6511                   { "Server host name", "bootp.server",
6512                     FT_STRING, BASE_NONE, NULL, 0x0,
6513                     NULL, HFILL }},
6514
6515                 { &hf_bootp_file,
6516                   { "Boot file name", "bootp.file",
6517                     FT_STRING, BASE_NONE, NULL, 0x0,
6518                     NULL, HFILL }},
6519
6520                 { &hf_bootp_cookie,
6521                   { "Magic cookie", "bootp.cookie",
6522                     FT_IPv4, BASE_NONE, NULL, 0x0,
6523                     NULL, HFILL }},
6524
6525                 { &hf_bootp_vendor_specific_options,
6526                   { "Bootp vendor specific options", "bootp.vendor_specific_options",
6527                     FT_BYTES, BASE_NONE, NULL, 0x0,
6528                     NULL, HFILL }},
6529
6530                 { &hf_bootp_fqdn_s,
6531                   { "Server", "bootp.fqdn.s",
6532                     FT_BOOLEAN, 8, TFS(&tfs_fqdn_s), F_FQDN_S,
6533                     "If true, server should do DDNS update", HFILL }},
6534
6535                 { &hf_bootp_fqdn_o,
6536                   { "Server overrides", "bootp.fqdn.o",
6537                     FT_BOOLEAN, 8, TFS(&tfs_fqdn_o), F_FQDN_O,
6538                     "If true, server insists on doing DDNS update", HFILL }},
6539
6540                 { &hf_bootp_fqdn_e,
6541                   { "Encoding", "bootp.fqdn.e",
6542                     FT_BOOLEAN, 8, TFS(&tfs_fqdn_e), F_FQDN_E,
6543                     "If true, name is binary encoded", HFILL }},
6544
6545                 { &hf_bootp_fqdn_n,
6546                   { "Server DDNS", "bootp.fqdn.n",
6547                     FT_BOOLEAN, 8, TFS(&tfs_fqdn_n), F_FQDN_N,
6548                     "If true, server should not do any DDNS updates", HFILL }},
6549
6550                 { &hf_bootp_fqdn_flags,
6551                   { "Flags", "bootp.fqdn.flags",
6552                     FT_UINT8, BASE_HEX, NULL, 0,
6553                     NULL, HFILL }},
6554
6555                 { &hf_bootp_fqdn_mbz,
6556                   { "Reserved flags", "bootp.fqdn.mbz",
6557                     FT_UINT8, BASE_HEX, NULL, F_FQDN_MBZ,
6558                     NULL, HFILL }},
6559
6560                 { &hf_bootp_fqdn_rcode1,
6561                   { "A-RR result", "bootp.fqdn.rcode1",
6562                     FT_UINT8, BASE_DEC, NULL, 0x0,
6563                     "Result code of A-RR update", HFILL }},
6564
6565                 { &hf_bootp_fqdn_rcode2,
6566                   { "PTR-RR result", "bootp.fqdn.rcode2",
6567                     FT_UINT8, BASE_DEC, NULL, 0x0,
6568                     "Result code of PTR-RR update", HFILL }},
6569
6570                 { &hf_bootp_fqdn_name,
6571                   { "Client name", "bootp.fqdn.name",
6572                     FT_STRING, BASE_NONE, NULL, 0x0,
6573                     "Name to register via DDNS", HFILL }},
6574
6575                 { &hf_bootp_fqdn_asciiname,
6576                   { "Client name", "bootp.fqdn.name",
6577                     FT_STRING, BASE_NONE, NULL, 0x0,
6578                     "Name to register via DDNS", HFILL }},
6579
6580                 { &hf_bootp_pkt_mta_cap_len,
6581                   { "MTA DC Length", "bootp.vendor.pktc.mta_cap_len",
6582                     FT_UINT8, BASE_DEC, NULL, 0x0,
6583                     "PacketCable MTA Device Capabilities Length", HFILL }},
6584
6585                 { &hf_bootp_pkt_mta_cap_type,
6586                   { "Type", "bootp.vendor.pktc.mta_cap_type",
6587                     FT_UINT8, BASE_DEC, VALS(pkt_mdc_type_vals), 0x0,
6588                     NULL, HFILL }},
6589
6590                 { &hf_bootp_pkt_mdc_supp_flow_secure,
6591                   { "Secure Flow (Full Secure Provisioning Flow)", "bootp.vendor.pktc.mdc.supp_flow.secure",
6592                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x01,
6593                     NULL, HFILL }},
6594
6595                 { &hf_bootp_pkt_mdc_supp_flow_hybrid,
6596                   { "Hybrid Flow", "bootp.vendor.pktc.mdc.supp_flow.hybrid",
6597                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x02,
6598                     NULL, HFILL }},
6599
6600                 { &hf_bootp_pkt_mdc_supp_flow_basic,
6601                   { "Basic Flow", "bootp.vendor.pktc.mdc.supp_flow.basic",
6602                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x04,
6603                     NULL, HFILL }},
6604
6605                 { &hf_bootp_pkt_mdc_mib_cl_mta,
6606                   { "PacketCable 1.5 MTA MIB", "bootp.vendor.pktc.mdc_cl.mib.mta",
6607                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
6608                     NULL, HFILL }},
6609
6610                 { &hf_bootp_pkt_mdc_mib_cl_signaling,
6611                   { "PacketCable 1.5 Signaling MIB", "bootp.vendor.pktc.mdc_cl.mib.signaling",
6612                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
6613                     NULL, HFILL }},
6614
6615                 { &hf_bootp_pkt_mdc_mib_cl_management_event,
6616                   { "PacketCable 1.5 Management Event MIB", "bootp.vendor.pktc.mdc_cl.mib.management_event",
6617                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
6618                     NULL, HFILL }},
6619
6620                 { &hf_bootp_pkt_mdc_mib_cl_mta_extension,
6621                   { "PacketCable 1.5 MTA Extension MIB", "bootp.vendor.pktc.mdc_cl.mib.mta_extension",
6622                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
6623                     NULL, HFILL }},
6624
6625                 { &hf_bootp_pkt_mdc_mib_cl_mta_signaling_extension,
6626                   { "PacketCable 1.5 Signaling Extension MIB", "bootp.vendor.pktc.mdc_cl.mib.signaling_extension",
6627                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
6628                     NULL, HFILL }},
6629
6630                 { &hf_bootp_pkt_mdc_mib_cl_mta_mem_extention,
6631                   { "PacketCable 1.5 MEM Extension MIB", "bootp.vendor.pktc.mdc_cl.mib.mem_extention",
6632                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
6633                     NULL, HFILL }},
6634
6635                 { &hf_bootp_pkt_mdc_mib_cl_reserved,
6636                   { "Reserved", "bootp.vendor.pktc.mdc_cl.mib.reserved",
6637                     FT_UINT8, BASE_HEX, NULL, 0xC0,
6638                     NULL, HFILL }},
6639
6640                 { &hf_bootp_pkt_mdc_mib_ietf_mta,
6641                   { "IETF MTA MIB", "bootp.vendor.pktc.mdc_ietf.mib.mta",
6642                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
6643                     NULL, HFILL }},
6644
6645                 { &hf_bootp_pkt_mdc_mib_ietf_signaling,
6646                   { "IETF Signaling MIB", "bootp.vendor.pktc.mdc_ietf.mib.signaling",
6647                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
6648                     NULL, HFILL }},
6649
6650                 { &hf_bootp_pkt_mdc_mib_ietf_management_event,
6651                   { "IETF Management Event MIB", "bootp.vendor.pktc.mdc_ietf.mib.management_event",
6652                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
6653                     NULL, HFILL }},
6654
6655                 { &hf_bootp_pkt_mdc_mib_ietf_reserved,
6656                   { "Reserved", "bootp.vendor.pktc.mdc_ietf.mib.reserved",
6657                     FT_UINT8, BASE_HEX, NULL, 0xF8,
6658                     NULL, HFILL }},
6659
6660                 { &hf_bootp_pkt_mdc_mib_euro_mta,
6661                   { "PacketCable 1.5 MTA MIB", "bootp.vendor.pktc.mdc_euro.mib.mta",
6662                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
6663                     NULL, HFILL }},
6664
6665                 { &hf_bootp_pkt_mdc_mib_euro_signaling,
6666                   { "PacketCable 1.5 Signaling MIB", "bootp.vendor.pktc.mdc_euro.mib.signaling",
6667                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
6668                     NULL, HFILL }},
6669
6670                 { &hf_bootp_pkt_mdc_mib_euro_management_event,
6671                   { "PacketCable 1.5 Management Event MIB", "bootp.vendor.pktc.mdc_euro.mib.management_event",
6672                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
6673                     NULL, HFILL }},
6674
6675                 { &hf_bootp_pkt_mdc_mib_euro_mta_extension,
6676                   { "PacketCable 1.5 MTA Extension MIB", "bootp.vendor.pktc.mdc_euro.mib.mta_extension",
6677                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
6678                     NULL, HFILL }},
6679
6680                 { &hf_bootp_pkt_mdc_mib_euro_mta_signaling_extension,
6681                   { "PacketCable 1.5 Signaling Extension MIB", "bootp.vendor.pktc.mdc_euro.mib.signaling_extension",
6682                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
6683                     NULL, HFILL }},
6684
6685                 { &hf_bootp_pkt_mdc_mib_euro_mta_mem_extention,
6686                   { "PacketCable 1.5 MEM Extension MIB", "bootp.vendor.pktc.mdc_euro.mib.mem_extention",
6687                     FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
6688                     NULL, HFILL }},
6689
6690                 { &hf_bootp_pkt_mdc_mib_euro_reserved,
6691                   { "Reserved", "bootp.vendor.pktc.mdc_euro.mib.reserved",
6692                     FT_UINT8, BASE_HEX, NULL, 0xC0,
6693                     NULL, HFILL }},
6694
6695                 { &hf_bootp_docsis_cm_cap_len,
6696                   { "CM DC Length", "bootp.vendor.docsis.cm_cap_len",
6697                     FT_UINT8, BASE_DEC, NULL, 0x0,
6698                     "DOCSIS Cable Modem Device Capabilities Length", HFILL }},
6699
6700                 { &hf_bootp_docsis_cm_cap_type,
6701                   { "CM DC Type", "bootp.docsis_cm_cap_type",
6702                     FT_UINT16, BASE_DEC, VALS(docsis_cm_cap_type_vals), 0x0,
6703                     "Docsis Cable Modem Device Capability type", HFILL }},
6704
6705                 { &hf_bootp_docsis_cm_cap_ranging_hold_off_cm,
6706                   { "CM", "bootp.docsis_cm_cap.ranging_hold_off.cm",
6707                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x01,
6708                     NULL, HFILL }},
6709
6710                 { &hf_bootp_docsis_cm_cap_ranging_hold_off_eps,
6711                   { "ePS or eRouter", "bootp.docsis_cm_cap.ranging_hold_off.eps",
6712                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x02,
6713                     NULL, HFILL }},
6714
6715                 { &hf_bootp_docsis_cm_cap_ranging_hold_off_emta,
6716                   { "EMTA or EDVA", "bootp.docsis_cm_cap.ranging_hold_off.emta",
6717                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x04,
6718                     NULL, HFILL }},
6719
6720                 { &hf_bootp_docsis_cm_cap_ranging_hold_off_dsg,
6721                   { "DSG/eSTB", "bootp.docsis_cm_cap.ranging_hold_off.dsg",
6722                     FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x08,
6723                     NULL, HFILL }},
6724
6725                 { &hf_bootp_docsis_cm_cap_mpls_stpid,
6726                   { "[IEEE 802.1ad] S-TPID", "bootp.docsis_cm_cap.mpls.stpid",
6727                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x01,
6728                     NULL, HFILL }},
6729
6730                 { &hf_bootp_docsis_cm_cap_mpls_svid,
6731                   { "[IEEE 802.1ad] S-VID", "bootp.docsis_cm_cap.mpls.svid",
6732                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x02,
6733                     NULL, HFILL }},
6734
6735                 { &hf_bootp_docsis_cm_cap_mpls_spcp,
6736                   { "[IEEE 802.1ad] S-PCP", "bootp.docsis_cm_cap.mpls.spcp",
6737                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x04,
6738                     NULL, HFILL }},
6739
6740                 { &hf_bootp_docsis_cm_cap_mpls_sdei,
6741                   { "[IEEE 802.1ad] S-DEI", "bootp.docsis_cm_cap.mpls.sdei",
6742                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x08,
6743                     NULL, HFILL }},
6744
6745                 { &hf_bootp_docsis_cm_cap_mpls_ctpid,
6746                   { "[IEEE 802.1ad] C-TPID", "bootp.docsis_cm_cap.mpls.ctpid",
6747                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x10,
6748                     NULL, HFILL }},
6749
6750                 { &hf_bootp_docsis_cm_cap_mpls_cvid,
6751                   { "[IEEE 802.1ad] C-VID", "bootp.docsis_cm_cap.mpls.cvid",
6752                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x20,
6753                     NULL, HFILL }},
6754
6755                 { &hf_bootp_docsis_cm_cap_mpls_cpcp,
6756                   { "[IEEE 802.1ad] C-PCP", "bootp.docsis_cm_cap.mpls.cpcp",
6757                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x40,
6758                     NULL, HFILL }},
6759
6760                 { &hf_bootp_docsis_cm_cap_mpls_ccfi,
6761                   { "[IEEE 802.1ad] C-CFI", "bootp.docsis_cm_cap.mpls.ccfi",
6762                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x80,
6763                     NULL, HFILL }},
6764
6765                 { &hf_bootp_docsis_cm_cap_mpls_stci,
6766                   { "[IEEE 802.1ad] S-TCI", "bootp.docsis_cm_cap.mpls.stci",
6767                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x100,
6768                     NULL, HFILL }},
6769
6770                 { &hf_bootp_docsis_cm_cap_mpls_ctci,
6771                   { "[IEEE 802.1ad] C-TCI", "bootp.docsis_cm_cap.mpls.ctci",
6772                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x200,
6773                     NULL, HFILL }},
6774
6775                 { &hf_bootp_docsis_cm_cap_mpls_itpid,
6776                   { "[IEEE 802.1ad] I-TPID", "bootp.docsis_cm_cap.mpls.itpid",
6777                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x400,
6778                     NULL, HFILL }},
6779
6780                 { &hf_bootp_docsis_cm_cap_mpls_isid,
6781                   { "[IEEE 802.1ad] I-SID", "bootp.docsis_cm_cap.mpls.isid",
6782                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x800,
6783                     NULL, HFILL }},
6784
6785                 { &hf_bootp_docsis_cm_cap_mpls_itci,
6786                   { "[IEEE 802.1ad] I-TCI", "bootp.docsis_cm_cap.mpls.itci",
6787                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x1000,
6788                     NULL, HFILL }},
6789
6790                 { &hf_bootp_docsis_cm_cap_mpls_ipcp,
6791                   { "[IEEE 802.1ad] I-PCP", "bootp.docsis_cm_cap.mpls.ipcp",
6792                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x2000,
6793                     NULL, HFILL }},
6794
6795                 { &hf_bootp_docsis_cm_cap_mpls_idei,
6796                   { "[IEEE 802.1ad] I-DEI", "bootp.docsis_cm_cap.mpls.idei",
6797                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x4000,
6798                     NULL, HFILL }},
6799
6800                 { &hf_bootp_docsis_cm_cap_mpls_iuca,
6801                   { "[IEEE 802.1ad] I-UCA", "bootp.docsis_cm_cap.mpls.iuca",
6802                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x8000,
6803                     NULL, HFILL }},
6804
6805                 { &hf_bootp_docsis_cm_cap_mpls_btpid,
6806                   { "[IEEE 802.1ad] B-TPID", "bootp.docsis_cm_cap.mpls.btpid",
6807                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x10000,
6808                     NULL, HFILL }},
6809
6810                 { &hf_bootp_docsis_cm_cap_mpls_btci,
6811                   { "[IEEE 802.1ad] B-TCI", "bootp.docsis_cm_cap.mpls.btci",
6812                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x20000,
6813                     NULL, HFILL }},
6814
6815                 { &hf_bootp_docsis_cm_cap_mpls_bpcp,
6816                   { "[IEEE 802.1ad] B-PCP", "bootp.docsis_cm_cap.mpls.bpcp",
6817                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x40000,
6818                     NULL, HFILL }},
6819
6820                 { &hf_bootp_docsis_cm_cap_mpls_bdei,
6821                   { "[IEEE 802.1ad] B-DEI", "bootp.docsis_cm_cap.mpls.bdei",
6822                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x80000,
6823                     NULL, HFILL }},
6824
6825                 { &hf_bootp_docsis_cm_cap_mpls_bvid,
6826                   { "[IEEE 802.1ad] B-VID", "bootp.docsis_cm_cap.mpls.bvid",
6827                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x100000,
6828                     NULL, HFILL }},
6829
6830                 { &hf_bootp_docsis_cm_cap_mpls_bda,
6831                   { "[IEEE 802.1ad] B-DA", "bootp.docsis_cm_cap.mpls.bda",
6832                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x200000,
6833                     NULL, HFILL }},
6834
6835                 { &hf_bootp_docsis_cm_cap_mpls_bsa,
6836                   { "[IEEE 802.1ad] B-SA", "bootp.docsis_cm_cap.mpls.bsa",
6837                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x200000,
6838                     NULL, HFILL }},
6839
6840                 { &hf_bootp_docsis_cm_cap_mpls_tc,
6841                   { "MPLS TC", "bootp.docsis_cm_cap.mpls.tc",
6842                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x200000,
6843                     NULL, HFILL }},
6844
6845                 { &hf_bootp_docsis_cm_cap_mpls_label,
6846                   { "MPLS Label", "bootp.docsis_cm_cap.mpls.label",
6847                     FT_BOOLEAN, 32, TFS(&tfs_supported_not_supported), 0x200000,
6848                     NULL, HFILL }},
6849
6850                 { &hf_bootp_docsis_cm_cap_ussymrate_160,
6851                   { "160 ksps symbol rate", "bootp.docsis_cm_cap.ussymrate.160",
6852                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
6853                     NULL, HFILL }},
6854
6855                 { &hf_bootp_docsis_cm_cap_ussymrate_320,
6856                   { "320 ksps symbol rate", "bootp.docsis_cm_cap.ussymrate.320",
6857                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
6858                     NULL, HFILL }},
6859
6860                 { &hf_bootp_docsis_cm_cap_ussymrate_640,
6861                   { "640 ksps symbol rate", "bootp.docsis_cm_cap.ussymrate.640",
6862                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
6863                     NULL, HFILL }},
6864
6865                 { &hf_bootp_docsis_cm_cap_ussymrate_1280,
6866                   { "1280 ksps symbol rate", "bootp.docsis_cm_cap.ussymrate.1280",
6867                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
6868                     NULL, HFILL }},
6869
6870                 { &hf_bootp_docsis_cm_cap_ussymrate_2560,
6871                   { "2560 ksps symbol rate", "bootp.docsis_cm_cap.ussymrate.2560",
6872                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
6873                     NULL, HFILL }},
6874
6875                 { &hf_bootp_docsis_cm_cap_ussymrate_5120,
6876                   { "5120 ksps symbol rate", "bootp.docsis_cm_cap.ussymrate.5120",
6877                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
6878                     NULL, HFILL }},
6879
6880                 { &hf_bootp_client_identifier_uuid,
6881                   { "Client Identifier (UUID)", "bootp.client_id.uuid",
6882                     FT_GUID, BASE_NONE, NULL, 0x0,
6883                     "Client Machine Identifier (UUID)", HFILL }},
6884
6885                 { &hf_bootp_client_hardware_address,
6886                   { "Client hardware address", "bootp.client_hardware_address",
6887                     FT_STRING, BASE_NONE, NULL, 0x0,
6888                     NULL, HFILL }},
6889
6890                 { &hf_bootp_client_id_iaid,
6891                   { "IAID", "bootp.client_id.iaid",
6892                     FT_STRING, BASE_NONE, NULL, 0x0,
6893                     NULL, HFILL }},
6894
6895                 { &hf_bootp_client_id_duid_type,
6896                   { "DUID Type", "bootp.client_id.duid_type",
6897                     FT_UINT16, BASE_DEC, VALS(duidtype_vals), 0x0,
6898                     NULL, HFILL }},
6899
6900                 { &hf_bootp_client_identifier_duid_llt_hw_type,
6901                   { "Hardware type", "bootp.client_id.duid_llt_hw_type",
6902                     FT_UINT16, BASE_DEC, VALS(arp_hrd_vals), 0x0,
6903                     "Client Identifier DUID LLT Hardware type", HFILL }},
6904
6905                 { &hf_bootp_client_identifier_duid_ll_hw_type,
6906                   { "Hardware type", "bootp.client_id.duid_ll_hw_type",
6907                     FT_UINT16, BASE_DEC, VALS(arp_hrd_vals), 0x0,
6908                     "Client Identifier DUID LL Hardware type", HFILL }},
6909
6910                 { &hf_bootp_client_identifier_time,
6911                   { "Time", "bootp.client_id.time",
6912                     FT_UINT32, BASE_DEC, NULL, 0x0,
6913                     NULL, HFILL }},
6914
6915                 { &hf_bootp_client_identifier_link_layer_address,
6916                   { "Link layer address", "bootp.client_id.link_layer_address",
6917                     FT_STRING, BASE_NONE, NULL, 0x0,
6918                     NULL, HFILL }},
6919
6920                 { &hf_bootp_client_identifier_enterprise_num,
6921                   { "Enterprise-number", "bootp.client_id.enterprise_num",
6922                     FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0x0,
6923                     NULL, HFILL }},
6924
6925                 { &hf_bootp_client_identifier,
6926                   { "Identifier", "bootp.client_id",
6927                     FT_BYTES, BASE_NONE, NULL, 0x0,
6928                     NULL, HFILL }},
6929
6930                 { &hf_bootp_client_identifier_type,
6931                   { "Type", "bootp.client_id.type",
6932                     FT_UINT8, BASE_DEC, NULL, 0x0,
6933                     NULL, HFILL }},
6934
6935                 { &hf_bootp_client_identifier_undef,
6936                   { "Client Identifier", "bootp.client_id.undef",
6937                     FT_STRING, BASE_NONE, NULL, 0x0,
6938                     NULL, HFILL }},
6939
6940                 { &hf_bootp_option_type,
6941                   { "Option", "bootp.option.type",
6942                     FT_UINT8, BASE_DEC, NULL, 0x0,
6943                     "Bootp/Dhcp option type", HFILL }},
6944
6945                 { &hf_bootp_option_length,
6946                   { "Length", "bootp.option.length",
6947                     FT_UINT8, BASE_DEC, NULL, 0x0,
6948                     "Bootp/Dhcp option length", HFILL }},
6949
6950                 { &hf_bootp_suboption_length,
6951                   { "Length", "bootp.option.suboption_length",
6952                     FT_UINT8, BASE_DEC, NULL, 0x0,
6953                     "Suboption length", HFILL }},
6954
6955                 { &hf_bootp_option_value,
6956                   { "Value", "bootp.option.value",
6957                     FT_BYTES, BASE_NONE, NULL, 0x0,
6958                     "Bootp/Dhcp option value", HFILL }},
6959
6960                 { &hf_bootp_option_value_8,
6961                   { "Value", "bootp.option.value.uint",
6962                     FT_UINT8, BASE_DEC, NULL, 0x0,
6963                     "8-bit Bootp/Dhcp option value", HFILL }},
6964
6965                 { &hf_bootp_option_value_16,
6966                   { "Value", "bootp.option.value.uint",
6967                     FT_UINT16, BASE_DEC, NULL, 0x0,
6968                     "16-bit Bootp/Dhcp option value", HFILL }},
6969
6970                 { &hf_bootp_option_value_u32,
6971                   { "Value", "bootp.option.value.uint",
6972                     FT_UINT32, BASE_HEX, NULL, 0x0,
6973                     "32-bit Bootp/Dhcp option value", HFILL }},
6974
6975                 { &hf_bootp_option_value_i32,
6976                   { "Value", "bootp.option.value.int",
6977                     FT_INT32, BASE_DEC, NULL, 0x0,
6978                     "32-bit Bootp/Dhcp option value", HFILL }},
6979
6980                 { &hf_bootp_option_value_stringz,
6981                   { "Value", "bootp.option.value.string",
6982                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
6983                     "Z-String Bootp/Dhcp option value", HFILL }},
6984
6985                 { &hf_bootp_option_value_ip_address,
6986                   { "Value", "bootp.option.value.address",
6987                     FT_IPv4, BASE_NONE, NULL, 0x00,
6988                     "IP address Bootp/Dhcp option value", HFILL }},
6989
6990                 { &hf_bootp_option_value_boolean,
6991                   { "Value", "bootp.option.value.bool",
6992                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_true_false), 0x00,
6993                     "Boolean Bootp/Dhcp option value", HFILL }},
6994
6995                 { &hf_bootp_option_padding,
6996                   { "Padding", "bootp.option.padding",
6997                     FT_BYTES, BASE_NONE, NULL, 0x0,
6998                     "Option 0: Padding", HFILL }},
6999
7000                 { &hf_bootp_option_subnet_mask,
7001                   { "Subnet Mask", "bootp.option.subnet_mask",
7002                     FT_IPv4, BASE_NETMASK, NULL, 0x00,
7003                     "Option 1: Subnet Mask", HFILL }},
7004
7005                 { &hf_bootp_option_time_offset,
7006                   { "Time Offset", "bootp.option.time_offset",
7007                     FT_INT32, BASE_DEC, NULL, 0x00,
7008                     "Option 2: Time Offset", HFILL }},
7009
7010                 { &hf_bootp_option_router,
7011                   { "Router", "bootp.option.router",
7012                     FT_IPv4, BASE_NONE, NULL, 0x00,
7013                     "Option 3: Router", HFILL }},
7014
7015                 { &hf_bootp_option_time_server,
7016                   { "Time Server", "bootp.option.time_server",
7017                     FT_IPv4, BASE_NONE, NULL, 0x00,
7018                     "Option 4: Time Server", HFILL }},
7019
7020                 { &hf_bootp_option_name_server,
7021                   { "Name Server", "bootp.option.name_server",
7022                     FT_IPv4, BASE_NONE, NULL, 0x00,
7023                     "Option 5: Name Server", HFILL }},
7024
7025                 { &hf_bootp_option_domain_name_server,
7026                   { "Domain Name Server", "bootp.option.domain_name_server",
7027                     FT_IPv4, BASE_NONE, NULL, 0x00,
7028                     "Option 6: Domain Name Server", HFILL }},
7029
7030                 { &hf_bootp_option_log_server,
7031                   { "Log Server", "bootp.option.log_server",
7032                     FT_IPv4, BASE_NONE, NULL, 0x00,
7033                     "Option 7: Log Server", HFILL }},
7034
7035                 { &hf_bootp_option_quotes_server,
7036                   { "Quotes Server", "bootp.option.quotes_server",
7037                     FT_IPv4, BASE_NONE, NULL, 0x00,
7038                     "Option 8: Quotes Server", HFILL }},
7039
7040                 { &hf_bootp_option_lpr_server,
7041                   { "LPR Server", "bootp.option.lpr_server",
7042                     FT_IPv4, BASE_NONE, NULL, 0x00,
7043                     "Option 9: LPR Server", HFILL }},
7044
7045                 { &hf_bootp_option_impress_server,
7046                   { "Impress Server", "bootp.option.impress_server",
7047                     FT_IPv4, BASE_NONE, NULL, 0x00,
7048                     "Option 10: Impress Server", HFILL }},
7049
7050                 { &hf_bootp_option_resource_location_server,
7051                   { "Resource Location Server", "bootp.option.resource_location_server",
7052                     FT_IPv4, BASE_NONE, NULL, 0x00,
7053                     "Option 11: Resource Location Server", HFILL }},
7054
7055                 { &hf_bootp_option_hostname,
7056                   { "Host Name", "bootp.option.hostname",
7057                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7058                     "Option 12: Host Name", HFILL }},
7059
7060                 { &hf_bootp_option_boot_file_size,
7061                   { "Boot File Size", "bootp.option.boot_file_size",
7062                     FT_UINT16, BASE_DEC, NULL, 0x0,
7063                     "Option 13: Boot File Size", HFILL }},
7064
7065                 { &hf_bootp_option_merit_dump_file,
7066                   { "Merit Dump File", "bootp.option.merit_dump_file",
7067                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7068                     "Option 14: Merit Dump File", HFILL }},
7069
7070                 { &hf_bootp_option_domain_name,
7071                   { "Domain Name", "bootp.option.domain_name",
7072                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7073                     "Option 15: Domain Name", HFILL }},
7074
7075                 { &hf_bootp_option_swap_server,
7076                   { "Swap Server", "bootp.option.swap_server",
7077                     FT_IPv4, BASE_NONE, NULL, 0x00,
7078                     "Option 16: Swap Server", HFILL }},
7079
7080                 { &hf_bootp_option_root_path,
7081                   { "Root Path", "bootp.option.root_path",
7082                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7083                     "Option 17: Root Path", HFILL }},
7084
7085                 { &hf_bootp_option_extension_path,
7086                   { "Extensions Path", "bootp.option.extension_path",
7087                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7088                     "Option 18: Extensions Path", HFILL }},
7089
7090                 { &hf_bootp_option_ip_forwarding,
7091                   { "IP Forwarding", "bootp.option.ip_forwarding",
7092                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7093                     "Option 19: IP Forwarding", HFILL }},
7094
7095                 { &hf_bootp_option_policy_filter_ip,
7096                   { "IP Address", "bootp.option.policy_filter.ip",
7097                     FT_IPv4, BASE_NONE, NULL, 0x00,
7098                     "Option 21: IP address", HFILL }},
7099
7100                 { &hf_bootp_option_policy_filter_subnet_mask,
7101                   { "Subnet Mask", "bootp.option.policy_filter.subnet_mask",
7102                     FT_IPv4, BASE_NETMASK, NULL, 0x00,
7103                     "Option 21: Subnet Mask", HFILL }},
7104
7105                 { &hf_bootp_option_non_local_source_routing,
7106                   { "Non-Local Source Routing", "bootp.option.non_local_source_routing",
7107                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7108                     "Option 20: Non-Local Source Routing", HFILL }},
7109
7110                 { &hf_bootp_option_max_datagram_reassembly_size,
7111                   { "Maximum Datagram Reassembly Size", "bootp.option.max_datagram_reassembly_size",
7112                     FT_UINT16, BASE_DEC, NULL, 0x0,
7113                     "Option 22: Maximum Datagram Reassembly Size", HFILL }},
7114
7115                 { &hf_bootp_option_default_ip_ttl,
7116                   { "Default IP Time-to-Live", "bootp.option.default_ip_ttl",
7117                     FT_UINT8, BASE_DEC, NULL, 0x0,
7118                     "Option 23: Default IP Time-to-Live", HFILL }},
7119
7120                 { &hf_bootp_option_path_mtu_aging_timeout,
7121                   { "Path MTU Aging Timeout", "bootp.option.path_mtu_aging_timeout",
7122                     FT_UINT32, BASE_DEC, NULL, 0x00,
7123                     "Option 24: Path MTU Aging Timeout", HFILL }},
7124
7125                 { &hf_bootp_option_path_mtu_plateau_table_item,
7126                   { "Path MTU Plateau Table Item", "bootp.option.path_mtu_plateau_table_item",
7127                     FT_UINT16, BASE_DEC, NULL, 0x0,
7128                     "Option 25: Path MTU Plateau Table Item", HFILL }},
7129
7130                 { &hf_bootp_option_interface_mtu,
7131                   { "Interface MTU", "bootp.option.interface_mtu",
7132                     FT_UINT16, BASE_DEC, NULL, 0x0,
7133                     "Option 26: Interface MTU", HFILL }},
7134
7135                 { &hf_bootp_option_all_subnets_are_local,
7136                   { "All Subnets are Local", "bootp.option.all_subnets_are_local",
7137                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x00,
7138                     "Option 27: All Subnets are Local", HFILL }},
7139
7140                 { &hf_bootp_option_broadcast_address,
7141                   { "Broadcast Address", "bootp.option.broadcast_address",
7142                     FT_IPv4, BASE_NONE, NULL, 0x00,
7143                     "Option 28: Broadcast Address", HFILL }},
7144
7145                 { &hf_bootp_option_perform_mask_discovery,
7146                   { "Perform Mask Discovery", "bootp.option.perform_mask_discovery",
7147                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7148                     "Option 29: Perform Mask Discovery", HFILL }},
7149
7150                 { &hf_bootp_option_mask_supplier,
7151                   { "Mask Supplier", "bootp.option.mask_supplier",
7152                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x00,
7153                     "Option 30: Mask Supplier", HFILL }},
7154
7155                 { &hf_bootp_option_perform_router_discover,
7156                   { "Perform Router Discover", "bootp.option.perform_router_discover",
7157                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7158                     "Option 31: Perform Router Discover", HFILL }},
7159
7160                 { &hf_bootp_option_router_solicitation_address,
7161                   { "Router Solicitation Address", "bootp.option.router_solicitation_address",
7162                     FT_IPv4, BASE_NONE, NULL, 0x00,
7163                     "Option 32: Router Solicitation Address", HFILL }},
7164
7165                 { &hf_bootp_option_static_route_ip,
7166                   { "Destination IP Address", "bootp.option.static_route.ip",
7167                     FT_IPv4, BASE_NONE, NULL, 0x00,
7168                     "Option 33: Destination IP address", HFILL }},
7169
7170                 { &hf_bootp_option_static_route_router,
7171                   { "Destination Router", "bootp.option.static_route.router",
7172                     FT_IPv4, BASE_NONE, NULL, 0x00,
7173                     "Option 33: Destination Router", HFILL }},
7174
7175                 { &hf_bootp_option_trailer_encapsulation,
7176                   { "Trailer Encapsulation", "bootp.option.trailer_encapsulation",
7177                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7178                     "Option 34: Trailer Encapsulation", HFILL }},
7179
7180                 { &hf_bootp_option_arp_cache_timeout,
7181                   { "ARP Cache Timeout", "bootp.option.arp_cache_timeout",
7182                     FT_UINT32, BASE_DEC, NULL, 0x00,
7183                     "Option 35: ARP Cache Timeout", HFILL }},
7184
7185                 { &hf_bootp_option_ethernet_encapsulation,
7186                   { "Ethernet Encapsulation", "bootp.option.ethernet_encapsulation",
7187                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7188                     "Option 36: Ethernet Encapsulation", HFILL }},
7189
7190                 { &hf_bootp_option_tcp_default_ttl,
7191                   { "TCP Default TTL", "bootp.option.tcp_default_ttl",
7192                     FT_UINT8, BASE_DEC, NULL, 0x0,
7193                     "Option 37: TCP Default TTL", HFILL }},
7194
7195                 { &hf_bootp_option_tcp_keepalive_interval,
7196                   { "TCP Keepalive Interval", "bootp.option.tcp_keepalive_interval",
7197                     FT_UINT32, BASE_DEC, NULL, 0x00,
7198                     "Option 38: TCP Keepalive Interval", HFILL }},
7199
7200                 { &hf_bootp_option_tcp_keepalive_garbage,
7201                   { "TCP Keepalive Garbage", "bootp.option.tcp_keepalive_garbage",
7202                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_enabled_disabled), 0x00,
7203                     "Option 39: TCP Keepalive Garbage", HFILL }},
7204
7205                 { &hf_bootp_option_nis_domain,
7206                   { "Network Information Service Domain", "bootp.option.nis_domain",
7207                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7208                     "Option 40: Network Information Service Domain", HFILL }},
7209
7210                 { &hf_bootp_option_nis_server,
7211                   { "Network Information Service Server", "bootp.option.nis_server",
7212                     FT_IPv4, BASE_NONE, NULL, 0x00,
7213                     "Option 41: Network Information Service Server", HFILL }},
7214
7215                 { &hf_bootp_option_ntp_server,
7216                   { "Network Time Protocol Server", "bootp.option.ntp_server",
7217                     FT_IPv4, BASE_NONE, NULL, 0x00,
7218                     "Option 42: Network Time Protocol Server", HFILL }},
7219
7220
7221                 { &hf_bootp_option43_value,
7222                   { "Value", "bootp.option.vendor.value",
7223                     FT_BYTES, BASE_NONE, NULL, 0x0,
7224                     "Option 43: Suboption value", HFILL }},
7225
7226                 { &hf_bootp_option43_value_8,
7227                   { "Value", "bootp.option.vendor.value.uint",
7228                     FT_UINT8, BASE_DEC, NULL, 0x0,
7229                     "Option 43: Suboption 8-bit value", HFILL }},
7230
7231                 { &hf_bootp_option43_value_32,
7232                   { "Value", "bootp.option.vendor.value.uint",
7233                     FT_UINT32, BASE_DEC, NULL, 0x0,
7234                     "Option 43: Suboption 32-bit value", HFILL }},
7235
7236                 { &hf_bootp_option43_value_stringz,
7237                   { "Value", "bootp.option.vendor.value.string",
7238                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7239                     "Option 43: Suboption Z-String value", HFILL }},
7240
7241                 { &hf_bootp_option43_value_ip_address,
7242                   { "Value", "bootp.option.vendor.value.address",
7243                     FT_IPv4, BASE_NONE, NULL, 0x00,
7244                     "Option 43: Suboption IP address", HFILL }},
7245
7246
7247                 { &hf_bootp_option43_pxeclient_suboption,
7248                   { "Option 43 Suboption", "bootp.option.vendor.pxeclient.suboption",
7249                     FT_UINT8, BASE_DEC, VALS(option43_pxeclient_suboption_vals), 0x0,
7250                     "Option 43:PXE Client Suboption", HFILL }},
7251
7252                 { &hf_bootp_option43_pxeclient_padding,
7253                   { "Padding", "bootp.option.vendor.pxeclient.padding",
7254                     FT_UINT8, BASE_DEC, NULL, 0x0,
7255                     "Option 43:PXE Client 0 Padding", HFILL }},
7256
7257                 { &hf_bootp_option43_pxeclient_mtftp_ip,
7258                   { "mtftp IP", "bootp.option.vendor.pxeclient.mtftp_ip",
7259                     FT_IPv4, BASE_NONE, NULL, 0x00,
7260                     "Option 43:PXE Client 1 mtftp IP", HFILL }},
7261
7262                 { &hf_bootp_option43_pxeclient_mtftp_client_port,
7263                   { "mtftp IP", "bootp.option.vendor.pxeclient.mtftp_client_port",
7264                     FT_UINT16, BASE_DEC, NULL, 0x00,
7265                     "Option 43:PXE Client 2 mtftp client port", HFILL }},
7266
7267                 { &hf_bootp_option43_pxeclient_mtftp_server_port,
7268                   { "mtftp IP", "bootp.option.vendor.pxeclient.mtftp_server_port",
7269                     FT_UINT16, BASE_DEC, NULL, 0x00,
7270                     "Option 43:PXE Client 3 mtftp server port", HFILL }},
7271
7272                 { &hf_bootp_option43_pxeclient_mtftp_timeout,
7273                   { "mtftp timeout", "bootp.option.vendor.pxeclient.mtftp_timeout",
7274                     FT_UINT8, BASE_DEC, NULL, 0x0,
7275                     "Option 43:PXE Client 4 mtftp timeout", HFILL }},
7276
7277                 { &hf_bootp_option43_pxeclient_mtftp_delay,
7278                   { "mtftp delay", "bootp.option.vendor.pxeclient.mtftp_delay",
7279                     FT_UINT8, BASE_DEC, NULL, 0x0,
7280                     "Option 43:PXE Client 5 mtftp delay", HFILL }},
7281
7282                 { &hf_bootp_option43_pxeclient_discovery_control,
7283                   { "discovery control", "bootp.option.vendor.pxeclient.discovery_control",
7284                     FT_UINT8, BASE_HEX, NULL, 0x0,
7285                     "Option 43:PXE Client 6 discovery control", HFILL }},
7286
7287                 { &hf_bootp_option43_pxeclient_multicast_address,
7288                   { "multicast address", "bootp.option.vendor.pxeclient.multicast_address",
7289                     FT_IPv4, BASE_NONE, NULL, 0x00,
7290                     "Option 43:PXE Client 7 multicast address", HFILL }},
7291
7292                 { &hf_bootp_option43_pxeclient_boot_servers,
7293                   { "boot servers", "bootp.option.vendor.pxeclient.boot_servers",
7294                     FT_BYTES, BASE_NONE, NULL, 0x0,
7295                     "Option 43:PXE Client 8 boot servers", HFILL }},
7296
7297                 { &hf_bootp_option43_pxeclient_boot_menu,
7298                   { "boot menu", "bootp.option.vendor.pxeclient.boot_menu",
7299                     FT_BYTES, BASE_NONE, NULL, 0x0,
7300                     "Option 43:PXE Client 9 boot menu", HFILL }},
7301
7302                 { &hf_bootp_option43_pxeclient_menu_prompt,
7303                   { "menu prompt", "bootp.option.vendor.pxeclient.menu_prompt",
7304                     FT_BYTES, BASE_NONE, NULL, 0x0,
7305                     "Option 43:PXE Client 10 menu prompt", HFILL }},
7306
7307                 { &hf_bootp_option43_pxeclient_multicast_address_alloc,
7308                   { "multicast address alloc", "bootp.option.vendor.pxeclient.multicast_address_alloc",
7309                     FT_BYTES, BASE_NONE, NULL, 0x0,
7310                     "Option 43:PXE Client 11 multicast address alloc", HFILL }},
7311
7312                 { &hf_bootp_option43_pxeclient_credential_types,
7313                   { "credential types", "bootp.option.vendor.pxeclient.credential_types",
7314                     FT_BYTES, BASE_NONE, NULL, 0x0,
7315                     "Option 43:PXE Client 12 credential types", HFILL }},
7316
7317                 { &hf_bootp_option43_pxeclient_boot_item,
7318                   { "boot item", "bootp.option.vendor.pxeclient.boot_item",
7319                     FT_BYTES, BASE_NONE, NULL, 0x0,
7320                     "Option 43:PXE Client 71 boot item", HFILL }},
7321
7322                 { &hf_bootp_option43_pxeclient_end,
7323                   { "PXE Client End", "bootp.option.vendor.pxeclient.end",
7324                     FT_UINT8, BASE_DEC, NULL, 0x0,
7325                     "Option 43:PXE Client 255 End", HFILL }},
7326
7327
7328                 { &hf_bootp_option43_cl_suboption,
7329                   { "Option 43 Suboption", "bootp.option.vendor.cl.suboption",
7330                     FT_UINT8, BASE_DEC, VALS(option43_cl_suboption_vals), 0x0,
7331                     "Option 43:CL Suboption", HFILL }},
7332
7333                 { &hf_bootp_option43_cl_padding,
7334                   { "Padding", "bootp.option.vendor.cl.padding",
7335                     FT_UINT8, BASE_DEC, NULL, 0x0,
7336                     "Option 43:CL 0 Padding", HFILL }},
7337
7338                 { &hf_bootp_option43_cl_suboption_request_list,
7339                   { "Suboption Request List", "bootp.option.vendor.cl.suboption_request_list",
7340                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7341                     "Option 43:CL 1 Suboption Request List", HFILL }},
7342
7343                 { &hf_bootp_option43_cl_device_type,
7344                   { "Device Type", "bootp.option.vendor.cl.device_type",
7345                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7346                     "Option 43:CL 2 Device Type", HFILL }},
7347
7348                 { &hf_bootp_option43_cl_esafe_type,
7349                   { "eSAFE Types", "bootp.option.vendor.cl.esafe_type",
7350                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7351                     "Option 43:CL 3 eSAFE Types", HFILL }},
7352
7353                 { &hf_bootp_option43_cl_serial_number,
7354                   { "Serial Number", "bootp.option.vendor.cl.serial_number",
7355                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7356                     "Option 43:CL 4 Serial Number", HFILL }},
7357
7358                 { &hf_bootp_option43_cl_hardware_version,
7359                   { "Hardware Version", "bootp.option.vendor.cl.hardware_version",
7360                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7361                     "Option 43:CL 5 Hardware Version", HFILL }},
7362
7363                 { &hf_bootp_option43_cl_software_version,
7364                   { "Software Version", "bootp.option.vendor.cl.software_version",
7365                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7366                     "Option 43:CL 6 Software Version", HFILL }},
7367
7368                 { &hf_bootp_option43_cl_boot_rom_version,
7369                   { "Boot ROM version", "bootp.option.vendor.cl.boot_rom_version",
7370                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7371                     "Option 43:CL 7 Boot ROM version", HFILL }},
7372
7373                 { &hf_bootp_option43_cl_oui_string,
7374                   { "Organizationally Unique Identifier", "bootp.option.vendor.cl.oui_string",
7375                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7376                     "Option 43:CL 8 Organizationally Unique Identifier", HFILL }},
7377
7378                 { &hf_bootp_option43_cl_oui_bytes,
7379                   { "Organizationally Unique Identifier", "bootp.option.vendor.cl.oui_bytes",
7380                     FT_BYTES, BASE_NONE, NULL, 0x0,
7381                     "Option 43:CL 8 Organizationally Unique Identifier", HFILL }},
7382
7383                 { &hf_bootp_option43_cl_model_number,
7384                   { "Model Number", "bootp.option.vendor.cl.model_number",
7385                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7386                     "Option 43:CL 9 Model Number", HFILL }},
7387
7388                 { &hf_bootp_option43_cl_vendor_name10,
7389                   { "Vendor Name", "bootp.option.vendor.cl.vendor_name10",
7390                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7391                     "Option 43:CL 10 Vendor Name", HFILL }},
7392
7393                 { &hf_bootp_option43_cl_address_realm,
7394                   { "Address Realm", "bootp.option.vendor.cl.address_realm",
7395                     FT_UINT8, BASE_DEC, VALS(cablehome_subopt11_vals), 0x0,
7396                     "Option 43:CL 11 Address Realm", HFILL }},
7397
7398                 { &hf_bootp_option43_cl_cm_ps_system_desc,
7399                   { "CM/PS System Description", "bootp.option.vendor.cl.cm_ps_system_desc",
7400                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7401                     "Option 43:CL 12 CM/PS System Description", HFILL }},
7402
7403                 { &hf_bootp_option43_cl_cm_ps_firmware_revision,
7404                   { "CM/PS Firmware Revision", "bootp.option.vendor.cl.cm_ps_firmware_revision",
7405                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7406                     "Option 43:CL 13 CM/PS Firmware Revision", HFILL }},
7407
7408                 { &hf_bootp_option43_cl_firewall_policy_file_version,
7409                   { "Firewall Policy File Version", "bootp.option.vendor.cl.firewall_policy_file_version",
7410                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7411                     "Option 43:CL 14 Firewall Policy File Version", HFILL }},
7412
7413                 { &hf_bootp_option43_cl_esafe_config_file_devices,
7414                   { "eSafe Config File Devices", "bootp.option.vendor.cl.esafe_config_file_devices",
7415                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7416                     "Option 43:CL 15 eSafe Config File Devices", HFILL }},
7417
7418                 { &hf_bootp_option43_cl_video_security_tape,
7419                   { "Video Security Type", "bootp.option.vendor.cl.video_security_tape",
7420                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7421                     "Option 43:CL 18 Video Security Type", HFILL }},
7422
7423                 { &hf_bootp_option43_cl_mta_mac_address,
7424                   { "MTA MAC Address", "bootp.option.vendor.cl.mta_mac_address",
7425                     FT_ETHER, BASE_NONE, NULL, 0x0,
7426                     "Option 43:CL 31 MTA MAC Address", HFILL }},
7427
7428                 { &hf_bootp_option43_cl_correlation_ID,
7429                   { "Correlation ID", "bootp.option.vendor.cl.correlation_ID",
7430                     FT_UINT32, BASE_DEC, NULL, 0x0,
7431                     "Option 43: CL 32 Correlation ID", HFILL }},
7432
7433                 { &hf_bootp_option43_cl_vendor_name51,
7434                   { "Vendor Name", "bootp.option.vendor.cl.vendor_name51",
7435                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7436                     "Option 43:CL 51 Vendor Name", HFILL }},
7437
7438                 { &hf_bootp_option43_cl_cablecard_capability,
7439                   { "CableCARD Capability", "bootp.option.vendor.cl.cablecard_capability",
7440                     FT_BYTES, BASE_NONE, NULL, 0x0,
7441                     "Option 43:CL 52 CableCARD Capability", HFILL }},
7442
7443                 { &hf_bootp_option43_cl_device_id_ca,
7444                   { "Device Identification (CA)", "bootp.option.vendor.cl.device_id_ca",
7445                     FT_BYTES, BASE_NONE, NULL, 0x0,
7446                     "Option 43:CL 53 Device Identification (CA)", HFILL }},
7447
7448                 { &hf_bootp_option43_cl_device_id_x509,
7449                   { "Device Identification (X.509)", "bootp.option.vendor.cl.device_id_x509",
7450                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7451                     "Option 43:CL 54 Device Identification (X.509)", HFILL }},
7452
7453                 { &hf_bootp_option43_cl_end,
7454                   { "CL End", "bootp.option.vendor.cl.end",
7455                     FT_UINT8, BASE_DEC, NULL, 0x0,
7456                     "Option 43:CL 255 End", HFILL }},
7457
7458
7459                 { &hf_bootp_option43_alcatel_suboption,
7460                   { "Option 43 Suboption", "bootp.option.vendor.alu.suboption",
7461                     FT_UINT8, BASE_DEC, VALS(option43_alcatel_suboption_vals), 0x0,
7462                     "Option 43:Alcatel Suboption", HFILL }},
7463
7464                 { &hf_bootp_option43_alcatel_padding,
7465                   { "Padding", "bootp.option.vendor.alu.padding",
7466                     FT_UINT8, BASE_DEC, NULL, 0x0,
7467                     "Option 43:Alcatel 0 Padding", HFILL }},
7468
7469                 { &hf_bootp_option43_alcatel_vlan_id,
7470                   { "Voice VLAN ID", "bootp.option.vendor.alu.vid",
7471                     FT_UINT16, BASE_DEC, NULL, 0x0,
7472                     "Option 43:Alcatel 58 Voice VLAN ID", HFILL }},
7473
7474                 { &hf_bootp_option43_alcatel_tftp1,
7475                   { "Spatial Redundancy TFTP1", "bootp.option.vendor.alu.tftp1",
7476                     FT_IPv4, BASE_NONE, NULL, 0x0,
7477                     "Option 43:Alcatel 64 Spatial Redundancy TFTP1", HFILL }},
7478
7479                 { &hf_bootp_option43_alcatel_tftp2,
7480                   { "Spatial Redundancy TFTP2", "bootp.option.vendor.alu.tftp2",
7481                     FT_IPv4, BASE_NONE, NULL, 0x0,
7482                     "Option 43:Alcatel 65 Spatial Redundancy TFTP2", HFILL }},
7483
7484                 { &hf_bootp_option43_alcatel_app_type,
7485                   { "Application Type", "bootp.option.vendor.alu.app_type",
7486                     FT_UINT8, BASE_DEC, VALS(option43_alcatel_app_type_vals), 0x0,
7487                     "Option 43:Alcatel 66 Application Type", HFILL }},
7488
7489                 { &hf_bootp_option43_alcatel_sip_url,
7490                   { "SIP URL", "bootp.option.vendor.alu.sip_url",
7491                     FT_STRING, BASE_NONE, NULL, 0x0,
7492                     "Option 43:Alcatel 67 SIP URL", HFILL }},
7493
7494                 { &hf_bootp_option43_alcatel_end,
7495                   { "Alcatel End", "bootp.option.vendor.alu.end",
7496                     FT_UINT8, BASE_DEC, NULL, 0x0,
7497                     "Option 43:Alcatel 255 End", HFILL }},
7498
7499                 { &hf_bootp_option43_arubaap_controllerip,
7500                   { "Aruba Controller IP", "bootp.option.vendor.arubaap.controllerip",
7501                     FT_STRING, BASE_NONE, NULL, 0x0,
7502                     "Address IP of Aruba controller", HFILL }},
7503
7504                 { &hf_bootp_option43_arubaiap,
7505                   { "Aruba Instant AP", "bootp.option.vendor.arubaiap",
7506                     FT_STRING, BASE_NONE, NULL, 0x0,
7507                     "nameorg,amp-ip-address,password", HFILL }},
7508
7509                 { &hf_bootp_option43_arubaiap_nameorg,
7510                   { "Name Organisation", "bootp.option.vendor.arubaiap.name_org",
7511                     FT_STRING, BASE_NONE, NULL, 0x0,
7512                     NULL, HFILL }},
7513
7514                 { &hf_bootp_option43_arubaiap_ampip,
7515                   { "AMP IP Address", "bootp.option.vendor.arubaiap.amp_ip",
7516                     FT_STRING, BASE_NONE, NULL, 0x0,
7517                     "Address IP of Airwave server (AMP)", HFILL }},
7518
7519                 { &hf_bootp_option43_arubaiap_password,
7520                   { "Password", "bootp.option.vendor.arubaiap.password",
7521                     FT_STRING, BASE_NONE, NULL, 0x0,
7522                     "Password for Instant AP Airwave server (AMP)", HFILL }},
7523
7524
7525                 { &hf_bootp_option43_bsdp_suboption,
7526                   { "Option 43 Suboption", "bootp.option.vendor.bsdp.suboption",
7527                     FT_UINT8, BASE_DEC, VALS(option43_cl_suboption_vals), 0x0,
7528                     "Option 43:BSDP Suboption", HFILL }},
7529
7530                 { &hf_bootp_option43_bsdp_message_type,
7531                   { "Message Type", "bootp.option.vendor.bsdp.message_type",
7532                     FT_UINT8, BASE_DEC, VALS(o43_bsdp_message_type_vals), 0x0,
7533                     NULL, HFILL }},
7534
7535                 { &hf_bootp_option43_bsdp_version,
7536                   { "Version", "bootp.option.vendor.bsdp.version",
7537                     FT_UINT16, BASE_HEX, NULL, 0x0,
7538                     NULL, HFILL }},
7539
7540                 { &hf_bootp_option43_bsdp_server_identifier,
7541                   { "Server Identifier", "bootp.option.vendor.bsdp.server_identifier",
7542                     FT_IPv4, BASE_NONE, NULL, 0x0,
7543                     NULL, HFILL }},
7544
7545                 { &hf_bootp_option43_bsdp_server_priority,
7546                   { "Server Priority", "bootp.option.vendor.bsdp.server_priority",
7547                     FT_UINT16, BASE_DEC, NULL, 0x0,
7548                     NULL, HFILL }},
7549
7550                 { &hf_bootp_option43_bsdp_reply_port,
7551                   { "Reply Port", "bootp.option.vendor.bsdp.reply_port",
7552                     FT_UINT16, BASE_DEC, NULL, 0x0,
7553                     NULL, HFILL }},
7554
7555                 { &hf_bootp_option43_bsdp_boot_image_list_path,
7556                   { "Boot Image List Path", "bootp.option.vendor.bsdp.boot_image_list_path",
7557                     FT_STRING, BASE_NONE, NULL, 0x0,
7558                     NULL, HFILL }},
7559
7560                 { &hf_bootp_option43_bsdp_boot_image_index,
7561                   { "Boot Image Index", "bootp.option.vendor.bsdp.boot_image.index",
7562                     FT_UINT16, BASE_HEX, NULL, 0x0,
7563                     NULL, HFILL }},
7564
7565                 { &hf_bootp_option43_bsdp_default_boot_image_id,
7566                   { "Default Boot Image ID", "bootp.option.vendor.bsdp.default_boot_image_id",
7567                     FT_UINT32, BASE_HEX, NULL, 0x0,
7568                     NULL, HFILL }},
7569
7570                 { &hf_bootp_option43_bsdp_selected_boot_image_id,
7571                   { "Selected Boot Image ID", "bootp.option.vendor.bsdp.selected_boot_image_id",
7572                     FT_UINT32, BASE_HEX, NULL, 0x0,
7573                     NULL, HFILL }},
7574
7575                 { &hf_bootp_option43_bsdp_boot_image_list,
7576                   { "Boot Image List", "bootp.option.vendor.bsdp.boot_image_list",
7577                     FT_BYTES, BASE_NONE, NULL, 0x0,
7578                     NULL, HFILL }},
7579
7580                 { &hf_bootp_option43_bsdp_image_desc,
7581                   { "Boot Image Description", "bootp.option.vendor.bsdp.boot_image.desc",
7582                     FT_BYTES, BASE_NONE, NULL, 0x0,
7583                     NULL, HFILL }},
7584
7585                 { &hf_bootp_option43_bsdp_boot_image_name_len,
7586                   { "Boot Image Name Length", "bootp.option.vendor.bsdp.boot_image.name_len",
7587                     FT_UINT8, BASE_DEC, NULL, 0x0,
7588                     NULL, HFILL }},
7589
7590                 { &hf_bootp_option43_bsdp_boot_image_name,
7591                   { "Boot Image Name", "bootp.option.vendor.bsdp.boot_image.name",
7592                     FT_STRING, BASE_NONE, NULL, 0x0,
7593                     NULL, HFILL }},
7594
7595                 { &hf_bootp_option43_bsdp_netboot_firmware,
7596                   { "NetBoot 1.0 Firmware", "bootp.option.vendor.bsdp.netboot_firmware",
7597                     FT_NONE, BASE_NONE, NULL, 0x0,
7598                     NULL, HFILL }},
7599
7600                 { &hf_bootp_option43_bsdp_attributes_filter_list,
7601                   { "Boot Image Attributes Filter List", "bootp.option.vendor.bsdp.attributes_filter_list",
7602                     FT_BYTES, BASE_NONE, NULL, 0x0,
7603                     NULL, HFILL }},
7604
7605                 { &hf_bootp_option43_bsdp_boot_image_attribute,
7606                   { "Boot Image Attribute", "bootp.option.vendor.bsdp.boot_image.attribute",
7607                     FT_UINT16, BASE_HEX, NULL, 0x0,
7608                     NULL, HFILL }},
7609
7610                 { &hf_bootp_option43_bsdp_boot_image_attribute_install,
7611                   { "Install", "bootp.option.vendor.bsdp.boot_image.attribute.install",
7612                     FT_UINT16, BASE_HEX, VALS(o43_bsdp_boot_image_install_vals), 0x8000,
7613                     "Boot Image Attribute Install", HFILL }},
7614
7615                 { &hf_bootp_option43_bsdp_boot_image_attribute_kind,
7616                   { "Kind", "bootp.option.vendor.bsdp.boot_image.attribute.kind",
7617                     FT_UINT16, BASE_HEX, VALS(o43_bsdp_boot_image_kind_vals), 0x7f00,
7618                     "Boot Image Attribute Kind", HFILL }},
7619
7620                 { &hf_bootp_option43_bsdp_boot_image_attribute_reserved,
7621                   { "Reserved", "bootp.option.vendor.bsdp.boot_image.attribute.reserved",
7622                     FT_UINT16, BASE_HEX, NULL, 0x00ff,
7623                     "Boot Image Attribute Reserved", HFILL }},
7624
7625                 { &hf_bootp_option43_bsdp_message_size,
7626                   { "Message Size", "bootp.option.vendor.bsdp.message_size",
7627                     FT_UINT16, BASE_DEC, NULL, 0x0,
7628                     NULL, HFILL }},
7629
7630
7631                 { &hf_bootp_option_netbios_over_tcpip_name_server,
7632                   { "NetBIOS over TCP/IP Name Server", "bootp.option.netbios_over_tcpip_name_server",
7633                     FT_IPv4, BASE_NONE, NULL, 0x00,
7634                     "Option 44: NetBIOS over TCP/IP Name Server", HFILL }},
7635
7636                 { &hf_bootp_option_netbios_over_tcpip_dd_name_server,
7637                   { "NetBIOS over TCP/IP Datagram Distribution Name Server", "bootp.option.netbios_over_tcpip_dd_name_server",
7638                     FT_IPv4, BASE_NONE, NULL, 0x00,
7639                     "Option 45: NetBIOS over TCP/IP Datagram Distribution Name Server", HFILL }},
7640
7641                 { &hf_bootp_option_netbios_over_tcpip_node_type,
7642                   { "NetBIOS over TCP/IP Node Type", "bootp.option.netbios_over_tcpip_node_type",
7643                     FT_UINT8, BASE_DEC, VALS(bootp_nbnt_vals), 0x0,
7644                     "Option 46: NetBIOS over TCP/IP Node Type", HFILL }},
7645
7646                 { &hf_bootp_option_netbios_over_tcpip_scope,
7647                   { "NetBIOS over TCP/IP Scope", "bootp.option.netbios_over_tcpip_scope",
7648                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7649                     "Option 47: NetBIOS over TCP/IP Scope", HFILL }},
7650
7651                 { &hf_bootp_option_xwindows_system_font_server,
7652                   { "X Window System Font Server", "bootp.option.xwindows_system_font_server",
7653                     FT_IPv4, BASE_NONE, NULL, 0x00,
7654                     "Option 48: X Window System Font Server", HFILL }},
7655
7656                 { &hf_bootp_option_xwindows_system_display_manager,
7657                   { "X Window System Display Manager", "bootp.option.xwindows_system_display_manager",
7658                     FT_IPv4, BASE_NONE, NULL, 0x00,
7659                     "Option 49: X Window System Display Manager", HFILL }},
7660
7661                 { &hf_bootp_option_requested_ip_address,
7662                   { "Requested IP Address", "bootp.option.requested_ip_address",
7663                     FT_IPv4, BASE_NONE, NULL, 0x00,
7664                     "Option 50: Requested IP Address", HFILL }},
7665
7666                 { &hf_bootp_option_ip_address_lease_time,
7667                   { "IP Address Lease Time", "bootp.option.ip_address_lease_time",
7668                     FT_UINT32, BASE_DEC, NULL, 0x00,
7669                     "Option 51: IP Address Lease Time", HFILL }},
7670
7671                 { &hf_bootp_option_option_overload,
7672                   { "Option Overload", "bootp.option.option_overload",
7673                     FT_UINT8, BASE_DEC, VALS(opt_overload_vals), 0x0,
7674                     "Option 52: Option Overload", HFILL }},
7675
7676                 { &hf_bootp_option_dhcp,
7677                   { "DHCP", "bootp.option.dhcp",
7678                     FT_UINT8, BASE_DEC, VALS(opt53_text), 0x0,
7679                     "Option 53: DHCP option", HFILL }},
7680
7681                 { &hf_bootp_option_dhcp_server_id,
7682                   { "DHCP Server Identifier", "bootp.option.dhcp_server_id",
7683                     FT_IPv4, BASE_NONE, NULL, 0x00,
7684                     "Option 54: DHCP Server Identifier", HFILL }},
7685
7686                 { &hf_bootp_option_parameter_request_list_item,
7687                   { "Parameter Request List Item", "bootp.option.request_list_item",
7688                     FT_UINT8, BASE_DEC, NULL, 0x0,
7689                     "Option 55: Parameter Request List Item", HFILL }},
7690
7691                 { &hf_bootp_option_message,
7692                   { "Message", "bootp.option.message",
7693                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7694                     "Option 56: Option message", HFILL }},
7695
7696                 { &hf_bootp_option_dhcp_max_message_size,
7697                   { "Maximum DHCP Message Size", "bootp.option.dhcp_max_message_size",
7698                     FT_UINT16, BASE_DEC, NULL, 0x0,
7699                     "Option 57: Maximum DHCP Message Size", HFILL }},
7700
7701                 { &hf_bootp_option_renewal_time_value,
7702                   { "Renewal Time Value", "bootp.option.renewal_time_value",
7703                     FT_UINT32, BASE_DEC, NULL, 0x00,
7704                     "Option 58: Renewal Time Value", HFILL }},
7705
7706                 { &hf_bootp_option_rebinding_time_value,
7707                   { "Rebinding Time Value", "bootp.option.rebinding_time_value",
7708                     FT_UINT32, BASE_DEC, NULL, 0x00,
7709                     "Option 59: Rebinding Time Value", HFILL }},
7710
7711                 { &hf_bootp_option_vendor_class_id,
7712                   { "Vendor class identifier", "bootp.option.vendor_class_id",
7713                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7714                     "Option 60: Vendor class identifier", HFILL }},
7715
7716                 { &hf_bootp_option_vendor_class_data,
7717                   { "vendor-class-data", "bootp.option.vendor_class_data",
7718                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7719                     "Option 60: Vendor class data", HFILL }},
7720
7721                 { &hf_bootp_option_novell_netware_ip_domain,
7722                   { "Novell/Netware IP domain", "bootp.option.novell_netware_ip_domain",
7723                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7724                     "Option 62: Novell/Netware IP domain", HFILL }},
7725
7726                 { &hf_bootp_option63_suboption,
7727                   { "Option 63 Suboption", "bootp.option.novell_options.suboption",
7728                     FT_UINT8, BASE_DEC, VALS(option63_suboption_vals), 0x0,
7729                     "Option 63: Suboption", HFILL }},
7730
7731                 { &hf_bootp_option63_value,
7732                   { "Value", "bootp.option.novell_options.value",
7733                     FT_BYTES, BASE_NONE, NULL, 0x0,
7734                     "Option 63: Suboption value", HFILL }},
7735
7736                 { &hf_bootp_option63_value_8,
7737                   { "Value", "bootp.option.novell_options.value.uint",
7738                     FT_UINT8, BASE_DEC, NULL, 0x0,
7739                     "Option 63: Suboption 8-bit value", HFILL }},
7740
7741                 { &hf_bootp_option63_value_ip_address,
7742                   { "Value", "bootp.option.novell_options.value.address",
7743                     FT_IPv4, BASE_NONE, NULL, 0x00,
7744                     "Option 63: Suboption IP address", HFILL }},
7745
7746                 { &hf_bootp_option63_value_boolean,
7747                   { "Value", "bootp.option.novell_options.value.bool",
7748                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_true_false), 0x00,
7749                     "Option 63: Suboption Boolean value", HFILL }},
7750
7751                 { &hf_bootp_option63_broadcast,
7752                   { "Broadcast for nearest Netware server", "bootp.option.novell_options.broadcast",
7753                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x00,
7754                     "Option 63:5 Broadcast for nearest Netware server", HFILL }},
7755
7756                 { &hf_bootp_option63_preferred_dss_server,
7757                   { "Preferred DSS server", "bootp.option.novell_options.preferred_dss_server",
7758                     FT_IPv4, BASE_NONE, NULL, 0x00,
7759                     "Option 63:6 Preferred DSS server", HFILL }},
7760
7761                 { &hf_bootp_option63_nearest_nwip_server,
7762                   { "Nearest NWIP server", "bootp.option.novell_options.nearest_nwip_server",
7763                     FT_IPv4, BASE_NONE, NULL, 0x00,
7764                     "Option 63:7 Nearest NWIP server", HFILL }},
7765
7766                 { &hf_bootp_option63_autoretries,
7767                   { "Autoretries", "bootp.option.novell_options.autoretries",
7768                     FT_UINT8, BASE_DEC, NULL, 0x0,
7769                     "Option 63:8 Autoretries", HFILL }},
7770
7771                 { &hf_bootp_option63_autoretry_delay,
7772                   { "Autoretry delay, sec",
7773                     "bootp.option.novell_options.autoretry_delay", FT_UINT8, BASE_DEC, NULL,
7774                     0x0, "Option 63:9 Autoretry delay, sec", HFILL }},
7775
7776                 { &hf_bootp_option63_support_netware_v1_1,
7777                   { "Broadcast for nearest Netware server", "bootp.option.novell_options.support_netware_v1_1",
7778                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x00,
7779                     "Option 63:10 Broadcast for nearest Netware server", HFILL }},
7780
7781                 { &hf_bootp_option63_primary_dss,
7782                   { "Primary DSS", "bootp.option.novell_options.primary_dss",
7783                     FT_IPv4, BASE_NONE, NULL, 0x00,
7784                     "Option 63:11 Primary DSS", HFILL }},
7785
7786
7787                 { &hf_bootp_option_nis_plus_domain,
7788                   { "Network Information Service+ Domain", "bootp.option.nis_plus_domain",
7789                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7790                     "Option 64: Network Information Service+ Domain", HFILL }},
7791
7792                 { &hf_bootp_option_nis_plus_server,
7793                   { "Network Information Service+ Server", "bootp.option.nis_plus_server",
7794                     FT_IPv4, BASE_NONE, NULL, 0x00,
7795                     "Option 65: Network Information Service+ Server", HFILL }},
7796
7797                 { &hf_bootp_option_tftp_server_name,
7798                   { "TFTP Server Name", "bootp.option.tftp_server_name",
7799                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7800                     "Option 66: TFTP Server Name", HFILL }},
7801
7802                 { &hf_bootp_option_bootfile_name,
7803                   { "Bootfile name", "bootp.option.bootfile_name",
7804                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7805                     "Option 67: Bootfile name", HFILL }},
7806
7807                 { &hf_bootp_option_mobile_ip_home_agent,
7808                   { "Mobile IP Home Agent", "bootp.option.mobile_ip_home_agent",
7809                     FT_IPv4, BASE_NONE, NULL, 0x00,
7810                     "Option 68: Mobile IP Home Agent", HFILL }},
7811
7812                 { &hf_bootp_option_smtp_server,
7813                   { "SMTP Server", "bootp.option.smtp_server",
7814                     FT_IPv4, BASE_NONE, NULL, 0x00,
7815                     "Option 69: SMTP Server", HFILL }},
7816
7817                 { &hf_bootp_option_pop3_server,
7818                   { "POP3 Server", "bootp.option.pop3_server",
7819                     FT_IPv4, BASE_NONE, NULL, 0x00,
7820                     "Option 70: POP3 Server", HFILL }},
7821
7822                 { &hf_bootp_option_nntp_server,
7823                   { "NNTP Server", "bootp.option.nntp_server",
7824                     FT_IPv4, BASE_NONE, NULL, 0x00,
7825                     "Option 71: NNTP Server", HFILL }},
7826
7827                 { &hf_bootp_option_default_www_server,
7828                   { "Default WWW Server", "bootp.option.default_www_server",
7829                     FT_IPv4, BASE_NONE, NULL, 0x00,
7830                     "Option 72: Default WWW Server", HFILL }},
7831
7832                 { &hf_bootp_option_default_finger_server,
7833                   { "Default Finger Server", "bootp.option.default_finger_server",
7834                     FT_IPv4, BASE_NONE, NULL, 0x00,
7835                     "Option 73: Default Finger Server", HFILL }},
7836
7837                 { &hf_bootp_option_default_irc_server,
7838                   { "Default IRC Server", "bootp.option.default_irc_server",
7839                     FT_IPv4, BASE_NONE, NULL, 0x00,
7840                     "Option 74: Default IRC Server", HFILL }},
7841
7842                 { &hf_bootp_option_streettalk_server,
7843                   { "StreetTalk Server", "bootp.option.streettalk_server",
7844                     FT_IPv4, BASE_NONE, NULL, 0x00,
7845                     "Option 75: StreetTalk Server", HFILL }},
7846
7847                 { &hf_bootp_option_streettalk_da_server,
7848                   { "StreetTalk Directory Assistance Server", "bootp.option.streettalk_da_server",
7849                     FT_IPv4, BASE_NONE, NULL, 0x00,
7850                     "Option 76: StreetTalk Directory Assistance Server", HFILL }},
7851
7852                 { &hf_bootp_option77_user_class,
7853                   { "Instance of User Class", "bootp.option.user_class",
7854                     FT_UINT8, BASE_DEC, NULL, 0x0,
7855                     NULL, HFILL }},
7856
7857                 { &hf_bootp_option77_user_class_length,
7858                   { "User Class Length", "bootp.option.user_class.length",
7859                     FT_UINT8, BASE_DEC, NULL, 0x0,
7860                     "Length of User Class Instance", HFILL }},
7861
7862                 { &hf_bootp_option77_user_class_data,
7863                   { "User Class Data", "bootp.option.user_class.data",
7864                     FT_BYTES, BASE_NONE, NULL, 0x0,
7865                     "Data of User Class Instance", HFILL }},
7866
7867                 { &hf_bootp_option_slp_directory_agent_value,
7868                   { "Value", "bootp.option.slp_directory_agent.value",
7869                     FT_UINT8, BASE_DEC, VALS(slpda_vals), 0x0,
7870                     "Option 78: SLPDA Value", HFILL }},
7871
7872                 { &hf_bootp_option_slp_directory_agent_slpda_address,
7873                   { "IP Address", "bootp.option.slp_directory_agent.slpda_address",
7874                     FT_IPv4, BASE_NONE, NULL, 0x00,
7875                     "Option 78: SLPDA Address", HFILL }},
7876
7877                 { &hf_bootp_option_slp_service_scope_value,
7878                   { "Value", "bootp.option.slp_service_scope.value",
7879                     FT_UINT8, BASE_DEC, VALS(slp_scope_vals), 0x0,
7880                     "Option 79: SLP Service Scope Value", HFILL }},
7881
7882                 { &hf_bootp_option_slp_service_scope_string,
7883                   { "SLP Service Scope", "bootp.option.slp_service_scope.string",
7884                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7885                     "Option 79: SLP Service Scope", HFILL }},
7886
7887
7888                 { &hf_bootp_option82_suboption,
7889                   { "Option 82 Suboption", "bootp.option.agent_information_option.suboption",
7890                     FT_UINT8, BASE_DEC, VALS(option82_suboption_vals), 0x0,
7891                     "Option 82: Suboption", HFILL }},
7892
7893                 { &hf_bootp_option82_value,
7894                   { "Value", "bootp.option.agent_information_option.value",
7895                     FT_BYTES, BASE_NONE, NULL, 0x0,
7896                     "Option 82: Suboption value", HFILL }},
7897
7898                 { &hf_bootp_option82_value_8,
7899                   { "Value", "bootp.option.agent_information_option.value.uint",
7900                     FT_UINT8, BASE_DEC, NULL, 0x0,
7901                     "Option 82: Suboption 8-bit value", HFILL }},
7902
7903                 { &hf_bootp_option82_value_32,
7904                   { "Value", "bootp.option.agent_information_option.value.uint",
7905                     FT_UINT32, BASE_DEC, NULL, 0x0,
7906                     "Option 82: Suboption 32-bit value", HFILL }},
7907
7908                 { &hf_bootp_option82_value_ip_address,
7909                   { "Value", "bootp.option.agent_information_option.value.address",
7910                     FT_IPv4, BASE_NONE, NULL, 0x00,
7911                     "Option 82: Suboption IP address", HFILL }},
7912
7913                 { &hf_bootp_option82_value_stringz,
7914                   { "Value", "bootp.option.agent_information_option.value.string",
7915                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7916                     "Option 82: Suboption Z-String value", HFILL }},
7917
7918                 { &hf_bootp_option82_padding,
7919                   { "Padding", "bootp.option.agent_information_option.padding",
7920                     FT_UINT8, BASE_DEC, NULL, 0x0,
7921                     "Option 82:0 Padding", HFILL }},
7922
7923                 { &hf_bootp_option82_agent_circuit_id,
7924                   { "Agent Circuit ID", "bootp.option.agent_information_option.agent_circuit_id",
7925                     FT_BYTES, BASE_NONE, NULL, 0x0,
7926                     "Option 82:1 Agent Circuit ID", HFILL }},
7927
7928                 { &hf_bootp_option82_agent_remote_id,
7929                   { "Agent Remote ID", "bootp.option.agent_information_option.agent_remote_id",
7930                     FT_BYTES, BASE_NONE, NULL, 0x0,
7931                     "Option 82:2 Agent Remote ID", HFILL }},
7932
7933                 { &hf_bootp_option82_reserved,
7934                   { "Reserved", "bootp.option.agent_information_option.reserved",
7935                     FT_BYTES, BASE_NONE, NULL, 0x0,
7936                     "Option 82:3 Reserved", HFILL }},
7937
7938                 { &hf_bootp_option82_docsis_device_class,
7939                   { "DOCSIS Device Class", "bootp.option.agent_information_option.docsis_device_class",
7940                     FT_UINT32, BASE_HEX, NULL, 0x0,
7941                     "Option 82:4 DOCSIS Device Class", HFILL }},
7942
7943                 { &hf_bootp_option82_link_selection,
7944                   { "Link selection", "bootp.option.agent_information_option.link_selection",
7945                     FT_IPv4, BASE_NONE, NULL, 0x00,
7946                     "Option 82:5 Link selection", HFILL }},
7947
7948                 { &hf_bootp_option82_subscriber_id,
7949                   { "Subscriber ID", "bootp.option.agent_information_option.subscriber_id",
7950                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
7951                     "Option 82:6 Subscriber ID", HFILL }},
7952
7953                 { &hf_bootp_option82_radius_attributes,
7954                   { "RADIUS Attributes", "bootp.option.agent_information_option.radius_attributes",
7955                     FT_BYTES, BASE_NONE, NULL, 0x0,
7956                     "Option 82:7 RADIUS Attributes", HFILL }},
7957
7958                 { &hf_bootp_option82_authentication,
7959                   { "Authentication", "bootp.option.agent_information_option.authentication",
7960                     FT_BYTES, BASE_NONE, NULL, 0x0,
7961                     "Option 82:8 Authentication", HFILL }},
7962
7963                 { &hf_bootp_option82_vi,
7964                   { "Vendor-Specific Information", "bootp.option.agent_information_option.vi",
7965                     FT_BYTES, BASE_NONE, NULL, 0x0,
7966                     "Option 82:9 Vendor-Specific Information", HFILL }},
7967
7968                 { &hf_bootp_option82_vi_enterprise,
7969                   { "Enterprise", "bootp.option.agent_information_option.vi.enterprise",
7970                     FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0x0,
7971                     "Option 82:9 VI Enterprise", HFILL }},
7972
7973                 { &hf_bootp_option82_vi_data_length,
7974                   { "Data Length", "bootp.option.agent_information_option.vi.data_length",
7975                     FT_UINT8, BASE_DEC, NULL, 0x0,
7976                     "Option 82:9 VI Data Length", HFILL }},
7977
7978                 { &hf_bootp_option82_vi_cl_option,
7979                   { "Option", "bootp.option.agent_information_option.vi.cl.option",
7980                     FT_UINT8, BASE_DEC, NULL, 0x0,
7981                     "Option 82:9 VI CL Option", HFILL }},
7982
7983                 { &hf_bootp_option82_vi_cl_length,
7984                   { "Length", "bootp.option.agent_information_option.vi.cl.length",
7985                     FT_UINT8, BASE_DEC, NULL, 0x0,
7986                     "Option 82:9 VI CL Length", HFILL }},
7987
7988                 { &hf_bootp_option82_vi_cl_tag,
7989                   { "Tag", "bootp.option.agent_information_option.vi.cl.tag",
7990                     FT_UINT8, BASE_DEC, NULL, 0x0,
7991                     "Option 82:9 VI CL Tag", HFILL }},
7992
7993                 { &hf_bootp_option82_vi_cl_tag_length,
7994                   { "Tag Length", "bootp.option.agent_information_option.vi.cl.tag_length",
7995                     FT_UINT8, BASE_DEC, NULL, 0x0,
7996                     "Option 82:9 VI CL Tag Length", HFILL }},
7997
7998                 { &hf_bootp_option82_vi_cl_docsis_version,
7999                   { "DOCSIS Version Number", "bootp.option.agent_information_option.vi.cl.docsis_version",
8000                     FT_UINT16, BASE_HEX, NULL, 0x0,
8001                     "Option 82:9 VI CL DOCSIS Version Number", HFILL }},
8002
8003                 { &hf_bootp_option82_flags,
8004                   { "Flags", "bootp.option.agent_information_option.flags",
8005                     FT_UINT8, BASE_HEX, NULL, 0x0,
8006                     "Option 82:10 Flags", HFILL }},
8007
8008                 { &hf_bootp_option82_server_id_override,
8009                   { "Server ID Override", "bootp.option.agent_information_option.server_id_override",
8010                     FT_IPv4, BASE_NONE, NULL, 0x00,
8011                     "Option 82:11 Server ID Override", HFILL }},
8012
8013                 { &hf_bootp_option82_relay_agent_id,
8014                   { "Relay Agent Identifier", "bootp.option.agent_information_option.relay_agent_id",
8015                     FT_BYTES, BASE_NONE, NULL, 0x00,
8016                     "Option 82:12 Relay Agent Identifier", HFILL }},
8017
8018                 { &hf_bootp_option82_link_selection_cisco,
8019                   { "Link selection (Cisco proprietary)", "bootp.option.agent_information_option.link_selection_cisco",
8020                     FT_IPv4, BASE_NONE, NULL, 0x00,
8021                     "Option 82:150 Link selection (Cisco proprietary)", HFILL }},
8022
8023                 { &hf_bootp_option82_vrf_name_vpn_id,
8024                   { "VRF name/VPN ID", "bootp.option.agent_information_option.vrf_name.vpn_id",
8025                     FT_BYTES, BASE_NONE, NULL, 0x00,
8026                     "Option 82:151 VRF name/VPN ID", HFILL }},
8027
8028                 { &hf_bootp_option82_vrf_name_global,
8029                   { "Global, default VPN", "bootp.option.agent_information_option.vrf_name.global",
8030                     FT_UINT8, BASE_DEC, NULL, 0x00,
8031                     "Option 82:151 Global, default VPN", HFILL }},
8032
8033                 { &hf_bootp_option82_vrf_name,
8034                   { "VRF name", "bootp.option.agent_information_option.vrf_name",
8035                     FT_STRING, BASE_NONE, NULL, 0x00,
8036                     "Option 82:151 VRF name", HFILL }},
8037
8038                 { &hf_bootp_option82_vrf_name_vpn_id_oui,
8039                   { "VRF name/VPN ID OUI", "bootp.option.agent_information_option.vrf_name.vpn_id.oui",
8040                     FT_UINT24, BASE_HEX, NULL, 0x00,
8041                     "Option 82:151 VRF name/VPN ID OUI", HFILL }},
8042
8043                 { &hf_bootp_option82_vrf_name_vpn_id_index,
8044                   { "VRF name/VPN ID Index", "bootp.option.agent_information_option.vrf_name.vpn_id.index",
8045                     FT_UINT32, BASE_HEX, NULL, 0x00,
8046                     "Option 82:151 VRF name/VPN ID Index", HFILL }},
8047
8048                 { &hf_bootp_option82_server_id_override_cisco,
8049                   { "Server ID Override (Cisco proprietary)", "bootp.option.agent_information_option.server_id_override_cisco",
8050                     FT_IPv4, BASE_NONE, NULL, 0x00,
8051                     "Option 82:152 Server ID Override (Cisco proprietary)", HFILL }},
8052
8053
8054                 { &hf_bootp_option_isns_functions,
8055                   { "iSNS Functions", "bootp.option.isns.functions",
8056                     FT_UINT16, BASE_HEX, NULL, 0x00,
8057                     "iSNS: the functions supported by the iSNS servers", HFILL }},
8058
8059                 { &hf_bootp_option_isns_functions_enabled,
8060                   { "Function Fields Enabled", "bootp.option.isns.functions.enabled",
8061                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_FUNCTIONS_ENABLED,
8062                     "If set to zero, then the contents of all other iSNS Function fields MUST be ignored", HFILL }},
8063
8064                 { &hf_bootp_option_isns_functions_dd_authorization,
8065                   { "Discovery Domain based Authorization", "bootp.option.isns.functions.dd_base_authorization",
8066                     FT_BOOLEAN, 16, TFS(&tfs_isns_function_dd_based_auth), F_ISNS_FUNCTIONS_DD_AUTH,
8067                     "If set to zero, then access authorization must be explicitly performed by each device", HFILL }},
8068
8069                 { &hf_bootp_option_isns_functions_sec_policy_distibution,
8070                   { "Security Policy Distribution", "bootp.option.isns.functions.sec_policy_distribution",
8071                     FT_BOOLEAN, 16, TFS(&tfs_isns_functions_sec_distrib), F_ISNS_FUNCTIONS_SEC_POLICY,
8072                     NULL, HFILL }},
8073
8074                 { &hf_bootp_option_isns_functions_reserved,
8075                   { "Reserved flags", "bootp.option.isns.functions.reserved",
8076                     FT_UINT16, BASE_HEX, NULL, F_ISNS_FUNCTIONS_RESERVED,
8077                     NULL, HFILL }},
8078
8079                 { &hf_bootp_option_isns_discovery_domain_access,
8080                   { "Discovery Domain Access flags", "bootp.option.isns.discovery_domain_access",
8081                     FT_UINT16, BASE_HEX, NULL, 0x00,
8082                     "iSNS: the types of iSNS clients that are allowed to modify Discovery Domains", HFILL }},
8083
8084                 { &hf_bootp_option_isns_discovery_domain_access_enabled,
8085                   { "Discovery Domain Enabled", "bootp.option.isns.discovery_domain_access.enabled",
8086                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_DD_ACCESS_ENABLED,
8087                     "If set to zero, then the contents of the remainder of this field MUST be ignored", HFILL }},
8088
8089                 { &hf_bootp_option_isns_discovery_domain_access_control_node,
8090                   { "Control Node", "bootp.option.isns.discovery_domain_access_control.node",
8091                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_DD_ACCESS_CTRL_NODE,
8092                     NULL, HFILL }},
8093
8094                 { &hf_bootp_option_isns_discovery_domain_access_iscsi_target,
8095                   { "iSCSI Target", "bootp.option.isns.discovery_domain_access.iscsi_target",
8096                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_DD_ACCESS_ISCSI_TARGET,
8097                     NULL, HFILL }},
8098
8099                 { &hf_bootp_option_isns_discovery_domain_access_iscsi_inititator,
8100                   { "iSCSI Initiator", "bootp.option.isns.discovery_domain_access.iscsi_initiator",
8101                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_DD_ACCESS_ISCSI_INITIATOR,
8102                     NULL, HFILL }},
8103
8104                 { &hf_bootp_option_isns_discovery_domain_access_ifcp_target_port,
8105                   { "iFCP Target Port", "bootp.option.isns.discovery_domain_access.ifcp_target_port",
8106                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_DD_ACCESS_IFCP_TARGET_PORT,
8107                     NULL, HFILL }},
8108
8109                 { &hf_bootp_option_isns_discovery_domain_access_ifcp_initiator_port,
8110                   { "iFCP Initiator Port", "bootp.option.isns.discovery_domain_access.initiator_target_port",
8111                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_DD_ACCESS_IFCP_INITIATOR_PORT,
8112                     NULL, HFILL }},
8113
8114                 { &hf_bootp_option_isns_discovery_domain_access_reserved,
8115                   { "Reserved Flags", "bootp.option.isns.discovery_domain_access.reserved",
8116                     FT_UINT16, BASE_HEX, NULL, F_ISNS_DD_ACCESS_RESERVED,
8117                     NULL, HFILL }},
8118
8119                 { &hf_bootp_option_isns_administrative_flags,
8120                   { "Administrative Flags", "bootp.option.isns.administrative_flags",
8121                     FT_UINT16, BASE_HEX, NULL, 0x00,
8122                     "iSNS: administrative settings for the iSNS servers discovered through the DHCP query", HFILL }},
8123
8124                 { &hf_bootp_option_isns_administrative_flags_enabled,
8125                   { "Administrative Flags Enabled", "bootp.option.isns.administrative_flags.enabled",
8126                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_ADMIN_FLAGS_ENABLED,
8127                     NULL, HFILL }},
8128
8129                 { &hf_bootp_option_isns_administrative_flags_heartbeat,
8130                   { "Heartbeat", "bootp.option.isns.administrative_flags.heartbeat",
8131                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_ADMIN_FLAGS_HEARTBEAT,
8132                     NULL, HFILL }},
8133
8134                 { &hf_bootp_option_isns_administrative_flags_management_scns,
8135                   { "Management SCNs", "bootp.option.isns.administrative_flags.management_scns",
8136                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_ADMIN_FLAGS_MANAGEMENT_SCNS,
8137                     NULL, HFILL }},
8138
8139                 { &hf_bootp_option_isns_administrative_flags_default_dd,
8140                   { "Default Discovery Domain", "bootp.option.isns.administrative_flags.default_discovery_domain",
8141                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_ADMIN_FLAGS_DEFAULT_DD,
8142                     NULL, HFILL }},
8143
8144                 { &hf_bootp_option_isns_administrative_flags_reserved,
8145                   { "Reserved Flags", "bootp.option.isns.administrative_flags.reserved",
8146                     FT_UINT16, BASE_HEX, NULL, F_ISNS_ADMIN_FLAGS_RESERVED,
8147                     NULL, HFILL }},
8148
8149                 { &hf_bootp_option_isns_server_security_bitmap,
8150                   { "iSNS Server Security Bitmap", "bootp.option.isns.server_security_bitmap",
8151                     FT_UINT32, BASE_HEX, NULL, 0x00,
8152                     "iSNS: server security settings", HFILL }},
8153
8154                 { &hf_bootp_option_isns_server_security_bitmap_enabled,
8155                   { "Server Security Bitmap Enabled", "bootp.option.isns.server_security_bitmap.enabled",
8156                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), F_ISNS_SRV_SEC_BITMAP_ENABLED,
8157                     NULL, HFILL }},
8158
8159                 { &hf_bootp_option_isns_server_security_bitmap_ike_ipsec_enabled,
8160                   { "IKE/IPSec", "bootp.option.isns.server_security_bitmap.ike_ipsec_enabled",
8161                     FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), F_ISNS_SRV_SEC_BITMAP_IKE_IPSEC,
8162                     NULL, HFILL }},
8163
8164                 { &hf_bootp_option_isns_server_security_bitmap_main_mode,
8165                   { "Main Mode", "bootp.option.isns.server_security_bitmap.main_mode",
8166                     FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), F_ISNS_SRV_SEC_BITMAP_MAIN_MODE,
8167                     NULL, HFILL }},
8168
8169                 { &hf_bootp_option_isns_server_security_bitmap_aggressive_mode,
8170                   { "Aggresive Mode", "bootp.option.isns.server_security_bitmap.aggressive_mode",
8171                     FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), F_ISNS_SRV_SEC_BITMAP_AGGRESSIVE,
8172                     NULL, HFILL }},
8173
8174                 { &hf_bootp_option_isns_server_security_bitmap_pfs,
8175                   { "PFS", "bootp.option.isns.server_security_bitmap.pfs",
8176                     FT_BOOLEAN, 16, TFS(&tfs_enabled_disabled), F_ISNS_SRV_SEC_BITMAP_PFS,
8177                     NULL, HFILL }},
8178
8179                 { &hf_bootp_option_isns_server_security_bitmap_transport_mode,
8180                   { "Transport Mode", "bootp.option.isns.server_security_bitmap.transport_mode",
8181                     FT_BOOLEAN, 16, TFS(&tfs_preferred_no_preference), F_ISNS_SRV_SEC_BITMAP_TRASPORT_MODE,
8182                     NULL, HFILL }},
8183
8184                 { &hf_bootp_option_isns_server_security_bitmap_tunnel_mode,
8185                   { "Tunnel Mode", "bootp.option.isns.server_security_bitmap.tunnel_mode",
8186                     FT_BOOLEAN, 16, TFS(&tfs_preferred_no_preference), F_ISNS_SRV_SEC_BITMAP_TUNNEL_MODE,
8187                     NULL, HFILL }},
8188
8189                 { &hf_bootp_option_isns_server_security_bitmap_reserved,
8190                   { "Reserved Flags", "bootp.option.isns.server_security_bitmap.reserved",
8191                     FT_UINT16, BASE_HEX, NULL, F_ISNS_SRV_SEC_BITMAP_RESERVED,
8192                     NULL, HFILL }},
8193
8194                 { &hf_bootp_option_isns_primary_server_addr,
8195                   { "Primary Server Address", "bootp.option.isns.primary_server_addr",
8196                     FT_IPv4, BASE_NONE, NULL, 0x00,
8197                     "iSNS: IP address of the primary server", HFILL }},
8198
8199                 { &hf_bootp_option_isns_heartbeat_originator_addr,
8200                   { "Heartbeat Originator Address", "bootp.option.isns.heartbeat_originator_addr",
8201                     FT_IPv4, BASE_NONE, NULL, 0x00,
8202                     "iSNS: IP address from which the iSNS heartbeat originates", HFILL }},
8203
8204                 { &hf_bootp_option_isns_secondary_server_addr_list,
8205                   { "Secondary Server Address", "bootp.option.isns.secondary_server_addr",
8206                     FT_IPv4, BASE_NONE, NULL, 0x00,
8207                     "iSNS: a list of IP addresses of the secondary iSNS servers", HFILL }},
8208
8209
8210                 { &hf_bootp_option_novell_dss_string,
8211                   { "Novell Directory Services Servers String", "bootp.option.novell_dss.string",
8212                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8213                     "Option 85: Novell Directory Services Servers String", HFILL }},
8214
8215                 { &hf_bootp_option_novell_dss_ip,
8216                   { "IP Address", "bootp.option.novell_dss.ip",
8217                     FT_IPv4, BASE_NONE, NULL, 0x00,
8218                     "Option 85: Novell Directory Services Servers IP Address", HFILL }},
8219
8220                 { &hf_bootp_option_novell_ds_tree_name,
8221                   { "Novell Directory Services Tree Name", "bootp.option.novell_ds_tree_name",
8222                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8223                     "Option 86: Novell Directory Services Tree Name", HFILL }},
8224
8225                 { &hf_bootp_option_novell_ds_context,
8226                   { "Novell Directory Services Context", "bootp.option.novell_ds_context",
8227                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8228                     "Option 87: Novell Directory Services Context", HFILL }},
8229
8230                 { &hf_bootp_option_dhcp_authentication_protocol,
8231                   { "Protocol", "bootp.option.dhcp_authentication.protocol",
8232                     FT_UINT8, BASE_DEC, VALS(authen_protocol_vals), 0x0,
8233                     "Option 90: Authentication Protocol", HFILL }},
8234
8235                 { &hf_bootp_option_dhcp_authentication_alg_delay,
8236                   { "Delay Algorithm", "bootp.option.dhcp_authentication.alg_delay",
8237                     FT_UINT8, BASE_DEC, VALS(authen_da_algo_vals), 0x0,
8238                     "Option 90: Delayed Authentication Algorithm", HFILL }},
8239
8240                 { &hf_bootp_option_dhcp_authentication_algorithm,
8241                   { "Algorithm", "bootp.option.dhcp_authentication.algorithm",
8242                     FT_UINT8, BASE_DEC, NULL, 0x0,
8243                     "Option 90: Authentication Algorithm", HFILL }},
8244
8245                 { &hf_bootp_option_dhcp_authentication_rdm,
8246                   { "Replay Detection Method", "bootp.option.dhcp_authentication.rdm",
8247                     FT_UINT8, BASE_DEC, VALS(authen_rdm_vals), 0x0,
8248                     "Option 90: Replay Detection Method", HFILL }},
8249
8250                 { &hf_bootp_option_dhcp_authentication_rdm_replay_detection,
8251                   { "RDM Replay Detection Value", "bootp.option.dhcp_authentication.rdm_replay_detection",
8252                     FT_UINT64, BASE_HEX, NULL, 0x0,
8253                     "Option 90: RDM Replay Detection Value", HFILL }},
8254
8255                 { &hf_bootp_option_dhcp_authentication_rdm_rdv,
8256                   { "Replay Detection Value", "bootp.option.dhcp_authentication.rdm_rdv",
8257                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8258                     "Option 90: Replay Detection Value", HFILL }},
8259
8260                 { &hf_bootp_option_dhcp_authentication_secret_id,
8261                   { "Secret ID", "bootp.option.dhcp_authentication.secret_id",
8262                     FT_UINT32, BASE_HEX, NULL, 0x0,
8263                     "Option 90: Secret ID", HFILL }},
8264
8265                 { &hf_bootp_option_dhcp_authentication_hmac_md5_hash,
8266                   { "HMAC MD5 Hash", "bootp.option.dhcp_authentication.hmac_md5_hash",
8267                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8268                     "Option 90: HMAC MD5 Hash", HFILL }},
8269
8270                 { &hf_bootp_option_dhcp_authentication_information,
8271                   { "Authentication Information", "bootp.option.dhcp_authentication.information",
8272                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8273                     "Option 90: Authentication Information", HFILL }},
8274
8275                 { &hf_bootp_option_client_last_transaction_time,
8276                   { "Client last transaction time", "bootp.option.client_last_transaction_time",
8277                     FT_UINT32, BASE_DEC, NULL, 0x00,
8278                     "Option 91: Client last transaction time", HFILL }},
8279
8280                 { &hf_bootp_option_associated_ip_option,
8281                   { "Associated IP option", "bootp.option.associated_ip_option",
8282                     FT_IPv4, BASE_NONE, NULL, 0x00,
8283                     "Option 92: Associated IP option", HFILL }},
8284
8285                 { &hf_bootp_option_client_system_architecture,
8286                   { "Client System Architecture", "bootp.option.client_system_architecture",
8287                     FT_UINT16, BASE_DEC, VALS(bootp_client_arch), 0x0,
8288                     "Option 93: Client System Architecture", HFILL }},
8289
8290                 { &hf_bootp_option_client_network_id_major_ver,
8291                   { "Major Version", "bootp.client_network_id_major",
8292                     FT_UINT8, BASE_DEC, NULL, 0x0,
8293                     "Option 94: Major Version", HFILL }},
8294
8295                 { &hf_bootp_option_client_network_id_minor_ver,
8296                   { "Minor Version", "bootp.client_network_id_minor",
8297                     FT_UINT8, BASE_DEC, NULL, 0x0,
8298                     "Option 94: Minor Version", HFILL }},
8299
8300                 { &hf_bootp_option_civic_location_what,
8301                   { "What", "bootp.option.civic_location.what",
8302                     FT_UINT8, BASE_DEC, VALS(civic_address_what_values), 0x0,
8303                     "Option 99: What", HFILL }},
8304
8305                 { &hf_bootp_option_civic_location_country,
8306                   { "Country", "bootp.option.civic_location.country",
8307                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8308                     "Option 99: Country", HFILL }},
8309
8310                 { &hf_bootp_option_civic_location_ca_type,
8311                   { "CA Type", "bootp.option.civic_location.ca_type",
8312                     FT_UINT8, BASE_DEC, VALS(civic_address_type_values), 0x0,
8313                     "Option 99: CA Type", HFILL }},
8314
8315                 { &hf_bootp_option_civic_location_ca_length,
8316                   { "CA Length", "bootp.option.civic_location.ca_length",
8317                     FT_UINT8, BASE_DEC, NULL, 0x0,
8318                     "Option 99: CA Length", HFILL }},
8319
8320                 { &hf_bootp_option_civic_location_ca_value,
8321                   { "CA Value", "bootp.option.civic_location.ca_value",
8322                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8323                     "Option 99: CA Value", HFILL }},
8324
8325                 { &hf_bootp_option_tz_pcode,
8326                   { "TZ PCode", "bootp.option.tz_pcode",
8327                     FT_STRING, BASE_NONE, NULL, 0x0,
8328                     "Option 100: TZ PCode", HFILL  }},
8329
8330                 { &hf_bootp_option_tz_tcode,
8331                   { "TZ TCode", "bootp.option.tz_tcode",
8332                     FT_STRING, BASE_NONE, NULL, 0x0,
8333                     "Option 101: TZ TCode", HFILL  }},
8334
8335                 { &hf_bootp_option_netinfo_parent_server_address,
8336                   { "NetInfo Parent Server Address", "bootp.option.netinfo_parent_server_address",
8337                     FT_IPv4, BASE_NONE, NULL, 0x00,
8338                     "Option 112: NetInfo Parent Server Address", HFILL }},
8339
8340                 { &hf_bootp_option_netinfo_parent_server_tag,
8341                   { "NetInfo Parent Server Tag", "bootp.option.netinfo_parent_server_tag",
8342                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8343                     "Option 113: NetInfo Parent Server Tag", HFILL }},
8344
8345                 { &hf_bootp_option_dhcp_auto_configuration,
8346                   { "DHCP Auto-Configuration", "bootp.option.dhcp_auto_configuration",
8347                     FT_UINT8, BASE_DEC, VALS(dhcp_autoconfig), 0x0,
8348                     "Option 116: DHCP Auto-Configuration", HFILL }},
8349
8350                 { &hf_bootp_option_dhcp_name_service_search_option,
8351                   { "Name Service", "bootp.option.dhcp_name_service_search_option",
8352                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8353                     "Option 117: Name Service", HFILL }},
8354
8355                 { &hf_bootp_option_dhcp_dns_domain_search_list_rfc_3396_detected,
8356                   { "Encoding Long Options detected (RFC 3396)", "bootp.option.dhcp_dns_domain_search_list_rfc_3396_detected",
8357                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8358                     "Option 119: Encoding Long Options detected (RFC 3396)", HFILL }},
8359
8360                 { &hf_bootp_option_dhcp_dns_domain_search_list_refer_last_option,
8361                   { "For the data, please refer to last option 119", "bootp.option.dhcp_dns_domain_search_list_refer_last_option",
8362                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8363                     "Option 119: For the data, please refer to last option 119", HFILL }},
8364
8365                 { &hf_bootp_option_dhcp_dns_domain_search_list_fqdn,
8366                   { "FQDN", "bootp.option.dhcp_dns_domain_search_list_fqdn",
8367                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8368                     "Option 119: FQDN", HFILL }},
8369
8370                 { &hf_bootp_option_sip_server_rfc_3396_detected,
8371                   { "Encoding Long Options detected (RFC 3396)", "bootp.option.sip_server.rfc_3396_detected",
8372                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8373                     "Option 120: Encoding Long Options detected (RFC 3396)", HFILL }},
8374
8375                 { &hf_bootp_option_sip_server_refer_last_option,
8376                   { "For the data, please refer to last option 120", "bootp.option.sip_server.refer_last_option",
8377                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8378                     "Option 120: For the data, please refer to last option 120", HFILL }},
8379
8380                 { &hf_bootp_option_sip_server_enc,
8381                   { "SIP Server Encoding", "bootp.option.sip_server.encoding",
8382                     FT_UINT8, BASE_DEC, VALS(sip_server_enc_vals), 0x0,
8383                     "Option 120: SIP Server encoding", HFILL }},
8384
8385                 { &hf_bootp_option_sip_server_name,
8386                   { "SIP Server Name", "bootp.option.sip_server.name",
8387                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8388                     "Option 120: SIP Server Name", HFILL }},
8389
8390                 { &hf_bootp_option_sip_server_address,
8391                   { "SIP Server Address", "bootp.option.sip_server.address",
8392                     FT_IPv4, BASE_NONE, NULL, 0x0,
8393                     "Option 120: SIP Server Address", HFILL }},
8394
8395                 { &hf_bootp_option_classless_static_route,
8396                   { "Subnet/MaskWidth-Router", "bootp.option.classless_static_route.",
8397                     FT_BYTES, BASE_NONE, NULL, 0x0,
8398                     "Option 121: Subnet/MaskWidth-Router", HFILL }},
8399
8400                 { &hf_bootp_option_rfc3825_error,
8401                   { "Error", "bootp.option.rfc3825.error",
8402                     FT_UINT8, BASE_DEC, VALS(rfc3825_error_types), 0x0,
8403                     "Option 123: Error", HFILL }},
8404
8405                 { &hf_bootp_option_rfc3825_latitude,
8406                   { "Latitude", "bootp.option.rfc3825.latitude",
8407                     FT_DOUBLE, BASE_NONE, NULL, 0x0,
8408                     "Option 123: Latitude", HFILL }},
8409
8410                 { &hf_bootp_option_rfc3825_longitude,
8411                   { "Longitude", "bootp.option.rfc3825.longitude",
8412                     FT_DOUBLE, BASE_NONE, NULL, 0x0,
8413                     "Option 123: Longitude", HFILL }},
8414
8415                 { &hf_bootp_option_rfc3825_latitude_res,
8416                   { "Latitude resolution", "bootp.option.rfc3825.latitude_res",
8417                     FT_DOUBLE, BASE_NONE, NULL, 0x0,
8418                     "Option 123: Latitude resolution", HFILL }},
8419
8420                 { &hf_bootp_option_rfc3825_longitude_res,
8421                   { "Longitude resolution", "bootp.option.rfc3825.longitude_res",
8422                     FT_DOUBLE, BASE_NONE, NULL, 0x0,
8423                     "Option 123: Longitude resolution", HFILL }},
8424
8425                 { &hf_bootp_option_rfc3825_altitude,
8426                   { "Altitude", "bootp.option.rfc3825.altitude",
8427                     FT_DOUBLE, BASE_NONE, NULL, 0x0,
8428                     "Option 123: Altitude", HFILL }},
8429
8430                 { &hf_bootp_option_rfc3825_altitide_res,
8431                   { "Altitude resolution", "bootp.option.rfc3825.altitide_res",
8432                     FT_DOUBLE, BASE_NONE, NULL, 0x0,
8433                     "Option 123: Altitude resolution", HFILL }},
8434
8435                 { &hf_bootp_option_rfc3825_altitude_type,
8436                   { "Altitude type", "bootp.option.rfc3825.altitude_type",
8437                     FT_UINT8, BASE_DEC, VALS(altitude_type_values), 0x0,
8438                     "Option 123: Altitude type", HFILL }},
8439
8440                 { &hf_bootp_option_rfc3825_map_datum,
8441                   { "Map Datum", "bootp.option.cl_dss_id.option",
8442                     FT_UINT8, BASE_DEC, VALS(map_datum_type_values), 0x0,
8443                     "Option 123: Map Datum", HFILL }},
8444
8445                 { &hf_bootp_option_cl_dss_id_option,
8446                   { "DSS_ID Type", "bootp.option.cl_dss_id.option",
8447                     FT_UINT8, BASE_DEC, VALS(cl_dss_id_type_vals), 0x0,
8448                     "Option 123:CL DSS_ID Type", HFILL }},
8449
8450                 { &hf_bootp_option_cl_dss_id_len,
8451                   { "DSS_ID Length", "bootp.option.cl_dss_id.len",
8452                     FT_UINT8, BASE_DEC, NULL, 0x0,
8453                     "Option 123:CL DSS_ID Length", HFILL }},
8454
8455                 { &hf_bootp_option_cl_dss_id,
8456                   { "Country", "bootp.option.cl_dss_id",
8457                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8458                     "Option 123:CL DSS_ID", HFILL }},
8459
8460                 { &hf_bootp_option_vi_class_cl_address_mode,
8461                   { "CableLab Address Mode", "bootp.option.vi_class.cl_address_mode",
8462                     FT_UINT8, BASE_DEC, VALS(cablelab_ipaddr_mode_vals), 0x0,
8463                     "Option 124: CableLab Address Mode", HFILL }},
8464
8465                 { &hf_bootp_option_vi_class_enterprise,
8466                   { "Enterprise", "bootp.option.vi_class.enterprise",
8467                     FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0x00,
8468                     "Option 124: Enterprise", HFILL }},
8469
8470                 { &hf_bootp_option_vi_class_data_length,
8471                   { "CableLab Address Mode", "bootp.option.vi_class.length",
8472                     FT_UINT8, BASE_DEC, NULL, 0x0,
8473                     "Option 124: Length", HFILL }},
8474
8475                 { &hf_bootp_option_vi_class_data,
8476                   { "NetInfo Parent Server Tag", "bootp.option.vi_class.data",
8477                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8478                     "Option 124: Data", HFILL }},
8479
8480                 { &hf_bootp_option125_enterprise,
8481                   { "Enterprise", "bootp.option.vi.enterprise",
8482                     FT_UINT32, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0x00,
8483                     "Option 125: Enterprise", HFILL }},
8484
8485                 { &hf_bootp_option125_length,
8486                   { "Length", "bootp.option.vi.length",
8487                     FT_UINT8, BASE_DEC, NULL, 0x00,
8488                     "Option 125: Length", HFILL }},
8489
8490                 { &hf_bootp_option125_value,
8491                   { "Value", "bootp.option.vi.value",
8492                     FT_BYTES, BASE_NONE, NULL, 0x0,
8493                     "Option 125: Suboption value", HFILL }},
8494
8495                 { &hf_bootp_option125_value_8,
8496                   { "Value", "bootp.option.vi.value.uint",
8497                     FT_UINT8, BASE_DEC, NULL, 0x0,
8498                     "Option 125: Suboption 8-bit value", HFILL }},
8499
8500                 { &hf_bootp_option125_value_16,
8501                   { "Value", "bootp.option.vi.value.uint",
8502                     FT_UINT16, BASE_DEC, NULL, 0x0,
8503                     "Option 125: Suboption 16-bit value", HFILL }},
8504
8505                 { &hf_bootp_option125_value_ip_address,
8506                   { "Value", "bootp.option.vi.value.address",
8507                     FT_IPv4, BASE_NONE, NULL, 0x00,
8508                     "Option 125: Suboption IP address value", HFILL }},
8509
8510                 { &hf_bootp_option125_value_stringz,
8511                   { "Value", "bootp.option.vi.value.string",
8512                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8513                     "Option 125: Suboption Z-String value", HFILL }},
8514
8515                 { &hf_bootp_option125_tr111_suboption,
8516                   { "Option 125 Suboption", "bootp.option.vi.tr111.suboption",
8517                     FT_UINT8, BASE_DEC, VALS(option125_tr111_suboption_vals), 0x0,
8518                     "Option 125:TR 111 Suboption", HFILL }},
8519
8520                 { &hf_bootp_option125_tr111_device_manufacturer_oui,
8521                   { "DeviceManufacturerOUI", "bootp.option.vi.tr111.device_manufacturer_oui",
8522                     FT_UINT24, BASE_OUI, NULL, 0x0,
8523                     "Option 125:TR 111 1 DeviceManufacturerOUI", HFILL }},
8524
8525                 { &hf_bootp_option125_tr111_device_serial_number,
8526                   { "DeviceSerialNumber", "bootp.option.vi.tr111.device_serial_number",
8527                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8528                     "Option 125:TR 111 2 DeviceSerialNumber", HFILL }},
8529
8530                 { &hf_bootp_option125_tr111_device_product_class,
8531                   { "DeviceProductClass", "bootp.option.vi.tr111.device_product_class",
8532                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8533                     "Option 125:TR 111 3 DeviceProductClass", HFILL }},
8534
8535                 { &hf_bootp_option125_tr111_gateway_manufacturer_oui,
8536                   { "GatewayManufacturerOUI", "bootp.option.vi.tr111.gateway_manufacturer_oui",
8537                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8538                     "Option 125:TR 111 4 GatewayManufacturerOUI", HFILL }},
8539
8540                 { &hf_bootp_option125_tr111_gateway_serial_number,
8541                   { "GatewaySerialNumber", "bootp.option.vi.tr111.gateway_serial_number",
8542                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8543                     "Option 125:TR 111 5 GatewaySerialNumber", HFILL }},
8544
8545                 { &hf_bootp_option125_tr111_gateway_product_class,
8546                   { "GatewayProductClass", "bootp.option.vi.tr111.gateway_product_class",
8547                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8548                     "Option 125:TR 111 6 GatewayProductClass", HFILL }},
8549
8550                 { &hf_bootp_option125_cl_suboption,
8551                   { "Option 125 Suboption", "bootp.option.vi.cl.suboption",
8552                     FT_UINT8, BASE_DEC, VALS(option125_cl_suboption_vals), 0x0,
8553                     "Option 125:CL Suboption", HFILL }},
8554
8555                 { &hf_bootp_option125_cl_option_request,
8556                   { "Option Request", "bootp.option.vi.cl.option_request",
8557                     FT_BYTES, SEP_SPACE, NULL, 0x0,
8558                     "Option 125:CL 1 Option Request", HFILL }},
8559
8560                 { &hf_bootp_option125_cl_tftp_server_addresses,
8561                   { "TFTP Server Addresses", "bootp.option.vi.cl.tftp_server_addresses",
8562                     FT_IPv4, BASE_NONE, NULL, 0x00,
8563                     "Option 125:CL 2 TFTP Server Addresses", HFILL }},
8564
8565                 { &hf_bootp_option125_cl_erouter_container_option,
8566                   { "eRouter Container Option", "bootp.option.vi.cl.erouter_container_option",
8567                     FT_BYTES, BASE_NONE, NULL, 0x0,
8568                     "Option 125:CL 3 eRouter Container Option", HFILL }},
8569
8570                 { &hf_bootp_option125_cl_mib_environment_indicator_option,
8571                   { "MIB Environment Indicator Option", "bootp.option.vi.cl.suboption",
8572                     FT_UINT8, BASE_DEC, VALS(pkt_mib_env_ind_opt_vals), 0x0,
8573                     "Option 125:CL 4 MIB Environment Indicator Option", HFILL }},
8574
8575                 { &hf_bootp_option125_cl_modem_capabilities,
8576                   { "Modem Capabilities", "bootp.option.vi.cl.modem_capabilities",
8577                     FT_BYTES, BASE_NONE, NULL, 0x0,
8578                     "Option 125:CL 5 Modem Capabilities", HFILL }},
8579
8580                 { &hf_bootp_option_subnet_selection_option,
8581                   { "Subnet Selection Option", "bootp.option.subnet_selection_option",
8582                     FT_IPv4, BASE_NONE, NULL, 0x00,
8583                     "Option 118: Subnet Selection Option", HFILL }},
8584
8585                 { &hf_bootp_option_lost_server_domain_name,
8586                   { "LoST Server Domain Name", "bootp.option.lost_server_domain_name",
8587                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8588                     "Option 137: LoST Server Domain Name", HFILL }},
8589
8590                 { &hf_bootp_option_capwap_access_controller,
8591                   { "CAPWAP Access Controllers", "bootp.option.capwap_access_controller",
8592                     FT_IPv4, BASE_NONE, NULL, 0x00,
8593                     "Option 138: CAPWAP Access Controllers", HFILL }},
8594
8595                 { &hf_bootp_option_tftp_server_address,
8596                   { "TFTP Server Address", "bootp.option.tftp_server_address",
8597                     FT_IPv4, BASE_NONE, NULL, 0x00,
8598                     "Option 150: TFTP Server Address", HFILL }},
8599
8600                 { &hf_bootp_option_mudurl,
8601                   { "MUDURL", "bootp.option.mudurl",
8602                     FT_STRING, BASE_NONE, NULL, 0x0,
8603                     "Option 161: MUDURL", HFILL  }},
8604
8605                 { &hf_bootp_option_pxe_config_file,
8606                   { "PXELINUX configuration file", "bootp.option.pxe_config_file",
8607                     FT_STRING, BASE_NONE, NULL, 0x0,
8608                     "Option 209: PXE Configuration File", HFILL }},
8609
8610                 { &hf_bootp_option_pxe_path_prefix,
8611                   { "PXELINUX path prefix", "bootp.option.pxe_path_prefix",
8612                     FT_STRING, BASE_NONE, NULL, 0x0,
8613                     "Option 210: PXE Path Prefix", HFILL }},
8614
8615                 { &hf_bootp_option_captive_portal,
8616                   { "Captive Portal", "bootp.option.captive_portal",
8617                     FT_STRING, BASE_NONE, NULL, 0x0,
8618                     "The contact URI for the captive portal that the user should connect to", HFILL }},
8619
8620                 { &hf_bootp_option_6RD_ipv4_mask_len,
8621                   { "6RD IPv4 Mask Length", "bootp.option.6RD.ipv4_mask_len",
8622                     FT_UINT8, BASE_DEC, NULL, 0x0,
8623                     "Option 212: 6RD IPv4 Mask Length", HFILL }},
8624
8625                 { &hf_bootp_option_6RD_prefix_len,
8626                   { "6RD Prefix Length", "bootp.option.6RD.prefix_len",
8627                     FT_UINT8, BASE_DEC, NULL, 0x0,
8628                     "Option 212: 6RD Prefix Length", HFILL }},
8629
8630                 { &hf_bootp_option_6RD_prefix,
8631                   { "6RD Prefix", "bootp.option.6RD.prefix",
8632                     FT_IPv6, BASE_NONE, NULL, 0x00,
8633                     "Option 212: 6RD Prefix", HFILL }},
8634
8635                 { &hf_bootp_option_6RD_border_relay_ip,
8636                   { "Border Relay IP", "bootp.option.6RD.border_relay_ip",
8637                     FT_IPv4, BASE_NONE, NULL, 0x00,
8638                     "Option 212: Border Relay IP", HFILL }},
8639
8640                 { &hf_bootp_option_private_proxy_autodiscovery,
8641                   { "Private/Proxy autodiscovery", "bootp.option.private_proxy_autodiscovery",
8642                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8643                     "Option 252: Private/Proxy autodiscovery", HFILL }},
8644
8645                 { &hf_bootp_option_end,
8646                   { "Option End", "bootp.option.end",
8647                     FT_UINT8, BASE_DEC, NULL, 0x0,
8648                     "Option 255: End", HFILL }},
8649
8650                 { &hf_bootp_option_end_overload,
8651                   { "Option End (Overload)", "bootp.option.end",
8652                     FT_UINT8, BASE_DEC, NULL, 0x0,
8653                     "Option 255: End (Overload)", HFILL }},
8654
8655                 { &hf_bootp_vendor_unknown_suboption,
8656                   { "Option 125 Suboption", "bootp.vendor.suboption",
8657                     FT_UINT8, BASE_DEC, NULL, 0x0,
8658                     NULL, HFILL }},
8659
8660                 { &hf_bootp_suboption_data,
8661                   { "Data", "bootp.vendor.data",
8662                     FT_BYTES, BASE_NONE, NULL, 0x0,
8663                     NULL, HFILL }},
8664
8665                 { &hf_bootp_pc_ietf_ccc_suboption,
8666                   { "Suboption", "bootp.vendor.pc.ietf_ccc.suboption",
8667                     FT_UINT8, BASE_DEC, VALS(pkt_draft5_ccc_opt_vals), 0x0,
8668                     NULL, HFILL }},
8669
8670                 { &hf_bootp_pc_i05_ccc_suboption,
8671                   { "Suboption", "bootp.vendor.pc.i05_ccc.suboption",
8672                     FT_UINT8, BASE_DEC, VALS(pkt_i05_ccc_opt_vals), 0x0,
8673                     NULL, HFILL }},
8674
8675                 { &hf_bootp_cl_ietf_ccc_dev_realm_unc_key_nom_timeout,
8676                   { "pktcMtaDevRealmUnsolicitedKeyNomTimeout", "bootp.cl.ietf_ccc.dev_realm_unc_key_nom_timeout",
8677                     FT_UINT32, BASE_DEC, NULL, 0x0,
8678                     NULL, HFILL }},
8679
8680                 { &hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_timeout,
8681                   { "pktcMtaDevRealmUnsolicitedKeyMaxTimeout", "bootp.cl.ietf_ccc.dev_realm_unc_key_max_timeout",
8682                     FT_UINT32, BASE_DEC, NULL, 0x0,
8683                     NULL, HFILL }},
8684
8685                 { &hf_bootp_cl_ietf_ccc_dev_realm_unc_key_max_retries,
8686                   { "pktcMtaDevRealmUnsolicitedKeyMaxRetries", "bootp.cl.ietf_ccc.dev_realm_unc_key_max_retries",
8687                     FT_UINT32, BASE_DEC, NULL, 0x0,
8688                     NULL, HFILL }},
8689
8690                 { &hf_bootp_cl_ietf_ccc_dev_prov_unc_key_nom_timeout,
8691                   { "pktcMtaDevProvUnsolicitedKeyNomTimeout", "bootp.cl.ietf_ccc.dev_prov_unc_key_nom_timeout",
8692                     FT_UINT32, BASE_DEC, NULL, 0x0,
8693                     NULL, HFILL }},
8694
8695                 { &hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_timeout,
8696                   { "pktcMtaDevProvUnsolicitedKeyMaxTimeout", "bootp.cl.ietf_ccc.dev_prov_unc_key_max_timeout",
8697                     FT_UINT32, BASE_DEC, NULL, 0x0,
8698                     NULL, HFILL }},
8699
8700                 { &hf_bootp_cl_ietf_ccc_dev_prov_unc_key_max_retries,
8701                   { "pktcMtaDevProvUnsolicitedKeyMaxRetries", "bootp.cl.ietf_ccc.dev_prov_unc_key_max_retries",
8702                     FT_UINT32, BASE_DEC, NULL, 0x0,
8703                     NULL, HFILL }},
8704
8705                 { &hf_bootp_ccc_ietf_sec_tkt_pc_provision_server,
8706                   { "Invalidate PacketCable Provisioning Server", "bootp.ccc.ietf.sec_tkt.pc_provision_server",
8707                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x01,
8708                     NULL, HFILL }},
8709
8710                 { &hf_bootp_ccc_ietf_sec_tkt_all_pc_call_management,
8711                   { "Invalidate All PacketCable Call Management Servers", "bootp.ccc.ietf.sec_tkt.all_pc_call_management",
8712                     FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x02,
8713                     NULL, HFILL }},
8714
8715                 { &hf_bootp_option242_avaya,
8716                   { "Private/Avaya IP Telephone",  "bootp.option.vendor.avaya",
8717                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8718                     "Option 242: Private/Avaya IP Telephone", HFILL }},
8719
8720                 { &hf_bootp_option242_avaya_tlssrvr,
8721                   { "TLSSRVR",  "bootp.option.vendor.avaya.tlssrvr",
8722                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8723                     "Option 242: TLSSRVR (HTTPS server(s) to download configuration)", HFILL }},
8724
8725                 { &hf_bootp_option242_avaya_httpsrvr,
8726                   { "HTTPSRVR",  "bootp.option.vendor.avaya.httpsrvr",
8727                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8728                     "Option 242: HTTPSRVR (HTTP server(s) to download configuration)", HFILL }},
8729
8730                 { &hf_bootp_option242_avaya_httpdir,
8731                   { "HTTPDIR",  "bootp.option.vendor.avaya.httpdir",
8732                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8733                     "Option 242: HTTPDIR (Path to configuration files)", HFILL }},
8734
8735                 { &hf_bootp_option242_avaya_static,
8736                   { "STATIC",  "bootp.option.vendor.avaya.static",
8737                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8738                     "Option 242: STATIC (Static programming override flag)", HFILL }},
8739
8740                 { &hf_bootp_option242_avaya_mcipadd,
8741                   { "MCIPADD",  "bootp.option.vendor.avaya.mcipadd",
8742                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8743                     "Option 242: MCIPADD (List of CM server(s))", HFILL }},
8744
8745                 { &hf_bootp_option242_avaya_dot1x,
8746                   { "DOT1X",  "bootp.option.vendor.avaya.dot1x",
8747                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8748                     "Option 242: DOT1X (802.1X Supplicant operation mode)", HFILL }},
8749
8750                 { &hf_bootp_option242_avaya_icmpdu,
8751                   { "ICMPDU",  "bootp.option.vendor.avaya.icmpdu",
8752                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8753                     "Option 242: ICMPDU (ICMP Destination Unreachable processing)", HFILL }},
8754
8755                 { &hf_bootp_option242_avaya_icmpred,
8756                   { "ICMPRED",  "bootp.option.vendor.avaya.icmpred",
8757                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8758                     "Option 242: ICMPRED (ICMP Redirect handling)", HFILL }},
8759
8760                 { &hf_bootp_option242_avaya_l2q,
8761                   { "L2Q",  "bootp.option.vendor.avaya.l2q",
8762                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8763                     "Option 242: L2Q (Controls 802.1Q tagging)", HFILL }},
8764
8765                 { &hf_bootp_option242_avaya_l2qvlan,
8766                   { "L2QVLAN",  "bootp.option.vendor.avaya.l2qvlan",
8767                     FT_INT32, BASE_DEC, NULL, 0x0,
8768                     "Option 242: L2QVLAN (VLAN ID)", HFILL }},
8769
8770                 { &hf_bootp_option242_avaya_loglocal,
8771                   { "LOGLOCAL",  "bootp.option.vendor.avaya.loglocal",
8772                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8773                     "Option 242: LOGLOCAL (Log level)", HFILL }},
8774
8775                 { &hf_bootp_option242_avaya_phy1stat,
8776                   { "PHY1STAT",  "bootp.option.vendor.avaya.phy1stat",
8777                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8778                     "Option 242: PHY1STAT (Interface configuration)", HFILL }},
8779
8780                 { &hf_bootp_option242_avaya_phy2stat,
8781                   { "PHY2STAT",  "bootp.option.vendor.avaya.phy2stat",
8782                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8783                     "Option 242: PHY2STAT (Interface configuration)", HFILL }},
8784
8785                 { &hf_bootp_option242_avaya_procpswd,
8786                   { "PROCPSWD",  "bootp.option.vendor.avaya.procpswd",
8787                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8788                     "Option 242: PROCPSWD (Security string used to access local procedures)", HFILL }},
8789
8790                 { &hf_bootp_option242_avaya_procstat,
8791                   { "PROCSTAT",  "bootp.option.vendor.avaya.procstat",
8792                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8793                     "Option 242: PROCSTAT (Local (dialpad) Administrative access)", HFILL }},
8794
8795                 { &hf_bootp_option242_avaya_snmpadd,
8796                   { "SNMPADD",  "bootp.option.vendor.avaya.snmpadd",
8797                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8798                     "Option 242: SNMPADD (Allowable source IP Address(es) for SNMP queries)", HFILL }},
8799
8800                 { &hf_bootp_option242_avaya_snmpstring,
8801                   { "SNMPSTRING",  "bootp.option.vendor.avaya.snmpstring",
8802                     FT_STRINGZ, BASE_NONE, NULL, 0x0,
8803                     "Option 242: SNMPSTRING (SNMP community string)", HFILL }},
8804
8805                 { &hf_bootp_option242_avaya_vlantest,
8806                   { "VLANTEST",  "bootp.option.vendor.avaya.vlantest",
8807                     FT_INT32, BASE_DEC, NULL, 0x0,
8808                     "Option 242: VLANTEST (Timeout in seconds)", HFILL }},
8809         };
8810
8811         static uat_field_t bootp_uat_flds[] = {
8812                 UAT_FLD_DEC(uat_bootp_records, opt, "Option number", "Custom Option Number"),
8813                 UAT_FLD_CSTRING(uat_bootp_records, text, "Option Name", "Custom Option Name"),
8814                 UAT_FLD_VS(uat_bootp_records, ftype, "Option type", bootp_custom_type_vals, "Option datatype"),
8815                 UAT_END_FIELDS
8816         };
8817
8818         static gint *ett[] = {
8819                 &ett_bootp,
8820                 &ett_bootp_flags,
8821                 &ett_bootp_option,
8822                 &ett_bootp_option43_suboption,
8823                 &ett_bootp_option63_suboption,
8824                 &ett_bootp_option77_instance,
8825                 &ett_bootp_option82_suboption,
8826                 &ett_bootp_option82_suboption9,
8827                 &ett_bootp_option125_suboption,
8828                 &ett_bootp_option125_tr111_suboption,
8829                 &ett_bootp_option125_cl_suboption,
8830                 &ett_bootp_option242_suboption,
8831                 &ett_bootp_fqdn,
8832                 &ett_bootp_filename_option,
8833                 &ett_bootp_server_hostname,
8834                 &ett_bootp_fqdn_flags,
8835                 &ett_bootp_isns_functions,
8836                 &ett_bootp_isns_discovery_domain_access,
8837                 &ett_bootp_isns_administrative_flags,
8838                 &ett_bootp_isns_server_security_bitmap,
8839                 &ett_bootp_isns_secondary_server_addr,
8840                 &ett_bootp_o43_bsdp_boot_image,
8841                 &ett_bootp_o43_bsdp_attributes,
8842                 &ett_bootp_o43_bsdp_image_desc_list,
8843                 &ett_bootp_o43_bsdp_image_desc,
8844                 &ett_bootp_o43_bsdp_attributes_flags,
8845         };
8846
8847         static ei_register_info ei[] = {
8848                 { &ei_bootp_bad_length, { "bootp.bad_length", PI_PROTOCOL, PI_ERROR, "length isn't 0", EXPFILL }},
8849                 { &ei_bootp_bad_bitfield, { "bootp.bad_bitfield", PI_PROTOCOL, PI_ERROR, "Bogus bitfield", EXPFILL }},
8850                 { &ei_bootp_missing_subopt_length, { "bootp.missing_subopt_length", PI_PROTOCOL, PI_ERROR, "no room left in option for suboption length", EXPFILL }},
8851                 { &ei_bootp_missing_subopt_value, { "bootp.missing_subopt_value", PI_PROTOCOL, PI_ERROR, "no room left in option for suboption value", EXPFILL }},
8852                 { &ei_bootp_mal_duid, { "bootp.malformed.duid", PI_PROTOCOL, PI_ERROR, "DUID: malformed option", EXPFILL }},
8853                 { &hf_bootp_opt_overload_file_end_missing, { "bootp.option.option_overload.file_end_missing", PI_PROTOCOL, PI_ERROR, "file overload end option missing", EXPFILL }},
8854                 { &hf_bootp_opt_overload_sname_end_missing, { "bootp.option.option_overload.sname_end_missing", PI_PROTOCOL, PI_ERROR, "sname overload end option missing", EXPFILL }},
8855                 { &hf_bootp_subopt_unknown_type, { "bootp.subopt.unknown_type", PI_PROTOCOL, PI_ERROR, "ERROR, please report: Unknown subopt type handler", EXPFILL }},
8856                 { &ei_bootp_option_civic_location_bad_cattype, { "bootp.option.civic_location.bad_cattype", PI_PROTOCOL, PI_ERROR, "Error with CAType", EXPFILL }},
8857                 { &ei_bootp_option_dhcp_name_service_invalid, { "bootp.option.dhcp_name_service.invalid", PI_PROTOCOL, PI_ERROR, "Invalid Name Service", EXPFILL }},
8858                 { &ei_bootp_option_sip_server_address_encoding, { "bootp.option.sip_server_address.encoding", PI_PROTOCOL, PI_ERROR, "RFC 3361 defines only 0 and 1 for Encoding byte", EXPFILL }},
8859                 { &ei_bootp_option_classless_static_route, { "bootp.option.classless_static.route", PI_PROTOCOL, PI_ERROR, "Mask width > 32", EXPFILL }},
8860                 { &ei_bootp_option125_enterprise_malformed, { "bootp.option.enterprise.malformed", PI_PROTOCOL, PI_ERROR, "no room left in option for enterprise data", EXPFILL }},
8861                 { &ei_bootp_option_6RD_malformed, { "bootp.option.6RD.malformed", PI_PROTOCOL, PI_ERROR, "6RD: malformed option", EXPFILL }},
8862                 { &ei_bootp_option82_vi_cl_tag_unknown, { "bootp.option.option.vi.cl.tag_unknown", PI_PROTOCOL, PI_ERROR, "Unknown tag", EXPFILL }},
8863                 { &ei_bootp_option_parse_err, { "bootp.option.parse_err", PI_PROTOCOL, PI_ERROR, "Parse error", EXPFILL }},
8864                 { &ei_bootp_suboption_invalid, { "bootp.suboption_invalid", PI_PROTOCOL, PI_ERROR, "Invalid suboption", EXPFILL }},
8865                 { &ei_bootp_secs_le, { "bootp.secs_le", PI_PROTOCOL, PI_NOTE, "Seconds elapsed appears to be encoded as little-endian", EXPFILL }},
8866                 { &ei_bootp_end_option_missing, { "bootp.end_option_missing", PI_PROTOCOL, PI_ERROR, "End option missing", EXPFILL }},
8867                 { &ei_bootp_client_address_not_given, { "bootp.client_address_not_given", PI_PROTOCOL, PI_NOTE, "Client address not given", EXPFILL }},
8868                 { &ei_bootp_server_name_overloaded_by_dhcp, { "bootp.server_name_overloaded_by_dhcp", PI_PROTOCOL, PI_NOTE, "Server name option overloaded by DHCP", EXPFILL }},
8869                 { &ei_bootp_boot_filename_overloaded_by_dhcp, { "bootp.boot_filename_overloaded_by_dhcp", PI_PROTOCOL, PI_NOTE, "Boot file name option overloaded by DHCP", EXPFILL }},
8870                 { &ei_bootp_option_isns_ignored_bitfield, { "bootp.option.isns.ignored_bitfield", PI_PROTOCOL, PI_NOTE, "Enabled field is not set - non-zero bitmask ignored", EXPFILL }},
8871                 { &ei_bootp_option242_avaya_l2qvlan_invalid, { "bootp.option.vendor.avaya.l2qvlan.invalid", PI_PROTOCOL, PI_ERROR, "Option 242 (L2QVLAN) invalid", EXPFILL }},
8872                 { &ei_bootp_option242_avaya_vlantest_invalid, { "bootp.option.vendor.avaya.vlantest.invalid", PI_PROTOCOL, PI_ERROR, "Option 242 (avaya vlantest) invalid", EXPFILL }}
8873         };
8874
8875         static tap_param bootp_stat_params[] = {
8876                 { PARAM_FILTER, "filter", "Filter", NULL, TRUE }
8877         };
8878
8879         static stat_tap_table_ui bootp_stat_table = {
8880                 REGISTER_STAT_GROUP_UNSORTED,
8881                 "DHCP (BOOTP) Statistics",
8882                 "bootp",
8883                 "bootp,stat",
8884                 bootp_stat_init,
8885                 bootp_stat_packet,
8886                 bootp_stat_reset,
8887                 NULL,
8888                 NULL,
8889                 sizeof(bootp_stat_fields)/sizeof(stat_tap_table_item), bootp_stat_fields,
8890                 sizeof(bootp_stat_params)/sizeof(tap_param), bootp_stat_params,
8891                 NULL,
8892                 0
8893         };
8894
8895         module_t *bootp_module;
8896         expert_module_t* expert_bootp;
8897
8898         proto_bootp = proto_register_protocol("Bootstrap Protocol", "BOOTP/DHCP", "bootp");
8899         proto_register_field_array(proto_bootp, hf, array_length(hf));
8900         proto_register_subtree_array(ett, array_length(ett));
8901         bootp_dhcp_tap = register_tap("bootp");
8902
8903         expert_bootp = expert_register_protocol(proto_bootp);
8904         expert_register_field_array(expert_bootp, ei, array_length(ei));
8905
8906         bootp_option_table = register_dissector_table("bootp.option", "BOOTP Options", proto_bootp, FT_UINT8, BASE_DEC);
8907         bootp_vendor_id_subdissector = register_heur_dissector_list("bootp.vendor_id", proto_bootp);
8908         bootp_vendor_info_subdissector = register_heur_dissector_list("bootp.vendor_info", proto_bootp);
8909         bootp_enterprise_table = register_dissector_table("bootp.enterprise", "V-I Vendor Specific Enterprise", proto_bootp, FT_UINT32, BASE_DEC);
8910
8911         /* register init/cleanup routine to handle the custom bootp options */
8912         register_init_routine(&bootp_init_protocol);
8913         register_cleanup_routine(&bootp_cleanup_protocol);
8914
8915         /* Allow dissector to find be found by name. */
8916         bootp_handle = register_dissector("bootp", dissect_bootp, proto_bootp);
8917
8918         bootp_module = prefs_register_protocol(proto_bootp, NULL);
8919
8920         prefs_register_bool_preference(bootp_module, "novellserverstring",
8921                                        "Decode Option 85 as String",
8922                                        "Novell Servers option 85 can be configured as a string instead of address",
8923                                        &novell_string);
8924
8925         prefs_register_enum_preference(bootp_module, "pkt.ccc.protocol_version",
8926                                        "PacketCable CCC protocol version",
8927                                        "The PacketCable CCC protocol version",
8928                                        &pkt_ccc_protocol_version,
8929                                        pkt_ccc_protocol_versions,
8930                                        FALSE);
8931
8932         prefs_register_uint_preference(bootp_module, "pkt.ccc.option",
8933                                        "PacketCable CCC option",
8934                                        "Option Number for PacketCable CableLabs Client Configuration",
8935                                        10,
8936                                        &pkt_ccc_option);
8937
8938         prefs_register_enum_preference(bootp_module, "uuid.endian",
8939                                        "Endianness of UUID",
8940                                        "Endianness applied to UUID fields",
8941                                        &bootp_uuid_endian,
8942                                        bootp_uuid_endian_vals,
8943                                        FALSE);
8944
8945         prefs_register_obsolete_preference(bootp_module, "displayasstring");
8946
8947         bootp_uat = uat_new("Custom BootP/DHCP Options (Excl. suboptions)",
8948                         sizeof(uat_bootp_record_t), /* record size           */
8949                         "custom_bootp",             /* filename              */
8950                         TRUE,                       /* from_profile          */
8951                         &uat_bootp_records,         /* data_ptr              */
8952                         &num_bootp_records_uat,     /* numitems_ptr          */
8953                         UAT_AFFECTS_DISSECTION,     /* affects dissection of packets, but not set of named fields */
8954                         NULL,                       /* help                  */
8955                         uat_bootp_record_copy_cb,   /* copy callback         */
8956                         uat_bootp_record_update_cb, /* update callback       */
8957                         uat_bootp_record_free_cb,   /* free callback         */
8958                         NULL,                       /* post update callback  */
8959                         NULL,                           /* reset callback */
8960                         bootp_uat_flds);            /* UAT field definitions */
8961
8962         prefs_register_uat_preference(bootp_module,
8963                                       "custom_bootp_table",
8964                                       "Custom BootP/DHCP Options (Excl. suboptions)",
8965                                       "Custom BootP/DHCP Options (Excl. suboptions)",
8966                                       bootp_uat);
8967
8968         register_stat_tap_table_ui(&bootp_stat_table);
8969 }
8970
8971 void
8972 proto_reg_handoff_bootp(void)
8973 {
8974         range_t *bootopt_basictype_range;
8975
8976         dissector_add_uint_range_with_preference("udp.port", BOOTP_UDP_PORT_RANGE, bootp_handle);
8977
8978         /* Create dissection function handles for all BOOTP options */
8979         bootpopt_basic_handle = create_dissector_handle( dissect_bootpopt_basic_type, -1 );
8980         range_convert_str(wmem_epan_scope(), &bootopt_basictype_range, BOOTP_OPTION_BASICTYPE_RANGE, 0xFF);
8981         dissector_add_uint_range("bootp.option", bootopt_basictype_range, bootpopt_basic_handle);
8982
8983         dissector_add_uint("bootp.option", 21, create_dissector_handle( dissect_bootpopt_policy_filter, -1 ));
8984         dissector_add_uint("bootp.option", 33, create_dissector_handle( dissect_bootpopt_static_route, -1 ));
8985         dissector_add_uint("bootp.option", 43, create_dissector_handle( dissect_bootpopt_vendor_specific_info, -1 ));
8986         dissector_add_uint("bootp.option", 52, create_dissector_handle( dissect_bootpopt_option_overload, -1 ));
8987         dissector_add_uint("bootp.option", 53, create_dissector_handle( dissect_bootpopt_dhcp, -1 ));
8988         dissector_add_uint("bootp.option", 55, create_dissector_handle( dissect_bootpopt_param_request_list, -1 ));
8989         dissector_add_uint("bootp.option", 60, create_dissector_handle( dissect_bootpopt_vendor_class_identifier, -1 ));
8990         dissector_add_uint("bootp.option", 61, create_dissector_handle( dissect_bootpopt_client_identifier, -1 ));
8991         dissector_add_uint("bootp.option", 63, create_dissector_handle( dissect_bootpopt_netware_ip, -1 ));
8992         dissector_add_uint("bootp.option", 77, create_dissector_handle( dissect_bootpopt_user_class_information, -1 ));
8993         dissector_add_uint("bootp.option", 78, create_dissector_handle( dissect_bootpopt_slp_directory_agent, -1 ));
8994         dissector_add_uint("bootp.option", 79, create_dissector_handle( dissect_bootpopt_slp_service_scope, -1 ));
8995         dissector_add_uint("bootp.option", 81, create_dissector_handle( dissect_bootpopt_client_full_domain_name, -1 ));
8996         dissector_add_uint("bootp.option", 82, create_dissector_handle( dissect_bootpopt_relay_agent_info, -1 ));
8997         dissector_add_uint("bootp.option", 83, create_dissector_handle( dissect_bootpopt_isns, -1 ));
8998         dissector_add_uint("bootp.option", 85, create_dissector_handle( dissect_bootpopt_novell_servers, -1 ));
8999         dissector_add_uint("bootp.option", 90, create_dissector_handle( dissect_bootpopt_dhcp_authentication, -1 ));
9000         dissector_add_uint("bootp.option", 94, create_dissector_handle( dissect_bootpopt_client_network_interface_id, -1 ));
9001         dissector_add_uint("bootp.option", 97, create_dissector_handle( dissect_bootpopt_client_identifier_uuid, -1 ));
9002         dissector_add_uint("bootp.option", 99, create_dissector_handle( dissect_bootpopt_civic_location, -1 ));
9003         dissector_add_uint("bootp.option", 117, create_dissector_handle( dissect_bootpopt_name_server_search, -1 ));
9004         dissector_add_uint("bootp.option", 119, create_dissector_handle( dissect_bootpopt_dhcp_domain_search, -1 ));
9005         dissector_add_uint("bootp.option", 120, create_dissector_handle( dissect_bootpopt_sip_servers, -1 ));
9006         dissector_add_uint("bootp.option", 121, create_dissector_handle( dissect_bootpopt_classless_static_route, -1 ));
9007         /* The PacketCable CCC option number can vary. Still handled through preference */
9008         dissector_add_uint("bootp.option", 122, create_dissector_handle( dissect_bootpopt_packetcable_ccc, -1 ));
9009
9010         dissector_add_uint("bootp.option", 123, create_dissector_handle( dissect_bootpopt_coordinate_based_location, -1 ));
9011         dissector_add_uint("bootp.option", 124, create_dissector_handle( dissect_bootpopt_vi_vendor_class, -1 ));
9012         dissector_add_uint("bootp.option", 125, create_dissector_handle( dissect_bootpopt_vi_vendor_specific_info, -1 ));
9013         dissector_add_uint("bootp.option", 160, create_dissector_handle( dissect_bootpopt_dhcp_captive_portal, -1 ));
9014         dissector_add_uint("bootp.option", 212, create_dissector_handle( dissect_bootpopt_6RD_option, -1 ));
9015         dissector_add_uint("bootp.option", 242, create_dissector_handle( dissect_bootpopt_avaya_ip_telephone, -1 ));
9016         dissector_add_uint("bootp.option", 249, create_dissector_handle( dissect_bootpopt_classless_static_route, -1 ));
9017
9018         /* Create heuristic dissection for BOOTP vendor class id */
9019         heur_dissector_add( "bootp.vendor_id", dissect_packetcable_mta_vendor_id_heur, "PacketCable MTA", "packetcable_mta_bootp", proto_bootp, HEURISTIC_ENABLE );
9020         heur_dissector_add( "bootp.vendor_id", dissect_packetcable_cm_vendor_id_heur, "PacketCable CM", "packetcable_cm_bootp", proto_bootp, HEURISTIC_ENABLE );
9021         heur_dissector_add( "bootp.vendor_id", dissect_packetcable_bsdpd_vendor_id_heur, "PacketCable BSDPD", "packetcable_bsdpd_bootp", proto_bootp, HEURISTIC_ENABLE );
9022
9023         /* Create heuristic dissection for BOOTP vendor specific information */
9024
9025         /* Note that this is a rather weak (permissive) heuristic,
9026            it's put first so it ends up at the end of the list, I guess this is OK.
9027            Add any stronger (less permissive) heuristics after this!
9028            XXX - Should we just disable by default? */
9029         heur_dissector_add( "bootp.vendor_info", dissect_alcatel_lucent_vendor_info_heur, "Alcatel-Lucent", "alcatel_lucent_bootp", proto_bootp, HEURISTIC_ENABLE );
9030
9031         heur_dissector_add( "bootp.vendor_info", dissect_pxeclient_vendor_info_heur, "PXEClient", "pxeclient_bootp", proto_bootp, HEURISTIC_ENABLE );
9032         heur_dissector_add( "bootp.vendor_info", dissect_cablelabs_vendor_info_heur, "CableLabs", "cablelabs_bootp", proto_bootp, HEURISTIC_ENABLE );
9033         heur_dissector_add( "bootp.vendor_info", dissect_aruba_ap_vendor_info_heur, ARUBA_AP, "aruba_ap_bootp", proto_bootp, HEURISTIC_ENABLE );
9034         heur_dissector_add( "bootp.vendor_info", dissect_aruba_instant_ap_vendor_info_heur, ARUBA_INSTANT_AP, "aruba_instant_ap_bootp", proto_bootp, HEURISTIC_ENABLE );
9035         heur_dissector_add( "bootp.vendor_info", dissect_packetcable_bsdpd_vendor_info_heur, "PacketCable BSDPD", "packetcable_bsdpd_info_bootp", proto_bootp, HEURISTIC_ENABLE );
9036
9037         /* Create dissection function handles for BOOTP Enterprise dissection */
9038         dissector_add_uint("bootp.enterprise", 4491, create_dissector_handle( dissect_vendor_cl_suboption, -1 ));
9039         dissector_add_uint("bootp.enterprise", 3561, create_dissector_handle( dissect_vendor_tr111_suboption, -1 ));
9040 }
9041
9042 /*
9043  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
9044  *
9045  * Local variables:
9046  * c-basic-offset: 8
9047  * tab-width: 8
9048  * indent-tabs-mode: t
9049  * End:
9050  *
9051  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
9052  * :indentSize=8:tabSize=8:noTabs=false:
9053  */