2 * Routines for Layer Two Tunnelling Protocol (L2TP) packet disassembly
3 * John Thomes <john@ensemblecom.com>
5 * Minor changes by: (2000-01-10)
6 * Laurent Cazalet <laurent.cazalet@mailclub.net>
7 * Thomas Parvais <thomas.parvais@advalvas.be>
9 * Added RFC 5515 by Uli Heilmeier <uh@heilmeier.eu>, 2016-02-29
11 * Ericsson L2TP by Harald Welte <laforge@gnumonks.org>, 2016-07-16
13 * Wireshark - Network traffic analyzer
14 * By Gerald Combs <gerald@wireshark.org>
15 * Copyright 1998 Gerald Combs
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 * http://tools.ietf.org/html/rfc2661
37 * http://tools.ietf.org/html/rfc3931
39 * Layer Two Tunneling Protocol "L2TP" number assignments:
40 * http://www.iana.org/assignments/l2tp-parameters
44 * RFC 4591 for Frame Relay
45 * http://tools.ietf.org/html/rfc4591
48 * http://tools.ietf.org/html/rfc4454
50 * RFC 4719 for Ethernet
51 * http://tools.ietf.org/html/rfc4719
54 * http://tools.ietf.org/html/rfc4349
56 * XXX - what about LAPD?
61 #include <epan/packet.h>
62 #include <epan/ipproto.h>
63 #include <epan/sminmpec.h>
64 #include <epan/addr_resolv.h>
65 #include <epan/prefs.h>
66 #include <epan/conversation.h>
67 #include <epan/expert.h>
68 #include <epan/decode_as.h>
69 #include <epan/proto_data.h>
71 #include <wsutil/wsgcrypt.h>
73 #include "packet-l2tp.h"
75 void proto_register_l2tp(void);
76 void proto_reg_handoff_l2tp(void);
78 static int proto_l2tp = -1;
79 static int hf_l2tp_type = -1;
80 static int hf_l2tp_length_bit = -1;
81 static int hf_l2tp_seq_bit = -1;
82 static int hf_l2tp_offset_bit = -1;
83 static int hf_l2tp_priority = -1;
84 static int hf_l2tp_version = -1;
85 static int hf_l2tp_length = -1;
86 static int hf_l2tp_tunnel = -1;
87 static int hf_l2tp_session = -1;
88 static int hf_l2tp_Ns = -1;
89 static int hf_l2tp_Nr = -1;
90 static int hf_l2tp_offset = -1;
91 static int hf_l2tp_avp_mandatory = -1;
92 static int hf_l2tp_avp_hidden = -1;
93 static int hf_l2tp_avp_length = -1;
94 static int hf_l2tp_avp_vendor_id = -1;
95 static int hf_l2tp_avp_type = -1;
96 static int hf_l2tp_tie_breaker = -1;
97 static int hf_l2tp_sid = -1;
98 static int hf_l2tp_res = -1;
99 static int hf_l2tp_ccid = -1;
100 static int hf_l2tp_cookie = -1;
101 static int hf_l2tp_l2_spec_def = -1;
102 static int hf_l2tp_l2_spec_atm = -1;
103 static int hf_l2tp_l2_spec_docsis_dmpt = -1;
104 static int hf_l2tp_l2_spec_v = -1;
105 static int hf_l2tp_l2_spec_s = -1;
106 static int hf_l2tp_l2_spec_h = -1;
107 static int hf_l2tp_l2_spec_flow_id = -1;
108 static int hf_l2tp_l2_spec_sequence = -1;
109 static int hf_l2tp_l2_spec_t = -1;
110 static int hf_l2tp_l2_spec_g = -1;
111 static int hf_l2tp_l2_spec_c = -1;
112 static int hf_l2tp_l2_spec_u = -1;
113 static int hf_l2tp_cisco_avp_type = -1;
114 static int hf_l2tp_ericsson_avp_type = -1;
115 static int hf_l2tp_broadband_avp_type = -1;
116 static int hf_l2tp_cablelabs_avp_type = -1;
117 static int hf_l2tp_avp_message_type = -1;
118 static int hf_l2tp_avp_assigned_tunnel_id = -1;
119 static int hf_l2tp_avp_assigned_control_conn_id = -1;
120 static int hf_l2tp_avp_assigned_session_id = -1;
121 static int hf_l2tp_avp_remote_session_id = -1;
122 static int hf_l2tp_avp_local_session_id = -1;
123 static int hf_l2tp_avp_called_number = -1;
124 static int hf_l2tp_avp_calling_number = -1;
125 static int hf_l2tp_cisco_tie_breaker = -1;
126 static int hf_l2tp_cablel_avp_l_bit = -1;
127 static int hf_l2tp_cablel_avp_tsid_group_id = -1;
128 static int hf_l2tp_cablel_avp_frequency = -1;
129 static int hf_l2tp_cablel_avp_modulation = -1;
130 static int hf_l2tp_cablel_avp_m = -1;
131 static int hf_l2tp_cablel_avp_n = -1;
132 static int hf_l2tp_broadband_agent_circuit_id = -1;
133 static int hf_l2tp_broadband_agent_remote_id = -1;
134 static int hf_l2tp_broadband_actual_dr_up = -1;
135 static int hf_l2tp_broadband_actual_dr_down = -1;
136 static int hf_l2tp_broadband_minimum_dr_up = -1;
137 static int hf_l2tp_broadband_minimum_dr_down = -1;
138 static int hf_l2tp_broadband_attainable_dr_up = -1;
139 static int hf_l2tp_broadband_attainable_dr_down = -1;
140 static int hf_l2tp_broadband_maximum_dr_up = -1;
141 static int hf_l2tp_broadband_maximum_dr_down = -1;
142 static int hf_l2tp_broadband_minimum_dr_up_low_power = -1;
143 static int hf_l2tp_broadband_minimum_dr_down_low_power = -1;
144 static int hf_l2tp_broadband_maximum_interleaving_delay_up = -1;
145 static int hf_l2tp_broadband_actual_interleaving_delay_up = -1;
146 static int hf_l2tp_broadband_maximum_interleaving_delay_down = -1;
147 static int hf_l2tp_broadband_actual_interleaving_delay_down = -1;
148 static int hf_l2tp_broadband_access_loop_encapsulation = -1;
149 static int hf_l2tp_broadband_access_loop_encapsulation_data_link = -1;
150 static int hf_l2tp_broadband_access_loop_encapsulation_enc1 = -1;
151 static int hf_l2tp_broadband_access_loop_encapsulation_enc2 = -1;
152 static int hf_l2tp_broadband_ancp_access_line_type = -1;
153 static int hf_l2tp_broadband_iwf_session = -1;
154 static int hf_l2tp_avp_csu = -1;
155 static int hf_l2tp_avp_csu_res = -1;
156 static int hf_l2tp_avp_csu_remote_session_id_v2 = -1;
157 static int hf_l2tp_avp_csu_current_tx_speed_v2 = -1;
158 static int hf_l2tp_avp_csu_current_rx_speed_v2 = -1;
159 static int hf_l2tp_avp_csu_remote_session_id_v3 = -1;
160 static int hf_l2tp_avp_csu_current_tx_speed_v3 = -1;
161 static int hf_l2tp_avp_csu_current_rx_speed_v3 = -1;
163 static int hf_l2tp_ericsson_msg_type = -1;
164 static int hf_l2tp_ericsson_conn_type = -1;
165 static int hf_l2tp_ericsson_stn_name = -1;
166 static int hf_l2tp_ericsson_crc32_enable = -1;
167 static int hf_l2tp_ericsson_abis_lower_mode = -1;
168 static int hf_l2tp_ericsson_tc_overl_thresh = -1;
169 static int hf_l2tp_ericsson_tc_num_groups = -1;
170 static int hf_l2tp_ericsson_tcg_group_id = -1;
171 static int hf_l2tp_ericsson_tcg_num_sapis = -1;
172 static int hf_l2tp_ericsson_tcg_sapi = -1;
173 static int hf_l2tp_ericsson_tcg_ip = -1;
174 static int hf_l2tp_ericsson_tcg_dscp = -1;
175 static int hf_l2tp_ericsson_tcg_crc32_enable = -1;
176 static int hf_l2tp_ericsson_tcg_bundling_tout = -1;
177 static int hf_l2tp_ericsson_tcg_bundling_max_pkt = -1;
178 static int hf_l2tp_ericsson_tc_num_maps = -1;
179 static int hf_l2tp_ericsson_map_tei_low = -1;
180 static int hf_l2tp_ericsson_map_tei_high = -1;
181 static int hf_l2tp_ericsson_map_sc = -1;
182 static int hf_l2tp_ericsson_ver_pref = -1;
183 static int hf_l2tp_ericsson_ver_2 = -1;
184 static int hf_l2tp_ericsson_ver_3 = -1;
186 /* Generated from convert_proto_tree_add_text.pl */
187 static int hf_l2tp_cisco_pw_type = -1;
188 static int hf_l2tp_avp_error_code = -1;
189 static int hf_l2tp_avp_cause_msg = -1;
190 static int hf_l2tp_avp_host_name = -1;
191 static int hf_l2tp_avp_maximum_bps = -1;
192 static int hf_l2tp_avp_pseudowire_type = -1;
193 static int hf_l2tp_avp_minimum_bps = -1;
194 static int hf_l2tp_avp_nonce = -1;
195 static int hf_l2tp_avp_circuit_status = -1;
196 static int hf_l2tp_avp_receive_window_size = -1;
197 static int hf_l2tp_avp_vendor_name = -1;
198 static int hf_l2tp_avp_layer2_specific_sublayer = -1;
199 static int hf_l2tp_avp_disconnect_code = -1;
200 static int hf_l2tp_cisco_circuit_status = -1;
201 static int hf_l2tp_cisco_remote_session_id = -1;
202 static int hf_l2tp_avp_router_id = -1;
203 static int hf_l2tp_avp_send_accm = -1;
204 static int hf_l2tp_avp_last_sent_lcp_confreq = -1;
205 static int hf_l2tp_avp_sync_framing_supported = -1;
206 static int hf_l2tp_cisco_assigned_control_connection_id = -1;
207 static int hf_l2tp_avp_sync_framing_type = -1;
208 static int hf_l2tp_avp_assigned_cookie = -1;
209 static int hf_l2tp_avp_time_out_errors = -1;
210 static int hf_l2tp_avp_sub_address = -1;
211 static int hf_l2tp_avp_connect_speed = -1;
212 static int hf_l2tp_avp_analog_access_supported = -1;
213 static int hf_l2tp_avp_private_group_id = -1;
214 static int hf_l2tp_avp_proxy_authen_response = -1;
215 static int hf_l2tp_avp_chap_challenge = -1;
216 static int hf_l2tp_avp_call_serial_number = -1;
217 static int hf_l2tp_avp_digital_access_supported = -1;
218 static int hf_l2tp_avp_physical_channel = -1;
219 static int hf_l2tp_avp_advisory_msg = -1;
220 static int hf_l2tp_avp_data_sequencing = -1;
221 static int hf_l2tp_avp_control_protocol_number = -1;
222 static int hf_l2tp_avp_error_message = -1;
223 static int hf_l2tp_avp_initial_received_lcp_confreq = -1;
224 static int hf_l2tp_avp_async_framing_supported = -1;
225 static int hf_l2tp_cisco_message_digest = -1;
226 static int hf_l2tp_avp_circuit_type = -1;
227 static int hf_l2tp_cisco_circuit_type = -1;
228 static int hf_l2tp_avp_proxy_authen_challenge = -1;
229 static int hf_l2tp_cisco_assigned_cookie = -1;
230 static int hf_l2tp_avp_receive_accm = -1;
231 static int hf_l2tp_stop_ccn_result_code = -1;
232 static int hf_l2tp_avp_proxy_authen_id = -1;
233 static int hf_l2tp_avp_digital_bearer_type = -1;
234 static int hf_l2tp_avp_rx_connect_speed = -1;
235 static int hf_l2tp_cisco_nonce = -1;
236 static int hf_l2tp_avp_chap_challenge_response = -1;
237 static int hf_l2tp_avp_cause_code = -1;
238 static int hf_l2tp_avp_protocol_revision = -1;
239 static int hf_l2tp_avp_alignment_errors = -1;
240 static int hf_l2tp_avp_last_received_lcp_confreq = -1;
241 static int hf_l2tp_avp_crc_errors = -1;
242 static int hf_l2tp_avp_random_vector = -1;
243 static int hf_l2tp_avp_preferred_language = -1;
244 static int hf_l2tp_cisco_interface_mtu = -1;
245 static int hf_l2tp_avp_async_framing_type = -1;
246 static int hf_l2tp_avp_pw_type = -1;
247 static int hf_l2tp_cisco_local_session_id = -1;
248 static int hf_l2tp_avp_hardware_overruns = -1;
249 static int hf_l2tp_avp_proxy_authen_type = -1;
250 static int hf_l2tp_cisco_draft_avp_version = -1;
251 static int hf_l2tp_avp_protocol_version = -1;
252 static int hf_l2tp_result_code = -1;
253 static int hf_l2tp_avp_buffer_overruns = -1;
254 static int hf_l2tp_avp_remote_end_id = -1;
255 static int hf_l2tp_cisco_pseudowire_type = -1;
256 static int hf_l2tp_avp_message_digest = -1;
257 static int hf_l2tp_avp_proxy_authen_name = -1;
258 static int hf_l2tp_avp_analog_bearer_type = -1;
259 static int hf_l2tp_avp_cause_code_direction = -1;
260 static int hf_l2tp_avp_firmware_revision = -1;
261 static int hf_l2tp_avp_cause_code_message = -1;
262 static int hf_l2tp_avp_framing_errors = -1;
263 static int hf_l2tp_cisco_remote_end_id = -1;
264 static int hf_l2tp_avp_tx_connect_speed_v3 = -1;
265 static int hf_l2tp_avp_rx_connect_speed_v3 = -1;
266 static int hf_l2tp_lapd_info = -1;
267 static int hf_l2tp_session_id = -1;
268 static int hf_l2tp_zero_length_body_message = -1;
269 static int hf_l2tp_offset_padding = -1;
271 static dissector_table_t l2tp_vendor_avp_dissector_table;
272 static dissector_table_t pw_type_table;
274 #define UDP_PORT_L2TP 1701
276 #define CONTROL_BIT(msg_info) (msg_info & 0x8000) /* Type bit control = 1 data = 0 */
277 #define LENGTH_BIT(msg_info) (msg_info & 0x4000) /* Length bit = 1 */
278 #define RESERVE_BITS(msg_info) (msg_info &0x37F8) /* Reserved bit - unused */
279 #define SEQUENCE_BIT(msg_info) (msg_info & 0x0800) /* SEQUENCE bit = 1 Ns and Nr fields */
280 #define OFFSET_BIT(msg_info) (msg_info & 0x0200) /* Offset */
281 #define PRIORITY_BIT(msg_info) (msg_info & 0x0100) /* Priority */
282 #define L2TP_VERSION(msg_info) (msg_info & 0x000f) /* Version of l2tp */
283 #define MANDATORY_BIT(msg_info) (msg_info & 0x8000) /* Mandatory = 1 */
284 #define HIDDEN_BIT(msg_info) (msg_info & 0x4000) /* Hidden = 1 */
285 #define AVP_LENGTH(msg_info) (msg_info & 0x03ff) /* AVP Length */
286 #define FRAMING_SYNC(msg_info) (msg_info & 0x0001) /* SYNC Framing Type */
287 #define FRAMING_ASYNC(msg_info) (msg_info & 0x0002) /* ASYNC Framing Type */
288 #define BEARER_DIGITAL(msg_info) (msg_info & 0x0001) /* Digital Bearer Type */
289 #define BEARER_ANALOG(msg_info) (msg_info & 0x0002) /* Analog Bearer Type */
290 #define CIRCUIT_STATUS_BIT(msg_info) (msg_info & 0x0001) /* Circuit Status */
291 #define CIRCUIT_TYPE_BIT(msg_info) (msg_info & 0x0001) /* Circuit Condition */
293 /* DOCSIS DMPT Sub-Layer Header definitions */
294 #define FLOW_ID_MASK 0x0E
296 static gint ett_l2tp = -1;
297 static gint ett_l2tp_ctrl = -1;
298 static gint ett_l2tp_avp = -1;
299 static gint ett_l2tp_avp_sub = -1;
300 static gint ett_l2tp_ale_sub = -1;
301 static gint ett_l2tp_lcp = -1;
302 static gint ett_l2tp_l2_spec = -1;
303 static gint ett_l2tp_csu = -1;
304 static gint ett_l2tp_ericsson_tcg = -1;
305 static gint ett_l2tp_ericsson_map = -1;
307 static expert_field ei_l2tp_incorrect_digest = EI_INIT;
308 /* Generated from convert_proto_tree_add_text.pl */
309 static expert_field ei_l2tp_vendor_specific_avp_data = EI_INIT;
310 static expert_field ei_l2tp_avp_length = EI_INIT;
312 static const enum_val_t l2tpv3_cookies[] = {
313 {"detect", "Detect", -1},
314 {"cookie0", "None", 0},
315 {"cookie4", "4 Byte Cookie", 4},
316 {"cookie8", "8 Byte Cookie", 8},
320 #define L2TPv3_COOKIE_DEFAULT 0
321 #define L2TPv3_PROTOCOL_DEFAULT L2TPv3_PROTOCOL_CHDLC
323 #define L2TPv3_L2_SPECIFIC_NONE 0
324 #define L2TPv3_L2_SPECIFIC_DEFAULT 1
325 #define L2TPv3_L2_SPECIFIC_ATM 2
326 #define L2TPv3_L2_SPECIFIC_LAPD 3
327 #define L2TPv3_L2_SPECIFIC_DOCSIS_DMPT 4
328 #define L2TPv3_L2_SPECIFIC_MAX (L2TPv3_L2_SPECIFIC_DOCSIS_DMPT + 1)
330 static const enum_val_t l2tpv3_l2_specifics[] = {
331 {"detect", "Detect", -1},
332 {"none", "None", L2TPv3_L2_SPECIFIC_NONE},
333 {"default", "Default L2-Specific", L2TPv3_L2_SPECIFIC_DEFAULT},
334 {"atm", "ATM-Specific", L2TPv3_L2_SPECIFIC_ATM},
335 {"lapd", "LAPD-Specific", L2TPv3_L2_SPECIFIC_LAPD},
336 {"dmpt", "DOCSIS DMPT-Specific", L2TPv3_L2_SPECIFIC_DOCSIS_DMPT},
340 static gint l2tpv3_cookie = -1;
341 static gint l2tpv3_l2_specific = -1;
343 #define MESSAGE_TYPE_SCCRQ 1
344 #define MESSAGE_TYPE_SCCRP 2
345 #define MESSAGE_TYPE_SCCCN 3
346 #define MESSAGE_TYPE_StopCCN 4
347 #define MESSAGE_TYPE_Reserved_5 5
348 #define MESSAGE_TYPE_HELLO 6
349 #define MESSAGE_TYPE_OCRQ 7
350 #define MESSAGE_TYPE_OCRP 8
351 #define MESSAGE_TYPE_OCCN 9
352 #define MESSAGE_TYPE_ICRQ 10
353 #define MESSAGE_TYPE_ICRP 11
354 #define MESSAGE_TYPE_ICCN 12
355 #define MESSAGE_TYPE_Reserved_13 13
356 #define MESSAGE_TYPE_CDN 14
357 #define MESSAGE_TYPE_WEN 15
358 #define MESSAGE_TYPE_SLI 16
359 #define MESSAGE_TYPE_MDMST 17
360 #define MESSAGE_TYPE_SRRQ 18
361 #define MESSAGE_TYPE_SRRP 19
362 #define MESSAGE_TYPE_ACK 20
363 #define MESSAGE_TYPE_FSQ 21
364 #define MESSAGE_TYPE_FSR 22
365 #define MESSAGE_TYPE_MSRQ 23
366 #define MESSAGE_TYPE_MSRP 24
367 #define MESSAGE_TYPE_MSE 25
368 #define MESSAGE_TYPE_MSI 26
369 #define MESSAGE_TYPE_MSEN 27
370 #define MESSAGE_TYPE_CSUN 28
371 #define MESSAGE_TYPE_CSURQ 29
373 static const value_string message_type_vals[] = {
374 { MESSAGE_TYPE_SCCRQ, "Start_Control_Request" },
375 { MESSAGE_TYPE_SCCRP, "Start_Control_Reply" },
376 { MESSAGE_TYPE_SCCCN, "Start_Control_Connected" },
377 { MESSAGE_TYPE_StopCCN, "Stop_Control_Notification" },
378 { MESSAGE_TYPE_Reserved_5, "Reserved" },
379 { MESSAGE_TYPE_HELLO, "Hello" },
380 { MESSAGE_TYPE_OCRQ, "Outgoing_Call_Request" },
381 { MESSAGE_TYPE_OCRP, "Outgoing_Call_Reply" },
382 { MESSAGE_TYPE_OCCN, "Outgoing_Call_Connected" },
383 { MESSAGE_TYPE_ICRQ, "Incoming_Call_Request" },
384 { MESSAGE_TYPE_ICRP, "Incoming_Call_Reply" },
385 { MESSAGE_TYPE_ICCN, "Incoming_Call_Connected" },
386 { MESSAGE_TYPE_Reserved_13, "Reserved" },
387 { MESSAGE_TYPE_CDN, "Call_Disconnect_Notification" },
388 { MESSAGE_TYPE_WEN, "WAN_Error_Notify" },
389 { MESSAGE_TYPE_SLI, "Set_Link_Info" },
390 { MESSAGE_TYPE_MDMST, "Modem_Status" },
391 { MESSAGE_TYPE_SRRQ, "Service_Relay_Request_Msg" },
392 { MESSAGE_TYPE_SRRP, "Service_Relay_Reply_Message" },
393 { MESSAGE_TYPE_ACK, "Explicit_Acknowledgement" },
394 /* Fail Over Extensions - RFC4951 */
395 { MESSAGE_TYPE_FSQ, "Failover_Session_Query_Message" },
396 { MESSAGE_TYPE_FSR, "Failover_Session_Response_Message" },
397 /* Multicast Management - RFC4045 */
398 { MESSAGE_TYPE_MSRQ, "Multicast-Session-Request" },
399 { MESSAGE_TYPE_MSRP, "Multicast-Session-Response" },
400 { MESSAGE_TYPE_MSE, "Multicast-Session-Establishment" },
401 { MESSAGE_TYPE_MSI, "Multicast-Session-Information" },
402 { MESSAGE_TYPE_MSEN, "Multicast-Session-End-Notify" },
403 { MESSAGE_TYPE_CSUN, "Connect-Speed-Update-Notification" },
404 { MESSAGE_TYPE_CSURQ, "Connect-Speed-Update-Request" },
407 static value_string_ext message_type_vals_ext = VALUE_STRING_EXT_INIT(message_type_vals);
409 static const value_string l2tp_message_type_short_str_vals[] = {
410 { MESSAGE_TYPE_SCCRQ, "SCCRQ" },
411 { MESSAGE_TYPE_SCCRP, "SCCRP" },
412 { MESSAGE_TYPE_SCCCN, "SCCCN" },
413 { MESSAGE_TYPE_StopCCN, "StopCCN" },
415 { MESSAGE_TYPE_HELLO, "Hello" },
416 { MESSAGE_TYPE_OCRQ, "OCRQ" },
417 { MESSAGE_TYPE_OCRP, "OCRP" },
418 { MESSAGE_TYPE_OCCN, "OCCN" },
419 { MESSAGE_TYPE_ICRQ, "ICRQ" },
420 { MESSAGE_TYPE_ICRP, "ICRP" },
421 { MESSAGE_TYPE_ICCN, "ICCN" },
423 { MESSAGE_TYPE_CDN, "CDN" },
424 { MESSAGE_TYPE_WEN, "WEN" },
425 { MESSAGE_TYPE_SLI, "SLI" },
426 { MESSAGE_TYPE_MDMST, "MDMST" },
427 { MESSAGE_TYPE_SRRQ, "SRRQ" },
428 { MESSAGE_TYPE_SRRP, "SRRP" },
429 { MESSAGE_TYPE_ACK, "ACK" },
430 /* Fail Over Extensions - RFC4951 */
431 { MESSAGE_TYPE_FSQ, "FSQ" },
432 { MESSAGE_TYPE_FSR, "FSR" },
433 /* Multicast Management - RFC4045 */
434 { MESSAGE_TYPE_MSRQ, "MSRQ" },
435 { MESSAGE_TYPE_MSRP, "MSRP" },
436 { MESSAGE_TYPE_MSE, "MSE" },
437 { MESSAGE_TYPE_MSI, "MSI" },
438 { MESSAGE_TYPE_MSEN, "MSEN" },
439 { MESSAGE_TYPE_CSUN, "CSUN" },
440 { MESSAGE_TYPE_CSURQ, "CSURQ" },
443 static value_string_ext l2tp_message_type_short_str_vals_ext = VALUE_STRING_EXT_INIT(l2tp_message_type_short_str_vals);
446 static const char *control_msg = "Control Message";
447 static const char *data_msg = "Data Message";
448 static const value_string l2tp_type_vals[] = {
449 { 0, "Data Message" },
450 { 1, "Control Message" },
454 static const value_string cause_code_direction_vals[] = {
455 { 0, "global error" },
461 static const true_false_string l2tp_length_bit_truth =
462 { "Length field is present", "Length field is not present" };
464 static const true_false_string l2tp_seq_bit_truth =
465 { "Ns and Nr fields are present", "Ns and Nr fields are not present" };
467 static const true_false_string l2tp_offset_bit_truth =
468 { "Offset Size field is present", "Offset size field is not present" };
470 static const true_false_string l2tp_priority_truth =
471 { "This data message has priority", "No priority" };
473 static const value_string authen_type_vals[] = {
475 { 1, "Textual username/password exchange" },
478 { 4, "No Authentication" },
479 { 5, "Microsoft CHAP Version 1" },
485 static const value_string data_sequencing_vals[] = {
486 { 0, "No incoming data packets require sequencing" },
487 { 1, "Only non-IP data packets require sequencing" },
488 { 2, "All incoming data packets require sequencing" },
492 static const value_string l2_sublayer_vals[] = {
493 { 0, "No L2-Specific Sublayer" },
494 { 1, "Default L2-Specific Sublayer present" },
495 { 2, "ATM-Specific Sublayer present" },
496 { 3, "MPT-Specific Sublayer" },
497 { 4, "PSP-Specific Sublayer" },
501 /* Result Code values for the StopCCN message */
502 static const value_string result_code_stopccn_vals[] = {
504 { 1, "General request to clear control connection", },
505 { 2, "General error, Error Code indicates the problem", },
506 { 3, "Control connection already exists", },
507 { 4, "Requester is not authorized to establish a control connection", },
508 { 5, "The protocol version of the requester is not supported", },
509 { 6, "Requester is being shut down", },
510 { 7, "Finite state machine error or timeout", },
511 { 8, "Control connection due to mismatching CCDS value", }, /* [RFC3308] */
515 /* Result Code values for the CDN message */
516 static const value_string result_code_cdn_vals[] = {
518 { 1, "Session disconnected due to loss of carrier or circuit disconnect", },
519 { 2, "Session disconnected for the reason indicated in Error Code", },
520 { 3, "Session disconnected for administrative reasons", },
521 { 4, "Appropriate facilities unavailable (temporary condition)", },
522 { 5, "Appropriate facilities unavailable (permanent condition)", },
523 { 6, "Invalid destination", },
524 { 7, "Call failed due to no carrier detected", },
525 { 8, "Call failed due to detection of a busy signal", },
526 { 9, "Call failed due to lack of a dial tone", },
527 { 10, "Call was not established within time allotted by LAC", },
528 { 11, "Call was connected but no appropriate framing was detected", },
529 { 12, "Disconnecting call due to mismatching SDS value", },
530 { 13, "Session not established due to losing tie breaker", },
531 { 14, "Session not established due to unsupported PW type", },
532 { 15, "Session not established, sequencing required without valid L2-Specific Sublayer", },
533 { 16, "Finite state machine error or timeout", },
534 { 17, "FR PVC was deleted permanently (no longer provisioned) ", }, /* [RFC4591] */
535 { 18, "FR PVC has been INACTIVE for an extended period of time", }, /* [RFC4591] */
536 { 19, "Mismatched FR Header Length", }, /* [RFC4591] */
537 { 20, "HDLC Link was deleted permanently (no longer provisioned)", }, /* [RFC4349] */
538 { 21, "HDLC Link has been INACTIVE for an extended period of time", }, /* [RFC4349] */
539 { 22, "Session not established due to other LCCE can not support the OAM Cell Emulation", }, /* [RFC4454] */
540 { 23, "Mismatching interface MTU", }, /* [RFC4667] */
541 { 24, "Attempt to connect to non-existent forwarder", }, /* [RFC4667] */
542 { 25, "Attempt to connect to unauthorized forwarder", }, /* [RFC4667] */
543 { 26, "Loop Detected", }, /* [draft-ietf-l2tpext-tunnel-switching-06.txt] */
544 { 27, "Attachment Circuit bound to different PE", }, /* [RFC6074] */
545 { 28, "Attachment Circuit bound to different remote Attachment Circuit", }, /* [RFC6074] */
546 { 29, "Unassigned", },
547 { 30, "Return code to indicate connection was refused because of TDM PW parameters. The error code indicates the problem.", }, /* [RFC5611] */
548 { 31, "Sequencing not supported", }, /* [RFC6073] */
551 static value_string_ext result_code_cdn_vals_ext = VALUE_STRING_EXT_INIT(result_code_cdn_vals);
554 static const value_string error_code_vals[] = {
555 { 0, "No General Error", },
556 { 1, "No control connection exists yet for this pair of LCCEs", },
557 { 2, "Length is wrong", },
558 { 3, "One of the field values was out of range", },
559 { 4, "Insufficient resources to handle this operation now", },
560 { 5, "Invalid Session ID", },
561 { 6, "A generic vendor-specific error occurred", },
562 { 7, "Try another", },
563 { 8, "Receipt of an unknown AVP with the M bit set", },
564 { 9, "Try another directed", },
565 { 10, "Next hop unreachable", },
566 { 11, "Next hop busy", },
571 #define CONTROL_MESSAGE 0
572 #define RESULT_ERROR_CODE 1
573 #define PROTOCOL_VERSION 2
574 #define FRAMING_CAPABILITIES 3
575 #define BEARER_CAPABILITIES 4
576 #define TIE_BREAKER 5
577 #define FIRMWARE_REVISION 6
579 #define VENDOR_NAME 8
580 #define ASSIGNED_TUNNEL_ID 9
581 #define RECEIVE_WINDOW_SIZE 10
583 #define CAUSE_CODE 12
584 #define CHALLENGE_RESPONSE 13
585 #define ASSIGNED_SESSION 14
586 #define CALL_SERIAL_NUMBER 15
587 #define MINIMUM_BPS 16
588 #define MAXIMUM_BPS 17
589 #define BEARER_TYPE 18
590 #define FRAMING_TYPE 19
591 #define CALLED_NUMBER 21
592 #define CALLING_NUMBER 22
593 #define SUB_ADDRESS 23
594 #define TX_CONNECT_SPEED 24
595 #define PHYSICAL_CHANNEL 25
596 #define INITIAL_RECEIVED_LCP_CONFREQ 26
597 #define LAST_SENT_LCP_CONFREQ 27
598 #define LAST_RECEIVED_LCP_CONFREQ 28
599 #define PROXY_AUTHEN_TYPE 29
600 #define PROXY_AUTHEN_NAME 30
601 #define PROXY_AUTHEN_CHALLENGE 31
602 #define PROXY_AUTHEN_ID 32
603 #define PROXY_AUTHEN_RESPONSE 33
604 #define CALL_STATUS_AVPS 34
606 #define RANDOM_VECTOR 36
607 #define PRIVATE_GROUP_ID 37
608 #define RX_CONNECT_SPEED 38
609 #define SEQUENCING_REQUIRED 39
610 #define PPP_DISCONNECT_CAUSE_CODE 46 /* RFC 3145 */
611 #define EXTENDED_VENDOR_ID 58
612 #define MESSAGE_DIGEST 59
614 #define ASSIGNED_CONTROL_CONN_ID 61
615 #define PW_CAPABILITY_LIST 62
616 #define LOCAL_SESSION_ID 63
617 #define REMOTE_SESSION_ID 64
618 #define ASSIGNED_COOKIE 65
619 #define REMOTE_END_ID 66
621 #define L2_SPECIFIC_SUBLAYER 69
622 #define DATA_SEQUENCING 70
623 #define CIRCUIT_STATUS 71
624 #define PREFERRED_LANGUAGE 72
625 #define CTL_MSG_AUTH_NONCE 73
626 #define TX_CONNECT_SPEED_V3 74
627 #define RX_CONNECT_SPEED_V3 75
628 #define CONNECT_SPEED_UPDATE 97
630 /* http://www.iana.org/assignments/l2tp-parameters/l2tp-parameters.xhtml */
631 #define NUM_AVP_TYPES 102
632 static const value_string avp_type_vals[] = {
633 { CONTROL_MESSAGE, "Control Message" },
634 { RESULT_ERROR_CODE, "Result-Error Code" },
635 { PROTOCOL_VERSION, "Protocol Version" },
636 { FRAMING_CAPABILITIES, "Framing Capabilities" },
637 { BEARER_CAPABILITIES, "Bearer Capabilities" },
638 { TIE_BREAKER, "Tie Breaker" },
639 { FIRMWARE_REVISION, "Firmware Revision" },
640 { HOST_NAME, "Host Name" },
641 { VENDOR_NAME, "Vendor Name" },
642 { ASSIGNED_TUNNEL_ID, "Assigned Tunnel ID" },
643 { RECEIVE_WINDOW_SIZE, "Receive Window Size" },
644 { CHALLENGE, "Challenge" },
645 { CAUSE_CODE, "Cause Code" },
646 { CHALLENGE_RESPONSE, "Challenge Response" },
647 { ASSIGNED_SESSION, "Assigned Session" },
648 { CALL_SERIAL_NUMBER, "Call Serial Number" },
649 { MINIMUM_BPS, "Minimum BPS" },
650 { MAXIMUM_BPS, "Maximum BPS" },
651 { BEARER_TYPE, "Bearer Type" },
652 { FRAMING_TYPE, "Framing Type" },
654 { CALLED_NUMBER, "Called Number" },
655 { CALLING_NUMBER, "Calling Number" },
656 { SUB_ADDRESS, "Sub-Address" },
657 { TX_CONNECT_SPEED, "Connect Speed" },
658 { PHYSICAL_CHANNEL, "Physical Channel" },
659 { INITIAL_RECEIVED_LCP_CONFREQ, "Initial Received LCP CONFREQ" },
660 { LAST_SENT_LCP_CONFREQ, "Last Sent LCP CONFREQ" },
661 { LAST_RECEIVED_LCP_CONFREQ, "Last Received LCP CONFREQ" },
662 { PROXY_AUTHEN_TYPE, "Proxy Authen Type" },
663 { PROXY_AUTHEN_NAME, "Proxy Authen Name" },
664 { PROXY_AUTHEN_CHALLENGE, "Proxy Authen Challenge" },
665 { PROXY_AUTHEN_ID, "Proxy Authen ID" },
666 { PROXY_AUTHEN_RESPONSE, "Proxy Authen Response" },
667 { CALL_STATUS_AVPS, "Call status AVPs" },
669 { RANDOM_VECTOR, "Random Vector" },
670 { PRIVATE_GROUP_ID, "Private group ID" },
671 { RX_CONNECT_SPEED, "RxConnect Speed" },
672 { SEQUENCING_REQUIRED, "Sequencing Required" },
673 { PPP_DISCONNECT_CAUSE_CODE, "PPP Disconnect Cause Code" },
674 { EXTENDED_VENDOR_ID, "Extended Vendor ID" },
675 { MESSAGE_DIGEST, "Message Digest" },
676 { ROUTER_ID, "Router ID" },
677 { ASSIGNED_CONTROL_CONN_ID, "Assigned Control Connection ID" },
678 { PW_CAPABILITY_LIST, "Pseudowire Capability List" },
679 { LOCAL_SESSION_ID, "Local Session ID" },
680 { REMOTE_SESSION_ID, "Remote Session ID" },
681 { ASSIGNED_COOKIE, "Assigned Cookie" },
682 { REMOTE_END_ID, "Remote End ID" },
683 { PW_TYPE, "Pseudowire Type" },
684 { L2_SPECIFIC_SUBLAYER, "Layer2 Specific Sublayer" },
685 { DATA_SEQUENCING, "Data Sequencing" },
686 { CIRCUIT_STATUS, "Circuit Status" },
687 { PREFERRED_LANGUAGE, "Preferred Language" },
688 { CTL_MSG_AUTH_NONCE, "Control Message Authentication Nonce" },
689 { TX_CONNECT_SPEED_V3, "Tx Connect Speed Version 3" },
690 { RX_CONNECT_SPEED_V3, "Rx Connect Speed Version 3" },
691 { 76, "Failover Capability" }, /*[RFC4951] */
692 { 77, "Tunnel Recovery" }, /*[RFC4951] */
693 { 78, "Suggested Control Sequence" }, /*[RFC4951] */
694 { 79, "Failover Session State" }, /*[RFC4951] */
695 { 80, "Multicast Capability" }, /*[RFC4045] */
696 { 81, "New Outgoing Sessions" }, /*[RFC4045] */
697 { 82, "New Outgoing Sessions Acknowledgement" }, /*[RFC4045] */
698 { 83, "Withdraw Outgoing Sessions" }, /*[RFC4045] */
699 { 84, "Multicast Packets Priority" }, /*[RFC4045] */
700 { 85, "Frame-Relay Header Length" }, /*[RFC4591] */
701 { 86, "ATM Maximum Concatenated Cells" }, /*[RFC4454] */
702 { 87, "OAM Emulation Required" }, /*[RFC4454] */
703 { 88, "ATM Alarm Status" }, /*[RFC4454] */
704 /* Also, see ATM Alarm Status AVP Values below */
705 { 89, "Attachment Group Identifier" }, /*[RFC4667] */
706 { 90, "Local End Identifier" }, /*[RFC4667] */
707 { 91, "Interface Maximum Transmission Unit" }, /*[RFC4667] */
708 { 92, "FCS Retention" }, /*[RFC4720] */
709 { 93, "Tunnel Switching Aggregator ID" }, /*[draft-ietf-l2tpext-tunnel-switching-06.txt] */
710 { 94, "Maximum Receive Unit (MRU)" }, /*[RFC4623] */
711 { 95, "Maximum Reassembled Receive Unit (MRRU)" }, /*[RFC4623] */
712 { 96, "VCCV Capability" }, /*[RFC5085] */
713 { CONNECT_SPEED_UPDATE, "Connect Speed Update" }, /*[RFC5515] */
714 { 98, "Connect Speed Update Enable" }, /*[RFC5515] */
715 { 99, "TDM Pseudowire" }, /*[RFC5611] */
716 { 100, "RTP AVP" }, /*[RFC5611] */
717 { 101, "PW Switching Point" }, /*[RFC6073] */
721 static value_string_ext avp_type_vals_ext = VALUE_STRING_EXT_INIT(avp_type_vals);
724 #define CISCO_ASSIGNED_CONNECTION_ID 1
725 #define CISCO_PW_CAPABILITY_LIST 2
726 #define CISCO_LOCAL_SESSION_ID 3
727 #define CISCO_REMOTE_SESSION_ID 4
728 #define CISCO_ASSIGNED_COOKIE 5
729 #define CISCO_REMOTE_END_ID 6
730 #define CISCO_PW_TYPE 7
731 #define CISCO_CIRCUIT_STATUS 8
732 #define CISCO_SESSION_TIE_BREAKER 9
733 #define CISCO_DRAFT_AVP_VERSION 10
734 #define CISCO_MESSAGE_DIGEST 12
735 #define CISCO_AUTH_NONCE 13
736 #define CISCO_INTERFACE_MTU 14
738 static const value_string cisco_avp_type_vals[] = {
739 { CISCO_ACK, "Cisco ACK" },
740 { CISCO_ASSIGNED_CONNECTION_ID, "Assigned Connection ID" },
741 { CISCO_PW_CAPABILITY_LIST, "Pseudowire Capabilities List" },
742 { CISCO_LOCAL_SESSION_ID, "Local Session ID" },
743 { CISCO_REMOTE_SESSION_ID, "Remote Session ID" },
744 { CISCO_ASSIGNED_COOKIE, "Assigned Cookie" },
745 { CISCO_REMOTE_END_ID, "Remote End ID" },
746 { CISCO_PW_TYPE, "Pseudowire Type" },
747 { CISCO_CIRCUIT_STATUS, "Circuit Status" },
748 { CISCO_SESSION_TIE_BREAKER, "Session Tie Breaker" },
749 { CISCO_DRAFT_AVP_VERSION, "Draft AVP Version" },
750 { CISCO_MESSAGE_DIGEST, "Message Digest" },
751 { CISCO_AUTH_NONCE, "Control Message Authentication Nonce" },
752 { CISCO_INTERFACE_MTU, "Interface MTU" },
756 #define ERICSSON_MSG_TYPE 0
757 #define ERICSSON_TRANSPORT_CONFIG 1
758 #define ERICSSON_PACKET_LOSS 2
759 #define ERICSSON_PROTO_VERSION 3
760 #define ERICSSON_CONN_TYPE 4
761 #define ERICSSON_CRC_ENABLED 5
762 #define ERICSSON_STN_NAME 6
763 #define ERICSSON_ABIS_LOWER_MODE 7
764 #define ERICSSON_TEI_TO_SC_MAP 8
765 #define ERICSSON_CHAN_STATUS_LIST 9
766 #define ERICSSON_EXT_PROTO_VERSION 10
767 #define ERICSSON_CHAN_STATUS_LIST2 11
769 static const value_string ericsson_avp_type_vals[] = {
770 { ERICSSON_MSG_TYPE, "Message Type" },
771 { ERICSSON_TRANSPORT_CONFIG, "Transport Configuration" },
772 { ERICSSON_PACKET_LOSS, "Packet Loss" },
773 { ERICSSON_PROTO_VERSION, "Protocol Version" },
774 { ERICSSON_CONN_TYPE, "Connection Type" },
775 { ERICSSON_STN_NAME, "STN Name" },
776 { ERICSSON_CRC_ENABLED, "CRC32 Enabled" },
777 { ERICSSON_ABIS_LOWER_MODE, "Abis Lower Mode" },
778 { ERICSSON_TEI_TO_SC_MAP, "TEI to SC Map" },
779 { ERICSSON_CHAN_STATUS_LIST, "Channel Status List" },
780 { ERICSSON_EXT_PROTO_VERSION, "Extended Protoocl Version" },
781 { ERICSSON_CHAN_STATUS_LIST2, "Channel Status List 2" },
785 static const value_string ericsson_msg_type_vals[] = {
786 { 0, "Transport Configuration Notification" },
787 { 1, "Performance Notification" },
788 { 2, "Transport Configuration Request" },
789 { 3, "Transport Configuration Response" },
790 { 4, "Abis Lower Transport Config Request" },
791 { 5, "Abis Lower Transport Config Response" },
792 { 6, "Local Connect Channel Status Notification" },
796 static const value_string ericsson_short_msg_type_vals[] = {
807 static const value_string ericsson_conn_type_vals[] = {
813 static const value_string ericsson_abis_lower_mode_vals[] = {
814 { 0, "Single Timeslot" },
815 { 1, "Super Channel" },
819 #define BROADBAND_AGENT_CIRCUIT_ID 1
820 #define BROADBAND_AGENT_REMOTE_ID 2
821 #define BROADBAND_ACTUAL_DR_UP 129
822 #define BROADBAND_ACTUAL_DR_DOWN 130
823 #define BROADBAND_MINIMUM_DR_UP 131
824 #define BROADBAND_MINIMUM_DR_DOWN 132
825 #define BROADBAND_ATTAINABLE_DR_UP 133
826 #define BROADBAND_ATTAINABLE_DR_DOWN 134
827 #define BROADBAND_MAXIMUM_DR_UP 135
828 #define BROADBAND_MAXIMUM_DR_DOWN 136
829 #define BROADBAND_MINIMUM_DR_UP_LOW_POWER 137
830 #define BROADBAND_MINIMUM_DR_DOWN_LOW_POWER 138
831 #define BROADBAND_MAXIMUM_INTERLEAVING_DELAY_UP 139
832 #define BROADBAND_ACTUAL_INTERLEAVING_DELAY_UP 140
833 #define BROADBAND_MAXIMUM_INTERLEAVING_DELAY_DOWN 141
834 #define BROADBAND_ACTUAL_INTERLEAVING_DELAY_DOWN 142
835 #define BROADBAND_ACCESS_LOOP_ENCAPSULATION 144
836 #define BROADBAND_ANCP_ACCESS_LINE_TYPE 145
837 #define BROADBAND_IWF_SESSION 254
839 static const value_string broadband_avp_type_vals[] = {
840 { BROADBAND_AGENT_CIRCUIT_ID, "Agent-Circuit-Id" },
841 { BROADBAND_AGENT_REMOTE_ID, "Agent-Remote-Id" },
842 { BROADBAND_ACTUAL_DR_UP, "Actual-Data-Rate-Upstream" },
843 { BROADBAND_ACTUAL_DR_DOWN, "Actual-Data-Rate-Downstream" },
844 { BROADBAND_MINIMUM_DR_UP, "Minimum-Data-Rate-Upstream" },
845 { BROADBAND_MINIMUM_DR_DOWN, "Minimum-Data-Rate-Downstream" },
846 { BROADBAND_ATTAINABLE_DR_UP, "Attainable-Data-Rate-Upstream" },
847 { BROADBAND_ATTAINABLE_DR_DOWN, "Attainable-Data-Rate-Downstream" },
848 { BROADBAND_MAXIMUM_DR_UP, "Maximum-Data-Rate-Upstream" },
849 { BROADBAND_MAXIMUM_DR_DOWN, "Maximum-Data-Rate-Downstream" },
850 { BROADBAND_MINIMUM_DR_UP_LOW_POWER, "Minimum-Data-Rate-Upstream-Low-Power" },
851 { BROADBAND_MINIMUM_DR_DOWN_LOW_POWER, "Minimum-Data-Rate-Downstream-Low-Power" },
852 { BROADBAND_MAXIMUM_INTERLEAVING_DELAY_UP, "Maximum-Interleaving-Delay-Upstream" },
853 { BROADBAND_ACTUAL_INTERLEAVING_DELAY_UP, "Actual-Interleaving-Delay-Upstream" },
854 { BROADBAND_MAXIMUM_INTERLEAVING_DELAY_DOWN, "Maximum-Interleaving-Delay-Downstream" },
855 { BROADBAND_ACTUAL_INTERLEAVING_DELAY_DOWN, "Actual-Interleaving-Delay-Downstream" },
856 { BROADBAND_ACCESS_LOOP_ENCAPSULATION, "Access-Loop-Encapsulation" },
857 { BROADBAND_ANCP_ACCESS_LINE_TYPE, "ANCP Access Line Type" },
858 { BROADBAND_IWF_SESSION, "IWF-Session" },
862 static const value_string cablelabs_avp_type_vals[] = {
863 /* 7.5.2 DEPI Specific AVPs */
865 { 1, "DEPI Result Code" },
866 { 2, "DEPI Resource Allocation Request" },
867 { 3, "DEPI Resource Allocation Reply" },
868 { 4, "DEPI Local MTU" },
869 { 5, "DOCSIS SYNC Control" },
870 { 6, "EQAM Capability Bits" },
871 { 7, "DEPI Remote MTU" },
872 { 8, "DEPI Local UDP Port" },
873 { 9, "DPR Session Type" },
874 { 10, "DPR Session Status" },
875 /* 7.5.3 QAM Channel PHY AVPs */
876 { 100, "Downstream QAM Channel TSID Group" },
877 { 101, "Downstream QAM Channel Frequency" },
878 { 102, "Downstream QAM Channel Power" },
879 { 103, "Downstream QAM Channel Modulation" },
880 { 104, "Downstream QAM Channel J.83 Annex" },
881 { 105, "Downstream QAM Channel Symbol Rate" },
882 { 106, "Downstream QAM Channel Interleave Depth" },
883 { 107, "Downstream QAM Channel RF Block Muting53" },
884 /* 7.5.4 DEPI Redundancy Capabilities AVPs */
885 { 200, "DEPI Redundancy Capabilities" },
889 static const value_string l2tp_cablel_modulation_vals[] = {
895 static const value_string pw_types_vals[] = {
896 { 0x0001, "Frame Relay DLCI" },
897 { 0x0002, "ATM AAL5 SDU VCC transport" },
898 { 0x0003, "ATM Cell transparent Port Mode" },
899 { 0x0004, "Ethernet VLAN" },
900 { 0x0005, "Ethernet" },
903 { 0x0009, "ATM Cell transport VCC Mode" },
904 { 0x000A, "ATM Cell transport VPC Mode" },
905 { 0x000B, "IP Transport" },
906 { 0x000C, "MPEG-TS Payload Type (MPTPW)" },
907 { 0x000D, "Packet Streaming Protocol (PSPPW)" },
908 /* 0x000E-0x0010 Unassigned */
909 { 0x0011, "Structure-agnostic E1 circuit" }, /* [RFC5611] */
910 { 0x0012, "Structure-agnostic T1 (DS1) circuit" }, /* [RFC5611] */
911 { 0x0013, "Structure-agnostic E3 circuit" }, /* [RFC5611] */
912 { 0x0014, "Structure-agnostic T3 (DS3) circuit" }, /* [RFC5611] */
913 { 0x0015, "CESoPSN basic mode" }, /* [RFC5611] */
914 { 0x0016, "Unassigned" },
915 { 0x0017, "CESoPSN TDM with CAS" }, /* [RFC5611] */
920 static const value_string ale_datalink_types_vals[] = {
921 { 0x00, "ATM AAL5" },
922 { 0x01, "Ethernet" },
926 static const value_string ale_enc1_types_vals[] = {
927 { 0x00, "NA - Not Available" },
928 { 0x01, "Untagged Ethernet" },
929 { 0x02, "Single-Tagged Ethernet" },
933 static const value_string ale_enc2_types_vals[] = {
934 { 0x00, "NA - Not Available" },
935 { 0x01, "PPPoA LLC" },
936 { 0x02, "PPPoA Null" },
937 { 0x03, "IP over ATM (IPoA) LLC" },
938 { 0x04, "IPoA Null" },
939 { 0x05, "Ethernet over AAL5 LLC with Frame Check Sequence (FCS)" },
940 { 0x06, "Ethernet over AAL5 LLC without FCS" },
941 { 0x07, "Ethernet over AAL5 Null with FCS" },
942 { 0x08, "Ethernet over AAL5 Null without FCS" },
946 static const value_string ancp_types_vals[] = {
957 static const value_string iwf_types_vals[] = {
958 { 0x00, "IWF not performed" },
959 { 0x01, "IWF performed" },
963 static const val64_string unique_indeterminable_or_no_link[] = {
964 { 0, "indeterminable or no physical p2p link" },
968 static const true_false_string tfs_new_existing = { "New", "Existing" };
970 static dissector_handle_t ppp_hdlc_handle;
971 static dissector_handle_t ppp_lcp_options_handle;
973 static dissector_handle_t atm_oam_handle;
974 static dissector_handle_t llc_handle;
976 static dissector_handle_t l2tp_udp_handle;
977 static dissector_handle_t l2tp_ip_handle;
979 #define L2TP_HMAC_MD5 0
980 #define L2TP_HMAC_SHA1 1
982 typedef struct l2tpv3_conversation {
988 struct l2tpv3_tunnel *tunnel;
989 } l2tpv3_conversation_t;
991 typedef struct l2tpv3_tunnel {
992 l2tpv3_conversation_t *conv;
997 gint lcce1_nonce_len;
1001 guint8 *lcce2_nonce;
1002 gint lcce2_nonce_len;
1004 gchar *shared_key_secret;
1005 guint8 shared_key[HASH_MD5_LENGTH];
1010 typedef struct lcce_settings {
1016 typedef struct l2tpv3_session {
1017 lcce_settings_t lcce1;
1018 lcce_settings_t lcce2;
1023 static const gchar* shared_secret = "";
1025 static GSList *list_heads = NULL;
1027 static void update_shared_key(l2tpv3_tunnel_t *tunnel)
1029 const gchar *secret = "";
1031 /* There is at least one nonce in the packet, so we can do authentication,
1032 otherwise it's just a plain digest without nonces. */
1033 if (tunnel->lcce1_nonce != NULL || tunnel->lcce2_nonce != NULL) {
1034 secret = shared_secret;
1037 /* If there's no shared key in the conversation context, or the secret has been changed */
1038 if (tunnel->shared_key_secret == NULL || strcmp(secret, tunnel->shared_key_secret) != 0) {
1039 /* For secret specification, see RFC 3931 pg 37 */
1041 if (ws_hmac_buffer(GCRY_MD_MD5, tunnel->shared_key, &data, 1, secret, strlen(secret))) {
1044 tunnel->shared_key_secret = wmem_strdup(wmem_file_scope(), secret);
1048 static void md5_hmac_digest(l2tpv3_tunnel_t *tunnel,
1057 guint8 zero[HASH_MD5_LENGTH] = { 0 };
1058 gcry_md_hd_t hmac_handle;
1062 if (tunnel->conv->pt == PT_NONE) /* IP encapsulated L2TPv3 */
1065 if (gcry_md_open(&hmac_handle, GCRY_MD_MD5, GCRY_MD_FLAG_HMAC)) {
1068 if (gcry_md_setkey(hmac_handle, tunnel->shared_key, HASH_MD5_LENGTH)) {
1069 gcry_md_close(hmac_handle);
1073 if (msg_type != MESSAGE_TYPE_SCCRQ) {
1074 if (tunnel->lcce1_nonce != NULL && tunnel->lcce2_nonce != NULL) {
1075 if (addresses_equal(&tunnel->lcce1, &pinfo->src)) {
1076 gcry_md_write(hmac_handle, tunnel->lcce1_nonce, tunnel->lcce1_nonce_len);
1077 gcry_md_write(hmac_handle, tunnel->lcce2_nonce, tunnel->lcce2_nonce_len);
1079 gcry_md_write(hmac_handle, tunnel->lcce2_nonce, tunnel->lcce2_nonce_len);
1080 gcry_md_write(hmac_handle, tunnel->lcce1_nonce, tunnel->lcce1_nonce_len);
1085 gcry_md_write(hmac_handle, tvb_get_ptr(tvb, offset, idx + 1 - offset), idx + 1 - offset);
1086 /* Message digest is calculated with an empty message digest field */
1087 gcry_md_write(hmac_handle, zero, avp_len - 1);
1088 remainder = length - (idx + avp_len);
1089 gcry_md_write(hmac_handle, tvb_get_ptr(tvb, idx + avp_len, remainder), remainder);
1090 memcpy(digest, gcry_md_read(hmac_handle, 0), HASH_MD5_LENGTH);
1091 gcry_md_close(hmac_handle);
1094 static void sha1_hmac_digest(l2tpv3_tunnel_t *tunnel,
1103 guint8 zero[HASH_SHA1_LENGTH] = { 0 };
1104 gcry_md_hd_t hmac_handle;
1108 if (tunnel->conv->pt == PT_NONE) /* IP encapsulated L2TPv3 */
1111 if (gcry_md_open(&hmac_handle, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC)) {
1114 if (gcry_md_setkey(hmac_handle, tunnel->shared_key, HASH_MD5_LENGTH)) {
1115 gcry_md_close(hmac_handle);
1119 if (msg_type != MESSAGE_TYPE_SCCRQ) {
1120 if (tunnel->lcce1_nonce != NULL && tunnel->lcce2_nonce != NULL) {
1121 if (addresses_equal(&tunnel->lcce1, &pinfo->src)) {
1122 gcry_md_write(hmac_handle, tunnel->lcce1_nonce, tunnel->lcce1_nonce_len);
1123 gcry_md_write(hmac_handle, tunnel->lcce2_nonce, tunnel->lcce2_nonce_len);
1125 gcry_md_write(hmac_handle, tunnel->lcce2_nonce, tunnel->lcce2_nonce_len);
1126 gcry_md_write(hmac_handle, tunnel->lcce1_nonce, tunnel->lcce1_nonce_len);
1131 gcry_md_write(hmac_handle, tvb_get_ptr(tvb, offset, idx + 1 - offset), idx + 1 - offset);
1132 /* Message digest is calculated with an empty message digest field */
1133 gcry_md_write(hmac_handle, zero, avp_len - 1);
1134 remainder = length - (idx + avp_len);
1135 gcry_md_write(hmac_handle, tvb_get_ptr(tvb, idx + avp_len, remainder), remainder);
1136 memcpy(digest, gcry_md_read(hmac_handle, 0), HASH_SHA1_LENGTH);
1137 gcry_md_close(hmac_handle);
1140 static int check_control_digest(l2tpv3_tunnel_t *tunnel,
1148 guint8 digest[HASH_SHA1_LENGTH];
1153 update_shared_key(tunnel);
1155 switch (tvb_get_guint8(tvb, idx)) {
1157 if ((avp_len - 1) != HASH_MD5_LENGTH)
1159 md5_hmac_digest(tunnel, tvb, length, idx, avp_len, msg_type, pinfo, digest);
1161 case L2TP_HMAC_SHA1:
1162 if ((avp_len - 1) != HASH_SHA1_LENGTH)
1164 sha1_hmac_digest(tunnel, tvb, length, idx, avp_len, msg_type, pinfo, digest);
1171 return tvb_memeql(tvb, idx + 1, digest, avp_len - 1);
1174 static void store_cma_nonce(l2tpv3_tunnel_t *tunnel,
1180 guint8 *nonce = NULL;
1186 case MESSAGE_TYPE_SCCRQ:
1187 if (!tunnel->lcce1_nonce) {
1188 tunnel->lcce1_nonce = (guint8 *)wmem_alloc(wmem_file_scope(), length);
1189 tunnel->lcce1_nonce_len = length;
1190 nonce = tunnel->lcce1_nonce;
1193 case MESSAGE_TYPE_SCCRP:
1194 if (!tunnel->lcce2_nonce) {
1195 tunnel->lcce2_nonce = (guint8 *)wmem_alloc(wmem_file_scope(), length);
1196 tunnel->lcce2_nonce_len = length;
1197 nonce = tunnel->lcce2_nonce;
1205 tvb_memcpy(tvb, (void *)nonce, offset, length);
1210 static void store_ccid(l2tpv3_tunnel_t *tunnel,
1219 case MESSAGE_TYPE_SCCRQ:
1220 tunnel->lcce1_id = tvb_get_ntohl(tvb, offset);
1222 case MESSAGE_TYPE_SCCRP:
1223 tunnel->lcce2_id = tvb_get_ntohl(tvb, offset);
1232 static l2tpv3_session_t *find_session(l2tpv3_tunnel_t *tunnel,
1236 l2tpv3_session_t *session = NULL;
1239 iterator = tunnel->sessions;
1241 session = (l2tpv3_session_t *)iterator->data;
1243 if ((session->lcce1.id == lcce1_id) ||
1244 (session->lcce2.id == lcce2_id)) {
1248 iterator = g_slist_next(iterator);
1254 static void init_session(l2tpv3_session_t *session)
1256 session->lcce1.cookie_len = session->lcce2.cookie_len = -1;
1257 session->lcce1.l2_specific = session->lcce2.l2_specific = -1;
1258 session->pw_type = -1;
1261 static l2tpv3_session_t *alloc_session(void)
1263 l2tpv3_session_t *session = wmem_new0(wmem_packet_scope(), l2tpv3_session_t);
1264 init_session(session);
1269 static l2tpv3_session_t *store_lsession_id(l2tpv3_session_t *_session,
1274 l2tpv3_session_t *session = _session;
1277 case MESSAGE_TYPE_ICRQ:
1278 case MESSAGE_TYPE_OCRQ:
1279 case MESSAGE_TYPE_ICRP:
1280 case MESSAGE_TYPE_OCRP:
1286 if (session == NULL)
1287 session = alloc_session();
1290 case MESSAGE_TYPE_ICRQ:
1291 case MESSAGE_TYPE_OCRQ:
1292 session->lcce1.id = tvb_get_ntohl(tvb, offset);
1294 case MESSAGE_TYPE_ICRP:
1295 case MESSAGE_TYPE_OCRP:
1296 session->lcce2.id = tvb_get_ntohl(tvb, offset);
1303 static l2tpv3_session_t *store_rsession_id(l2tpv3_session_t *_session,
1308 l2tpv3_session_t *session = _session;
1311 case MESSAGE_TYPE_ICRP:
1312 case MESSAGE_TYPE_OCRP:
1318 if (session == NULL)
1319 session = alloc_session();
1321 session->lcce1.id = tvb_get_ntohl(tvb, offset);
1326 static l2tpv3_session_t *store_cookie_len(l2tpv3_session_t *_session,
1330 l2tpv3_session_t *session = _session;
1333 case MESSAGE_TYPE_ICRQ:
1334 case MESSAGE_TYPE_OCRQ:
1335 case MESSAGE_TYPE_ICRP:
1336 case MESSAGE_TYPE_OCRP:
1342 if (session == NULL)
1343 session = alloc_session();
1346 case MESSAGE_TYPE_ICRQ:
1347 case MESSAGE_TYPE_OCRQ:
1348 session->lcce1.cookie_len = len;
1350 case MESSAGE_TYPE_ICRP:
1351 case MESSAGE_TYPE_OCRP:
1352 session->lcce2.cookie_len = len;
1359 static l2tpv3_session_t *store_pw_type(l2tpv3_session_t *_session,
1364 l2tpv3_session_t *session = _session;
1369 case MESSAGE_TYPE_ICRQ:
1370 case MESSAGE_TYPE_OCRQ:
1376 if (session == NULL)
1377 session = alloc_session();
1379 pw_type = tvb_get_ntohs(tvb, offset);
1382 result = L2TPv3_PROTOCOL_PPP; break;
1384 result = L2TPv3_PROTOCOL_ETH; break;
1386 result = L2TPv3_PROTOCOL_CHDLC; break;
1388 result = L2TPv3_PROTOCOL_AAL5; break;
1390 result = L2TPv3_PROTOCOL_FR; break;
1395 session->pw_type = result;
1400 static l2tpv3_session_t *store_l2_sublayer(l2tpv3_session_t *_session,
1405 l2tpv3_session_t *session = _session;
1406 gint result = l2tpv3_l2_specific;
1407 guint16 l2_sublayer;
1410 case MESSAGE_TYPE_ICRQ:
1411 case MESSAGE_TYPE_OCRQ:
1412 case MESSAGE_TYPE_ICCN:
1413 case MESSAGE_TYPE_OCCN:
1414 case MESSAGE_TYPE_ICRP:
1415 case MESSAGE_TYPE_OCRP:
1421 if (session == NULL)
1422 session = alloc_session();
1424 l2_sublayer = tvb_get_ntohs(tvb, offset);
1425 switch (l2_sublayer) {
1427 result = L2TPv3_L2_SPECIFIC_NONE; break;
1429 result = L2TPv3_L2_SPECIFIC_DEFAULT; break;
1431 result = L2TPv3_L2_SPECIFIC_ATM; break;
1433 result = L2TPv3_L2_SPECIFIC_DOCSIS_DMPT; break;
1439 case MESSAGE_TYPE_ICRQ:
1440 case MESSAGE_TYPE_OCRQ:
1441 case MESSAGE_TYPE_ICCN:
1442 case MESSAGE_TYPE_OCCN:
1443 session->lcce1.l2_specific = result;
1445 case MESSAGE_TYPE_ICRP:
1446 case MESSAGE_TYPE_OCRP:
1447 session->lcce2.l2_specific = result;
1454 static void update_session(l2tpv3_tunnel_t *tunnel, l2tpv3_session_t *session)
1456 l2tpv3_session_t *existing = NULL;
1458 if (tunnel == NULL || session == NULL)
1461 if (session->lcce1.id == 0 && session->lcce2.id == 0)
1464 existing = find_session(tunnel, session->lcce1.id, session->lcce2.id);
1466 existing = wmem_new0(wmem_file_scope(), l2tpv3_session_t);
1467 init_session(existing);
1470 if (session->lcce1.id != 0)
1471 existing->lcce1.id = session->lcce1.id;
1473 if (session->lcce2.id != 0)
1474 existing->lcce2.id = session->lcce2.id;
1476 if (session->lcce1.cookie_len != -1)
1477 existing->lcce1.cookie_len = session->lcce1.cookie_len;
1479 if (session->lcce2.cookie_len != -1)
1480 existing->lcce2.cookie_len = session->lcce2.cookie_len;
1482 if (session->lcce1.l2_specific != -1)
1483 existing->lcce1.l2_specific = session->lcce1.l2_specific;
1485 if (session->lcce2.l2_specific != -1)
1486 existing->lcce2.l2_specific = session->lcce2.l2_specific;
1488 if (session->pw_type != -1)
1489 existing->pw_type = session->pw_type;
1491 if (tunnel->sessions == NULL) {
1492 tunnel->sessions = g_slist_append(tunnel->sessions, existing);
1493 list_heads = g_slist_append(list_heads, tunnel->sessions);
1495 tunnel->sessions = g_slist_append(tunnel->sessions, existing);
1499 static void l2tp_prompt(packet_info *pinfo _U_, gchar* result)
1501 g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Decode L2TPv3 packet type 0x%04x as",
1502 GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_l2tp, 0)));
1505 static gpointer l2tp_value(packet_info *pinfo _U_)
1507 return p_get_proto_data(pinfo->pool, pinfo, proto_l2tp, 0);
1511 * Dissect CISCO AVP:s
1513 static int dissect_l2tp_cisco_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid) {
1517 guint32 avp_vendor_id;
1519 guint16 ver_len_hidden;
1520 proto_tree *l2tp_avp_tree, *l2tp_avp_tree_sub;
1522 ver_len_hidden = tvb_get_ntohs(tvb, offset);
1523 avp_len = AVP_LENGTH(ver_len_hidden);
1524 avp_vendor_id = tvb_get_ntohs(tvb, offset + 2);
1525 avp_type = tvb_get_ntohs(tvb, offset + 4);
1527 l2tp_avp_tree = proto_tree_add_subtree_format(tree, tvb, offset,
1528 avp_len, ett_l2tp_avp, NULL, "Vendor %s (%u): %s AVP",
1529 enterprises_lookup(avp_vendor_id, "Unknown"), avp_vendor_id,
1530 val_to_str(avp_type, cisco_avp_type_vals, "Unknown (%u)"));
1532 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN);
1533 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, offset, 2, ENC_BIG_ENDIAN);
1534 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1536 if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */
1544 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1548 proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_cisco_avp_type, tvb, offset, 2, avp_type);
1554 /* process_l2tpv3_control does not set COL_INFO for vendor messages */
1555 col_add_fstr(pinfo->cinfo, COL_INFO, "%s - Cisco ACK (tunnel id=%u)", control_msg, ccid);
1558 case CISCO_ASSIGNED_CONNECTION_ID:
1559 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_assigned_control_connection_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1562 case CISCO_PW_CAPABILITY_LIST:
1563 l2tp_avp_tree_sub = proto_tree_add_subtree(l2tp_avp_tree, tvb, offset, avp_len,
1564 ett_l2tp_avp_sub, NULL, "Pseudowire Capabilities List");
1565 while (avp_len >= 2) {
1566 proto_tree_add_item(l2tp_avp_tree_sub, hf_l2tp_cisco_pw_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1572 case CISCO_LOCAL_SESSION_ID:
1573 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_local_session_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1575 case CISCO_REMOTE_SESSION_ID:
1576 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_remote_session_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1578 case CISCO_ASSIGNED_COOKIE:
1579 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_assigned_cookie, tvb, offset, avp_len, ENC_NA);
1581 case CISCO_REMOTE_END_ID:
1582 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_remote_end_id, tvb, offset, avp_len, ENC_NA|ENC_ASCII);
1585 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_pseudowire_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1587 case CISCO_CIRCUIT_STATUS:
1588 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_circuit_status, tvb, offset, 2, ENC_BIG_ENDIAN);
1589 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_circuit_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1591 case CISCO_SESSION_TIE_BREAKER:
1592 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_tie_breaker,
1593 tvb, offset, 8, ENC_BIG_ENDIAN);
1595 case CISCO_DRAFT_AVP_VERSION:
1596 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_draft_avp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
1598 case CISCO_MESSAGE_DIGEST:
1599 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_message_digest, tvb, offset, avp_len, ENC_NA);
1601 case CISCO_AUTH_NONCE:
1602 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_nonce, tvb, offset, avp_len, ENC_NA);
1604 case CISCO_INTERFACE_MTU:
1605 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cisco_interface_mtu, tvb, offset, avp_len, ENC_BIG_ENDIAN);
1609 proto_tree_add_expert(l2tp_avp_tree, pinfo, &ei_l2tp_vendor_specific_avp_data, tvb, offset, avp_len);
1618 * Dissect Broadband Forums AVP:s
1620 static int dissect_l2tp_broadband_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
1624 guint32 avp_vendor_id;
1626 guint16 ver_len_hidden;
1627 proto_tree *l2tp_avp_tree, *l2tp_avp_ale_tree;
1630 ver_len_hidden = tvb_get_ntohs(tvb, offset);
1631 avp_len = AVP_LENGTH(ver_len_hidden);
1632 avp_vendor_id = tvb_get_ntohs(tvb, offset + 2);
1633 avp_type = tvb_get_ntohs(tvb, offset + 4);
1635 l2tp_avp_tree = proto_tree_add_subtree_format(tree, tvb, offset,
1636 avp_len, ett_l2tp_avp, NULL, "Vendor %s (%u): %s AVP",
1637 enterprises_lookup(avp_vendor_id, "Unknown"), avp_vendor_id,
1638 val_to_str(avp_type, broadband_avp_type_vals, "Unknown (%u)"));
1640 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN);
1641 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, offset, 2, ENC_BIG_ENDIAN);
1642 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1644 if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */
1652 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1656 proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_broadband_avp_type, tvb, offset, 2, avp_type);
1662 case BROADBAND_AGENT_CIRCUIT_ID:
1663 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_agent_circuit_id, tvb, offset, avp_len, ENC_UTF_8|ENC_NA);
1666 case BROADBAND_AGENT_REMOTE_ID:
1667 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_agent_remote_id, tvb, offset, avp_len, ENC_UTF_8|ENC_NA);
1670 case BROADBAND_ACTUAL_DR_UP:
1671 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_actual_dr_up, tvb, offset, 8, ENC_BIG_ENDIAN);
1674 case BROADBAND_ACTUAL_DR_DOWN:
1675 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_actual_dr_down, tvb, offset, 8, ENC_BIG_ENDIAN);
1678 case BROADBAND_MINIMUM_DR_UP:
1679 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_minimum_dr_up, tvb, offset, 8, ENC_BIG_ENDIAN);
1682 case BROADBAND_MINIMUM_DR_DOWN:
1683 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_minimum_dr_down, tvb, offset, 8, ENC_BIG_ENDIAN);
1686 case BROADBAND_ATTAINABLE_DR_UP:
1687 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_attainable_dr_up, tvb, offset, 8, ENC_BIG_ENDIAN);
1690 case BROADBAND_ATTAINABLE_DR_DOWN:
1691 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_attainable_dr_down, tvb, offset, 8, ENC_BIG_ENDIAN);
1694 case BROADBAND_MAXIMUM_DR_UP:
1695 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_maximum_dr_up, tvb, offset, 8, ENC_BIG_ENDIAN);
1698 case BROADBAND_MAXIMUM_DR_DOWN:
1699 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_maximum_dr_down, tvb, offset, 8, ENC_BIG_ENDIAN);
1702 case BROADBAND_MINIMUM_DR_UP_LOW_POWER:
1703 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_minimum_dr_up_low_power, tvb, offset, 8, ENC_BIG_ENDIAN);
1706 case BROADBAND_MINIMUM_DR_DOWN_LOW_POWER:
1707 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_minimum_dr_down_low_power, tvb, offset, 8, ENC_BIG_ENDIAN);
1710 case BROADBAND_MAXIMUM_INTERLEAVING_DELAY_UP:
1711 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_maximum_interleaving_delay_up, tvb, offset, 4, ENC_BIG_ENDIAN);
1714 case BROADBAND_ACTUAL_INTERLEAVING_DELAY_UP:
1715 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_actual_interleaving_delay_up, tvb, offset, 4, ENC_BIG_ENDIAN);
1718 case BROADBAND_MAXIMUM_INTERLEAVING_DELAY_DOWN:
1719 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_maximum_interleaving_delay_down, tvb, offset, 4, ENC_BIG_ENDIAN);
1722 case BROADBAND_ACTUAL_INTERLEAVING_DELAY_DOWN:
1723 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_actual_interleaving_delay_down, tvb, offset, 4, ENC_BIG_ENDIAN);
1726 case BROADBAND_ACCESS_LOOP_ENCAPSULATION:
1728 ta = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_access_loop_encapsulation, tvb, offset, avp_len, ENC_NA);
1729 l2tp_avp_ale_tree = proto_item_add_subtree(ta, ett_l2tp_ale_sub);
1730 proto_tree_add_item(l2tp_avp_ale_tree, hf_l2tp_broadband_access_loop_encapsulation_data_link, tvb, offset, 1, ENC_BIG_ENDIAN);
1731 proto_tree_add_item(l2tp_avp_ale_tree, hf_l2tp_broadband_access_loop_encapsulation_enc1, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1732 proto_tree_add_item(l2tp_avp_ale_tree, hf_l2tp_broadband_access_loop_encapsulation_enc2, tvb, offset+2, 1, ENC_BIG_ENDIAN);
1736 case BROADBAND_ANCP_ACCESS_LINE_TYPE:
1737 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_ancp_access_line_type, tvb, offset, avp_len, ENC_BIG_ENDIAN);
1740 case BROADBAND_IWF_SESSION:
1741 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_broadband_iwf_session, tvb, offset, avp_len, ENC_BIG_ENDIAN);
1745 proto_tree_add_expert(l2tp_avp_tree, pinfo, &ei_l2tp_vendor_specific_avp_data, tvb, offset, avp_len);
1754 * Dissect Ericsson AVP:s
1757 /* Dissect a single variable-length Ericsson Transport Configuration Group */
1758 static int dissect_l2tp_ericsson_transp_cfg(tvbuff_t *tvb, proto_tree *parent_tree)
1761 guint32 i, num_sapis;
1764 while (tvb_reported_length_remaining(tvb, offset) >= 8) {
1765 tree = proto_tree_add_subtree_format(parent_tree, tvb, 0, -1, ett_l2tp_ericsson_tcg,
1766 NULL, "Transport Config Bundling Group");
1767 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_group_id, tvb, offset++, 1, ENC_NA);
1768 proto_tree_add_item_ret_uint(tree, hf_l2tp_ericsson_tcg_num_sapis, tvb, offset++, 1, ENC_NA, &num_sapis);
1769 for (i = 0; i < num_sapis; i++) {
1770 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_sapi, tvb, offset++, 1, ENC_NA);
1772 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_ip, tvb, offset, 4, ENC_NA);
1774 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_dscp, tvb, offset++, 1, ENC_NA);
1775 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_crc32_enable, tvb, offset++, 1, ENC_NA);
1776 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_bundling_tout, tvb, offset++, 1, ENC_NA);
1777 proto_tree_add_item(tree, hf_l2tp_ericsson_tcg_bundling_max_pkt, tvb, offset, 2, ENC_BIG_ENDIAN);
1784 /* Dissect a single 3-byte Ericsson TEI-to-SC Map */
1785 static int dissect_l2tp_ericsson_tei_sc_map(tvbuff_t *tvb, proto_tree *parent_tree)
1787 int i = 0, offset = 0;
1790 while (tvb_reported_length_remaining(tvb, offset) >= 3) {
1791 tree = proto_tree_add_subtree_format(parent_tree, tvb, offset, 3, ett_l2tp_ericsson_map,
1792 NULL, "Transport Config Bundling Group %u", i);
1793 proto_tree_add_item(tree, hf_l2tp_ericsson_map_tei_low, tvb, offset++, 1, ENC_NA);
1794 proto_tree_add_item(tree, hf_l2tp_ericsson_map_tei_high, tvb, offset++, 1, ENC_NA);
1795 proto_tree_add_item(tree, hf_l2tp_ericsson_map_sc, tvb, offset++, 1, ENC_NA);
1801 static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid)
1805 guint32 avp_vendor_id;
1807 guint16 ver_len_hidden;
1809 proto_tree *l2tp_avp_tree;
1812 ver_len_hidden = tvb_get_ntohs(tvb, offset);
1813 avp_len = AVP_LENGTH(ver_len_hidden);
1814 avp_vendor_id = tvb_get_ntohs(tvb, offset + 2);
1815 avp_type = tvb_get_ntohs(tvb, offset + 4);
1817 l2tp_avp_tree = proto_tree_add_subtree_format(tree, tvb, offset,
1818 avp_len, ett_l2tp_avp, NULL, "Vendor %s (%u): %s AVP",
1819 enterprises_lookup(avp_vendor_id, "Unknown"), avp_vendor_id,
1820 val_to_str(avp_type, ericsson_avp_type_vals, "Unknown (%u)"));
1822 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN);
1823 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, offset, 2, ENC_BIG_ENDIAN);
1824 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1826 if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */
1834 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1838 proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_ericsson_avp_type, tvb, offset, 2, avp_type);
1845 case ERICSSON_MSG_TYPE:
1846 proto_tree_add_item_ret_uint(l2tp_avp_tree, hf_l2tp_ericsson_msg_type, tvb, offset, 2, ENC_BIG_ENDIAN, &msg_type);
1847 col_add_fstr(pinfo->cinfo, COL_INFO, "%s - %s", control_msg, val_to_str(msg_type, ericsson_short_msg_type_vals, "Unknown (0x%x)"));
1849 case ERICSSON_PROTO_VERSION:
1850 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_ver_pref, tvb, offset, 4, ENC_BIG_ENDIAN);
1851 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_ver_2, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1852 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_ver_3, tvb, offset+8, 4, ENC_BIG_ENDIAN);
1854 case ERICSSON_CONN_TYPE:
1855 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_conn_type, tvb, offset, 1, ENC_NA);
1857 case ERICSSON_STN_NAME:
1858 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_stn_name, tvb, offset, avp_len, ENC_ASCII|ENC_NA);
1860 case ERICSSON_CRC_ENABLED:
1861 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_crc32_enable, tvb, offset, avp_len, ENC_NA);
1863 case ERICSSON_ABIS_LOWER_MODE:
1864 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_abis_lower_mode, tvb, offset, 1, ENC_NA);
1866 case ERICSSON_TRANSPORT_CONFIG:
1867 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_tc_overl_thresh, tvb, offset, 2, ENC_BIG_ENDIAN);
1868 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_tc_num_groups, tvb, offset+2, 1, ENC_NA);
1869 /* FIXME: iterate over multiple groups */
1870 tcg_tvb = tvb_new_subset_length(tvb, offset+3, avp_len-3);
1871 dissect_l2tp_ericsson_transp_cfg(tcg_tvb, l2tp_avp_tree);
1873 case ERICSSON_TEI_TO_SC_MAP:
1874 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_ericsson_tc_num_maps, tvb, offset++, 1, ENC_NA);
1875 tcg_tvb = tvb_new_subset_length(tvb, offset, avp_len);
1876 offset += dissect_l2tp_ericsson_tei_sc_map(tcg_tvb, l2tp_avp_tree);
1880 proto_tree_add_expert(l2tp_avp_tree, pinfo, &ei_l2tp_vendor_specific_avp_data, tvb, offset, avp_len);
1889 * Ref: http://www.cablelabs.com/specifications/CM-SP-DEPI-I08-100611.pdf
1892 dissect_l2tp_vnd_cablelabs_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1896 guint32 avp_vendor_id;
1898 guint16 ver_len_hidden;
1899 proto_tree *l2tp_avp_tree;
1901 ver_len_hidden = tvb_get_ntohs(tvb, offset);
1902 avp_len = AVP_LENGTH(ver_len_hidden);
1903 avp_vendor_id = tvb_get_ntohs(tvb, offset + 2);
1904 avp_type = tvb_get_ntohs(tvb, offset + 4);
1906 l2tp_avp_tree = proto_tree_add_subtree_format(tree, tvb, offset,
1907 avp_len, ett_l2tp_avp, NULL, "Vendor %s (%u): %s AVP",
1908 enterprises_lookup(avp_vendor_id, "Unknown"), avp_vendor_id,
1909 val_to_str(avp_type, cablelabs_avp_type_vals, "Unknown (%u)"));
1911 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN);
1912 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, offset, 2, ENC_BIG_ENDIAN);
1913 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1915 if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */
1923 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1927 proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_cablelabs_avp_type, tvb, offset, 2, avp_type);
1933 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_l_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
1934 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_tsid_group_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1937 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_frequency, tvb, offset, 4, ENC_BIG_ENDIAN);
1942 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_l_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
1943 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_tsid_group_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1944 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_modulation, tvb, offset, 2, ENC_BIG_ENDIAN);
1949 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_l_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
1950 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_tsid_group_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1954 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_m, tvb, offset, 2, ENC_BIG_ENDIAN);
1957 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_cablel_avp_n, tvb, offset, 2, ENC_BIG_ENDIAN);
1963 proto_tree_add_expert(l2tp_avp_tree, pinfo, &ei_l2tp_vendor_specific_avp_data, tvb, offset, avp_len);
1973 * Processes AVPs for Control Messages all versions and transports
1975 static void process_control_avps(tvbuff_t *tvb,
1977 proto_tree *l2tp_tree,
1981 l2tpv3_tunnel_t *tunnel)
1983 proto_tree *l2tp_lcp_avp_tree, *l2tp_avp_tree = NULL, *l2tp_avp_tree_sub, *l2tp_avp_csu_tree;
1984 proto_item *te, *tc;
1987 gboolean isStopCcn = FALSE;
1989 guint32 avp_vendor_id;
1991 guint16 ver_len_hidden;
1992 tvbuff_t *next_tvb, *avp_tvb;
1994 guint16 digest_avp_len = 0;
1995 proto_item *digest_item = NULL;
1996 l2tp_cntrl_data_t *l2tp_cntrl_data = wmem_new0(wmem_packet_scope(), l2tp_cntrl_data_t);
1998 l2tpv3_session_t *session = NULL;
2000 l2tp_cntrl_data->ccid = ccid;
2002 while (idx < length) { /* Process AVP's */
2003 ver_len_hidden = tvb_get_ntohs(tvb, idx);
2004 avp_len = AVP_LENGTH(ver_len_hidden);
2005 avp_vendor_id = tvb_get_ntohs(tvb, idx + 2);
2006 avp_type = tvb_get_ntohs(tvb, idx + 4);
2009 proto_tree_add_expert_format(l2tp_avp_tree ? l2tp_avp_tree : l2tp_tree, pinfo, &ei_l2tp_avp_length, tvb, idx, 2, "AVP length must be >= 6, got %u", avp_len);
2013 if (avp_vendor_id != VENDOR_IETF) {
2015 avp_tvb = tvb_new_subset_length(tvb, idx, avp_len);
2017 if (avp_vendor_id == VENDOR_CISCO) { /* Vendor-Specific AVP */
2019 dissect_l2tp_cisco_avps(avp_tvb, pinfo, l2tp_tree, ccid);
2023 } else if (avp_vendor_id == VENDOR_BROADBAND_FORUM) { /* Vendor-Specific AVP */
2025 dissect_l2tp_broadband_avps(avp_tvb, pinfo, l2tp_tree);
2029 } else if (avp_vendor_id == VENDOR_ERICSSON) { /* Vendor-Specific AVP */
2031 dissect_l2tp_ericsson_avps(avp_tvb, pinfo, l2tp_tree, ccid);
2036 /* Vendor-Specific AVP */
2037 if (!dissector_try_uint_new(l2tp_vendor_avp_dissector_table, avp_vendor_id, avp_tvb, pinfo, l2tp_tree, FALSE, l2tp_cntrl_data)){
2038 l2tp_avp_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, idx,
2039 avp_len, ett_l2tp_avp, NULL, "Vendor %s (%u) AVP Type %u",
2040 enterprises_lookup(avp_vendor_id, "Unknown"), avp_vendor_id,
2043 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, idx, 2, ENC_BIG_ENDIAN);
2044 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, idx, 2, ENC_BIG_ENDIAN);
2045 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
2047 if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */
2052 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id, tvb, idx, 2, ENC_BIG_ENDIAN);
2055 proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_avp_type, tvb, idx, 2, avp_type);
2057 proto_tree_add_expert(l2tp_avp_tree, pinfo, &ei_l2tp_vendor_specific_avp_data, tvb, idx, avp_len-6);
2066 l2tp_avp_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, idx,
2067 avp_len, ett_l2tp_avp, NULL, "%s AVP",
2068 val_to_str_ext(avp_type, &avp_type_vals_ext, "Unknown (%u)"));
2070 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_mandatory, tvb, idx, 2, ENC_BIG_ENDIAN);
2071 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hidden, tvb, idx, 2, ENC_BIG_ENDIAN);
2072 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
2074 if (HIDDEN_BIT(ver_len_hidden)) { /* don't try do display hidden */
2082 /* Special Case for handling Extended Vendor Id */
2083 if (avp_type == EXTENDED_VENDOR_ID) {
2085 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id,
2086 tvb, idx, 4, ENC_BIG_ENDIAN);
2093 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_id,
2094 tvb, idx, 2, ENC_BIG_ENDIAN);
2099 proto_tree_add_uint(l2tp_avp_tree, hf_l2tp_avp_type,
2100 tvb, idx, 2, avp_type);
2106 case CONTROL_MESSAGE:
2107 msg_type = tvb_get_ntohs(tvb, idx);
2108 l2tp_cntrl_data->msg_type = msg_type;
2109 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_message_type,
2110 tvb, idx, 2, ENC_BIG_ENDIAN);
2112 if (msg_type == MESSAGE_TYPE_StopCCN) {
2117 case RESULT_ERROR_CODE:
2121 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_stop_ccn_result_code, tvb, idx, 2, ENC_BIG_ENDIAN);
2124 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_result_code, tvb, idx, 2, ENC_BIG_ENDIAN);
2131 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_error_code, tvb, idx, 2, ENC_BIG_ENDIAN);
2137 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_error_message, tvb, idx, avp_len, ENC_ASCII|ENC_NA);
2140 case PROTOCOL_VERSION:
2143 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_protocol_version, tvb, idx, 1, ENC_BIG_ENDIAN);
2147 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_protocol_revision, tvb, idx, 1, ENC_BIG_ENDIAN);
2150 case FRAMING_CAPABILITIES:
2151 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_async_framing_supported, tvb, idx, 4, ENC_BIG_ENDIAN);
2152 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_sync_framing_supported, tvb, idx, 4, ENC_BIG_ENDIAN);
2155 case BEARER_CAPABILITIES:
2156 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_analog_access_supported, tvb, idx, 4, ENC_BIG_ENDIAN);
2157 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_digital_access_supported, tvb, idx, 4, ENC_BIG_ENDIAN);
2161 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_tie_breaker, tvb, idx, 8, ENC_BIG_ENDIAN);
2164 case FIRMWARE_REVISION:
2165 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_firmware_revision, tvb, idx, 2, ENC_BIG_ENDIAN);
2169 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_host_name, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2173 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_vendor_name, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2176 case ASSIGNED_TUNNEL_ID:
2177 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_tunnel_id, tvb, idx, 2, ENC_BIG_ENDIAN);
2180 case RECEIVE_WINDOW_SIZE:
2181 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_receive_window_size, tvb, idx, 2, ENC_BIG_ENDIAN);
2185 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_chap_challenge, tvb, idx, avp_len, ENC_NA);
2190 * XXX - export stuff from the Q.931 dissector
2191 * to dissect the cause code and cause message,
2196 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_cause_code, tvb, idx, 2, ENC_BIG_ENDIAN);
2202 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_cause_msg, tvb, idx, 1, ENC_BIG_ENDIAN);
2208 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_advisory_msg, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2211 case CHALLENGE_RESPONSE:
2212 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_chap_challenge_response, tvb, idx, 16, ENC_NA);
2215 case ASSIGNED_SESSION:
2216 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_session_id, tvb, idx, 2, ENC_BIG_ENDIAN);
2219 case CALL_SERIAL_NUMBER:
2220 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_call_serial_number, tvb, idx, 4, ENC_BIG_ENDIAN);
2224 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_minimum_bps, tvb, idx, 4, ENC_BIG_ENDIAN);
2228 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_maximum_bps, tvb, idx, 4, ENC_BIG_ENDIAN);
2232 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_analog_bearer_type, tvb, idx, 4, ENC_BIG_ENDIAN);
2233 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_digital_bearer_type, tvb, idx, 4, ENC_BIG_ENDIAN);
2237 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_async_framing_type, tvb, idx, 4, ENC_BIG_ENDIAN);
2238 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_sync_framing_type, tvb, idx, 4, ENC_BIG_ENDIAN);
2244 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_called_number,
2245 tvb, idx, avp_len, ENC_ASCII|ENC_NA);
2248 case CALLING_NUMBER:
2251 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_calling_number,
2252 tvb, idx, avp_len, ENC_ASCII|ENC_NA);
2258 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_sub_address, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2261 case TX_CONNECT_SPEED:
2262 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_connect_speed, tvb, idx, 4, ENC_BIG_ENDIAN);
2265 case PHYSICAL_CHANNEL:
2266 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_physical_channel, tvb, idx, 4, ENC_BIG_ENDIAN);
2269 case INITIAL_RECEIVED_LCP_CONFREQ:
2270 te = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_initial_received_lcp_confreq, tvb, idx, avp_len, ENC_NA);
2271 l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp);
2272 next_tvb = tvb_new_subset_length(tvb, idx, avp_len);
2273 call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree );
2276 case LAST_SENT_LCP_CONFREQ:
2277 te = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_last_sent_lcp_confreq, tvb, idx, avp_len, ENC_NA);
2278 l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp);
2279 next_tvb = tvb_new_subset_length(tvb, idx, avp_len);
2280 call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree );
2283 case LAST_RECEIVED_LCP_CONFREQ:
2284 te = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_last_received_lcp_confreq, tvb, idx, avp_len, ENC_NA);
2285 l2tp_lcp_avp_tree = proto_item_add_subtree(te, ett_l2tp_lcp);
2286 next_tvb = tvb_new_subset_length(tvb, idx, avp_len);
2287 call_dissector(ppp_lcp_options_handle, next_tvb, pinfo, l2tp_lcp_avp_tree );
2290 case PROXY_AUTHEN_TYPE:
2291 msg_type = tvb_get_ntohs(tvb, idx);
2292 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_proxy_authen_type, tvb, idx, 2, ENC_BIG_ENDIAN);
2295 case PROXY_AUTHEN_NAME:
2298 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_proxy_authen_name, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2301 case PROXY_AUTHEN_CHALLENGE:
2302 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_proxy_authen_challenge, tvb, idx, avp_len, ENC_NA);
2305 case PROXY_AUTHEN_ID:
2306 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_proxy_authen_id, tvb, idx + 1, 1, ENC_BIG_ENDIAN);
2309 case PROXY_AUTHEN_RESPONSE:
2310 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_proxy_authen_response, tvb, idx, avp_len, ENC_NA);
2313 case CALL_STATUS_AVPS:
2321 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_crc_errors, tvb, idx, 4, ENC_BIG_ENDIAN);
2327 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_framing_errors, tvb, idx, 4, ENC_BIG_ENDIAN);
2333 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_hardware_overruns, tvb, idx, 4, ENC_BIG_ENDIAN);
2339 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_buffer_overruns, tvb, idx, 4, ENC_BIG_ENDIAN);
2345 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_time_out_errors, tvb, idx, 4, ENC_BIG_ENDIAN);
2351 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_alignment_errors, tvb, idx, 4, ENC_BIG_ENDIAN);
2364 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_send_accm, tvb, idx, 4, ENC_BIG_ENDIAN);
2370 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_receive_accm, tvb, idx, 4, ENC_BIG_ENDIAN);
2376 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_random_vector, tvb, idx, avp_len, ENC_NA);
2379 case PRIVATE_GROUP_ID:
2380 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_private_group_id, tvb, idx, avp_len, ENC_NA);
2383 case RX_CONNECT_SPEED:
2384 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_rx_connect_speed, tvb, idx, 4, ENC_BIG_ENDIAN);
2387 case PPP_DISCONNECT_CAUSE_CODE:
2390 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_disconnect_code, tvb, idx, 2, ENC_BIG_ENDIAN);
2396 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_control_protocol_number, tvb, idx, 2, ENC_BIG_ENDIAN);
2402 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_cause_code_direction, tvb, idx, 1, ENC_BIG_ENDIAN);
2408 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_cause_code_message, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2411 case MESSAGE_DIGEST:
2414 digest_avp_len = avp_len;
2415 digest_item = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_message_digest, tvb, idx, avp_len, ENC_NA);
2419 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_router_id, tvb, idx, 4, ENC_BIG_ENDIAN);
2421 case ASSIGNED_CONTROL_CONN_ID:
2422 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_control_conn_id,
2423 tvb, idx, 4, ENC_BIG_ENDIAN);
2424 store_ccid(tunnel, tvb, idx, msg_type);
2426 case PW_CAPABILITY_LIST:
2427 l2tp_avp_tree_sub = proto_tree_add_subtree(l2tp_avp_tree, tvb, idx, avp_len,
2428 ett_l2tp_avp_sub, NULL, "Pseudowire Capabilities List");
2430 while (avp_len >= 2) {
2431 proto_tree_add_item(l2tp_avp_tree_sub, hf_l2tp_avp_pw_type, tvb, idx, 2, ENC_BIG_ENDIAN);
2436 case LOCAL_SESSION_ID:
2437 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_local_session_id,
2438 tvb, idx, 4, ENC_BIG_ENDIAN);
2439 col_append_fstr(pinfo->cinfo,COL_INFO, ", LSID: %2u",
2440 tvb_get_ntohl(tvb, idx));
2441 session = store_lsession_id(session, tvb, idx, msg_type);
2443 case REMOTE_SESSION_ID:
2444 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_remote_session_id,
2445 tvb, idx, 4, ENC_BIG_ENDIAN);
2446 col_append_fstr(pinfo->cinfo,COL_INFO, ", RSID: %2u",
2447 tvb_get_ntohl(tvb, idx));
2448 session = store_rsession_id(session, tvb, idx, msg_type);
2450 case ASSIGNED_COOKIE:
2451 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_assigned_cookie, tvb, idx, avp_len, ENC_NA);
2452 session = store_cookie_len(session, avp_len, msg_type);
2455 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_remote_end_id, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2458 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_pseudowire_type, tvb, idx, 2, ENC_BIG_ENDIAN);
2459 session = store_pw_type(session, tvb, idx, msg_type);
2461 case L2_SPECIFIC_SUBLAYER:
2462 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_layer2_specific_sublayer, tvb, idx, 2, ENC_BIG_ENDIAN);
2463 session = store_l2_sublayer(session, tvb, idx, msg_type);
2465 case DATA_SEQUENCING:
2466 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_data_sequencing, tvb, idx, 2, ENC_BIG_ENDIAN);
2468 case CIRCUIT_STATUS:
2469 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_circuit_status, tvb, idx, 2, ENC_BIG_ENDIAN);
2470 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_circuit_type, tvb, idx, 2, ENC_BIG_ENDIAN);
2472 case PREFERRED_LANGUAGE:
2473 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_preferred_language, tvb, idx, avp_len, ENC_NA|ENC_ASCII);
2475 case CTL_MSG_AUTH_NONCE:
2476 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_nonce, tvb, idx, avp_len, ENC_NA);
2477 store_cma_nonce(tunnel, tvb, idx, avp_len, msg_type);
2479 case TX_CONNECT_SPEED_V3:
2483 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_tx_connect_speed_v3, tvb, idx, 8, ENC_BIG_ENDIAN);
2485 case RX_CONNECT_SPEED_V3:
2489 proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_rx_connect_speed_v3, tvb, idx, 8, ENC_BIG_ENDIAN);
2491 case CONNECT_SPEED_UPDATE:
2493 tc = proto_tree_add_item(l2tp_avp_tree, hf_l2tp_avp_csu, tvb, idx, avp_len, ENC_NA);
2494 l2tp_avp_csu_tree = proto_item_add_subtree(tc, ett_l2tp_csu);
2495 if (avp_len == 12) {
2497 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_res, tvb, idx, 2, ENC_BIG_ENDIAN);
2498 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_remote_session_id_v2, tvb, idx+2, 2, ENC_BIG_ENDIAN);
2499 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_current_tx_speed_v2, tvb, idx+4, 4, ENC_BIG_ENDIAN);
2500 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_current_rx_speed_v2, tvb, idx+8, 4, ENC_BIG_ENDIAN);
2502 else if (avp_len == 20) {
2504 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_remote_session_id_v3, tvb, idx, 4, ENC_BIG_ENDIAN);
2505 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_current_tx_speed_v3, tvb, idx+4, 8, ENC_BIG_ENDIAN);
2506 proto_tree_add_item(l2tp_avp_csu_tree, hf_l2tp_avp_csu_current_rx_speed_v3, tvb, idx+12, 8, ENC_BIG_ENDIAN);
2513 proto_tree_add_expert(l2tp_avp_tree, pinfo, &ei_l2tp_vendor_specific_avp_data, tvb, idx, avp_len);
2520 /* SCCRQ digest can only be calculated once we know whether nonces are being used */
2521 if (digest_avp_len) {
2522 if (check_control_digest(tunnel, tvb, length, digest_idx, digest_avp_len, msg_type, pinfo) < 0)
2523 expert_add_info(pinfo, digest_item, &ei_l2tp_incorrect_digest);
2526 update_session(tunnel, session);
2530 * Processes Data Messages for v3 IP and UDP, starting from the Session ID
2531 * (common to IP and UDP). Dissects the L2TPv3 Session header, the (optional)
2532 * L2-Specific sublayer and calls the appropriate dissector for the payload.
2535 process_l2tpv3_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2536 proto_tree *l2tp_tree, proto_item *l2tp_item, int *pIdx,
2537 l2tpv3_tunnel_t *tunnel)
2541 guint32 oam_cell = 0;
2542 proto_tree *l2_specific = NULL;
2543 proto_item *ti = NULL;
2545 gint cookie_len = l2tpv3_cookie;
2546 gint l2_spec = l2tpv3_l2_specific;
2549 lcce_settings_t *lcce = NULL;
2550 l2tpv3_session_t *session = NULL;
2552 /* Get Session ID */
2553 sid = tvb_get_ntohl(tvb, idx);
2557 if (addresses_equal(&tunnel->lcce1, &pinfo->dst)) {
2558 session = find_session(tunnel, sid, 0);
2560 lcce = &session->lcce1;
2562 session = find_session(tunnel, 0, sid);
2564 lcce = &session->lcce2;
2570 l2_spec = lcce->l2_specific;
2571 if (cookie_len == -1)
2572 cookie_len = lcce->cookie_len;
2574 pw_type = session->pw_type;
2578 l2_spec = L2TPv3_L2_SPECIFIC_NONE;
2581 pw_type = L2TPv3_PROTOCOL_DEFAULT;
2583 if (cookie_len == -1)
2584 cookie_len = L2TPv3_COOKIE_DEFAULT;
2586 col_add_fstr(pinfo->cinfo,COL_INFO,
2587 "%s (session id=%u)",
2591 proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, idx-4, 4, ENC_BIG_ENDIAN);
2592 proto_item_set_len(l2tp_item, idx);
2593 if (!(tvb_offset_exists(tvb, idx)))
2595 if (cookie_len != 0)
2596 proto_tree_add_item(l2tp_tree, hf_l2tp_cookie, tvb, idx, cookie_len, ENC_NA);
2600 case L2TPv3_L2_SPECIFIC_DEFAULT:
2602 ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_def,
2603 tvb, idx + cookie_len, 4, ENC_NA);
2604 l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec);
2606 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, idx + cookie_len,
2608 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb,
2609 idx + cookie_len + 1, 3, ENC_BIG_ENDIAN);
2611 next_tvb = tvb_new_subset_remaining(tvb, idx + cookie_len + 4);
2613 case L2TPv3_L2_SPECIFIC_DOCSIS_DMPT:
2615 ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_docsis_dmpt,
2616 tvb, idx + cookie_len, 4, ENC_NA);
2617 l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec);
2619 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_v, tvb,
2620 idx + cookie_len,1, ENC_BIG_ENDIAN);
2622 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb,
2623 idx + cookie_len,1, ENC_BIG_ENDIAN);
2625 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_h, tvb,
2626 idx + cookie_len,1, ENC_BIG_ENDIAN);
2628 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_flow_id, tvb,
2629 idx + cookie_len,1, ENC_BIG_ENDIAN);
2631 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb,
2632 idx + cookie_len + 2,2, ENC_BIG_ENDIAN);
2634 next_tvb = tvb_new_subset_remaining(tvb, idx + cookie_len + 4);
2636 case L2TPv3_L2_SPECIFIC_ATM:
2638 ti = proto_tree_add_item(tree, hf_l2tp_l2_spec_atm,
2639 tvb, idx + cookie_len, 4, ENC_NA);
2640 l2_specific = proto_item_add_subtree(ti, ett_l2tp_l2_spec);
2642 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_s, tvb, idx + cookie_len,
2644 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_t, tvb, idx + cookie_len,
2647 * As per RFC 4454, the T bit specifies whether
2648 * we're transporting an OAM cell or an AAL5 frame.
2650 oam_cell = tvb_get_guint8(tvb, idx + cookie_len) & 0x08;
2651 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_g, tvb, idx + cookie_len,
2653 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_c, tvb, idx + cookie_len,
2655 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_u, tvb, idx + cookie_len,
2657 proto_tree_add_item(l2_specific, hf_l2tp_l2_spec_sequence, tvb,
2658 idx + cookie_len + 1, 3, ENC_BIG_ENDIAN);
2660 next_tvb = tvb_new_subset_remaining(tvb, idx + cookie_len + 4);
2662 case L2TPv3_L2_SPECIFIC_LAPD:
2664 proto_tree_add_item(tree, hf_l2tp_lapd_info, tvb, idx + cookie_len + 4, 3, ENC_NA);
2665 next_tvb = tvb_new_subset_remaining(tvb, idx + cookie_len+4+3);
2667 case L2TPv3_L2_SPECIFIC_NONE:
2669 next_tvb = tvb_new_subset_remaining(tvb, idx + cookie_len);
2673 p_add_proto_data(pinfo->pool, pinfo, proto_l2tp, 0, GUINT_TO_POINTER((guint)pw_type));
2675 if (!dissector_try_uint_new(pw_type_table, pw_type, next_tvb, pinfo, tree, FALSE, GUINT_TO_POINTER(oam_cell)))
2677 call_data_dissector(next_tvb, pinfo, tree);
2681 static const int * l2tp_control_fields[] = {
2683 &hf_l2tp_length_bit,
2690 * Processes v3 data message over UDP, to then call process_l2tpv3_data
2691 * from the common part (Session ID)
2694 process_l2tpv3_data_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2695 l2tpv3_conversation_t *l2tp_conv)
2697 proto_tree *l2tp_tree, *ctrl_tree;
2698 proto_item *l2tp_item;
2699 int idx = 4; /* skip to sid */
2702 sid = tvb_get_ntohl(tvb, idx);
2704 l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA);
2705 l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
2708 proto_item_append_text(l2tp_item, " version 3");
2710 ctrl_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, 0, 2,
2711 ett_l2tp_ctrl, NULL, "Packet Type: %s Session Id=%u",
2713 proto_tree_add_bitmask_list(ctrl_tree, tvb, 0, 2, l2tp_control_fields, ENC_BIG_ENDIAN);
2715 /* Data in v3 over UDP has this reserved */
2716 proto_tree_add_item(l2tp_tree, hf_l2tp_res, tvb, 2, 2, ENC_BIG_ENDIAN);
2719 /* Call process_l2tpv3_data from Session ID (offset in idx of 4) */
2720 process_l2tpv3_data(tvb, pinfo, tree, l2tp_tree, l2tp_item, &idx, l2tp_conv->tunnel);
2724 * Processes v3 data message over IP, to then call process_l2tpv3_data
2725 * from the common part (Session ID)
2728 process_l2tpv3_data_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2729 l2tpv3_conversation_t *l2tp_conv)
2731 proto_tree *l2tp_tree;
2732 proto_item *l2tp_item;
2737 sid = tvb_get_ntohl(tvb, idx);
2739 l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA);
2740 l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
2741 proto_item_append_text(l2tp_item, " version 3");
2743 proto_tree_add_uint_format(l2tp_tree, hf_l2tp_session_id, tvb, 0, 4, sid, "Packet Type: %s Session Id=%u", data_msg, sid);
2745 /* Call process_l2tpv3_data from Session ID (offset in idx of 0) */
2746 process_l2tpv3_data(tvb, pinfo, tree, l2tp_tree, l2tp_item, &idx, l2tp_conv->tunnel);
2750 * Processes v3 Control Message over IP, that carries NULL Session ID
2751 * to then call process_control_avps after dissecting the control.
2754 process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int baseIdx,
2755 l2tpv3_conversation_t *l2tp_conv)
2757 proto_tree *l2tp_tree = NULL, *ctrl_tree;
2758 proto_item *l2tp_item = NULL;
2762 guint16 length = 0; /* Length field */
2763 guint32 ccid = 0; /* Control Connection ID */
2764 guint16 vendor_id = 0;
2767 guint16 control = 0;
2769 l2tpv3_tunnel_t *tunnel = NULL;
2770 l2tpv3_tunnel_t tmp_tunnel;
2772 control = tvb_get_ntohs(tvb, idx);
2773 idx += 2; /* skip ahead */
2774 if (LENGTH_BIT(control)) { /* length field included ? */
2775 length = tvb_get_ntohs(tvb, idx);
2779 /* Get Control Channel ID */
2780 ccid = tvb_get_ntohl(tvb, idx);
2785 if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */
2786 col_add_fstr(pinfo->cinfo, COL_INFO,
2787 "%s - ZLB (tunnel id=%u)",
2788 control_msg , ccid);
2791 if (SEQUENCE_BIT(control)) {
2797 vendor_id = tvb_get_ntohs(tvb, tmp_idx);
2800 avp_type = tvb_get_ntohs(tvb, tmp_idx);
2803 /* If it's a vendor AVP let the vendor AVP dissector fill in the info column */
2804 if ( vendor_id == VENDOR_IETF ) {
2805 if (avp_type == CONTROL_MESSAGE) {
2806 /* We print message type */
2807 msg_type = tvb_get_ntohs(tvb, tmp_idx);
2808 col_add_fstr(pinfo->cinfo, COL_INFO,
2809 "%s - %s (tunnel id=%u)",
2811 val_to_str_ext(msg_type, &l2tp_message_type_short_str_vals_ext, "Unknown (%u)"),
2816 * This is not a control message.
2817 * We never pass here except in case of bad l2tp packet!
2819 col_add_fstr(pinfo->cinfo, COL_INFO,
2820 "%s (tunnel id=%u)",
2826 if (LENGTH_BIT(control)) {
2828 * Set the length of this tvbuff to be no longer than the length
2831 * XXX - complain if that length is longer than the length of
2832 * the tvbuff? Have "set_actual_length()" return a Boolean
2833 * and have its callers check the result?
2835 set_actual_length(tvb, length+baseIdx);
2839 l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA);
2840 l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
2841 proto_item_append_text(l2tp_item, " version 3");
2844 proto_tree_add_item(l2tp_tree, hf_l2tp_sid, tvb, 0, 4, ENC_BIG_ENDIAN);
2846 ctrl_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, baseIdx, 2,
2847 ett_l2tp_ctrl, NULL, "Packet Type: %s Control Connection Id=%u",
2848 (CONTROL_BIT(control) ? control_msg : data_msg), ccid);
2849 proto_tree_add_bitmask_list(ctrl_tree, tvb, baseIdx, 2, l2tp_control_fields, ENC_BIG_ENDIAN);
2852 if (LENGTH_BIT(control)) {
2853 proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
2857 proto_tree_add_item(l2tp_tree, hf_l2tp_ccid, tvb, idx, 4, ENC_BIG_ENDIAN);
2860 if (SEQUENCE_BIT(control)) {
2861 proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN);
2863 proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN);
2868 if (tree && (LENGTH_BIT(control))&&(length==12)) {
2869 proto_tree_add_item(l2tp_tree, hf_l2tp_zero_length_body_message, tvb, 0, 0, ENC_NA);
2871 avp_type = tvb_get_ntohs(tvb, idx + 4);
2872 if (avp_type == CONTROL_MESSAGE) {
2874 msg_type = tvb_get_ntohs(tvb, idx + 6);
2875 if (msg_type == MESSAGE_TYPE_SCCRQ) {
2876 tunnel = &tmp_tunnel;
2877 memset(tunnel, 0, sizeof(l2tpv3_tunnel_t));
2878 tunnel->conv = l2tp_conv;
2879 copy_address_wmem(wmem_file_scope(), &tunnel->lcce1, &pinfo->src);
2880 copy_address_wmem(wmem_file_scope(), &tunnel->lcce2, &pinfo->dst);
2885 if (!LENGTH_BIT(control)) {
2889 if (tunnel == NULL) {
2890 tunnel = l2tp_conv->tunnel;
2893 process_control_avps(tvb, pinfo, l2tp_tree, idx, length+baseIdx, ccid, tunnel);
2895 if (tunnel == &tmp_tunnel && l2tp_conv->tunnel == NULL) {
2896 l2tp_conv->tunnel = wmem_new0(wmem_file_scope(), l2tpv3_tunnel_t);
2897 memcpy(l2tp_conv->tunnel, &tmp_tunnel, sizeof(l2tpv3_tunnel_t));
2902 * Dissector for L2TP over UDP. For v2, calls process_control_avps for
2903 * control messages, or the ppp dissector based on the control bit.
2904 * For v3, calls either process_l2tpv3_control or process_l2tpv3_data_udp
2905 * based on the control bit.
2908 dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2910 proto_tree *l2tp_tree, *ctrl_tree;
2911 proto_item *l2tp_item;
2914 guint16 length = 0; /* Length field */
2915 guint16 tid; /* Tunnel ID */
2916 guint16 cid; /* Call ID */
2917 guint16 offset_size; /* Offset size */
2922 conversation_t *conv = NULL;
2923 l2tpv3_conversation_t *l2tp_conv = NULL;
2926 * Don't accept packets that aren't for an L2TP version we know,
2927 * as they might not be L2TP packets even though they happen
2928 * to be coming from or going to the L2TP port.
2930 if (tvb_captured_length(tvb) < 2)
2931 return 0; /* not enough information to check */
2932 control = tvb_get_ntohs(tvb, 0);
2933 switch (L2TP_VERSION(control)) {
2943 conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst, PT_UDP,
2944 pinfo->srcport, pinfo->destport, NO_PORT_B);
2947 conv = find_conversation(pinfo->num, &pinfo->src, &pinfo->dst, PT_UDP,
2948 pinfo->srcport, pinfo->destport, 0);
2951 if ((conv == NULL) || (conversation_get_dissector(conv, pinfo->num) != l2tp_udp_handle)) {
2952 conv = conversation_new(pinfo->num, &pinfo->src, &pinfo->dst, PT_UDP,
2953 pinfo->srcport, 0, NO_PORT2);
2954 conversation_set_dissector(conv, l2tp_udp_handle);
2957 col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TP");
2958 col_clear(pinfo->cinfo, COL_INFO);
2960 switch (L2TP_VERSION(control)) {
2966 l2tp_conv = (l2tpv3_conversation_t *)conversation_get_proto_data(conv, proto_l2tp);
2968 l2tp_conv = wmem_new0(wmem_file_scope(), l2tpv3_conversation_t);
2969 l2tp_conv->pt = PT_UDP;
2970 conversation_add_proto_data(conv, proto_l2tp, (void *)l2tp_conv);
2973 col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TPv3");
2974 if (CONTROL_BIT(control)) {
2975 /* Call to process l2tp v3 control message */
2976 process_l2tpv3_control(tvb, pinfo, tree, 0, l2tp_conv);
2979 /* Call to process l2tp v3 data message */
2980 process_l2tpv3_data_udp(tvb, pinfo, tree, l2tp_conv);
2982 return tvb_reported_length(tvb);
2985 if (LENGTH_BIT(control)) { /* length field included ? */
2986 idx += 2; /* skip ahead */
2987 length = tvb_get_ntohs(tvb, idx);
2990 /* collect the tunnel id & call id */
2992 tid = tvb_get_ntohs(tvb, idx);
2994 cid = tvb_get_ntohs(tvb, idx);
2996 if (CONTROL_BIT(control)) {
2997 /* CONTROL MESSAGE */
3000 if ((LENGTH_BIT(control))&&(length==12)) /* ZLB Message */
3001 col_add_fstr(pinfo->cinfo, COL_INFO,
3002 "%s - ZLB (tunnel id=%d, session id=%u)",
3003 control_msg, tid, cid);
3006 if (SEQUENCE_BIT(control)) {
3012 avp_type = tvb_get_ntohs(tvb, (tmp_idx+=2));
3014 if (avp_type == CONTROL_MESSAGE) {
3015 /* We print message type */
3016 msg_type = tvb_get_ntohs(tvb, tmp_idx+2);
3017 col_add_fstr(pinfo->cinfo, COL_INFO,
3018 "%s - %s (tunnel id=%u, session id=%u)",
3020 val_to_str_ext(msg_type, &l2tp_message_type_short_str_vals_ext, "Unknown (%u)"),
3026 * This is not a control message.
3027 * We never pass here except in case of bad l2tp packet!
3029 col_add_fstr(pinfo->cinfo, COL_INFO,
3030 "%s (tunnel id=%u, session id=%u)",
3031 control_msg, tid, cid);
3038 col_add_fstr(pinfo->cinfo, COL_INFO,
3039 "%s (tunnel id=%u, session id=%u)",
3040 data_msg, tid, cid);
3043 if (LENGTH_BIT(control)) {
3045 * Set the length of this tvbuff to be no longer than the length
3048 * XXX - complain if that length is longer than the length of
3049 * the tvbuff? Have "set_actual_length()" return a Boolean
3050 * and have its callers check the result?
3052 set_actual_length(tvb, length);
3055 l2tp_item = proto_tree_add_item(tree,proto_l2tp, tvb, 0, -1, ENC_NA);
3056 l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp);
3059 static const int * control_fields[] = {
3061 &hf_l2tp_length_bit,
3063 &hf_l2tp_offset_bit,
3069 ctrl_tree = proto_tree_add_subtree_format(l2tp_tree, tvb, 0, 2, ett_l2tp_ctrl, NULL,
3070 "Packet Type: %s Tunnel Id=%d Session Id=%d",
3071 (CONTROL_BIT(control) ? control_msg : data_msg), tid, cid);
3073 proto_tree_add_bitmask_list(ctrl_tree, tvb, 0, 2, control_fields, ENC_BIG_ENDIAN);
3076 if (LENGTH_BIT(control)) {
3078 proto_tree_add_item(l2tp_tree, hf_l2tp_length, tvb, idx, 2, ENC_BIG_ENDIAN);
3084 proto_tree_add_item(l2tp_tree, hf_l2tp_tunnel, tvb, idx, 2, ENC_BIG_ENDIAN);
3088 proto_tree_add_item(l2tp_tree, hf_l2tp_session, tvb, idx, 2, ENC_BIG_ENDIAN);
3092 if (SEQUENCE_BIT(control)) {
3094 proto_tree_add_item(l2tp_tree, hf_l2tp_Ns, tvb, idx, 2, ENC_BIG_ENDIAN);
3098 proto_tree_add_item(l2tp_tree, hf_l2tp_Nr, tvb, idx, 2, ENC_BIG_ENDIAN);
3102 if (OFFSET_BIT(control)) {
3103 offset_size = tvb_get_ntohs(tvb, idx);
3105 proto_tree_add_uint(l2tp_tree, hf_l2tp_offset, tvb, idx, 2,
3109 if (offset_size != 0) {
3111 proto_tree_add_item(l2tp_tree, hf_l2tp_offset_padding, tvb, idx, offset_size, ENC_NA);
3117 if (tree && (LENGTH_BIT(control))&&(length==12)) {
3118 proto_tree_add_item(l2tp_tree, hf_l2tp_zero_length_body_message, tvb, 0, 0, ENC_NA);
3121 if (!CONTROL_BIT(control)) { /* Data Messages so we are done */
3123 proto_item_set_len(l2tp_item, idx);
3124 /* If we have data, signified by having a length bit, dissect it */
3125 if (tvb_offset_exists(tvb, idx)) {
3126 next_tvb = tvb_new_subset_remaining(tvb, idx);
3127 call_dissector(ppp_hdlc_handle, next_tvb, pinfo, tree);
3129 return tvb_reported_length(tvb);
3132 if (LENGTH_BIT(control))
3133 process_control_avps(tvb, pinfo, l2tp_tree, idx, length, -1, NULL);
3135 return tvb_reported_length(tvb);
3140 * Only L2TPv3 runs directly over IP, and dissect_l2tp_ip starts dissecting
3141 * those packets to call either process_l2tpv3_control for Control Messages
3142 * or process_l2tpv3_data_ip for Data Messages over IP, based on the
3146 dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3149 guint32 sid; /* Session ID */
3151 conversation_t *conv = NULL;
3152 l2tpv3_conversation_t *l2tp_conv = NULL;
3154 conv = find_or_create_conversation(pinfo);
3156 l2tp_conv = (l2tpv3_conversation_t *)conversation_get_proto_data(conv, proto_l2tp);
3158 l2tp_conv = wmem_new0(wmem_file_scope(), l2tpv3_conversation_t);
3159 l2tp_conv->pt = PT_NONE;
3160 conversation_add_proto_data(conv, proto_l2tp, (void *)l2tp_conv);
3163 /* Only L2TPv3 runs directly over IP */
3164 col_set_str(pinfo->cinfo, COL_PROTOCOL, "L2TPv3");
3166 col_clear(pinfo->cinfo, COL_INFO);
3168 sid = tvb_get_ntohl(tvb, idx);
3170 /* This is control message */
3171 /* Call to process l2tp v3 control message */
3172 process_l2tpv3_control(tvb, pinfo, tree, 4, l2tp_conv);
3175 /* Call to process l2tp v3 data message */
3176 process_l2tpv3_data_ip(tvb, pinfo, tree, l2tp_conv);
3179 return tvb_captured_length(tvb);
3182 static int dissect_atm_oam_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3184 guint32 oam_cell = GPOINTER_TO_UINT(data);
3187 call_dissector(atm_oam_handle, tvb, pinfo, tree);
3189 call_dissector(llc_handle, tvb, pinfo, tree);
3192 return tvb_captured_length(tvb);
3195 static void l2tp_cleanup(void)
3197 GSList *iterator = list_heads;
3200 g_slist_free((GSList *)iterator->data);
3201 iterator = g_slist_next(iterator);
3204 if (list_heads != NULL) {
3205 g_slist_free(list_heads);
3210 /* registration with the filtering engine */
3212 proto_register_l2tp(void)
3214 static hf_register_info hf[] = {
3216 { "Type", "l2tp.type", FT_UINT16, BASE_DEC, VALS(l2tp_type_vals), 0x8000,
3217 "Type bit", HFILL }},
3219 { &hf_l2tp_length_bit,
3220 { "Length Bit", "l2tp.length_bit", FT_BOOLEAN, 16, TFS(&l2tp_length_bit_truth), 0x4000,
3224 { "Sequence Bit", "l2tp.seq_bit", FT_BOOLEAN, 16, TFS(&l2tp_seq_bit_truth), 0x0800,
3227 { &hf_l2tp_offset_bit,
3228 { "Offset bit", "l2tp.offset_bit", FT_BOOLEAN, 16, TFS(&l2tp_offset_bit_truth), 0x0200,
3231 { &hf_l2tp_priority,
3232 { "Priority", "l2tp.priority", FT_BOOLEAN, 16, TFS(&l2tp_priority_truth), 0x0100,
3233 "Priority bit", HFILL }},
3236 { "Version", "l2tp.version", FT_UINT16, BASE_DEC, NULL, 0x000f,
3240 { "Length","l2tp.length", FT_UINT16, BASE_DEC, NULL, 0x0,
3244 { "Tunnel ID","l2tp.tunnel", FT_UINT16, BASE_DEC, NULL, 0x0, /* Probably should be FT_BYTES */
3248 { "Session ID","l2tp.session", FT_UINT16, BASE_DEC, NULL, 0x0, /* Probably should be FT_BYTES */
3252 { "Ns","l2tp.Ns", FT_UINT16, BASE_DEC, NULL, 0x0,
3256 { "Nr","l2tp.Nr", FT_UINT16, BASE_DEC, NULL, 0x0,
3260 { "Offset","l2tp.offset", FT_UINT16, BASE_DEC, NULL, 0x0,
3261 "Number of octets past the L2TP header at which the payload data starts.", HFILL }},
3263 { &hf_l2tp_avp_mandatory,
3264 { "Mandatory", "l2tp.avp.mandatory", FT_BOOLEAN, 16, NULL, 0x8000,
3267 { &hf_l2tp_avp_hidden,
3268 { "Hidden", "l2tp.avp.hidden", FT_BOOLEAN, 16, NULL, 0x4000,
3271 { &hf_l2tp_avp_length,
3272 { "Length", "l2tp.avp.length", FT_UINT16, BASE_DEC, NULL, 0x03ff,
3275 { &hf_l2tp_avp_vendor_id,
3276 { "Vendor ID", "l2tp.avp.vendor_id", FT_UINT16, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0,
3277 "AVP Vendor ID", HFILL }},
3279 { &hf_l2tp_avp_type,
3280 { "AVP Type", "l2tp.avp.type", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &avp_type_vals_ext, 0,
3283 { &hf_l2tp_tie_breaker,
3284 { "Tie Breaker", "l2tp.tie_breaker", FT_UINT64, BASE_HEX, NULL, 0,
3288 { "Session ID","l2tp.sid", FT_UINT32, BASE_DEC, NULL, 0x0,
3292 { "Control Connection ID","l2tp.ccid", FT_UINT32, BASE_DEC, NULL, 0x0,
3296 { "Reserved","l2tp.res", FT_UINT16, BASE_HEX, NULL, 0x0,
3300 { "Cookie","l2tp.cookie", FT_BYTES, BASE_NONE, NULL, 0x0,
3303 { &hf_l2tp_l2_spec_def,
3304 { "Default L2-Specific Sublayer","l2tp.l2_spec_def", FT_NONE, BASE_NONE, NULL, 0x0,
3307 { &hf_l2tp_l2_spec_atm,
3308 { "ATM-Specific Sublayer","l2tp.l2_spec_atm", FT_NONE, BASE_NONE, NULL, 0x0,
3311 { &hf_l2tp_l2_spec_docsis_dmpt,
3312 { "DOCSIS DMPT - Specific Sublayer","l2tp.l2_spec_docsis_dmpt", FT_NONE, BASE_NONE, NULL, 0x0,
3315 { &hf_l2tp_l2_spec_v,
3316 { "V-bit","l2tp.l2_spec_v", FT_BOOLEAN, 8, NULL, 0x80,
3317 "VCCV Bit", HFILL }},
3319 { &hf_l2tp_l2_spec_s,
3320 { "S-bit","l2tp.l2_spec_s", FT_BOOLEAN, 8, NULL, 0x40,
3321 "Sequence Bit", HFILL }},
3323 { &hf_l2tp_l2_spec_h,
3324 { "H-bits","l2tp.l2_spec_h", FT_UINT8, BASE_HEX, NULL, 0x30,
3325 "Extended Header Bits", HFILL }},
3327 { &hf_l2tp_l2_spec_t,
3328 { "T-bit","l2tp.l2_spec_t", FT_BOOLEAN, 8, NULL, 0x08,
3329 "Transport Type Bit", HFILL }},
3331 { &hf_l2tp_l2_spec_g,
3332 { "G-bit","l2tp.l2_spec_g", FT_BOOLEAN, 8, NULL, 0x04,
3333 "EFCI Bit", HFILL }},
3335 { &hf_l2tp_l2_spec_c,
3336 { "C-bit","l2tp.l2_spec_c", FT_BOOLEAN, 8, NULL, 0x02,
3337 "CLP Bit", HFILL }},
3339 { &hf_l2tp_l2_spec_u,
3340 { "U-bit","l2tp.l2_spec_u", FT_BOOLEAN, 8, NULL, 0x01,
3341 "C/R Bit", HFILL }},
3343 { &hf_l2tp_l2_spec_flow_id,
3344 { "Flow ID","l2tp.l2_spec_flow_id", FT_UINT8, BASE_HEX, NULL, FLOW_ID_MASK,
3347 { &hf_l2tp_l2_spec_sequence,
3348 { "Sequence Number","l2tp.l2_spec_sequence", FT_UINT24, BASE_DEC, NULL, 0x0,
3351 { &hf_l2tp_cisco_avp_type,
3352 { "Type", "l2tp.avp.ciscotype", FT_UINT16, BASE_DEC, VALS(cisco_avp_type_vals), 0,
3353 "AVP Type", HFILL }},
3355 { &hf_l2tp_ericsson_avp_type,
3356 { "Type", "l2tp.avp.ericssontype", FT_UINT16, BASE_DEC, VALS(ericsson_avp_type_vals), 0,
3357 "AVP Type", HFILL }},
3359 { &hf_l2tp_broadband_avp_type,
3360 { "Type", "l2tp.avp.broadbandtype", FT_UINT16, BASE_DEC, VALS(broadband_avp_type_vals), 0,
3361 "AVP Type", HFILL }},
3363 { &hf_l2tp_cablelabs_avp_type,
3364 { "Type", "l2tp.avp.cablelabstype", FT_UINT16, BASE_DEC, VALS(cablelabs_avp_type_vals), 0,
3365 "AVP Type", HFILL }},
3367 { &hf_l2tp_avp_message_type,
3368 { "Message Type", "l2tp.avp.message_type", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &message_type_vals_ext, 0,
3371 { &hf_l2tp_avp_assigned_tunnel_id,
3372 { "Assigned Tunnel ID", "l2tp.avp.assigned_tunnel_id", FT_UINT16, BASE_DEC, NULL, 0,
3375 { &hf_l2tp_avp_assigned_control_conn_id,
3376 { "Assigned Control Connection ID", "l2tp.avp.assigned_control_conn_id", FT_UINT32, BASE_DEC, NULL, 0,
3379 { &hf_l2tp_avp_assigned_session_id,
3380 { "Assigned Session ID", "l2tp.avp.assigned_session_id", FT_UINT16, BASE_DEC, NULL, 0,
3383 { &hf_l2tp_avp_remote_session_id,
3384 { "Remote Session ID", "l2tp.avp.remote_session_id", FT_UINT32, BASE_DEC, NULL, 0,
3387 { &hf_l2tp_avp_local_session_id,
3388 { "Local Session ID", "l2tp.avp.local_session_id", FT_UINT32, BASE_DEC, NULL, 0,
3391 { &hf_l2tp_avp_called_number,
3392 { "Called Number", "l2tp.avp.called_number", FT_STRING, BASE_NONE, NULL, 0,
3395 { &hf_l2tp_avp_calling_number,
3396 { "Calling Number", "l2tp.avp.calling_number", FT_STRING, BASE_NONE, NULL, 0,
3399 { &hf_l2tp_cisco_tie_breaker,
3400 { "Tie Breaker", "l2tp.cisco.tie_breaker", FT_UINT64, BASE_HEX, NULL, 0,
3403 { &hf_l2tp_cablel_avp_l_bit,
3404 { "L(lock bit)", "l2tp.cablel.l_bit", FT_BOOLEAN, 16, NULL, 0x8000,
3407 { &hf_l2tp_cablel_avp_tsid_group_id,
3408 { "TSID Group ID", "l2tp.cablel.tsid_group_id", FT_UINT16, BASE_DEC, NULL, 0x7f00,
3411 { &hf_l2tp_cablel_avp_frequency,
3412 { "Frequency", "l2tp.cablel.frequency", FT_UINT32, BASE_DEC, NULL, 0,
3415 { &hf_l2tp_cablel_avp_modulation,
3416 { "Modulation", "l2tp.cablel.modulation", FT_UINT16, BASE_DEC, VALS(l2tp_cablel_modulation_vals), 0x000f,
3419 { &hf_l2tp_cablel_avp_m,
3420 { "M", "l2tp.cablel.m", FT_UINT16, BASE_DEC, NULL, 0x0,
3423 { &hf_l2tp_cablel_avp_n,
3424 { "N", "l2tp.cablel.n", FT_UINT16, BASE_DEC, NULL, 0x0,
3427 { &hf_l2tp_broadband_agent_circuit_id,
3428 { "Agent Circuit ID", "l2tp.broadband.agent_circuit_id", FT_STRING, BASE_NONE, NULL, 0x0,
3431 { &hf_l2tp_broadband_agent_remote_id,
3432 { "Agent Remote ID", "l2tp.broadband.agent_remote_id", FT_STRING, BASE_NONE, NULL, 0x0,
3435 { &hf_l2tp_broadband_actual_dr_up,
3436 { "Actual Data Rate Upstream", "l2tp.broadband.actual_dr_up", FT_UINT64, BASE_DEC, NULL, 0x0,
3437 "Actual Data Rate Upstream in bits per seconds", HFILL }},
3439 { &hf_l2tp_broadband_actual_dr_down,
3440 { "Actual Data Rate Downstream", "l2tp.broadband.actual_dr_down", FT_UINT64, BASE_DEC, NULL, 0x0,
3441 "Actual Data Rate Downstream in bits per seconds", HFILL }},
3443 { &hf_l2tp_broadband_minimum_dr_up,
3444 { "Minimum Data Rate Upstream", "l2tp.broadband.minimum_dr_up", FT_UINT64, BASE_DEC, NULL, 0x0,
3445 "Minimum Data Rate Upstream in bits per seconds", HFILL }},
3447 { &hf_l2tp_broadband_minimum_dr_down,
3448 { "Minimum Data Rate Downstream", "l2tp.broadband.minimum_dr_down", FT_UINT64, BASE_DEC, NULL, 0x0,
3449 "Minimum Data Rate Downstream in bits per seconds", HFILL }},
3451 { &hf_l2tp_broadband_attainable_dr_up,
3452 { "Attainable Data Rate Upstream", "l2tp.broadband.attainable_dr_up", FT_UINT64, BASE_DEC, NULL, 0x0,
3453 "Attainable Data Rate Upstream in bits per seconds", HFILL }},
3455 { &hf_l2tp_broadband_attainable_dr_down,
3456 { "Attainable Data Rate Downstream", "l2tp.broadband.attainable_dr_down", FT_UINT64, BASE_DEC, NULL, 0x0,
3457 "Attainable Data Rate Downstream in bits per seconds", HFILL }},
3459 { &hf_l2tp_broadband_maximum_dr_up,
3460 { "Maximum Data Rate Upstream", "l2tp.broadband.maximum_dr_up", FT_UINT64, BASE_DEC, NULL, 0x0,
3461 "Maximum Data Rate Upstream in bits per seconds", HFILL }},
3463 { &hf_l2tp_broadband_maximum_dr_down,
3464 { "Maximum Data Rate Downstream", "l2tp.broadband.maximum_dr_down", FT_UINT64, BASE_DEC, NULL, 0x0,
3465 "Maximum Data Rate Downstream in bits per seconds", HFILL }},
3467 { &hf_l2tp_broadband_minimum_dr_up_low_power,
3468 { "Minimum Data Rate Upstream Low-Power", "l2tp.broadband.minimum_dr_up_low_power", FT_UINT64, BASE_DEC, NULL, 0x0,
3469 "Minimum Data Rate Upstream Low-Power in bits per seconds", HFILL }},
3471 { &hf_l2tp_broadband_minimum_dr_down_low_power,
3472 { "Minimum Data Rate Downstream Low-Power", "l2tp.broadband.minimum_dr_down_low_power", FT_UINT64, BASE_DEC, NULL, 0x0,
3473 "Minimum Data Rate Downstream Low-Power in bits per seconds", HFILL }},
3475 { &hf_l2tp_broadband_maximum_interleaving_delay_up,
3476 { "Maximum Interleaving Dalay Upstream", "l2tp.broadband.maximum_interleaving_delay_up", FT_UINT32, BASE_DEC, NULL, 0x0,
3477 "Maximum Interleaving Dalay Upstream in ms", HFILL }},
3479 { &hf_l2tp_broadband_actual_interleaving_delay_up,
3480 { "Actual Interleaving Dalay Upstream", "l2tp.broadband.actual_interleaving_delay_up", FT_UINT32, BASE_DEC, NULL, 0x0,
3481 "Actual Interleaving Dalay Upstream in ms", HFILL }},
3483 { &hf_l2tp_broadband_maximum_interleaving_delay_down,
3484 { "Maximum Interleaving Dalay Downstream", "l2tp.broadband.maximum_interleaving_delay_down", FT_UINT32, BASE_DEC, NULL, 0x0,
3485 "Maximum Interleaving Dalay Downstream in ms", HFILL }},
3487 { &hf_l2tp_broadband_actual_interleaving_delay_down,
3488 { "Actual Interleaving Dalay Downstream", "l2tp.broadband.actual_interleaving_delay_down", FT_UINT32, BASE_DEC, NULL, 0x0,
3489 "Actual Interleaving Dalay Downstream in ms", HFILL }},
3491 { &hf_l2tp_broadband_access_loop_encapsulation,
3492 { "Access Loop Encapsulation", "l2tp.broadband.access_loop_encapsulation", FT_NONE, BASE_NONE, NULL, 0x0,
3495 { &hf_l2tp_broadband_access_loop_encapsulation_data_link,
3496 { "Data Link", "l2tp.broadband.access_loop_encapsulation.data_link", FT_UINT8, BASE_HEX, VALS(ale_datalink_types_vals), 0x0,
3499 { &hf_l2tp_broadband_access_loop_encapsulation_enc1,
3500 { "Encaps 1", "l2tp.broadband.access_loop_encapsulation.enc1", FT_UINT8, BASE_HEX, VALS(ale_enc1_types_vals), 0x0,
3503 { &hf_l2tp_broadband_access_loop_encapsulation_enc2,
3504 { "Encaps 2", "l2tp.broadband.access_loop_encapsulation.enc2", FT_UINT8, BASE_HEX, VALS(ale_enc2_types_vals), 0x0,
3507 { &hf_l2tp_broadband_ancp_access_line_type,
3508 { "ANCP Access Line Type", "l2tp.broadband.ancp_access_line_type", FT_UINT32, BASE_HEX, VALS(ancp_types_vals), 0x0,
3511 { &hf_l2tp_broadband_iwf_session,
3512 { "IWF Session", "l2tp.broadband.iwf_session", FT_UINT32, BASE_HEX, VALS(iwf_types_vals), 0x0,
3516 { "Connect Speed Update","l2tp.avp.csu", FT_NONE, BASE_NONE, NULL, 0x0,
3519 { &hf_l2tp_avp_csu_res,
3520 { "Reserved", "l2tp.avp.csu.res", FT_UINT16, BASE_HEX, NULL, 0x0,
3523 { &hf_l2tp_avp_csu_remote_session_id_v2,
3524 { "Remote Session ID", "l2tp.avp.csu.res", FT_UINT16, BASE_DEC_HEX, NULL, 0x0,
3527 { &hf_l2tp_avp_csu_current_tx_speed_v2,
3528 { "Current TX Connect Speed", "l2tp.avp.csu.current_tx_speed", FT_UINT32, BASE_DEC, NULL, 0x0,
3529 "Current TX Connect Speed in bps", HFILL }},
3531 { &hf_l2tp_avp_csu_current_rx_speed_v2,
3532 { "Current RX Connect Speed", "l2tp.avp.csu.current_rx_speed", FT_UINT32, BASE_DEC, NULL, 0x0,
3533 "Current RX Connect Speed in bps", HFILL }},
3535 { &hf_l2tp_avp_csu_remote_session_id_v3,
3536 { "Remote Session ID", "l2tp.avp.csu.res", FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
3539 { &hf_l2tp_avp_csu_current_tx_speed_v3,
3540 { "Current TX Connect Speed", "l2tp.avp.csu.current_tx_speed64", FT_UINT64, BASE_DEC, NULL, 0x0,
3541 "Current TX Connect Speed in bps", HFILL }},
3543 { &hf_l2tp_avp_csu_current_rx_speed_v3,
3544 { "Current RX Connect Speed", "l2tp.avp.csu.current_rx_speed64", FT_UINT64, BASE_DEC, NULL, 0x0,
3545 "Current RX Connect Speed in bps", HFILL }},
3547 { &hf_l2tp_ericsson_msg_type,
3548 { "Ericsson Message Type", "l2tp.ericsson.msg_type", FT_UINT16, BASE_DEC, VALS(ericsson_msg_type_vals), 0x0,
3551 { &hf_l2tp_ericsson_conn_type,
3552 { "Connection Type", "l2tp.ericsson.conn_type", FT_UINT8, BASE_DEC, VALS(ericsson_conn_type_vals), 0x0,
3555 { &hf_l2tp_ericsson_stn_name,
3556 { "STN Name", "l2tp.ericsson.stn_name", FT_STRING, BASE_NONE, NULL, 0x0,
3559 { &hf_l2tp_ericsson_crc32_enable,
3560 { "CRC32 Enabled", "l2tp.ericsson.crc32_enable", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3563 { &hf_l2tp_ericsson_abis_lower_mode,
3564 { "Abis Lower Type", "l2tp.ericsson.abis_lower_mode", FT_UINT8, BASE_DEC, VALS(ericsson_abis_lower_mode_vals), 0x0,
3567 { &hf_l2tp_ericsson_tc_overl_thresh,
3568 { "Overload Threshold in 0.1%", "l2tp.ericsson.overload_thresh", FT_UINT16, BASE_DEC, NULL, 0x0,
3571 { &hf_l2tp_ericsson_tc_num_groups,
3572 { "Number of Transport Config Groups", "l2tp.ericsson.tc_num_groups", FT_UINT8, BASE_DEC, NULL, 0x0,
3575 { &hf_l2tp_ericsson_tcg_group_id,
3576 { "Transport Config Group ID", "l2tp.ericsson.tc_group_id", FT_UINT8, BASE_DEC, NULL, 0x0,
3579 { &hf_l2tp_ericsson_tcg_num_sapis,
3580 { "Number of SAPIs in Transport Group", "l2tp.ericsson.tc_num_sapi", FT_UINT8, BASE_DEC, NULL, 0x0,
3583 { &hf_l2tp_ericsson_tcg_sapi,
3584 { "TCG SAPI", "l2tp.ericsson.tcg_sapi", FT_UINT8, BASE_DEC, NULL, 0x0,
3587 { &hf_l2tp_ericsson_tcg_ip,
3588 { "TCG IP Address", "l2tp.ericsson.tcg_ip", FT_IPv4, BASE_NONE, NULL, 0x0,
3591 { &hf_l2tp_ericsson_tcg_dscp,
3592 { "TCG DSCP", "l2tp.ericsson.tcg_dscp", FT_UINT8, BASE_HEX, NULL, 0x0,
3595 { &hf_l2tp_ericsson_tcg_crc32_enable,
3596 { "CRC32 Enabled", "l2tp.ericsson.crc32_en", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
3599 { &hf_l2tp_ericsson_tcg_bundling_tout,
3600 { "TCG Bundling Timeout (ms)", "l2tp.ericsson.gcg.bundle_tout", FT_UINT8, BASE_DEC, NULL, 0x0,
3603 { &hf_l2tp_ericsson_tcg_bundling_max_pkt,
3604 { "TCG Bundling Max Packet Size", "l2tp.ericsson.tcg.bundle_max_pkt", FT_UINT16, BASE_DEC, NULL, 0x0,
3607 { &hf_l2tp_ericsson_tc_num_maps,
3608 { "Number of TEI-SC Maps", "l2tp.ericsson.num_maps", FT_UINT8, BASE_DEC, NULL, 0x0,
3611 { &hf_l2tp_ericsson_map_tei_low,
3612 { "TEI Range Lowest Value", "l2tp.ericsson.map_tei_low", FT_UINT8, BASE_DEC, NULL, 0x0,
3615 { &hf_l2tp_ericsson_map_tei_high,
3616 { "TEI Range Highest Value", "l2tp.ericsson.map_tei_high", FT_UINT8, BASE_DEC, NULL, 0x0,
3619 { &hf_l2tp_ericsson_map_sc,
3620 { "Super Channel", "l2tp.ericsson.map_ssc", FT_UINT8, BASE_DEC, NULL, 0x0,
3623 { &hf_l2tp_ericsson_ver_pref,
3624 { "Preferred/Chosen Version", "l2tp.ericsson.ver_pref", FT_UINT32, BASE_DEC, NULL, 0x0,
3627 { &hf_l2tp_ericsson_ver_2,
3628 { "Version (2)", "l2tp.ericsson.ver_2", FT_UINT32, BASE_DEC, NULL, 0x0,
3631 { &hf_l2tp_ericsson_ver_3,
3632 { "Version (3)", "l2tp.ericsson.ver_3", FT_UINT32, BASE_DEC, NULL, 0x0,
3635 /* Generated from convert_proto_tree_add_text.pl */
3636 { &hf_l2tp_cisco_assigned_control_connection_id, { "Assigned Control Connection ID", "l2tp.cisco.assigned_control_connection_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3637 { &hf_l2tp_cisco_pw_type, { "PW Type", "l2tp.cisco.pw_type", FT_UINT16, BASE_DEC, VALS(pw_types_vals), 0x0, NULL, HFILL }},
3638 { &hf_l2tp_cisco_local_session_id, { "Local Session ID", "l2tp.cisco.local_session_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3639 { &hf_l2tp_cisco_remote_session_id, { "Remote Session ID", "l2tp.cisco.remote_session_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3640 { &hf_l2tp_cisco_assigned_cookie, { "Assigned Cookie", "l2tp.cisco.assigned_cookie", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3641 { &hf_l2tp_cisco_remote_end_id, { "Remote End ID", "l2tp.cisco.remote_end_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3642 { &hf_l2tp_cisco_pseudowire_type, { "Pseudowire Type", "l2tp.cisco.pseudowire_type", FT_UINT16, BASE_DEC, VALS(pw_types_vals), 0x0, NULL, HFILL }},
3643 { &hf_l2tp_cisco_circuit_status, { "Circuit Status", "l2tp.cisco.circuit_status", FT_BOOLEAN, 16, TFS(&tfs_up_down), 0x0001, NULL, HFILL }},
3644 { &hf_l2tp_cisco_circuit_type, { "Circuit Type", "l2tp.cisco.circuit_type", FT_BOOLEAN, 16, TFS(&tfs_new_existing), 0x0001, NULL, HFILL }},
3645 { &hf_l2tp_cisco_draft_avp_version, { "Draft AVP Version", "l2tp.cisco.draft_avp_version", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3646 { &hf_l2tp_cisco_message_digest, { "Message Digest", "l2tp.cisco.message_digest", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3647 { &hf_l2tp_cisco_nonce, { "Nonce", "l2tp.cisco.nonce", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3648 { &hf_l2tp_cisco_interface_mtu, { "Interface MTU", "l2tp.cisco.interface_mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3649 { &hf_l2tp_stop_ccn_result_code, { "Result code", "l2tp.result_code", FT_UINT16, BASE_DEC, VALS(result_code_stopccn_vals), 0x0, NULL, HFILL }},
3650 { &hf_l2tp_result_code, { "Result code", "l2tp.result_code", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &result_code_cdn_vals_ext, 0x0, NULL, HFILL }},
3651 { &hf_l2tp_avp_error_code, { "Error code", "l2tp.avp.error_code", FT_UINT16, BASE_DEC, VALS(error_code_vals), 0x0, NULL, HFILL }},
3652 { &hf_l2tp_avp_error_message, { "Error Message", "l2tp.avp.error_message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3653 { &hf_l2tp_avp_protocol_version, { "Version", "l2tp.avp.protocol_version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3654 { &hf_l2tp_avp_protocol_revision, { "Revision", "l2tp.avp.protocol_revision", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3655 { &hf_l2tp_avp_async_framing_supported, { "Async Framing Supported", "l2tp.avp.async_framing_supported", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0002, NULL, HFILL }},
3656 { &hf_l2tp_avp_sync_framing_supported, { "Sync Framing Supported", "l2tp.avp.sync_framing_supported", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0001, NULL, HFILL }},
3657 { &hf_l2tp_avp_analog_access_supported, { "Analog Access Supported", "l2tp.avp.analog_access_supported", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0002, NULL, HFILL }},
3658 { &hf_l2tp_avp_digital_access_supported, { "Digital Access Supported", "l2tp.avp.digital_access_supported", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0001, NULL, HFILL }},
3659 { &hf_l2tp_avp_firmware_revision, { "Firmware Revision", "l2tp.avp.firmware_revision", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
3660 { &hf_l2tp_avp_host_name, { "Host Name", "l2tp.avp.host_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3661 { &hf_l2tp_avp_vendor_name, { "Vendor Name", "l2tp.avp.vendor_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3662 { &hf_l2tp_avp_receive_window_size, { "Receive Window Size", "l2tp.avp.receive_window_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3663 { &hf_l2tp_avp_chap_challenge, { "CHAP Challenge", "l2tp.avp.chap_challenge", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3664 { &hf_l2tp_avp_cause_code, { "Cause Code", "l2tp.avp.cause_code", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3665 { &hf_l2tp_avp_cause_msg, { "Cause Msg", "l2tp.avp.cause_msg", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3666 { &hf_l2tp_avp_advisory_msg, { "Advisory Msg", "l2tp.avp.advisory_msg", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3667 { &hf_l2tp_avp_chap_challenge_response, { "CHAP Challenge Response", "l2tp.avp.chap_challenge_response", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3668 { &hf_l2tp_avp_call_serial_number, { "Call Serial Number", "l2tp.avp.call_serial_number", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3669 { &hf_l2tp_avp_minimum_bps, { "Minimum BPS", "l2tp.avp.minimum_bps", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3670 { &hf_l2tp_avp_maximum_bps, { "Maximum BPS", "l2tp.avp.maximum_bps", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3671 { &hf_l2tp_avp_analog_bearer_type, { "Analog Bearer Type", "l2tp.avp.analog_bearer_type", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0002, NULL, HFILL }},
3672 { &hf_l2tp_avp_digital_bearer_type, { "Digital Bearer Type", "l2tp.avp.digital_bearer_type", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0001, NULL, HFILL }},
3673 { &hf_l2tp_avp_async_framing_type, { "Async Framing Type", "l2tp.avp.async_framing_type", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0002, NULL, HFILL }},
3674 { &hf_l2tp_avp_sync_framing_type, { "Sync Framing Type", "l2tp.avp.sync_framing_type", FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x0001, NULL, HFILL }},
3675 { &hf_l2tp_avp_sub_address, { "Sub-Address", "l2tp.avp.sub_address", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3676 { &hf_l2tp_avp_connect_speed, { "Connect Speed", "l2tp.avp.connect_speed", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3677 { &hf_l2tp_avp_physical_channel, { "Physical Channel", "l2tp.avp.physical_channel", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3678 { &hf_l2tp_avp_initial_received_lcp_confreq, { "Initial Received LCP CONFREQ", "l2tp.avp.initial_received_lcp_confreq", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3679 { &hf_l2tp_avp_last_sent_lcp_confreq, { "Last Sent LCP CONFREQ", "l2tp.avp.last_sent_lcp_confreq", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3680 { &hf_l2tp_avp_last_received_lcp_confreq, { "Last Received LCP CONFREQ", "l2tp.avp.last_received_lcp_confreq", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3681 { &hf_l2tp_avp_proxy_authen_type, { "Proxy Authen Type", "l2tp.avp.proxy_authen_type", FT_UINT16, BASE_DEC, VALS(authen_type_vals), 0x0, NULL, HFILL }},
3682 { &hf_l2tp_avp_proxy_authen_name, { "Proxy Authen Name", "l2tp.avp.proxy_authen_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3683 { &hf_l2tp_avp_proxy_authen_challenge, { "Proxy Authen Challenge", "l2tp.avp.proxy_authen_challenge", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3684 { &hf_l2tp_avp_proxy_authen_id, { "Proxy Authen ID", "l2tp.avp.proxy_authen_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3685 { &hf_l2tp_avp_proxy_authen_response, { "Proxy Authen Response", "l2tp.avp.proxy_authen_response", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3686 { &hf_l2tp_avp_crc_errors, { "CRC Errors", "l2tp.avp.crc_errors", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3687 { &hf_l2tp_avp_framing_errors, { "Framing Errors", "l2tp.avp.framing_errors", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3688 { &hf_l2tp_avp_hardware_overruns, { "Hardware Overruns", "l2tp.avp.hardware_overruns", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3689 { &hf_l2tp_avp_buffer_overruns, { "Buffer Overruns", "l2tp.avp.buffer_overruns", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3690 { &hf_l2tp_avp_time_out_errors, { "Time-out Errors", "l2tp.avp.time_out_errors", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3691 { &hf_l2tp_avp_alignment_errors, { "Alignment Errors", "l2tp.avp.alignment_errors", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3692 { &hf_l2tp_avp_send_accm, { "Send ACCM", "l2tp.avp.send_accm", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3693 { &hf_l2tp_avp_receive_accm, { "Receive ACCM", "l2tp.avp.receive_accm", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3694 { &hf_l2tp_avp_random_vector, { "Random Vector", "l2tp.avp.random_vector", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3695 { &hf_l2tp_avp_private_group_id, { "Private Group ID", "l2tp.avp.private_group_id", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3696 { &hf_l2tp_avp_rx_connect_speed, { "Rx Connect Speed", "l2tp.avp.rx_connect_speed", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3697 { &hf_l2tp_avp_disconnect_code, { "Disconnect Code", "l2tp.avp.disconnect_code", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3698 { &hf_l2tp_avp_control_protocol_number, { "Control Protocol Number", "l2tp.avp.control_protocol_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3699 { &hf_l2tp_avp_cause_code_direction, { "Direction", "l2tp.avp.cause_code_direction", FT_UINT8, BASE_DEC, VALS(cause_code_direction_vals), 0x0, NULL, HFILL }},
3700 { &hf_l2tp_avp_cause_code_message, { "Message", "l2tp.avp.cause_code_message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3701 { &hf_l2tp_avp_message_digest, { "Message Digest", "l2tp.avp.message_digest", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3702 { &hf_l2tp_avp_router_id, { "Router ID", "l2tp.avp.router_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3703 { &hf_l2tp_avp_pw_type, { "PW Type", "l2tp.avp.pw_type", FT_UINT16, BASE_DEC, VALS(pw_types_vals), 0x0, NULL, HFILL }},
3704 { &hf_l2tp_avp_assigned_cookie, { "Assigned Cookie", "l2tp.avp.assigned_cookie", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3705 { &hf_l2tp_avp_remote_end_id, { "Remote End ID", "l2tp.avp.remote_end_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3706 { &hf_l2tp_avp_pseudowire_type, { "Pseudowire Type", "l2tp.avp.pseudowire_type", FT_UINT16, BASE_DEC, VALS(pw_types_vals), 0x0, NULL, HFILL }},
3707 { &hf_l2tp_avp_layer2_specific_sublayer, { "Layer2 Specific Sublayer", "l2tp.avp.layer2_specific_sublayer", FT_UINT16, BASE_DEC, VALS(l2_sublayer_vals), 0x0, NULL, HFILL }},
3708 { &hf_l2tp_avp_data_sequencing, { "Data Sequencing", "l2tp.avp.data_sequencing", FT_UINT16, BASE_DEC, VALS(data_sequencing_vals), 0x0, NULL, HFILL }},
3709 { &hf_l2tp_avp_circuit_status, { "Circuit Status", "l2tp.avp.circuit_status", FT_BOOLEAN, 16, TFS(&tfs_up_down), 0x0001, NULL, HFILL }},
3710 { &hf_l2tp_avp_circuit_type, { "Circuit Type", "l2tp.avp.circuit_type", FT_BOOLEAN, 16, TFS(&tfs_new_existing), 0x0002, NULL, HFILL }},
3711 { &hf_l2tp_avp_preferred_language, { "Preferred Language", "l2tp.avp.preferred_language", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3712 { &hf_l2tp_avp_nonce, { "Nonce", "l2tp.avp.nonce", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3713 { &hf_l2tp_avp_tx_connect_speed_v3, { "Tx Connect Speed v3", "l2tp.avp.tx_connect_speed_v3", FT_UINT64, BASE_HEX|BASE_VAL64_STRING|BASE_SPECIAL_VALS, VALS64(unique_indeterminable_or_no_link), 0x0, NULL, HFILL }},
3714 { &hf_l2tp_avp_rx_connect_speed_v3, { "Rx Connect Speed v3", "l2tp.avp.rx_connect_speed_v3", FT_UINT64, BASE_HEX|BASE_VAL64_STRING|BASE_SPECIAL_VALS, VALS64(unique_indeterminable_or_no_link), 0x0, NULL, HFILL }},
3715 { &hf_l2tp_lapd_info, { "LAPD info", "l2tp.lapd_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3716 { &hf_l2tp_session_id, { "Packet Type", "l2tp.session_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
3717 { &hf_l2tp_zero_length_body_message, { "Zero Length Body message", "l2tp.zero_length_body_message", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3718 { &hf_l2tp_offset_padding, { "Offset Padding", "l2tp.offset_padding", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
3721 static gint *ett[] = {
3730 &ett_l2tp_ericsson_tcg,
3731 &ett_l2tp_ericsson_map,
3734 static ei_register_info ei[] = {
3735 { &ei_l2tp_incorrect_digest, { "l2tp.incorrect_digest", PI_CHECKSUM, PI_WARN, "Incorrect Digest", EXPFILL }},
3736 /* Generated from convert_proto_tree_add_text.pl */
3737 { &ei_l2tp_vendor_specific_avp_data, { "l2tp.vendor_specific_avp_data", PI_UNDECODED, PI_WARN, "Vendor-Specific AVP data", EXPFILL }},
3738 { &ei_l2tp_avp_length, { "l2tp.avp_length.bad", PI_MALFORMED, PI_ERROR, "Bad AVP length", EXPFILL }},
3741 module_t *l2tp_module;
3742 expert_module_t* expert_l2tp;
3744 /* Decode As handling */
3745 static build_valid_func l2tp_da_build_value[1] = {l2tp_value};
3746 static decode_as_value_t l2tp_da_values = {l2tp_prompt, 1, l2tp_da_build_value};
3747 static decode_as_t l2tp_da = {"l2tp", "L2TPv3 payload", "l2tp.pw_type", 1, 0, &l2tp_da_values, NULL, NULL,
3748 decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL};
3750 proto_l2tp = proto_register_protocol(
3751 "Layer 2 Tunneling Protocol", "L2TP", "l2tp");
3752 proto_register_field_array(proto_l2tp, hf, array_length(hf));
3753 proto_register_subtree_array(ett, array_length(ett));
3754 expert_l2tp = expert_register_protocol(proto_l2tp);
3755 expert_register_field_array(expert_l2tp, ei, array_length(ei));
3757 l2tp_vendor_avp_dissector_table = register_dissector_table("l2tp.vendor_avp", "L2TP vendor AVP dissector table", proto_l2tp, FT_UINT32, BASE_DEC);
3758 pw_type_table = register_dissector_table("l2tp.pw_type", "L2TPv3 payload type", proto_l2tp, FT_UINT32, BASE_DEC);
3760 l2tp_module = prefs_register_protocol(proto_l2tp, NULL);
3762 prefs_register_enum_preference(l2tp_module,
3764 "L2TPv3 Cookie Size",
3765 "L2TPv3 Cookie Size",
3770 prefs_register_enum_preference(l2tp_module,
3772 "L2TPv3 L2-Specific Sublayer",
3773 "L2TPv3 L2-Specific Sublayer",
3774 &l2tpv3_l2_specific,
3775 l2tpv3_l2_specifics,
3778 prefs_register_obsolete_preference(l2tp_module, "protocol");
3780 prefs_register_string_preference(l2tp_module,"shared_secret","Shared Secret",
3781 "Shared secret used for control message digest authentication",
3784 register_cleanup_routine(l2tp_cleanup);
3785 register_decode_as(&l2tp_da);
3789 proto_reg_handoff_l2tp(void)
3791 dissector_handle_t atm_oam_llc_handle;
3793 l2tp_udp_handle = create_dissector_handle(dissect_l2tp_udp, proto_l2tp);
3794 dissector_add_uint_with_preference("udp.port", UDP_PORT_L2TP, l2tp_udp_handle);
3796 l2tp_ip_handle = create_dissector_handle(dissect_l2tp_ip, proto_l2tp);
3797 dissector_add_uint("ip.proto", IP_PROTO_L2TP, l2tp_ip_handle);
3800 * Get a handle for the PPP-in-HDLC-like-framing dissector.
3802 ppp_hdlc_handle = find_dissector_add_dependency("ppp_hdlc", proto_l2tp);
3803 ppp_lcp_options_handle = find_dissector_add_dependency("ppp_lcp_options", proto_l2tp);
3805 /* Register vendor AVP dissector(s)*/
3806 dissector_add_uint("l2tp.vendor_avp", VENDOR_CABLELABS, create_dissector_handle(dissect_l2tp_vnd_cablelabs_avps, proto_l2tp));
3810 * Get a handle for the dissectors used in v3.
3812 atm_oam_handle = find_dissector_add_dependency("atm_oam_cell", proto_l2tp);
3813 llc_handle = find_dissector_add_dependency("llc", proto_l2tp);
3815 atm_oam_llc_handle = create_dissector_handle( dissect_atm_oam_llc, proto_l2tp );
3816 dissector_add_uint("l2tp.pw_type", L2TPv3_PROTOCOL_AAL5, atm_oam_llc_handle);
3820 * Editor modelines - http://www.wireshark.org/tools/modelines.html
3825 * indent-tabs-mode: nil
3828 * vi: set shiftwidth=4 tabstop=8 expandtab:
3829 * :indentSize=4:tabSize=8:noTabs=true: