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