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