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>
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 * http://tools.ietf.org/html/rfc2661
35 * http://tools.ietf.org/html/rfc3931
37 * Layer Two Tunneling Protocol "L2TP" number assignments:
38 * http://www.iana.org/assignments/l2tp-parameters
42 * RFC 4591 for Frame Relay
43 * http://tools.ietf.org/html/rfc4591
46 * http://tools.ietf.org/html/rfc4454
48 * RFC 4719 for Ethernet
49 * http://tools.ietf.org/html/rfc4719
52 * http://tools.ietf.org/html/rfc4349
54 * XXX - what about LAPD?
61 #include <wsutil/md5.h>
62 #include <wsutil/sha1.h>
64 #include <epan/packet.h>
65 #include <epan/addr_resolv.h>
66 #include <epan/ipproto.h>
67 #include <epan/sminmpec.h>
68 #include <epan/prefs.h>
69 #include <epan/conversation.h>
70 #include <epan/expert.h>
71 #include <epan/proto.h>
72 #include <epan/wmem/wmem.h>
74 #include "packet-l2tp.h"
76 static int proto_l2tp
= -1;
77 static int hf_l2tp_type
= -1;
78 static int hf_l2tp_length_bit
= -1;
79 static int hf_l2tp_seq_bit
= -1;
80 static int hf_l2tp_offset_bit
= -1;
81 static int hf_l2tp_priority
= -1;
82 static int hf_l2tp_version
= -1;
83 static int hf_l2tp_length
= -1;
84 static int hf_l2tp_tunnel
= -1;
85 static int hf_l2tp_session
= -1;
86 static int hf_l2tp_Ns
= -1;
87 static int hf_l2tp_Nr
= -1;
88 static int hf_l2tp_offset
= -1;
89 static int hf_l2tp_avp_mandatory
= -1;
90 static int hf_l2tp_avp_hidden
= -1;
91 static int hf_l2tp_avp_length
= -1;
92 static int hf_l2tp_avp_vendor_id
= -1;
93 static int hf_l2tp_avp_type
= -1;
94 static int hf_l2tp_tie_breaker
= -1;
95 static int hf_l2tp_sid
= -1;
96 static int hf_l2tp_res
= -1;
97 static int hf_l2tp_ccid
= -1;
98 static int hf_l2tp_cookie
= -1;
99 static int hf_l2tp_l2_spec_def
= -1;
100 static int hf_l2tp_l2_spec_atm
= -1;
101 static int hf_l2tp_l2_spec_docsis_dmpt
= -1;
102 static int hf_l2tp_l2_spec_v
= -1;
103 static int hf_l2tp_l2_spec_s
= -1;
104 static int hf_l2tp_l2_spec_flow_id
= -1;
105 static int hf_l2tp_l2_spec_sequence
= -1;
106 static int hf_l2tp_l2_spec_t
= -1;
107 static int hf_l2tp_l2_spec_g
= -1;
108 static int hf_l2tp_l2_spec_c
= -1;
109 static int hf_l2tp_l2_spec_u
= -1;
110 static int hf_l2tp_cisco_avp_type
= -1;
111 static int hf_l2tp_cablelabs_avp_type
= -1;
112 static int hf_l2tp_avp_message_type
= -1;
113 static int hf_l2tp_avp_assigned_tunnel_id
= -1;
114 static int hf_l2tp_avp_assigned_control_conn_id
= -1;
115 static int hf_l2tp_avp_assigned_session_id
= -1;
116 static int hf_l2tp_avp_remote_session_id
= -1;
117 static int hf_l2tp_avp_local_session_id
= -1;
118 static int hf_l2tp_avp_called_number
= -1;
119 static int hf_l2tp_avp_calling_number
= -1;
120 static int hf_l2tp_cisco_tie_breaker
= -1;
121 static int hf_l2tp_cablel_avp_l_bit
= -1;
122 static int hf_l2tp_cablel_avp_tsid_group_id
= -1;
123 static int hf_l2tp_cablel_avp_frequency
= -1;
124 static int hf_l2tp_cablel_avp_modulation
= -1;
125 static int hf_l2tp_cablel_avp_m
= -1;
126 static int hf_l2tp_cablel_avp_n
= -1;
128 /* Generated from convert_proto_tree_add_text.pl */
129 static int hf_l2tp_cisco_pw_type
= -1;
130 static int hf_l2tp_avp_error_code
= -1;
131 static int hf_l2tp_avp_cause_msg
= -1;
132 static int hf_l2tp_avp_host_name
= -1;
133 static int hf_l2tp_avp_maximum_bps
= -1;
134 static int hf_l2tp_avp_pseudowire_type
= -1;
135 static int hf_l2tp_avp_minimum_bps
= -1;
136 static int hf_l2tp_avp_nonce
= -1;
137 static int hf_l2tp_avp_circuit_status
= -1;
138 static int hf_l2tp_avp_receive_window_size
= -1;
139 static int hf_l2tp_avp_vendor_name
= -1;
140 static int hf_l2tp_avp_layer2_specific_sublayer
= -1;
141 static int hf_l2tp_avp_disconnect_code
= -1;
142 static int hf_l2tp_cisco_circuit_status
= -1;
143 static int hf_l2tp_cisco_remote_session_id
= -1;
144 static int hf_l2tp_avp_router_id
= -1;
145 static int hf_l2tp_avp_send_accm
= -1;
146 static int hf_l2tp_avp_last_sent_lcp_confreq
= -1;
147 static int hf_l2tp_avp_sync_framing_supported
= -1;
148 static int hf_l2tp_cisco_assigned_control_connection_id
= -1;
149 static int hf_l2tp_avp_sync_framing_type
= -1;
150 static int hf_l2tp_avp_assigned_cookie
= -1;
151 static int hf_l2tp_avp_time_out_errors
= -1;
152 static int hf_l2tp_avp_sub_address
= -1;
153 static int hf_l2tp_avp_connect_speed
= -1;
154 static int hf_l2tp_avp_analog_access_supported
= -1;
155 static int hf_l2tp_avp_private_group_id
= -1;
156 static int hf_l2tp_avp_proxy_authen_response
= -1;
157 static int hf_l2tp_avp_chap_challenge
= -1;
158 static int hf_l2tp_avp_call_serial_number
= -1;
159 static int hf_l2tp_avp_digital_access_supported
= -1;
160 static int hf_l2tp_avp_physical_channel
= -1;
161 static int hf_l2tp_avp_advisory_msg
= -1;
162 static int hf_l2tp_avp_data_sequencing
= -1;
163 static int hf_l2tp_avp_control_protocol_number
= -1;
164 static int hf_l2tp_avp_error_message
= -1;
165 static int hf_l2tp_avp_initial_received_lcp_confreq
= -1;
166 static int hf_l2tp_avp_async_framing_supported
= -1;
167 static int hf_l2tp_cisco_message_digest
= -1;
168 static int hf_l2tp_avp_circuit_type
= -1;
169 static int hf_l2tp_cisco_circuit_type
= -1;
170 static int hf_l2tp_avp_proxy_authen_challenge
= -1;
171 static int hf_l2tp_cisco_assigned_cookie
= -1;
172 static int hf_l2tp_avp_receive_accm
= -1;
173 static int hf_l2tp_stop_ccn_result_code
= -1;
174 static int hf_l2tp_avp_proxy_authen_id
= -1;
175 static int hf_l2tp_avp_digital_bearer_type
= -1;
176 static int hf_l2tp_avp_rx_connect_speed
= -1;
177 static int hf_l2tp_cisco_nonce
= -1;
178 static int hf_l2tp_avp_chap_challenge_response
= -1;
179 static int hf_l2tp_avp_cause_code
= -1;
180 static int hf_l2tp_avp_protocol_revision
= -1;
181 static int hf_l2tp_avp_alignment_errors
= -1;
182 static int hf_l2tp_avp_last_received_lcp_confreq
= -1;
183 static int hf_l2tp_avp_crc_errors
= -1;
184 static int hf_l2tp_avp_random_vector
= -1;
185 static int hf_l2tp_avp_preferred_language
= -1;
186 static int hf_l2tp_cisco_interface_mtu
= -1;
187 static int hf_l2tp_avp_async_framing_type
= -1;
188 static int hf_l2tp_avp_pw_type
= -1;
189 static int hf_l2tp_cisco_local_session_id
= -1;
190 static int hf_l2tp_avp_hardware_overruns
= -1;
191 static int hf_l2tp_avp_proxy_authen_type
= -1;
192 static int hf_l2tp_cisco_draft_avp_version
= -1;
193 static int hf_l2tp_avp_protocol_version
= -1;
194 static int hf_l2tp_result_code
= -1;
195 static int hf_l2tp_avp_buffer_overruns
= -1;
196 static int hf_l2tp_avp_remote_end_id
= -1;
197 static int hf_l2tp_cisco_pseudowire_type
= -1;
198 static int hf_l2tp_avp_message_digest
= -1;
199 static int hf_l2tp_avp_proxy_authen_name
= -1;
200 static int hf_l2tp_avp_analog_bearer_type
= -1;
201 static int hf_l2tp_avp_cause_code_direction
= -1;
202 static int hf_l2tp_avp_firmware_revision
= -1;
203 static int hf_l2tp_avp_cause_code_message
= -1;
204 static int hf_l2tp_avp_framing_errors
= -1;
205 static int hf_l2tp_cisco_remote_end_id
= -1;
206 static int hf_l2tp_avp_tx_connect_speed_v3
= -1;
207 static int hf_l2tp_avp_rx_connect_speed_v3
= -1;
209 static dissector_table_t l2tp_vendor_avp_dissector_table
;
211 #define UDP_PORT_L2TP 1701
213 #define CONTROL_BIT(msg_info) (msg_info & 0x8000) /* Type bit control = 1 data = 0 */
214 #define LENGTH_BIT(msg_info) (msg_info & 0x4000) /* Length bit = 1 */
215 #define RESERVE_BITS(msg_info) (msg_info &0x37F8) /* Reserved bit - usused */
216 #define SEQUENCE_BIT(msg_info) (msg_info & 0x0800) /* SEQUENCE bit = 1 Ns and Nr fields */
217 #define OFFSET_BIT(msg_info) (msg_info & 0x0200) /* Offset */
218 #define PRIORITY_BIT(msg_info) (msg_info & 0x0100) /* Priority */
219 #define L2TP_VERSION(msg_info) (msg_info & 0x000f) /* Version of l2tp */
220 #define MANDATORY_BIT(msg_info) (msg_info & 0x8000) /* Mandatory = 1 */
221 #define HIDDEN_BIT(msg_info) (msg_info & 0x4000) /* Hidden = 1 */
222 #define AVP_LENGTH(msg_info) (msg_info & 0x03ff) /* AVP Length */
223 #define FRAMING_SYNC(msg_info) (msg_info & 0x0001) /* SYNC Framing Type */
224 #define FRAMING_ASYNC(msg_info) (msg_info & 0x0002) /* ASYNC Framing Type */
225 #define BEARER_DIGITAL(msg_info) (msg_info & 0x0001) /* Digital Bearer Type */
226 #define BEARER_ANALOG(msg_info) (msg_info & 0x0002) /* Analog Bearer Type */
227 #define CIRCUIT_STATUS_BIT(msg_info) (msg_info & 0x0001) /* Circuit Status */
228 #define CIRCUIT_TYPE_BIT(msg_info) (msg_info & 0x0001) /* Circuit Condition */
230 /* DOCSIS DMPT Sub-Layer Header definitions */
231 #define FLOW_ID_MASK 0x0E
233 static gint ett_l2tp
= -1;
234 static gint ett_l2tp_ctrl
= -1;
235 static gint ett_l2tp_avp
= -1;
236 static gint ett_l2tp_avp_sub
= -1;
237 static gint ett_l2tp_lcp
= -1;
238 static gint ett_l2tp_l2_spec
= -1;
240 static expert_field ei_l2tp_incorrect_digest
= EI_INIT
;
242 static const enum_val_t l2tpv3_cookies
[] = {
243 {"detect", "Detect", -1},
244 {"cookie0", "None", 0},
245 {"cookie4", "4 Byte Cookie", 4},
246 {"cookie8", "8 Byte Cookie", 8},
250 #define L2TPv3_COOKIE_DEFAULT 0
252 #define L2TPv3_PROTOCOL_ETH 0
253 #define L2TPv3_PROTOCOL_CHDLC 1
254 #define L2TPv3_PROTOCOL_FR 2
255 #define L2TPv3_PROTOCOL_PPP 3
256 #define L2TPv3_PROTOCOL_IP 4
257 #define L2TPv3_PROTOCOL_MPLS 5
258 #define L2TPv3_PROTOCOL_AAL5 6
259 #define L2TPv3_PROTOCOL_LAPD 7
260 #define L2TPv3_PROTOCOL_DOCSIS_DMPT 8
261 #define L2TPv3_PROTOCOL_ERICSSON 9
262 #define L2TPv3_PROTOCOL_MAX (L2TPv3_PROTOCOL_ERICSSON + 1)
264 #define L2TPv3_PROTOCOL_DEFAULT L2TPv3_PROTOCOL_CHDLC
266 static const enum_val_t l2tpv3_protocols
[] = {
267 {"detect", "Detect", -1},
268 {"eth", "Ethernet", L2TPv3_PROTOCOL_ETH
},
269 {"chdlc", "Cisco HDLC", L2TPv3_PROTOCOL_CHDLC
},
270 {"fr", "Frame Relay", L2TPv3_PROTOCOL_FR
},
271 {"ppp", "PPP", L2TPv3_PROTOCOL_PPP
},
272 {"ip", "IP", L2TPv3_PROTOCOL_IP
},
273 {"mpls", "MPLS", L2TPv3_PROTOCOL_MPLS
},
274 {"aal5", "AAL5", L2TPv3_PROTOCOL_AAL5
},
275 {"lapd", "LAPD", L2TPv3_PROTOCOL_LAPD
},
276 {"docsis-dmpt", "DOCSIS-DMPT", L2TPv3_PROTOCOL_DOCSIS_DMPT
},
277 {"ehdlc", "Ericsson HDLC", L2TPv3_PROTOCOL_ERICSSON
},
281 #define L2TPv3_L2_SPECIFIC_NONE 0
282 #define L2TPv3_L2_SPECIFIC_DEFAULT 1
283 #define L2TPv3_L2_SPECIFIC_ATM 2
284 #define L2TPv3_L2_SPECIFIC_LAPD 3
285 #define L2TPv3_L2_SPECIFIC_DOCSIS_DMPT 4
286 #define L2TPv3_L2_SPECIFIC_MAX (L2TPv3_L2_SPECIFIC_DOCSIS_DMPT + 1)
288 static const enum_val_t l2tpv3_l2_specifics
[] = {
289 {"detect", "Detect", -1},
290 {"none", "None", L2TPv3_L2_SPECIFIC_NONE
},
291 {"default", "Default L2-Specific", L2TPv3_L2_SPECIFIC_DEFAULT
},
292 {"atm", "ATM-Specific", L2TPv3_L2_SPECIFIC_ATM
},
293 {"lapd", "LAPD-Specific", L2TPv3_L2_SPECIFIC_LAPD
},
294 {"dmpt", "DOCSIS DMPT-Specific", L2TPv3_L2_SPECIFIC_DOCSIS_DMPT
},
298 static gint l2tpv3_cookie
= -1;
299 static gint l2tpv3_protocol
= -1;
300 static gint l2tpv3_l2_specific
= -1;
302 #define MESSAGE_TYPE_SCCRQ 1
303 #define MESSAGE_TYPE_SCCRP 2
304 #define MESSAGE_TYPE_SCCCN 3
305 #define MESSAGE_TYPE_StopCCN 4
306 #define MESSAGE_TYPE_Reserved_5 5
307 #define MESSAGE_TYPE_HELLO 6
308 #define MESSAGE_TYPE_OCRQ 7
309 #define MESSAGE_TYPE_OCRP 8
310 #define MESSAGE_TYPE_OCCN 9
311 #define MESSAGE_TYPE_ICRQ 10
312 #define MESSAGE_TYPE_ICRP 11
313 #define MESSAGE_TYPE_ICCN 12
314 #define MESSAGE_TYPE_Reserved_13 13
315 #define MESSAGE_TYPE_CDN 14
316 #define MESSAGE_TYPE_WEN 15
317 #define MESSAGE_TYPE_SLI 16
318 #define MESSAGE_TYPE_MDMST 17
319 #define MESSAGE_TYPE_SRRQ 18
320 #define MESSAGE_TYPE_SRRP 19
321 #define MESSAGE_TYPE_ACK 20
322 #define MESSAGE_TYPE_FSQ 21
323 #define MESSAGE_TYPE_FSR 22
324 #define MESSAGE_TYPE_MSRQ 23
325 #define MESSAGE_TYPE_MSRP 24
326 #define MESSAGE_TYPE_MSE 25
327 #define MESSAGE_TYPE_MSI 26
328 #define MESSAGE_TYPE_MSEN 27
330 static const value_string message_type_vals
[] = {
331 { MESSAGE_TYPE_SCCRQ
, "Start_Control_Request" },
332 { MESSAGE_TYPE_SCCRP
, "Start_Control_Reply" },
333 { MESSAGE_TYPE_SCCCN
, "Start_Control_Connected" },
334 { MESSAGE_TYPE_StopCCN
, "Stop_Control_Notification" },
335 { MESSAGE_TYPE_Reserved_5
, "Reserved" },
336 { MESSAGE_TYPE_HELLO
, "Hello" },
337 { MESSAGE_TYPE_OCRQ
, "Outgoing_Call_Request" },
338 { MESSAGE_TYPE_OCRP
, "Outgoing_Call_Reply" },
339 { MESSAGE_TYPE_OCCN
, "Outgoing_Call_Connected" },
340 { MESSAGE_TYPE_ICRQ
, "Incoming_Call_Request" },
341 { MESSAGE_TYPE_ICRP
, "Incoming_Call_Reply" },
342 { MESSAGE_TYPE_ICCN
, "Incoming_Call_Connected" },
343 { MESSAGE_TYPE_Reserved_13
, "Reserved" },
344 { MESSAGE_TYPE_CDN
, "Call_Disconnect_Notification" },
345 { MESSAGE_TYPE_WEN
, "WAN_Error_Notify" },
346 { MESSAGE_TYPE_SLI
, "Set_Link_Info" },
347 { MESSAGE_TYPE_MDMST
, "Modem_Status" },
348 { MESSAGE_TYPE_SRRQ
, "Service_Relay_Request_Msg" },
349 { MESSAGE_TYPE_SRRP
, "Service_Relay_Reply_Message" },
350 { MESSAGE_TYPE_ACK
, "Explicit_Acknowledgement" },
351 /* Fail Over Extensions - RFC4951 */
352 { MESSAGE_TYPE_FSQ
, "Failover_Session_Query_Message" },
353 { MESSAGE_TYPE_FSR
, "Failover_Session_Response_Message" },
354 /* Multicast Management - RFC4045 */
355 { MESSAGE_TYPE_MSRQ
, "Multicast-Session-Request" },
356 { MESSAGE_TYPE_MSRP
, "Multicast-Session-Response" },
357 { MESSAGE_TYPE_MSE
, "Multicast-Session-Establishment" },
358 { MESSAGE_TYPE_MSI
, "Multicast-Session-Information" },
359 { MESSAGE_TYPE_MSEN
, "Multicast-Session-End-Notify" },
362 static value_string_ext message_type_vals_ext
= VALUE_STRING_EXT_INIT(message_type_vals
);
364 static const value_string l2tp_message_type_short_str_vals
[] = {
365 { MESSAGE_TYPE_SCCRQ
, "SCCRQ" },
366 { MESSAGE_TYPE_SCCRP
, "SCCRP" },
367 { MESSAGE_TYPE_SCCCN
, "SCCCN" },
368 { MESSAGE_TYPE_StopCCN
, "StopCCN" },
370 { MESSAGE_TYPE_HELLO
, "Hello" },
371 { MESSAGE_TYPE_OCRQ
, "OCRQ" },
372 { MESSAGE_TYPE_OCRP
, "OCRP" },
373 { MESSAGE_TYPE_OCCN
, "OCCN" },
374 { MESSAGE_TYPE_ICRQ
, "ICRQ" },
375 { MESSAGE_TYPE_ICRP
, "ICRP" },
376 { MESSAGE_TYPE_ICCN
, "ICCN" },
378 { MESSAGE_TYPE_CDN
, "CDN" },
379 { MESSAGE_TYPE_WEN
, "WEN" },
380 { MESSAGE_TYPE_SLI
, "SLI" },
381 { MESSAGE_TYPE_MDMST
, "MDMST" },
382 { MESSAGE_TYPE_SRRQ
, "SRRQ" },
383 { MESSAGE_TYPE_SRRP
, "SRRP" },
384 { MESSAGE_TYPE_ACK
, "ACK" },
385 /* Fail Over Extensions - RFC4951 */
386 { MESSAGE_TYPE_FSQ
, "FSQ" },
387 { MESSAGE_TYPE_FSR
, "FSR" },
388 /* Multicast Management - RFC4045 */
389 { MESSAGE_TYPE_MSRQ
, "MSRQ" },
390 { MESSAGE_TYPE_MSRP
, "MSRP" },
391 { MESSAGE_TYPE_MSE
, "MSE" },
392 { MESSAGE_TYPE_MSI
, "MSI" },
393 { MESSAGE_TYPE_MSEN
, "MSEN" },
396 static value_string_ext l2tp_message_type_short_str_vals_ext
= VALUE_STRING_EXT_INIT(l2tp_message_type_short_str_vals
);
399 static const char *control_msg
= "Control Message";
400 static const char *data_msg
= "Data Message";
401 static const value_string l2tp_type_vals
[] = {
402 { 0, "Data Message" },
403 { 1, "Control Message" },
407 static const value_string cause_code_direction_vals
[] = {
408 { 0, "global error" },
414 static const true_false_string l2tp_length_bit_truth
=
415 { "Length field is present", "Length field is not present" };
417 static const true_false_string l2tp_seq_bit_truth
=
418 { "Ns and Nr fields are present", "Ns and Nr fields are not present" };
420 static const true_false_string l2tp_offset_bit_truth
=
421 { "Offset Size field is present", "Offset size field is not present" };
423 static const true_false_string l2tp_priority_truth
=
424 { "This data message has priority", "No priority" };
426 static const value_string authen_type_vals
[] = {
428 { 1, "Textual username/password exchange" },
431 { 4, "No Authentication" },
432 { 5, "Microsoft CHAP Version 1" },
438 static const value_string data_sequencing_vals
[] = {
439 { 0, "No incoming data packets require sequencing" },
440 { 1, "Only non-IP data packets require sequencing" },
441 { 2, "All incoming data packets require sequencing" },
445 static const value_string l2_sublayer_vals
[] = {
446 { 0, "No L2-Specific Sublayer" },
447 { 1, "Default L2-Specific Sublayer present" },
448 { 2, "ATM-Specific Sublayer present" },
449 { 3, "MPT-Specific Sublayer" },
450 { 4, "PSP-Specific Sublayer" },
454 /* Result Code values for the StopCCN message */
455 static const value_string result_code_stopccn_vals
[] = {
457 { 1, "General request to clear control connection", },
458 { 2, "General error, Error Code indicates the problem", },
459 { 3, "Control connection already exists", },
460 { 4, "Requester is not authorized to establish a control connection", },
461 { 5, "The protocol version of the requester is not supported", },
462 { 6, "Requester is being shut down", },
463 { 7, "Finite state machine error or timeout", },
464 { 8, "Control connection due to mismatching CCDS value", }, /* [RFC3308] */
468 /* Result Code values for the CDN message */
469 static const value_string result_code_cdn_vals
[] = {
471 { 1, "Session disconnected due to loss of carrier or circuit disconnect", },
472 { 2, "Session disconnected for the reason indicated in Error Code", },
473 { 3, "Session disconnected for administrative reasons", },
474 { 4, "Appropriate facilities unavailable (temporary condition)", },
475 { 5, "Appropriate facilities unavailable (permanent condition)", },
476 { 6, "Invalid destination", },
477 { 7, "Call failed due to no carrier detected", },
478 { 8, "Call failed due to detection of a busy signal", },
479 { 9, "Call failed due to lack of a dial tone", },
480 { 10, "Call was not established within time allotted by LAC", },
481 { 11, "Call was connected but no appropriate framing was detected", },
482 { 12, "Disconnecting call due to mismatching SDS value", },
483 { 13, "Session not established due to losing tie breaker", },
484 { 14, "Session not established due to unsupported PW type", },
485 { 15, "Session not established, sequencing required without valid L2-Specific Sublayer", },
486 { 16, "Finite state machine error or timeout", },
487 { 17, "FR PVC was deleted permanently (no longer provisioned) ", }, /* [RFC4591] */
488 { 18, "FR PVC has been INACTIVE for an extended period of time", }, /* [RFC4591] */
489 { 19, "Mismatched FR Header Length", }, /* [RFC4591] */
490 { 20, "HDLC Link was deleted permanently (no longer provisioned)", }, /* [RFC4349] */
491 { 21, "HDLC Link has been INACTIVE for an extended period of time", }, /* [RFC4349] */
492 { 22, "Session not established due to other LCCE can not support the OAM Cell Emulation", }, /* [RFC4454] */
493 { 23, "Mismatching interface MTU", }, /* [RFC4667] */
494 { 24, "Attempt to connect to non-existent forwarder", }, /* [RFC4667] */
495 { 25, "Attempt to connect to unauthorized forwarder", }, /* [RFC4667] */
496 { 26, "Loop Detected", }, /* [draft-ietf-l2tpext-tunnel-switching-06.txt] */
497 { 27, "Attachment Circuit bound to different PE", }, /* [RFC6074] */
498 { 28, "Attachment Circuit bound to different remote Attachment Circuit", }, /* [RFC6074] */
499 { 29, "Unassigned", },
500 { 30, "Return code to indicate connection was refused because of TDM PW parameters. The error code indicates the problem.", }, /* [RFC5611] */
501 { 31, "Sequencing not supported", }, /* [RFC6073] */
504 static value_string_ext result_code_cdn_vals_ext
= VALUE_STRING_EXT_INIT(result_code_cdn_vals
);
507 static const value_string error_code_vals
[] = {
508 { 0, "No General Error", },
509 { 1, "No control connection exists yet for this pair of LCCEs", },
510 { 2, "Length is wrong", },
511 { 3, "One of the field values was out of range", },
512 { 4, "Insufficient resources to handle this operation now", },
513 { 5, "Invalid Session ID", },
514 { 6, "A generic vendor-specific error occurred", },
515 { 7, "Try another", },
516 { 8, "Receipt of an unknown AVP with the M bit set", },
517 { 9, "Try another directed", },
518 { 10, "Next hop unreachable", },
519 { 11, "Next hop busy", },
524 #define CONTROL_MESSAGE 0
525 #define RESULT_ERROR_CODE 1
526 #define PROTOCOL_VERSION 2
527 #define FRAMING_CAPABILITIES 3
528 #define BEARER_CAPABILITIES 4
529 #define TIE_BREAKER 5
530 #define FIRMWARE_REVISION 6
532 #define VENDOR_NAME 8
533 #define ASSIGNED_TUNNEL_ID 9
534 #define RECEIVE_WINDOW_SIZE 10
536 #define CAUSE_CODE 12
537 #define CHALLENGE_RESPONSE 13
538 #define ASSIGNED_SESSION 14
539 #define CALL_SERIAL_NUMBER 15
540 #define MINIMUM_BPS 16
541 #define MAXIMUM_BPS 17
542 #define BEARER_TYPE 18
543 #define FRAMING_TYPE 19
544 #define CALLED_NUMBER 21
545 #define CALLING_NUMBER 22
546 #define SUB_ADDRESS 23
547 #define TX_CONNECT_SPEED 24
548 #define PHYSICAL_CHANNEL 25
549 #define INITIAL_RECEIVED_LCP_CONFREQ 26
550 #define LAST_SENT_LCP_CONFREQ 27
551 #define LAST_RECEIVED_LCP_CONFREQ 28
552 #define PROXY_AUTHEN_TYPE 29
553 #define PROXY_AUTHEN_NAME 30
554 #define PROXY_AUTHEN_CHALLENGE 31
555 #define PROXY_AUTHEN_ID 32
556 #define PROXY_AUTHEN_RESPONSE 33
557 #define CALL_STATUS_AVPS 34
559 #define RANDOM_VECTOR 36
560 #define PRIVATE_GROUP_ID 37
561 #define RX_CONNECT_SPEED 38
562 #define SEQUENCING_REQUIRED 39
563 #define PPP_DISCONNECT_CAUSE_CODE 46 /* RFC 3145 */
564 #define EXTENDED_VENDOR_ID 58
565 #define MESSAGE_DIGEST 59
567 #define ASSIGNED_CONTROL_CONN_ID 61
568 #define PW_CAPABILITY_LIST 62
569 #define LOCAL_SESSION_ID 63
570 #define REMOTE_SESSION_ID 64
571 #define ASSIGNED_COOKIE 65
572 #define REMOTE_END_ID 66
574 #define L2_SPECIFIC_SUBLAYER 69
575 #define DATA_SEQUENCING 70
576 #define CIRCUIT_STATUS 71
577 #define PREFERRED_LANGUAGE 72
578 #define CTL_MSG_AUTH_NONCE 73
579 #define TX_CONNECT_SPEED_V3 74
580 #define RX_CONNECT_SPEED_V3 75
582 /* http://www.iana.org/assignments/l2tp-parameters/l2tp-parameters.xhtml */
583 #define NUM_AVP_TYPES 102
584 static const value_string avp_type_vals
[] = {
585 { CONTROL_MESSAGE
, "Control Message" },
586 { RESULT_ERROR_CODE
, "Result-Error Code" },
587 { PROTOCOL_VERSION
, "Protocol Version" },
588 { FRAMING_CAPABILITIES
, "Framing Capabilities" },
589 { BEARER_CAPABILITIES
, "Bearer Capabilities" },
590 { TIE_BREAKER
, "Tie Breaker" },
591 { FIRMWARE_REVISION
, "Firmware Revision" },
592 { HOST_NAME
, "Host Name" },
593 { VENDOR_NAME
, "Vendor Name" },
594 { ASSIGNED_TUNNEL_ID
, "Assigned Tunnel ID" },
595 { RECEIVE_WINDOW_SIZE
, "Receive Window Size" },
596 { CHALLENGE
, "Challenge" },
597 { CAUSE_CODE
, "Cause Code" },
598 { CHALLENGE_RESPONSE
, "Challenge Response" },
599 { ASSIGNED_SESSION
, "Assigned Session" },
600 { CALL_SERIAL_NUMBER
, "Call Serial Number" },
601 { MINIMUM_BPS
, "Minimum BPS" },
602 { MAXIMUM_BPS
, "Maximum BPS" },
603 { BEARER_TYPE
, "Bearer Type" },
604 { FRAMING_TYPE
, "Framing Type" },
606 { CALLED_NUMBER
, "Called Number" },
607 { CALLING_NUMBER
, "Calling Number" },
608 { SUB_ADDRESS
, "Sub-Address" },
609 { TX_CONNECT_SPEED
, "Connect Speed" },
610 { PHYSICAL_CHANNEL
, "Physical Channel" },
611 { INITIAL_RECEIVED_LCP_CONFREQ
, "Initial Received LCP CONFREQ" },
612 { LAST_SENT_LCP_CONFREQ
, "Last Sent LCP CONFREQ" },
613 { LAST_RECEIVED_LCP_CONFREQ
, "Last Received LCP CONFREQ" },
614 { PROXY_AUTHEN_TYPE
, "Proxy Authen Type" },
615 { PROXY_AUTHEN_NAME
, "Proxy Authen Name" },
616 { PROXY_AUTHEN_CHALLENGE
, "Proxy Authen Challenge" },
617 { PROXY_AUTHEN_ID
, "Proxy Authen ID" },
618 { PROXY_AUTHEN_RESPONSE
, "Proxy Authen Response" },
619 { CALL_STATUS_AVPS
, "Call status AVPs" },
621 { RANDOM_VECTOR
, "Random Vector" },
622 { PRIVATE_GROUP_ID
, "Private group ID" },
623 { RX_CONNECT_SPEED
, "RxConnect Speed" },
624 { SEQUENCING_REQUIRED
, "Sequencing Required" },
625 { PPP_DISCONNECT_CAUSE_CODE
, "PPP Disconnect Cause Code" },
626 { EXTENDED_VENDOR_ID
, "Extended Vendor ID" },
627 { MESSAGE_DIGEST
, "Message Digest" },
628 { ROUTER_ID
, "Router ID" },
629 { ASSIGNED_CONTROL_CONN_ID
, "Assigned Control Connection ID" },
630 { PW_CAPABILITY_LIST
, "Pseudowire Capability List" },
631 { LOCAL_SESSION_ID
, "Local Session ID" },
632 { REMOTE_SESSION_ID
, "Remote Session ID" },
633 { ASSIGNED_COOKIE
, "Assigned Cookie" },
634 { REMOTE_END_ID
, "Remote End ID" },
635 { PW_TYPE
, "Pseudowire Type" },
636 { L2_SPECIFIC_SUBLAYER
, "Layer2 Specific Sublayer" },
637 { DATA_SEQUENCING
, "Data Sequencing" },
638 { CIRCUIT_STATUS
, "Circuit Status" },
639 { PREFERRED_LANGUAGE
, "Preferred Language" },
640 { CTL_MSG_AUTH_NONCE
, "Control Message Authentication Nonce" },
641 { TX_CONNECT_SPEED_V3
, "Tx Connect Speed Version 3" },
642 { RX_CONNECT_SPEED_V3
, "Rx Connect Speed Version 3" },
643 { 76, "Failover Capability" }, /*[RFC4951] */
644 { 77, "Tunnel Recovery" }, /*[RFC4951] */
645 { 78, "Suggested Control Sequence" }, /*[RFC4951] */
646 { 79, "Failover Session State" }, /*[RFC4951] */
647 { 80, "Multicast Capability" }, /*[RFC4045] */
648 { 81, "New Outgoing Sessions" }, /*[RFC4045] */
649 { 82, "New Outgoing Sessions Acknowledgement" }, /*[RFC4045] */
650 { 83, "Withdraw Outgoing Sessions" }, /*[RFC4045] */
651 { 84, "Multicast Packets Priority" }, /*[RFC4045] */
652 { 85, "Frame-Relay Header Length" }, /*[RFC4591] */
653 { 86, "ATM Maximum Concatenated Cells AVP" }, /*[RFC4454] */
654 { 87, "OAM Emulation Required AVP" }, /*[RFC4454] */
655 { 88, "ATM Alarm Status AVP" }, /*[RFC4454] */
656 /* Also, see ATM Alarm Status AVP Values below */
657 { 89, "Attachment Group Identifier" }, /*[RFC4667] */
658 { 90, "Local End Identifier" }, /*[RFC4667] */
659 { 91, "Interface Maximum Transmission Unit" }, /*[RFC4667] */
660 { 92, "FCS Retention" }, /*[RFC4720] */
661 { 93, "Tunnel Switching Aggregator ID AVP" }, /*[draft-ietf-l2tpext-tunnel-switching-06.txt] */
662 { 94, "Maximum Receive Unit (MRU) AVP" }, /*[RFC4623] */
663 { 95, "Maximum Reassembled Receive Unit (MRRU) AVP" }, /*[RFC4623] */
664 { 96, "VCCV Capability AVP" }, /*[RFC5085] */
665 { 97, "Connect Speed Update AVP" }, /*[RFC5515] */
666 { 98, "Connect Speed Update Enable AVP" }, /*[RFC5515] */
667 { 99, "TDM Pseudowire AVP" }, /*[RFC5611] */
668 { 100, "RTP AVP" }, /*[RFC5611] */
669 { 101, "PW Switching Point AVP" }, /*[RFC6073] */
673 static value_string_ext avp_type_vals_ext
= VALUE_STRING_EXT_INIT(avp_type_vals
);
675 #define CISCO_ASSIGNED_CONNECTION_ID 1
676 #define CISCO_PW_CAPABILITY_LIST 2
677 #define CISCO_LOCAL_SESSION_ID 3
678 #define CISCO_REMOTE_SESSION_ID 4
679 #define CISCO_ASSIGNED_COOKIE 5
680 #define CISCO_REMOTE_END_ID 6
681 #define CISCO_PW_TYPE 7
682 #define CISCO_CIRCUIT_STATUS 8
683 #define CISCO_SESSION_TIE_BREAKER 9
684 #define CISCO_DRAFT_AVP_VERSION 10
685 #define CISCO_MESSAGE_DIGEST 12
686 #define CISCO_AUTH_NONCE 13
687 #define CISCO_INTERFACE_MTU 14
689 static const value_string cisco_avp_type_vals
[] = {
690 { CISCO_ASSIGNED_CONNECTION_ID
, "Assigned Connection ID" },
691 { CISCO_PW_CAPABILITY_LIST
, "Pseudowire Capabilities List" },
692 { CISCO_LOCAL_SESSION_ID
, "Local Session ID" },
693 { CISCO_REMOTE_SESSION_ID
, "Remote Session ID" },
694 { CISCO_ASSIGNED_COOKIE
, "Assigned Cookie" },
695 { CISCO_REMOTE_END_ID
, "Remote End ID" },
696 { CISCO_PW_TYPE
, "Pseudowire Type" },
697 { CISCO_CIRCUIT_STATUS
, "Circuit Status" },
698 { CISCO_SESSION_TIE_BREAKER
, "Session Tie Breaker" },
699 { CISCO_DRAFT_AVP_VERSION
, "Draft AVP Version" },
700 { CISCO_MESSAGE_DIGEST
, "Message Digest" },
701 { CISCO_AUTH_NONCE
, "Control Message Authentication Nonce" },
702 { CISCO_INTERFACE_MTU
, "Interface MTU" },
706 static const value_string cablelabs_avp_type_vals
[] = {
707 /* 7.5.2 DEPI Specific AVPs */
709 { 1, "DEPI Result Code" },
710 { 2, "DEPI Resource Allocation Request" },
711 { 3, "DEPI Resource Allocation Reply" },
712 { 4, "DEPI Local MTU" },
713 { 5, "DOCSIS SYNC Control" },
714 { 6, "EQAM Capability Bits" },
715 { 7, "DEPI Remote MTU" },
716 { 8, "DEPI Local UDP Port" },
717 { 9, "DPR Session Type" },
718 { 10, "DPR Session Status" },
719 /* 7.5.3 QAM Channel PHY AVPs */
720 { 100, "Downstream QAM Channel TSID Group" },
721 { 101, "Downstream QAM Channel Frequency" },
722 { 102, "Downstream QAM Channel Power" },
723 { 103, "Downstream QAM Channel Modulation" },
724 { 104, "Downstream QAM Channel J.83 Annex" },
725 { 105, "Downstream QAM Channel Symbol Rate" },
726 { 106, "Downstream QAM Channel Interleaver Depth" },
727 { 107, "Downstream QAM Channel RF Block Muting53" },
728 /* 7.5.4 DEPI Redundancy Capabilities AVPs */
729 { 200, "DEPI Redundancy Capabilities" },
733 static const value_string l2tp_cablel_modulation_vals
[] = {
739 static const value_string pw_types_vals
[] = {
740 { 0x0001, "Frame Relay DLCI" },
741 { 0x0002, "ATM AAL5 SDU VCC transport" },
742 { 0x0003, "ATM Cell transparent Port Mode" },
743 { 0x0004, "Ethernet VLAN" },
744 { 0x0005, "Ethernet" },
747 { 0x0009, "ATM Cell transport VCC Mode" },
748 { 0x000A, "ATM Cell transport VPC Mode" },
749 { 0x000B, "IP Transport" },
750 { 0x000C, "MPEG-TS Payload Type (MPTPW)" },
751 { 0x000D, "Packet Streaming Protocol (PSPPW)" },
752 /* 0x000E-0x0010 Unassigned */
753 { 0x0011, "Structure-agnostic E1 circuit" }, /* [RFC5611] */
754 { 0x0012, "Structure-agnostic T1 (DS1) circuit" }, /* [RFC5611] */
755 { 0x0013, "Structure-agnostic E3 circuit" }, /* [RFC5611] */
756 { 0x0014, "Structure-agnostic T3 (DS3) circuit" }, /* [RFC5611] */
757 { 0x0015, "CESoPSN basic mode" }, /* [RFC5611] */
758 { 0x0016, "Unassigned" },
759 { 0x0017, "CESoPSN TDM with CAS" }, /* [RFC5611] */
764 static const true_false_string tfs_up_down
= { "Up", "Down" };
765 static const true_false_string tfs_new_existing
= { "New", "Existing" };
767 static dissector_handle_t ppp_hdlc_handle
;
768 static dissector_handle_t ppp_lcp_options_handle
;
770 static dissector_handle_t eth_withoutfcs_handle
;
771 static dissector_handle_t chdlc_handle
;
772 static dissector_handle_t fr_handle
;
773 static dissector_handle_t ip_handle
;
774 static dissector_handle_t mpls_handle
;
775 static dissector_handle_t atm_oam_handle
;
776 static dissector_handle_t llc_handle
;
777 static dissector_handle_t lapd_handle
;
778 static dissector_handle_t mp2t_handle
;
779 static dissector_handle_t ehdlc_handle
;
780 static dissector_handle_t data_handle
;
782 static dissector_handle_t l2tp_udp_handle
;
783 static dissector_handle_t l2tp_ip_handle
;
785 #define L2TP_HMAC_MD5 0
786 #define L2TP_HMAC_SHA1 1
787 #define L2TP_HMAC_MD5_KEY_LEN 16
788 #define L2TP_HMAC_MD5_DIGEST_LEN 16
789 #define L2TP_HMAC_SHA1_DIGEST_LEN 20
791 typedef struct l2tpv3_conversation
{
797 struct l2tpv3_tunnel
*tunnel
;
798 } l2tpv3_conversation_t
;
800 typedef struct l2tpv3_tunnel
{
801 l2tpv3_conversation_t
*conv
;
806 gint lcce1_nonce_len
;
811 gint lcce2_nonce_len
;
813 gchar
*shared_key_secret
;
814 guint8 shared_key
[L2TP_HMAC_MD5_KEY_LEN
];
819 typedef struct lcce_settings
{
825 typedef struct l2tpv3_session
{
826 lcce_settings_t lcce1
;
827 lcce_settings_t lcce2
;
832 static const gchar
* shared_secret
= "";
834 static GSList
*list_heads
= NULL
;
836 static void update_shared_key(l2tpv3_tunnel_t
*tunnel
)
838 const gchar
*secret
= "";
840 /* There is at least one nonce in the packet, so we can do authentication,
841 otherwise it's just a plain digest without nonces. */
842 if (tunnel
->lcce1_nonce
!= NULL
|| tunnel
->lcce2_nonce
!= NULL
) {
843 secret
= shared_secret
;
846 /* If there's no shared key in the conversation context, or the secret has been changed */
847 if (tunnel
->shared_key_secret
== NULL
|| strcmp(secret
, tunnel
->shared_key_secret
) != 0) {
848 /* For secret specification, see RFC 3931 pg 37 */
850 md5_hmac(&data
, 1, secret
, strlen(secret
), tunnel
->shared_key
);
851 tunnel
->shared_key_secret
= wmem_strdup(wmem_file_scope(), secret
);
855 static void md5_hmac_digest(l2tpv3_tunnel_t
*tunnel
,
864 guint8 zero
[L2TP_HMAC_MD5_DIGEST_LEN
];
869 if (tunnel
->conv
->pt
== PT_NONE
) /* IP encapsulated L2TPv3 */
872 md5_hmac_init(&ms
, tunnel
->shared_key
, L2TP_HMAC_MD5_KEY_LEN
);
874 if (msg_type
!= MESSAGE_TYPE_SCCRQ
) {
875 if (tunnel
->lcce1_nonce
!= NULL
&& tunnel
->lcce2_nonce
!= NULL
) {
876 if (ADDRESSES_EQUAL(&tunnel
->lcce1
, &pinfo
->src
)) {
877 md5_hmac_append(&ms
, tunnel
->lcce1_nonce
, tunnel
->lcce1_nonce_len
);
878 md5_hmac_append(&ms
, tunnel
->lcce2_nonce
, tunnel
->lcce2_nonce_len
);
880 md5_hmac_append(&ms
, tunnel
->lcce2_nonce
, tunnel
->lcce2_nonce_len
);
881 md5_hmac_append(&ms
, tunnel
->lcce1_nonce
, tunnel
->lcce1_nonce_len
);
886 md5_hmac_append(&ms
, tvb_get_ptr(tvb
, offset
, idx
+ 1 - offset
), idx
+ 1 - offset
);
887 /* Message digest is calculated with an empty message digest field */
888 memset(zero
, 0, L2TP_HMAC_MD5_DIGEST_LEN
);
889 md5_hmac_append(&ms
, zero
, avp_len
- 1);
890 remainder
= length
- (idx
+ avp_len
);
891 md5_hmac_append(&ms
, tvb_get_ptr(tvb
, idx
+ avp_len
, remainder
), remainder
);
892 md5_hmac_finish(&ms
, digest
);
895 static void sha1_hmac_digest(l2tpv3_tunnel_t
*tunnel
,
904 guint8 zero
[L2TP_HMAC_SHA1_DIGEST_LEN
];
905 sha1_hmac_context ms
;
909 if (tunnel
->conv
->pt
== PT_NONE
) /* IP encapsulated L2TPv3 */
912 sha1_hmac_starts(&ms
, tunnel
->shared_key
, L2TP_HMAC_MD5_KEY_LEN
);
914 if (msg_type
!= MESSAGE_TYPE_SCCRQ
) {
915 if (tunnel
->lcce1_nonce
!= NULL
&& tunnel
->lcce2_nonce
!= NULL
) {
916 if (ADDRESSES_EQUAL(&tunnel
->lcce1
, &pinfo
->src
)) {
917 sha1_hmac_update(&ms
, tunnel
->lcce1_nonce
, tunnel
->lcce1_nonce_len
);
918 sha1_hmac_update(&ms
, tunnel
->lcce2_nonce
, tunnel
->lcce2_nonce_len
);
920 sha1_hmac_update(&ms
, tunnel
->lcce2_nonce
, tunnel
->lcce2_nonce_len
);
921 sha1_hmac_update(&ms
, tunnel
->lcce1_nonce
, tunnel
->lcce1_nonce_len
);
926 sha1_hmac_update(&ms
, tvb_get_ptr(tvb
, 0, idx
+ 1 - offset
), idx
+ 1 - offset
);
927 /* Message digest is calculated with an empty message digest field */
928 memset(zero
, 0, L2TP_HMAC_SHA1_DIGEST_LEN
);
929 sha1_hmac_update(&ms
, zero
, avp_len
- 1);
930 remainder
= length
- (idx
+ avp_len
);
931 sha1_hmac_update(&ms
, tvb_get_ptr(tvb
, idx
+ avp_len
, remainder
), remainder
);
932 sha1_hmac_finish(&ms
, digest
);
935 static int check_control_digest(l2tpv3_tunnel_t
*tunnel
,
943 guint8 digest
[L2TP_HMAC_SHA1_DIGEST_LEN
];
948 update_shared_key(tunnel
);
950 switch (tvb_get_guint8(tvb
, idx
)) {
952 if ((avp_len
- 1) != L2TP_HMAC_MD5_DIGEST_LEN
)
954 md5_hmac_digest(tunnel
, tvb
, length
, idx
, avp_len
, msg_type
, pinfo
, digest
);
957 if ((avp_len
- 1) != L2TP_HMAC_SHA1_DIGEST_LEN
)
959 sha1_hmac_digest(tunnel
, tvb
, length
, idx
, avp_len
, msg_type
, pinfo
, digest
);
966 if (memcmp(digest
, tvb_get_ptr(tvb
, idx
+ 1, avp_len
- 1), avp_len
- 1) != 0)
972 static void store_cma_nonce(l2tpv3_tunnel_t
*tunnel
,
978 guint8
*nonce
= NULL
;
984 case MESSAGE_TYPE_SCCRQ
:
985 if (!tunnel
->lcce1_nonce
) {
986 tunnel
->lcce1_nonce
= (guint8
*)wmem_alloc(wmem_file_scope(), length
);
987 tunnel
->lcce1_nonce_len
= length
;
988 nonce
= tunnel
->lcce1_nonce
;
991 case MESSAGE_TYPE_SCCRP
:
992 if (!tunnel
->lcce2_nonce
) {
993 tunnel
->lcce2_nonce
= (guint8
*)wmem_alloc(wmem_file_scope(), length
);
994 tunnel
->lcce2_nonce_len
= length
;
995 nonce
= tunnel
->lcce2_nonce
;
1003 tvb_memcpy(tvb
, (void *)nonce
, offset
, length
);
1008 static void store_ccid(l2tpv3_tunnel_t
*tunnel
,
1017 case MESSAGE_TYPE_SCCRQ
:
1018 tunnel
->lcce1_id
= tvb_get_ntohl(tvb
, offset
);
1020 case MESSAGE_TYPE_SCCRP
:
1021 tunnel
->lcce2_id
= tvb_get_ntohl(tvb
, offset
);
1030 static l2tpv3_session_t
*find_session(l2tpv3_tunnel_t
*tunnel
,
1034 l2tpv3_session_t
*session
= NULL
;
1037 iterator
= tunnel
->sessions
;
1039 session
= (l2tpv3_session_t
*)iterator
->data
;
1041 if ((session
->lcce1
.id
== lcce1_id
) ||
1042 (session
->lcce2
.id
== lcce2_id
)) {
1046 iterator
= g_slist_next(iterator
);
1052 static void init_session(l2tpv3_session_t
*session
)
1054 session
->lcce1
.cookie_len
= session
->lcce2
.cookie_len
= -1;
1055 session
->lcce1
.l2_specific
= session
->lcce2
.l2_specific
= -1;
1056 session
->pw_type
= -1;
1059 static l2tpv3_session_t
*alloc_session(void)
1061 l2tpv3_session_t
*session
= wmem_new0(wmem_packet_scope(), l2tpv3_session_t
);
1062 init_session(session
);
1067 static l2tpv3_session_t
*store_lsession_id(l2tpv3_session_t
*_session
,
1072 l2tpv3_session_t
*session
= _session
;
1075 case MESSAGE_TYPE_ICRQ
:
1076 case MESSAGE_TYPE_OCRQ
:
1077 case MESSAGE_TYPE_ICRP
:
1078 case MESSAGE_TYPE_OCRP
:
1084 if (session
== NULL
)
1085 session
= alloc_session();
1088 case MESSAGE_TYPE_ICRQ
:
1089 case MESSAGE_TYPE_OCRQ
:
1090 session
->lcce1
.id
= tvb_get_ntohl(tvb
, offset
);
1092 case MESSAGE_TYPE_ICRP
:
1093 case MESSAGE_TYPE_OCRP
:
1094 session
->lcce2
.id
= tvb_get_ntohl(tvb
, offset
);
1101 static l2tpv3_session_t
*store_rsession_id(l2tpv3_session_t
*_session
,
1106 l2tpv3_session_t
*session
= _session
;
1109 case MESSAGE_TYPE_ICRP
:
1110 case MESSAGE_TYPE_OCRP
:
1116 if (session
== NULL
)
1117 session
= alloc_session();
1119 session
->lcce1
.id
= tvb_get_ntohl(tvb
, offset
);
1124 static l2tpv3_session_t
*store_cookie_len(l2tpv3_session_t
*_session
,
1128 l2tpv3_session_t
*session
= _session
;
1131 case MESSAGE_TYPE_ICRQ
:
1132 case MESSAGE_TYPE_OCRQ
:
1133 case MESSAGE_TYPE_ICRP
:
1134 case MESSAGE_TYPE_OCRP
:
1140 if (session
== NULL
)
1141 session
= alloc_session();
1144 case MESSAGE_TYPE_ICRQ
:
1145 case MESSAGE_TYPE_OCRQ
:
1146 session
->lcce1
.cookie_len
= len
;
1148 case MESSAGE_TYPE_ICRP
:
1149 case MESSAGE_TYPE_OCRP
:
1150 session
->lcce2
.cookie_len
= len
;
1157 static l2tpv3_session_t
*store_pw_type(l2tpv3_session_t
*_session
,
1162 l2tpv3_session_t
*session
= _session
;
1163 gint result
= l2tpv3_protocol
;
1167 case MESSAGE_TYPE_ICRQ
:
1168 case MESSAGE_TYPE_OCRQ
:
1174 if (session
== NULL
)
1175 session
= alloc_session();
1177 pw_type
= tvb_get_ntohs(tvb
, offset
);
1180 result
= L2TPv3_PROTOCOL_PPP
; break;
1182 result
= L2TPv3_PROTOCOL_ETH
; break;
1184 result
= L2TPv3_PROTOCOL_CHDLC
; break;
1186 result
= L2TPv3_PROTOCOL_AAL5
; break;
1188 result
= L2TPv3_PROTOCOL_FR
; break;
1193 session
->pw_type
= result
;
1198 static l2tpv3_session_t
*store_l2_sublayer(l2tpv3_session_t
*_session
,
1203 l2tpv3_session_t
*session
= _session
;
1204 gint result
= l2tpv3_l2_specific
;
1205 guint16 l2_sublayer
;
1208 case MESSAGE_TYPE_ICRQ
:
1209 case MESSAGE_TYPE_OCRQ
:
1210 case MESSAGE_TYPE_ICCN
:
1211 case MESSAGE_TYPE_OCCN
:
1212 case MESSAGE_TYPE_ICRP
:
1213 case MESSAGE_TYPE_OCRP
:
1219 if (session
== NULL
)
1220 session
= alloc_session();
1222 l2_sublayer
= tvb_get_ntohs(tvb
, offset
);
1223 switch (l2_sublayer
) {
1225 result
= L2TPv3_L2_SPECIFIC_NONE
; break;
1227 result
= L2TPv3_L2_SPECIFIC_DEFAULT
; break;
1229 result
= L2TPv3_L2_SPECIFIC_ATM
; break;
1231 result
= L2TPv3_L2_SPECIFIC_DOCSIS_DMPT
; break;
1237 case MESSAGE_TYPE_ICRQ
:
1238 case MESSAGE_TYPE_OCRQ
:
1239 case MESSAGE_TYPE_ICCN
:
1240 case MESSAGE_TYPE_OCCN
:
1241 session
->lcce1
.l2_specific
= result
;
1242 case MESSAGE_TYPE_ICRP
:
1243 case MESSAGE_TYPE_OCRP
:
1244 session
->lcce2
.l2_specific
= result
;
1251 static void update_session(l2tpv3_tunnel_t
*tunnel
, l2tpv3_session_t
*session
)
1253 l2tpv3_session_t
*existing
= NULL
;
1255 if (tunnel
== NULL
|| session
== NULL
)
1258 if (session
->lcce1
.id
== 0 && session
->lcce2
.id
== 0)
1261 existing
= find_session(tunnel
, session
->lcce1
.id
, session
->lcce2
.id
);
1263 existing
= wmem_new0(wmem_file_scope(), l2tpv3_session_t
);
1264 init_session(existing
);
1267 if (session
->lcce1
.id
!= 0)
1268 existing
->lcce1
.id
= session
->lcce1
.id
;
1270 if (session
->lcce2
.id
!= 0)
1271 existing
->lcce2
.id
= session
->lcce2
.id
;
1273 if (session
->lcce1
.cookie_len
!= -1)
1274 existing
->lcce1
.cookie_len
= session
->lcce1
.cookie_len
;
1276 if (session
->lcce2
.cookie_len
!= -1)
1277 existing
->lcce2
.cookie_len
= session
->lcce2
.cookie_len
;
1279 if (session
->lcce1
.l2_specific
!= -1)
1280 existing
->lcce1
.l2_specific
= session
->lcce1
.l2_specific
;
1282 if (session
->lcce2
.l2_specific
!= -1)
1283 existing
->lcce2
.l2_specific
= session
->lcce2
.l2_specific
;
1285 if (session
->pw_type
!= -1)
1286 existing
->pw_type
= session
->pw_type
;
1288 if (tunnel
->sessions
== NULL
) {
1289 tunnel
->sessions
= g_slist_append(tunnel
->sessions
, existing
);
1290 list_heads
= g_slist_append(list_heads
, tunnel
->sessions
);
1292 tunnel
->sessions
= g_slist_append(tunnel
->sessions
, existing
);
1298 * Dissect CISCO AVP:s
1300 static int dissect_l2tp_cisco_avps(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
) {
1304 guint32 avp_vendor_id
;
1306 guint16 ver_len_hidden
;
1307 proto_item
*tf
, *te
;
1308 proto_tree
*l2tp_avp_tree
, *l2tp_avp_tree_sub
;
1310 ver_len_hidden
= tvb_get_ntohs(tvb
, offset
);
1311 avp_len
= AVP_LENGTH(ver_len_hidden
);
1312 avp_vendor_id
= tvb_get_ntohs(tvb
, offset
+ 2);
1313 avp_type
= tvb_get_ntohs(tvb
, offset
+ 4);
1315 tf
= proto_tree_add_text(tree
, tvb
, offset
,
1316 avp_len
, "Vendor %s: %s AVP",
1317 val_to_str_ext(avp_vendor_id
, &sminmpec_values_ext
, "Unknown (%u)"),
1318 val_to_str(avp_type
, cisco_avp_type_vals
, "Unknown (%u)"));
1321 l2tp_avp_tree
= proto_item_add_subtree(tf
, ett_l2tp_avp
);
1323 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_mandatory
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1324 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_hidden
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1325 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1327 if (HIDDEN_BIT(ver_len_hidden
)) { /* don't try do display hidden */
1335 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_vendor_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1339 proto_tree_add_uint(l2tp_avp_tree
, hf_l2tp_cisco_avp_type
, tvb
, offset
, 2, avp_type
);
1344 case CISCO_ASSIGNED_CONNECTION_ID
:
1345 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_assigned_control_connection_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1348 case CISCO_PW_CAPABILITY_LIST
:
1349 te
= proto_tree_add_text(l2tp_avp_tree
, tvb
, offset
, avp_len
,
1350 "Pseudowire Capabilities List");
1351 l2tp_avp_tree_sub
= proto_item_add_subtree(te
, ett_l2tp_avp_sub
);
1352 while (avp_len
>= 2) {
1353 proto_tree_add_item(l2tp_avp_tree_sub
, hf_l2tp_cisco_pw_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1359 case CISCO_LOCAL_SESSION_ID
:
1360 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_local_session_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1362 case CISCO_REMOTE_SESSION_ID
:
1363 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_remote_session_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1365 case CISCO_ASSIGNED_COOKIE
:
1366 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_assigned_cookie
, tvb
, offset
, avp_len
, ENC_NA
);
1368 case CISCO_REMOTE_END_ID
:
1369 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_remote_end_id
, tvb
, offset
, avp_len
, ENC_NA
|ENC_ASCII
);
1372 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_pseudowire_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1374 case CISCO_CIRCUIT_STATUS
:
1375 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_circuit_status
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1376 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_circuit_type
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1378 case CISCO_SESSION_TIE_BREAKER
:
1379 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_tie_breaker
,
1380 tvb
, offset
, 8, ENC_BIG_ENDIAN
);
1382 case CISCO_DRAFT_AVP_VERSION
:
1383 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_draft_avp_version
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1385 case CISCO_MESSAGE_DIGEST
:
1386 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_message_digest
, tvb
, offset
, avp_len
, ENC_NA
);
1388 case CISCO_AUTH_NONCE
:
1389 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_nonce
, tvb
, offset
, avp_len
, ENC_NA
);
1391 case CISCO_INTERFACE_MTU
:
1392 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cisco_interface_mtu
, tvb
, offset
, avp_len
, ENC_BIG_ENDIAN
);
1396 proto_tree_add_text(l2tp_avp_tree
, tvb
, offset
,
1397 avp_len
, "Vendor-Specific AVP");
1406 * Ref: http://www.cablelabs.com/specifications/CM-SP-DEPI-I08-100611.pdf
1409 dissect_l2tp_vnd_cablelabs_avps(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void *data _U_
)
1413 guint32 avp_vendor_id
;
1415 guint16 ver_len_hidden
;
1417 proto_tree
*l2tp_avp_tree
;
1419 ver_len_hidden
= tvb_get_ntohs(tvb
, offset
);
1420 avp_len
= AVP_LENGTH(ver_len_hidden
);
1421 avp_vendor_id
= tvb_get_ntohs(tvb
, offset
+ 2);
1422 avp_type
= tvb_get_ntohs(tvb
, offset
+ 4);
1424 tf
= proto_tree_add_text(tree
, tvb
, offset
,
1425 avp_len
, "Vendor %s: %s AVP",
1426 val_to_str_ext(avp_vendor_id
, &sminmpec_values_ext
, "Unknown (%u)"),
1427 val_to_str(avp_type
, cablelabs_avp_type_vals
, "Unknown (%u)"));
1428 l2tp_avp_tree
= proto_item_add_subtree(tf
, ett_l2tp_avp
);
1430 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_mandatory
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1431 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_hidden
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1432 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1434 if (HIDDEN_BIT(ver_len_hidden
)) { /* don't try do display hidden */
1442 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_vendor_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1446 proto_tree_add_uint(l2tp_avp_tree
, hf_l2tp_cablelabs_avp_type
, tvb
, offset
, 2, avp_type
);
1452 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_l_bit
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1453 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_tsid_group_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1456 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_frequency
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1461 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_l_bit
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1462 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_tsid_group_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1463 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_modulation
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1468 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_l_bit
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1469 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_tsid_group_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1473 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_m
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1476 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_cablel_avp_n
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1482 proto_tree_add_text(l2tp_avp_tree
, tvb
, offset
,
1483 avp_len
, "Vendor-Specific AVP(not dissected yet)");
1493 * Processes AVPs for Control Messages all versions and transports
1495 static void process_control_avps(tvbuff_t
*tvb
,
1497 proto_tree
*l2tp_tree
,
1501 l2tpv3_tunnel_t
*tunnel
)
1503 proto_tree
*l2tp_lcp_avp_tree
, *l2tp_avp_tree
= NULL
, *l2tp_avp_tree_sub
;
1504 proto_item
*tf
, *te
;
1507 gboolean isStopCcn
= FALSE
;
1509 guint32 avp_vendor_id
;
1511 guint16 ver_len_hidden
;
1512 tvbuff_t
*next_tvb
, *avp_tvb
;
1514 guint16 digest_avp_len
= 0;
1515 proto_item
*digest_item
= NULL
;
1516 l2tp_cntrl_data_t
*l2tp_cntrl_data
= wmem_new0(wmem_packet_scope(), l2tp_cntrl_data_t
);
1518 l2tpv3_session_t
*session
= NULL
;
1520 l2tp_cntrl_data
->ccid
= ccid
;
1522 while (idx
< length
) { /* Process AVP's */
1523 ver_len_hidden
= tvb_get_ntohs(tvb
, idx
);
1524 avp_len
= AVP_LENGTH(ver_len_hidden
);
1525 avp_vendor_id
= tvb_get_ntohs(tvb
, idx
+ 2);
1526 avp_type
= tvb_get_ntohs(tvb
, idx
+ 4);
1529 proto_tree_add_text(l2tp_avp_tree
? l2tp_avp_tree
: l2tp_tree
, tvb
, idx
, 2,
1530 "AVP length must be >= 6, got %u", avp_len
);
1534 if (avp_vendor_id
!= VENDOR_IETF
) {
1536 avp_tvb
= tvb_new_subset(tvb
, idx
, avp_len
, avp_len
);
1538 if (avp_vendor_id
== VENDOR_CISCO
) { /* Vendor-Specific AVP */
1540 dissect_l2tp_cisco_avps(avp_tvb
, pinfo
, l2tp_tree
);
1545 /* Vendor-Specific AVP */
1546 if (!dissector_try_uint_new(l2tp_vendor_avp_dissector_table
, avp_vendor_id
, avp_tvb
, pinfo
, l2tp_tree
, FALSE
, l2tp_cntrl_data
)){
1547 tf
= proto_tree_add_text(l2tp_tree
, tvb
, idx
,
1548 avp_len
, "Vendor %s AVP Type %u",
1549 val_to_str_ext(avp_vendor_id
, &sminmpec_values_ext
, "Unknown (%u)"),
1552 l2tp_avp_tree
= proto_item_add_subtree(tf
, ett_l2tp_avp
);
1554 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_mandatory
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1555 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_hidden
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1556 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_length
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1558 if (HIDDEN_BIT(ver_len_hidden
)) { /* don't try do display hidden */
1563 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_vendor_id
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1566 proto_tree_add_text(l2tp_avp_tree
, tvb
, idx
, 2, "Type: %u", avp_type
);
1568 proto_tree_add_text(l2tp_avp_tree
, tvb
, idx
, avp_len
, "Vendor-Specific AVP");
1577 tf
= proto_tree_add_text(l2tp_tree
, tvb
, idx
,
1579 val_to_str_ext(avp_type
, &avp_type_vals_ext
, "Unknown (%u)"));
1581 l2tp_avp_tree
= proto_item_add_subtree(tf
, ett_l2tp_avp
);
1583 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_mandatory
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1584 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_hidden
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1585 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_length
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1587 if (HIDDEN_BIT(ver_len_hidden
)) { /* don't try do display hidden */
1595 /* Special Case for handling Extended Vendor Id */
1596 if (avp_type
== EXTENDED_VENDOR_ID
) {
1598 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_vendor_id
,
1599 tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1606 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_vendor_id
,
1607 tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1612 proto_tree_add_uint(l2tp_avp_tree
, hf_l2tp_avp_type
,
1613 tvb
, idx
, 2, avp_type
);
1619 case CONTROL_MESSAGE
:
1620 msg_type
= tvb_get_ntohs(tvb
, idx
);
1621 l2tp_cntrl_data
->msg_type
= msg_type
;
1622 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_message_type
,
1623 tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1625 if (msg_type
== MESSAGE_TYPE_StopCCN
) {
1630 case RESULT_ERROR_CODE
:
1634 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_stop_ccn_result_code
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1637 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_result_code
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1644 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_error_code
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1650 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_error_message
, tvb
, idx
, avp_len
, ENC_NA
);
1653 case PROTOCOL_VERSION
:
1656 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_protocol_version
, tvb
, idx
, 1, ENC_NA
);
1660 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_protocol_revision
, tvb
, idx
, 1, ENC_NA
);
1663 case FRAMING_CAPABILITIES
:
1664 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_async_framing_supported
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1665 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_sync_framing_supported
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1668 case BEARER_CAPABILITIES
:
1669 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_analog_access_supported
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1670 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_digital_access_supported
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1674 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_tie_breaker
, tvb
, idx
, 8, ENC_BIG_ENDIAN
);
1677 case FIRMWARE_REVISION
:
1678 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_firmware_revision
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1682 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_host_name
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1686 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_vendor_name
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1689 case ASSIGNED_TUNNEL_ID
:
1690 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_assigned_tunnel_id
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1693 case RECEIVE_WINDOW_SIZE
:
1694 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_receive_window_size
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1698 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_chap_challenge
, tvb
, idx
, avp_len
, ENC_NA
);
1703 * XXX - export stuff from the Q.931 dissector
1704 * to dissect the cause code and cause message,
1709 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_cause_code
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1715 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_cause_msg
, tvb
, idx
, 1, ENC_NA
);
1721 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_advisory_msg
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1724 case CHALLENGE_RESPONSE
:
1725 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_chap_challenge_response
, tvb
, idx
, 16, ENC_NA
);
1728 case ASSIGNED_SESSION
:
1729 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_assigned_session_id
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1732 case CALL_SERIAL_NUMBER
:
1733 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_call_serial_number
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1737 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_minimum_bps
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1741 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_maximum_bps
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1745 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_analog_bearer_type
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1746 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_digital_bearer_type
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1750 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_async_framing_type
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1751 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_sync_framing_type
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1757 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_called_number
,
1758 tvb
, idx
, avp_len
, ENC_ASCII
);
1761 case CALLING_NUMBER
:
1764 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_calling_number
,
1765 tvb
, idx
, avp_len
, ENC_ASCII
);
1771 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_sub_address
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1774 case TX_CONNECT_SPEED
:
1775 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_connect_speed
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1778 case PHYSICAL_CHANNEL
:
1779 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_physical_channel
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1782 case INITIAL_RECEIVED_LCP_CONFREQ
:
1783 te
= proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_initial_received_lcp_confreq
, tvb
, idx
, avp_len
, ENC_NA
);
1784 l2tp_lcp_avp_tree
= proto_item_add_subtree(te
, ett_l2tp_lcp
);
1785 next_tvb
= tvb_new_subset(tvb
, idx
, avp_len
, avp_len
);
1786 call_dissector(ppp_lcp_options_handle
, next_tvb
, pinfo
, l2tp_lcp_avp_tree
);
1789 case LAST_SENT_LCP_CONFREQ
:
1790 te
= proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_last_sent_lcp_confreq
, tvb
, idx
, avp_len
, ENC_NA
);
1791 l2tp_lcp_avp_tree
= proto_item_add_subtree(te
, ett_l2tp_lcp
);
1792 next_tvb
= tvb_new_subset(tvb
, idx
, avp_len
, avp_len
);
1793 call_dissector(ppp_lcp_options_handle
, next_tvb
, pinfo
, l2tp_lcp_avp_tree
);
1796 case LAST_RECEIVED_LCP_CONFREQ
:
1797 te
= proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_last_received_lcp_confreq
, tvb
, idx
, avp_len
, ENC_NA
);
1798 l2tp_lcp_avp_tree
= proto_item_add_subtree(te
, ett_l2tp_lcp
);
1799 next_tvb
= tvb_new_subset(tvb
, idx
, avp_len
, avp_len
);
1800 call_dissector(ppp_lcp_options_handle
, next_tvb
, pinfo
, l2tp_lcp_avp_tree
);
1803 case PROXY_AUTHEN_TYPE
:
1804 msg_type
= tvb_get_ntohs(tvb
, idx
);
1805 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_proxy_authen_type
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1808 case PROXY_AUTHEN_NAME
:
1811 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_proxy_authen_name
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1814 case PROXY_AUTHEN_CHALLENGE
:
1815 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_proxy_authen_challenge
, tvb
, idx
, avp_len
, ENC_NA
);
1818 case PROXY_AUTHEN_ID
:
1819 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_proxy_authen_id
, tvb
, idx
+ 1, 1, ENC_NA
);
1822 case PROXY_AUTHEN_RESPONSE
:
1823 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_proxy_authen_response
, tvb
, idx
, avp_len
, ENC_NA
);
1826 case CALL_STATUS_AVPS
:
1834 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_crc_errors
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1840 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_framing_errors
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1846 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_hardware_overruns
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1852 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_buffer_overruns
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1858 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_time_out_errors
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1864 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_alignment_errors
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1877 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_send_accm
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1883 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_receive_accm
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1889 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_random_vector
, tvb
, idx
, avp_len
, ENC_NA
);
1892 case PRIVATE_GROUP_ID
:
1893 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_private_group_id
, tvb
, idx
, avp_len
, ENC_NA
);
1896 case RX_CONNECT_SPEED
:
1897 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_rx_connect_speed
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1900 case PPP_DISCONNECT_CAUSE_CODE
:
1903 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_disconnect_code
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1909 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_control_protocol_number
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1915 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_cause_code_direction
, tvb
, idx
, 1, ENC_NA
);
1921 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_cause_code_message
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1924 case MESSAGE_DIGEST
:
1927 digest_avp_len
= avp_len
;
1928 digest_item
= proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_message_digest
, tvb
, idx
, avp_len
, ENC_NA
);
1932 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_router_id
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1934 case ASSIGNED_CONTROL_CONN_ID
:
1935 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_assigned_control_conn_id
,
1936 tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1937 store_ccid(tunnel
, tvb
, idx
, msg_type
);
1939 case PW_CAPABILITY_LIST
:
1940 te
= proto_tree_add_text(l2tp_avp_tree
, tvb
, idx
, avp_len
,
1941 "Pseudowire Capabilities List");
1942 l2tp_avp_tree_sub
= proto_item_add_subtree(te
, ett_l2tp_avp_sub
);
1944 while (avp_len
>= 2) {
1945 proto_tree_add_item(l2tp_avp_tree_sub
, hf_l2tp_avp_pw_type
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1950 case LOCAL_SESSION_ID
:
1951 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_local_session_id
,
1952 tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1953 col_append_fstr(pinfo
->cinfo
,COL_INFO
, ", LSID: %2u",
1954 tvb_get_ntohl(tvb
, idx
));
1955 session
= store_lsession_id(session
, tvb
, idx
, msg_type
);
1957 case REMOTE_SESSION_ID
:
1958 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_remote_session_id
,
1959 tvb
, idx
, 4, ENC_BIG_ENDIAN
);
1960 col_append_fstr(pinfo
->cinfo
,COL_INFO
, ", RSID: %2u",
1961 tvb_get_ntohl(tvb
, idx
));
1962 session
= store_rsession_id(session
, tvb
, idx
, msg_type
);
1964 case ASSIGNED_COOKIE
:
1965 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_assigned_cookie
, tvb
, idx
, avp_len
, ENC_NA
);
1966 session
= store_cookie_len(session
, avp_len
, msg_type
);
1969 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_remote_end_id
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1972 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_pseudowire_type
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1973 session
= store_pw_type(session
, tvb
, idx
, msg_type
);
1975 case L2_SPECIFIC_SUBLAYER
:
1976 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_layer2_specific_sublayer
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1977 session
= store_l2_sublayer(session
, tvb
, idx
, msg_type
);
1979 case DATA_SEQUENCING
:
1980 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_data_sequencing
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1982 case CIRCUIT_STATUS
:
1983 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_circuit_status
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1984 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_circuit_type
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
1986 case PREFERRED_LANGUAGE
:
1987 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_preferred_language
, tvb
, idx
, avp_len
, ENC_NA
|ENC_ASCII
);
1989 case CTL_MSG_AUTH_NONCE
:
1990 proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_nonce
, tvb
, idx
, avp_len
, ENC_NA
);
1991 store_cma_nonce(tunnel
, tvb
, idx
, avp_len
, msg_type
);
1993 case TX_CONNECT_SPEED_V3
:
1999 speed
= tvb_get_ntoh64(tvb
, idx
);
2000 tf
= proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_tx_connect_speed_v3
, tvb
, idx
, 8, ENC_BIG_ENDIAN
);
2002 proto_item_append_text(tf
, " (indeterminable or no physical p2p link)");
2006 case RX_CONNECT_SPEED_V3
:
2012 speed
= tvb_get_ntoh64(tvb
, idx
);
2013 tf
= proto_tree_add_item(l2tp_avp_tree
, hf_l2tp_avp_rx_connect_speed_v3
, tvb
, idx
, 8, ENC_BIG_ENDIAN
);
2015 proto_item_append_text(tf
, " (indeterminable or no physical p2p link)");
2020 proto_tree_add_text(l2tp_avp_tree
, tvb
, idx
, avp_len
,
2028 /* SCCRQ digest can only be calculated once we know whether nonces are being used */
2029 if (digest_avp_len
) {
2030 if (check_control_digest(tunnel
, tvb
, length
, digest_idx
, digest_avp_len
, msg_type
, pinfo
) < 0)
2031 expert_add_info(pinfo
, digest_item
, &ei_l2tp_incorrect_digest
);
2034 update_session(tunnel
, session
);
2038 * Processes Data Messages for v3 IP and UDP, starting from the Session ID
2039 * (common to IP and UDP). Dissects the L2TPv3 Session header, the (optional)
2040 * L2-Specific sublayer and calls the appropriate dissector for the payload.
2043 process_l2tpv3_data(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
2044 proto_tree
*l2tp_tree
, proto_item
*l2tp_item
, int *pIdx
,
2045 l2tpv3_tunnel_t
*tunnel
)
2049 guint8 oam_cell
= 0;
2050 proto_tree
*l2_specific
= NULL
;
2051 proto_item
*ti
= NULL
;
2053 gint cookie_len
= l2tpv3_cookie
;
2054 gint l2_spec
= l2tpv3_l2_specific
;
2055 gint pw_type
= l2tpv3_protocol
;
2057 lcce_settings_t
*lcce
= NULL
;
2058 l2tpv3_session_t
*session
= NULL
;
2060 /* Get Session ID */
2061 sid
= tvb_get_ntohl(tvb
, idx
);
2065 if (ADDRESSES_EQUAL(&tunnel
->lcce1
, &pinfo
->dst
)) {
2066 session
= find_session(tunnel
, sid
, 0);
2068 lcce
= &session
->lcce1
;
2070 session
= find_session(tunnel
, 0, sid
);
2072 lcce
= &session
->lcce2
;
2078 l2_spec
= lcce
->l2_specific
;
2079 if (cookie_len
== -1)
2080 cookie_len
= lcce
->cookie_len
;
2082 pw_type
= session
->pw_type
;
2086 l2_spec
= L2TPv3_L2_SPECIFIC_NONE
;
2089 pw_type
= L2TPv3_PROTOCOL_DEFAULT
;
2091 if (cookie_len
== -1)
2092 cookie_len
= L2TPv3_COOKIE_DEFAULT
;
2094 col_add_fstr(pinfo
->cinfo
,COL_INFO
,
2095 "%s (session id=%u)",
2099 proto_tree_add_item(l2tp_tree
, hf_l2tp_sid
, tvb
, idx
-4, 4, ENC_BIG_ENDIAN
);
2100 proto_item_set_len(l2tp_item
, idx
);
2101 if (!(tvb_offset_exists(tvb
, idx
)))
2103 if (cookie_len
!= 0)
2104 proto_tree_add_item(l2tp_tree
, hf_l2tp_cookie
, tvb
, idx
, cookie_len
, ENC_NA
);
2108 case L2TPv3_L2_SPECIFIC_DEFAULT
:
2110 ti
= proto_tree_add_item(tree
, hf_l2tp_l2_spec_def
,
2111 tvb
, idx
+ cookie_len
, 4, ENC_NA
);
2112 l2_specific
= proto_item_add_subtree(ti
, ett_l2tp_l2_spec
);
2114 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_s
, tvb
, idx
+ cookie_len
,
2116 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_sequence
, tvb
,
2117 idx
+ cookie_len
+ 1, 3, ENC_BIG_ENDIAN
);
2119 next_tvb
= tvb_new_subset_remaining(tvb
, idx
+ cookie_len
+ 4);
2121 case L2TPv3_L2_SPECIFIC_DOCSIS_DMPT
:
2123 ti
= proto_tree_add_item(tree
, hf_l2tp_l2_spec_docsis_dmpt
,
2124 tvb
, idx
+ cookie_len
, 4, ENC_NA
);
2125 l2_specific
= proto_item_add_subtree(ti
, ett_l2tp_l2_spec
);
2127 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_v
, tvb
,
2128 idx
+ cookie_len
,1, ENC_BIG_ENDIAN
);
2130 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_s
, tvb
,
2131 idx
+ cookie_len
,1, ENC_BIG_ENDIAN
);
2133 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_flow_id
, tvb
,
2134 idx
+ cookie_len
,1, ENC_BIG_ENDIAN
);
2136 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_sequence
, tvb
,
2137 idx
+ cookie_len
+ 2,2, ENC_BIG_ENDIAN
);
2139 next_tvb
= tvb_new_subset_remaining(tvb
, idx
+ cookie_len
+ 4);
2141 case L2TPv3_L2_SPECIFIC_ATM
:
2143 ti
= proto_tree_add_item(tree
, hf_l2tp_l2_spec_atm
,
2144 tvb
, idx
+ cookie_len
, 4, ENC_NA
);
2145 l2_specific
= proto_item_add_subtree(ti
, ett_l2tp_l2_spec
);
2147 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_s
, tvb
, idx
+ cookie_len
,
2149 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_t
, tvb
, idx
+ cookie_len
,
2152 * As per RFC 4454, the T bit specifies whether
2153 * we're transporting an OAM cell or an AAL5 frame.
2155 oam_cell
= tvb_get_guint8(tvb
, idx
+ cookie_len
) & 0x08;
2156 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_g
, tvb
, idx
+ cookie_len
,
2158 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_c
, tvb
, idx
+ cookie_len
,
2160 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_u
, tvb
, idx
+ cookie_len
,
2162 proto_tree_add_item(l2_specific
, hf_l2tp_l2_spec_sequence
, tvb
,
2163 idx
+ cookie_len
+ 1, 3, ENC_BIG_ENDIAN
);
2165 next_tvb
= tvb_new_subset_remaining(tvb
, idx
+ cookie_len
+ 4);
2167 case L2TPv3_L2_SPECIFIC_LAPD
:
2169 proto_tree_add_text(tree
, tvb
, idx
+ cookie_len
+ 4, 3,"LAPD info");
2170 next_tvb
= tvb_new_subset_remaining(tvb
, idx
+ cookie_len
+4+3);
2172 case L2TPv3_L2_SPECIFIC_NONE
:
2174 next_tvb
= tvb_new_subset_remaining(tvb
, idx
+ cookie_len
);
2179 case L2TPv3_PROTOCOL_ETH
:
2180 call_dissector(eth_withoutfcs_handle
, next_tvb
, pinfo
, tree
);
2182 case L2TPv3_PROTOCOL_CHDLC
:
2183 call_dissector(chdlc_handle
, next_tvb
, pinfo
, tree
);
2185 case L2TPv3_PROTOCOL_FR
:
2186 call_dissector(fr_handle
, next_tvb
, pinfo
, tree
);
2188 case L2TPv3_PROTOCOL_PPP
:
2190 * PPP is transported without Address and Control
2191 * fields, ppp_hdlc_handle can handle that as if if
2192 * was ACFC (NULL Address and Control)
2194 call_dissector(ppp_hdlc_handle
, next_tvb
, pinfo
, tree
);
2196 case L2TPv3_PROTOCOL_IP
:
2197 call_dissector(ip_handle
, next_tvb
, pinfo
, tree
);
2199 case L2TPv3_PROTOCOL_MPLS
:
2200 call_dissector(mpls_handle
, next_tvb
, pinfo
, tree
);
2202 case L2TPv3_PROTOCOL_DOCSIS_DMPT
:
2203 call_dissector(mp2t_handle
, next_tvb
, pinfo
, tree
);
2205 case L2TPv3_PROTOCOL_AAL5
:
2207 call_dissector(atm_oam_handle
, next_tvb
, pinfo
, tree
);
2209 call_dissector(llc_handle
, next_tvb
, pinfo
, tree
);
2212 case L2TPv3_PROTOCOL_LAPD
:
2213 call_dissector(lapd_handle
, next_tvb
, pinfo
, tree
);
2215 case L2TPv3_PROTOCOL_ERICSSON
:
2216 call_dissector(ehdlc_handle
, next_tvb
, pinfo
, tree
);
2219 call_dissector(data_handle
, next_tvb
, pinfo
, tree
);
2225 * Processes v3 data message over UDP, to then call process_l2tpv3_data
2226 * from the common part (Session ID)
2229 process_l2tpv3_data_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
2230 l2tpv3_conversation_t
*l2tp_conv
)
2232 proto_tree
*l2tp_tree
= NULL
, *ctrl_tree
;
2233 proto_item
*l2tp_item
= NULL
, *ti
;
2239 control
= tvb_get_ntohs(tvb
, idx
);
2240 idx
+= 2; /* skip ahead */
2241 idx
+= 2; /* Skip the reserved */
2242 sid
= tvb_get_ntohl(tvb
, idx
);
2245 l2tp_item
= proto_tree_add_item(tree
, proto_l2tp
, tvb
, 0, -1, ENC_NA
);
2246 l2tp_tree
= proto_item_add_subtree(l2tp_item
, ett_l2tp
);
2247 proto_item_append_text(l2tp_item
, " version 3");
2249 ti
= proto_tree_add_text(l2tp_tree
, tvb
, 0, 2,
2250 "Packet Type: %s Session Id=%u",
2253 ctrl_tree
= proto_item_add_subtree(ti
, ett_l2tp_ctrl
);
2254 proto_tree_add_uint(ctrl_tree
, hf_l2tp_type
, tvb
, 0, 2, control
);
2255 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_length_bit
, tvb
, 0, 2, control
);
2256 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_seq_bit
, tvb
, 0, 2, control
);
2257 proto_tree_add_uint(ctrl_tree
, hf_l2tp_version
, tvb
, 0, 2, control
);
2258 /* Data in v3 over UDP has this reserved */
2259 proto_tree_add_item(l2tp_tree
, hf_l2tp_res
, tvb
, 2, 2, ENC_BIG_ENDIAN
);
2262 /* Call process_l2tpv3_data from Session ID (offset in idx of 4) */
2263 process_l2tpv3_data(tvb
, pinfo
, tree
, l2tp_tree
, l2tp_item
, &idx
, l2tp_conv
->tunnel
);
2267 * Processes v3 data message over IP, to then call process_l2tpv3_data
2268 * from the common part (Session ID)
2271 process_l2tpv3_data_ip(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
,
2272 l2tpv3_conversation_t
*l2tp_conv
)
2274 proto_tree
*l2tp_tree
= NULL
;
2275 proto_item
*l2tp_item
= NULL
;
2280 sid
= tvb_get_ntohl(tvb
, idx
);
2283 l2tp_item
= proto_tree_add_item(tree
, proto_l2tp
, tvb
, 0, -1, ENC_NA
);
2284 l2tp_tree
= proto_item_add_subtree(l2tp_item
, ett_l2tp
);
2285 proto_item_append_text(l2tp_item
, " version 3");
2287 proto_tree_add_text(l2tp_tree
, tvb
, 0, 4,
2288 "Packet Type: %s Session Id=%u",
2292 /* Call process_l2tpv3_data from Session ID (offset in idx of 0) */
2293 process_l2tpv3_data(tvb
, pinfo
, tree
, l2tp_tree
, l2tp_item
, &idx
, l2tp_conv
->tunnel
);
2297 * Processes v3 Control Message over IP, that carries NULL Session ID
2298 * to then call process_control_avps after dissecting the control.
2301 process_l2tpv3_control(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int baseIdx
,
2302 l2tpv3_conversation_t
*l2tp_conv
)
2304 proto_tree
*l2tp_tree
= NULL
, *ctrl_tree
;
2305 proto_item
*l2tp_item
= NULL
, *ti
;
2309 guint16 length
= 0; /* Length field */
2310 guint32 ccid
= 0; /* Control Connection ID */
2311 guint16 vendor_id
= 0;
2314 guint16 control
= 0;
2316 l2tpv3_tunnel_t
*tunnel
= NULL
;
2317 l2tpv3_tunnel_t tmp_tunnel
;
2319 control
= tvb_get_ntohs(tvb
, idx
);
2320 idx
+= 2; /* skip ahead */
2321 if (LENGTH_BIT(control
)) { /* length field included ? */
2322 length
= tvb_get_ntohs(tvb
, idx
);
2326 /* Get Control Channel ID */
2327 ccid
= tvb_get_ntohl(tvb
, idx
);
2332 if ((LENGTH_BIT(control
))&&(length
==12)) /* ZLB Message */
2333 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2334 "%s - ZLB (tunnel id=%u)",
2335 control_msg
, ccid
);
2338 if (SEQUENCE_BIT(control
)) {
2344 vendor_id
= tvb_get_ntohs(tvb
, tmp_idx
);
2347 avp_type
= tvb_get_ntohs(tvb
, tmp_idx
);
2350 /* If it's a vendor AVP let the vendor AVP dissector fill in the info column */
2351 if ( vendor_id
== VENDOR_IETF
) {
2352 if (avp_type
== CONTROL_MESSAGE
) {
2353 /* We print message type */
2354 msg_type
= tvb_get_ntohs(tvb
, tmp_idx
);
2355 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2356 "%s - %s (tunnel id=%u)",
2358 val_to_str_ext(msg_type
, &l2tp_message_type_short_str_vals_ext
, "Unknown (%u)"),
2363 * This is not a control message.
2364 * We never pass here except in case of bad l2tp packet!
2366 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2367 "%s (tunnel id=%u)",
2373 if (LENGTH_BIT(control
)) {
2375 * Set the length of this tvbuff to be no longer than the length
2378 * XXX - complain if that length is longer than the length of
2379 * the tvbuff? Have "set_actual_length()" return a Boolean
2380 * and have its callers check the result?
2382 set_actual_length(tvb
, length
+baseIdx
);
2386 l2tp_item
= proto_tree_add_item(tree
, proto_l2tp
, tvb
, 0, -1, ENC_NA
);
2387 l2tp_tree
= proto_item_add_subtree(l2tp_item
, ett_l2tp
);
2388 proto_item_append_text(l2tp_item
, " version 3");
2391 proto_tree_add_item(l2tp_tree
, hf_l2tp_sid
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
2393 ti
= proto_tree_add_text(l2tp_tree
, tvb
, baseIdx
, 2,
2394 "Packet Type: %s Control Connection Id=%d",
2395 (CONTROL_BIT(control
) ? control_msg
: data_msg
), ccid
);
2397 ctrl_tree
= proto_item_add_subtree(ti
, ett_l2tp_ctrl
);
2398 proto_tree_add_uint(ctrl_tree
, hf_l2tp_type
, tvb
, baseIdx
, 2, control
);
2399 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_length_bit
, tvb
, baseIdx
, 2, control
);
2400 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_seq_bit
, tvb
, baseIdx
, 2, control
);
2401 proto_tree_add_uint(ctrl_tree
, hf_l2tp_version
, tvb
, baseIdx
, 2, control
);
2404 if (LENGTH_BIT(control
)) {
2406 proto_tree_add_item(l2tp_tree
, hf_l2tp_length
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2412 proto_tree_add_item(l2tp_tree
, hf_l2tp_ccid
, tvb
, idx
, 4, ENC_BIG_ENDIAN
);
2416 if (SEQUENCE_BIT(control
)) {
2418 proto_tree_add_item(l2tp_tree
, hf_l2tp_Ns
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2422 proto_tree_add_item(l2tp_tree
, hf_l2tp_Nr
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2428 if (tree
&& (LENGTH_BIT(control
))&&(length
==12)) {
2429 proto_tree_add_text(l2tp_tree
, tvb
, 0, 0, "Zero Length Bit message");
2431 avp_type
= tvb_get_ntohs(tvb
, idx
+ 4);
2432 if (avp_type
== CONTROL_MESSAGE
) {
2434 msg_type
= tvb_get_ntohs(tvb
, idx
+ 6);
2435 if (msg_type
== MESSAGE_TYPE_SCCRQ
) {
2436 tunnel
= &tmp_tunnel
;
2437 memset(tunnel
, 0, sizeof(l2tpv3_tunnel_t
));
2438 tunnel
->conv
= l2tp_conv
;
2439 SE_COPY_ADDRESS(&tunnel
->lcce1
, &pinfo
->src
);
2440 SE_COPY_ADDRESS(&tunnel
->lcce2
, &pinfo
->dst
);
2445 if (!LENGTH_BIT(control
)) {
2449 if (tunnel
== NULL
) {
2450 tunnel
= l2tp_conv
->tunnel
;
2453 process_control_avps(tvb
, pinfo
, l2tp_tree
, idx
, length
+baseIdx
, ccid
, tunnel
);
2455 if (tunnel
== &tmp_tunnel
&& l2tp_conv
->tunnel
== NULL
) {
2456 l2tp_conv
->tunnel
= wmem_new0(wmem_file_scope(), l2tpv3_tunnel_t
);
2457 memcpy(l2tp_conv
->tunnel
, &tmp_tunnel
, sizeof(l2tpv3_tunnel_t
));
2462 * Dissector for L2TP over UDP. For v2, calls process_control_avps for
2463 * control messages, or the ppp dissector based on the control bit.
2464 * For v3, calls either process_l2tpv3_control or process_l2tpv3_data_udp
2465 * based on the control bit.
2468 dissect_l2tp_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
2470 proto_tree
*l2tp_tree
= NULL
, *ctrl_tree
;
2471 proto_item
*l2tp_item
= NULL
, *ti
;
2474 guint16 length
= 0; /* Length field */
2475 guint16 tid
; /* Tunnel ID */
2476 guint16 cid
; /* Call ID */
2477 guint16 offset_size
; /* Offset size */
2482 conversation_t
*conv
= NULL
;
2483 l2tpv3_conversation_t
*l2tp_conv
= NULL
;
2486 * Don't accept packets that aren't for an L2TP version we know,
2487 * as they might not be L2TP packets even though they happen
2488 * to be coming from or going to the L2TP port.
2490 if (tvb_length(tvb
) < 2)
2491 return 0; /* not enough information to check */
2492 control
= tvb_get_ntohs(tvb
, 0);
2493 switch (L2TP_VERSION(control
)) {
2503 conv
= find_conversation(pinfo
->fd
->num
, &pinfo
->src
, &pinfo
->dst
, PT_UDP
,
2504 pinfo
->srcport
, pinfo
->destport
, NO_PORT_B
);
2507 conv
= find_conversation(pinfo
->fd
->num
, &pinfo
->src
, &pinfo
->dst
, PT_UDP
,
2508 pinfo
->srcport
, pinfo
->destport
, 0);
2511 if ((conv
== NULL
) || (conv
->dissector_handle
!= l2tp_udp_handle
)) {
2512 conv
= conversation_new(pinfo
->fd
->num
, &pinfo
->src
, &pinfo
->dst
, PT_UDP
,
2513 pinfo
->srcport
, 0, NO_PORT2
);
2514 conversation_set_dissector(conv
, l2tp_udp_handle
);
2517 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "L2TP");
2518 col_clear(pinfo
->cinfo
, COL_INFO
);
2520 switch (L2TP_VERSION(control
)) {
2526 l2tp_conv
= (l2tpv3_conversation_t
*)conversation_get_proto_data(conv
, proto_l2tp
);
2528 l2tp_conv
= wmem_new0(wmem_file_scope(), l2tpv3_conversation_t
);
2529 l2tp_conv
->pt
= PT_UDP
;
2530 conversation_add_proto_data(conv
, proto_l2tp
, (void *)l2tp_conv
);
2533 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "L2TPv3");
2534 if (CONTROL_BIT(control
)) {
2535 /* Call to process l2tp v3 control message */
2536 process_l2tpv3_control(tvb
, pinfo
, tree
, 0, l2tp_conv
);
2539 /* Call to process l2tp v3 data message */
2540 process_l2tpv3_data_udp(tvb
, pinfo
, tree
, l2tp_conv
);
2542 return tvb_length(tvb
);
2545 if (LENGTH_BIT(control
)) { /* length field included ? */
2546 idx
+= 2; /* skip ahead */
2547 length
= tvb_get_ntohs(tvb
, idx
);
2550 /* collect the tunnel id & call id */
2552 tid
= tvb_get_ntohs(tvb
, idx
);
2554 cid
= tvb_get_ntohs(tvb
, idx
);
2556 if (CONTROL_BIT(control
)) {
2557 /* CONTROL MESSAGE */
2560 if ((LENGTH_BIT(control
))&&(length
==12)) /* ZLB Message */
2561 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2562 "%s - ZLB (tunnel id=%d, session id=%u)",
2563 control_msg
, tid
, cid
);
2566 if (SEQUENCE_BIT(control
)) {
2572 avp_type
= tvb_get_ntohs(tvb
, (tmp_idx
+=2));
2574 if (avp_type
== CONTROL_MESSAGE
) {
2575 /* We print message type */
2576 msg_type
= tvb_get_ntohs(tvb
, tmp_idx
+2);
2577 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2578 "%s - %s (tunnel id=%u, session id=%u)",
2580 val_to_str_ext(msg_type
, &l2tp_message_type_short_str_vals_ext
, "Unknown (%u)"),
2586 * This is not a control message.
2587 * We never pass here except in case of bad l2tp packet!
2589 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2590 "%s (tunnel id=%u, session id=%u)",
2591 control_msg
, tid
, cid
);
2598 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
2599 "%s (tunnel id=%u, session id=%u)",
2600 data_msg
, tid
, cid
);
2603 if (LENGTH_BIT(control
)) {
2605 * Set the length of this tvbuff to be no longer than the length
2608 * XXX - complain if that length is longer than the length of
2609 * the tvbuff? Have "set_actual_length()" return a Boolean
2610 * and have its callers check the result?
2612 set_actual_length(tvb
, length
);
2616 l2tp_item
= proto_tree_add_item(tree
,proto_l2tp
, tvb
, 0, -1, ENC_NA
);
2617 l2tp_tree
= proto_item_add_subtree(l2tp_item
, ett_l2tp
);
2619 ti
= proto_tree_add_text(l2tp_tree
, tvb
, 0, 2,
2620 "Packet Type: %s Tunnel Id=%d Session Id=%d",
2621 (CONTROL_BIT(control
) ? control_msg
: data_msg
), tid
, cid
);
2623 ctrl_tree
= proto_item_add_subtree(ti
, ett_l2tp_ctrl
);
2624 proto_tree_add_uint(ctrl_tree
, hf_l2tp_type
, tvb
, 0, 2, control
);
2625 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_length_bit
, tvb
, 0, 2, control
);
2626 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_seq_bit
, tvb
, 0, 2, control
);
2627 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_offset_bit
, tvb
, 0, 2, control
);
2628 proto_tree_add_boolean(ctrl_tree
, hf_l2tp_priority
, tvb
, 0, 2, control
);
2629 proto_tree_add_uint(ctrl_tree
, hf_l2tp_version
, tvb
, 0, 2, control
);
2632 if (LENGTH_BIT(control
)) {
2634 proto_tree_add_item(l2tp_tree
, hf_l2tp_length
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2640 proto_tree_add_item(l2tp_tree
, hf_l2tp_tunnel
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2644 proto_tree_add_item(l2tp_tree
, hf_l2tp_session
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2648 if (SEQUENCE_BIT(control
)) {
2650 proto_tree_add_item(l2tp_tree
, hf_l2tp_Ns
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2654 proto_tree_add_item(l2tp_tree
, hf_l2tp_Nr
, tvb
, idx
, 2, ENC_BIG_ENDIAN
);
2658 if (OFFSET_BIT(control
)) {
2659 offset_size
= tvb_get_ntohs(tvb
, idx
);
2661 proto_tree_add_uint(l2tp_tree
, hf_l2tp_offset
, tvb
, idx
, 2,
2665 if (offset_size
!= 0) {
2667 proto_tree_add_text(l2tp_tree
, tvb
, idx
, offset_size
, "Offset Padding");
2673 if (tree
&& (LENGTH_BIT(control
))&&(length
==12)) {
2674 proto_tree_add_text(l2tp_tree
, tvb
, 0, 0, "Zero Length Bit message");
2677 if (!CONTROL_BIT(control
)) { /* Data Messages so we are done */
2679 proto_item_set_len(l2tp_item
, idx
);
2680 /* If we have data, signified by having a length bit, dissect it */
2681 if (tvb_offset_exists(tvb
, idx
)) {
2682 next_tvb
= tvb_new_subset_remaining(tvb
, idx
);
2683 call_dissector(ppp_hdlc_handle
, next_tvb
, pinfo
, tree
);
2685 return tvb_length(tvb
);
2688 if (LENGTH_BIT(control
))
2689 process_control_avps(tvb
, pinfo
, l2tp_tree
, idx
, length
, -1, NULL
);
2691 return tvb_length(tvb
);
2696 * Only L2TPv3 runs directly over IP, and dissect_l2tp_ip starts dissecting
2697 * those packets to call either process_l2tpv3_control for Control Messages
2698 * or process_l2tpv3_data_ip for Data Messages over IP, based on the
2702 dissect_l2tp_ip(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
2705 guint32 sid
; /* Session ID */
2707 conversation_t
*conv
= NULL
;
2708 l2tpv3_conversation_t
*l2tp_conv
= NULL
;
2710 conv
= find_or_create_conversation(pinfo
);
2712 l2tp_conv
= (l2tpv3_conversation_t
*)conversation_get_proto_data(conv
, proto_l2tp
);
2714 l2tp_conv
= wmem_new0(wmem_file_scope(), l2tpv3_conversation_t
);
2715 l2tp_conv
->pt
= PT_NONE
;
2716 conversation_add_proto_data(conv
, proto_l2tp
, (void *)l2tp_conv
);
2719 /* Only L2TPv3 runs directly over IP */
2720 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "L2TPv3");
2722 col_clear(pinfo
->cinfo
, COL_INFO
);
2724 sid
= tvb_get_ntohl(tvb
, idx
);
2726 /* This is control message */
2727 /* Call to process l2tp v3 control message */
2728 process_l2tpv3_control(tvb
, pinfo
, tree
, 4, l2tp_conv
);
2731 /* Call to process l2tp v3 data message */
2732 process_l2tpv3_data_ip(tvb
, pinfo
, tree
, l2tp_conv
);
2738 void init_l2tp_dissection(void)
2740 GSList
*iterator
= list_heads
;
2743 if (iterator
->data
!= NULL
)
2744 g_slist_free((GSList
*)iterator
->data
);
2745 iterator
= g_slist_next(iterator
);
2748 if (list_heads
!= NULL
) {
2749 g_slist_free(list_heads
);
2754 /* registration with the filtering engine */
2756 proto_register_l2tp(void)
2758 static hf_register_info hf
[] = {
2760 { "Type", "l2tp.type", FT_UINT16
, BASE_DEC
, VALS(l2tp_type_vals
), 0x8000,
2761 "Type bit", HFILL
}},
2763 { &hf_l2tp_length_bit
,
2764 { "Length Bit", "l2tp.length_bit", FT_BOOLEAN
, 16, TFS(&l2tp_length_bit_truth
), 0x4000,
2768 { "Sequence Bit", "l2tp.seq_bit", FT_BOOLEAN
, 16, TFS(&l2tp_seq_bit_truth
), 0x0800,
2771 { &hf_l2tp_offset_bit
,
2772 { "Offset bit", "l2tp.offset_bit", FT_BOOLEAN
, 16, TFS(&l2tp_offset_bit_truth
), 0x0200,
2775 { &hf_l2tp_priority
,
2776 { "Priority", "l2tp.priority", FT_BOOLEAN
, 16, TFS(&l2tp_priority_truth
), 0x0100,
2777 "Priority bit", HFILL
}},
2780 { "Version", "l2tp.version", FT_UINT16
, BASE_DEC
, NULL
, 0x000f,
2784 { "Length","l2tp.length", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2788 { "Tunnel ID","l2tp.tunnel", FT_UINT16
, BASE_DEC
, NULL
, 0x0, /* Probably should be FT_BYTES */
2792 { "Session ID","l2tp.session", FT_UINT16
, BASE_DEC
, NULL
, 0x0, /* Probably should be FT_BYTES */
2796 { "Ns","l2tp.Ns", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2800 { "Nr","l2tp.Nr", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2804 { "Offset","l2tp.offset", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2805 "Number of octest past the L2TP header at which the payload data starts.", HFILL
}},
2807 { &hf_l2tp_avp_mandatory
,
2808 { "Mandatory", "l2tp.avp.mandatory", FT_BOOLEAN
, 16, NULL
, 0x8000,
2811 { &hf_l2tp_avp_hidden
,
2812 { "Hidden", "l2tp.avp.hidden", FT_BOOLEAN
, 16, NULL
, 0x4000,
2815 { &hf_l2tp_avp_length
,
2816 { "Length", "l2tp.avp.length", FT_UINT16
, BASE_DEC
, NULL
, 0x03ff,
2819 { &hf_l2tp_avp_vendor_id
,
2820 { "Vendor ID", "l2tp.avp.vendor_id", FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &sminmpec_values_ext
, 0,
2821 "AVP Vendor ID", HFILL
}},
2823 { &hf_l2tp_avp_type
,
2824 { "AVP Type", "l2tp.avp.type", FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &avp_type_vals_ext
, 0,
2827 { &hf_l2tp_tie_breaker
,
2828 { "Tie Breaker", "l2tp.tie_breaker", FT_UINT64
, BASE_HEX
, NULL
, 0,
2832 { "Session ID","l2tp.sid", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
2836 { "Control Connection ID","l2tp.ccid", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
2840 { "Reserved","l2tp.res", FT_UINT16
, BASE_HEX
, NULL
, 0x0,
2844 { "Cookie","l2tp.cookie", FT_BYTES
, BASE_NONE
, NULL
, 0x0,
2847 { &hf_l2tp_l2_spec_def
,
2848 { "Default L2-Specific Sublayer","l2tp.l2_spec_def", FT_NONE
, BASE_NONE
, NULL
, 0x0,
2851 { &hf_l2tp_l2_spec_atm
,
2852 { "ATM-Specific Sublayer","l2tp.l2_spec_atm", FT_NONE
, BASE_NONE
, NULL
, 0x0,
2855 { &hf_l2tp_l2_spec_docsis_dmpt
,
2856 { "DOCSIS DMPT - Specific Sublayer","l2tp.l2_spec_docsis_dmpt", FT_NONE
, BASE_NONE
, NULL
, 0x0,
2859 { &hf_l2tp_l2_spec_v
,
2860 { "V-bit","l2tp.l2_spec_v", FT_BOOLEAN
, 8, NULL
, 0x80,
2861 "VCCV Bit", HFILL
}},
2863 { &hf_l2tp_l2_spec_s
,
2864 { "S-bit","l2tp.l2_spec_s", FT_BOOLEAN
, 8, NULL
, 0x40,
2865 "Sequence Bit", HFILL
}},
2867 { &hf_l2tp_l2_spec_t
,
2868 { "T-bit","l2tp.l2_spec_t", FT_BOOLEAN
, 8, NULL
, 0x08,
2869 "Transport Type Bit", HFILL
}},
2871 { &hf_l2tp_l2_spec_g
,
2872 { "G-bit","l2tp.l2_spec_g", FT_BOOLEAN
, 8, NULL
, 0x04,
2873 "EFCI Bit", HFILL
}},
2875 { &hf_l2tp_l2_spec_c
,
2876 { "C-bit","l2tp.l2_spec_c", FT_BOOLEAN
, 8, NULL
, 0x02,
2877 "CLP Bit", HFILL
}},
2879 { &hf_l2tp_l2_spec_u
,
2880 { "U-bit","l2tp.l2_spec_u", FT_BOOLEAN
, 8, NULL
, 0x01,
2881 "C/R Bit", HFILL
}},
2883 { &hf_l2tp_l2_spec_flow_id
,
2884 { "Flow ID","l2tp.l2_spec_flow_id", FT_UINT8
, BASE_HEX
, NULL
, FLOW_ID_MASK
,
2887 { &hf_l2tp_l2_spec_sequence
,
2888 { "Sequence Number","l2tp.l2_spec_sequence", FT_UINT24
, BASE_DEC
, NULL
, 0x0,
2891 { &hf_l2tp_cisco_avp_type
,
2892 { "Type", "l2tp.avp.ciscotype", FT_UINT16
, BASE_DEC
, VALS(cisco_avp_type_vals
), 0,
2893 "AVP Type", HFILL
}},
2895 { &hf_l2tp_cablelabs_avp_type
,
2896 { "Type", "l2tp.avp.cablelabstype", FT_UINT16
, BASE_DEC
, VALS(cablelabs_avp_type_vals
), 0,
2897 "AVP Type", HFILL
}},
2899 { &hf_l2tp_avp_message_type
,
2900 { "Message Type", "l2tp.avp.message_type", FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &message_type_vals_ext
, 0,
2903 { &hf_l2tp_avp_assigned_tunnel_id
,
2904 { "Assigned Tunnel ID", "l2tp.avp.assigned_tunnel_id", FT_UINT16
, BASE_DEC
, NULL
, 0,
2907 { &hf_l2tp_avp_assigned_control_conn_id
,
2908 { "Assigned Control Connection ID", "l2tp.avp.assigned_control_conn_id", FT_UINT32
, BASE_DEC
, NULL
, 0,
2911 { &hf_l2tp_avp_assigned_session_id
,
2912 { "Assigned Session ID", "l2tp.avp.assigned_session_id", FT_UINT16
, BASE_DEC
, NULL
, 0,
2915 { &hf_l2tp_avp_remote_session_id
,
2916 { "Remote Session ID", "l2tp.avp.remote_session_id", FT_UINT32
, BASE_DEC
, NULL
, 0,
2919 { &hf_l2tp_avp_local_session_id
,
2920 { "Local Session ID", "l2tp.avp.local_session_id", FT_UINT32
, BASE_DEC
, NULL
, 0,
2923 { &hf_l2tp_avp_called_number
,
2924 { "Called Number", "l2tp.avp.called_number", FT_STRING
, BASE_NONE
, NULL
, 0,
2927 { &hf_l2tp_avp_calling_number
,
2928 { "Calling Number", "l2tp.avp.calling_number", FT_STRING
, BASE_NONE
, NULL
, 0,
2931 { &hf_l2tp_cisco_tie_breaker
,
2932 { "Tie Breaker", "l2tp.cisco.tie_breaker", FT_UINT64
, BASE_HEX
, NULL
, 0,
2935 { &hf_l2tp_cablel_avp_l_bit
,
2936 { "L(lock bit)", "l2tp.cablel.l_bit", FT_BOOLEAN
, 16, NULL
, 0x8000,
2939 { &hf_l2tp_cablel_avp_tsid_group_id
,
2940 { "TSID Group ID", "l2tp.cablel.tsid_group_id", FT_UINT16
, BASE_DEC
, NULL
, 0x7f00,
2943 { &hf_l2tp_cablel_avp_frequency
,
2944 { "Frequency", "l2tp.cablel.frequency", FT_UINT32
, BASE_DEC
, NULL
, 0,
2947 { &hf_l2tp_cablel_avp_modulation
,
2948 { "Modulation", "l2tp.cablel.modulation", FT_UINT16
, BASE_DEC
, VALS(l2tp_cablel_modulation_vals
), 0x000f,
2951 { &hf_l2tp_cablel_avp_m
,
2952 { "M", "l2tp.cablel.m", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2955 { &hf_l2tp_cablel_avp_n
,
2956 { "N", "l2tp.cablel.n", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
2959 /* Generated from convert_proto_tree_add_text.pl */
2960 { &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
}},
2961 { &hf_l2tp_cisco_pw_type
, { "PW Type", "l2tp.cisco.pw_type", FT_UINT16
, BASE_DEC
, VALS(pw_types_vals
), 0x0, NULL
, HFILL
}},
2962 { &hf_l2tp_cisco_local_session_id
, { "Local Session ID", "l2tp.cisco.local_session_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2963 { &hf_l2tp_cisco_remote_session_id
, { "Remote Session ID", "l2tp.cisco.remote_session_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2964 { &hf_l2tp_cisco_assigned_cookie
, { "Assigned Cookie", "l2tp.cisco.assigned_cookie", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2965 { &hf_l2tp_cisco_remote_end_id
, { "Remote End ID", "l2tp.cisco.remote_end_id", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2966 { &hf_l2tp_cisco_pseudowire_type
, { "Pseudowire Type", "l2tp.cisco.pseudowire_type", FT_UINT16
, BASE_DEC
, VALS(pw_types_vals
), 0x0, NULL
, HFILL
}},
2967 { &hf_l2tp_cisco_circuit_status
, { "Circuit Status", "l2tp.cisco.circuit_status", FT_BOOLEAN
, 16, TFS(&tfs_up_down
), 0x0001, NULL
, HFILL
}},
2968 { &hf_l2tp_cisco_circuit_type
, { "Circuit Type", "l2tp.cisco.circuit_type", FT_BOOLEAN
, 16, TFS(&tfs_new_existing
), 0x0001, NULL
, HFILL
}},
2969 { &hf_l2tp_cisco_draft_avp_version
, { "Draft AVP Version", "l2tp.cisco.draft_avp_version", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2970 { &hf_l2tp_cisco_message_digest
, { "Message Digest", "l2tp.cisco.message_digest", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2971 { &hf_l2tp_cisco_nonce
, { "Nonce", "l2tp.cisco.nonce", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2972 { &hf_l2tp_cisco_interface_mtu
, { "Interface MTU", "l2tp.cisco.interface_mtu", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2973 { &hf_l2tp_stop_ccn_result_code
, { "Result code", "l2tp.result_code", FT_UINT16
, BASE_DEC
, VALS(result_code_stopccn_vals
), 0x0, NULL
, HFILL
}},
2974 { &hf_l2tp_result_code
, { "Result code", "l2tp.result_code", FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &result_code_cdn_vals_ext
, 0x0, NULL
, HFILL
}},
2975 { &hf_l2tp_avp_error_code
, { "Error code", "l2tp.avp.error_code", FT_UINT16
, BASE_DEC
, VALS(error_code_vals
), 0x0, NULL
, HFILL
}},
2976 { &hf_l2tp_avp_error_message
, { "Error Message", "l2tp.avp.error_message", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2977 { &hf_l2tp_avp_protocol_version
, { "Version", "l2tp.avp.protocol_version", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2978 { &hf_l2tp_avp_protocol_revision
, { "Revision", "l2tp.avp.protocol_revision", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2979 { &hf_l2tp_avp_async_framing_supported
, { "Async Framing Supported", "l2tp.avp.async_framing_supported", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0002, NULL
, HFILL
}},
2980 { &hf_l2tp_avp_sync_framing_supported
, { "Sync Framing Supported", "l2tp.avp.sync_framing_supported", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0001, NULL
, HFILL
}},
2981 { &hf_l2tp_avp_analog_access_supported
, { "Analog Access Supported", "l2tp.avp.analog_access_supported", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0002, NULL
, HFILL
}},
2982 { &hf_l2tp_avp_digital_access_supported
, { "Digital Access Supported", "l2tp.avp.digital_access_supported", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0001, NULL
, HFILL
}},
2983 { &hf_l2tp_avp_firmware_revision
, { "Firmware Revision", "l2tp.avp.firmware_revision", FT_UINT16
, BASE_DEC_HEX
, NULL
, 0x0, NULL
, HFILL
}},
2984 { &hf_l2tp_avp_host_name
, { "Host Name", "l2tp.avp.host_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2985 { &hf_l2tp_avp_vendor_name
, { "Vendor Name", "l2tp.avp.vendor_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2986 { &hf_l2tp_avp_receive_window_size
, { "Receive Window Size", "l2tp.avp.receive_window_size", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2987 { &hf_l2tp_avp_chap_challenge
, { "CHAP Challenge", "l2tp.avp.chap_challenge", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2988 { &hf_l2tp_avp_cause_code
, { "Cause Code", "l2tp.avp.cause_code", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2989 { &hf_l2tp_avp_cause_msg
, { "Cause Msg", "l2tp.avp.cause_msg", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2990 { &hf_l2tp_avp_advisory_msg
, { "Advisory Msg", "l2tp.avp.advisory_msg", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2991 { &hf_l2tp_avp_chap_challenge_response
, { "CHAP Challenge Response", "l2tp.avp.chap_challenge_response", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
2992 { &hf_l2tp_avp_call_serial_number
, { "Call Serial Number", "l2tp.avp.call_serial_number", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2993 { &hf_l2tp_avp_minimum_bps
, { "Minimum BPS", "l2tp.avp.minimum_bps", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2994 { &hf_l2tp_avp_maximum_bps
, { "Maximum BPS", "l2tp.avp.maximum_bps", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
2995 { &hf_l2tp_avp_analog_bearer_type
, { "Analog Bearer Type", "l2tp.avp.analog_bearer_type", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0002, NULL
, HFILL
}},
2996 { &hf_l2tp_avp_digital_bearer_type
, { "Digital Bearer Type", "l2tp.avp.digital_bearer_type", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0001, NULL
, HFILL
}},
2997 { &hf_l2tp_avp_async_framing_type
, { "Async Framing Type", "l2tp.avp.async_framing_type", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0002, NULL
, HFILL
}},
2998 { &hf_l2tp_avp_sync_framing_type
, { "Sync Framing Type", "l2tp.avp.sync_framing_type", FT_BOOLEAN
, 32, TFS(&tfs_true_false
), 0x0001, NULL
, HFILL
}},
2999 { &hf_l2tp_avp_sub_address
, { "Sub-Address", "l2tp.avp.sub_address", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3000 { &hf_l2tp_avp_connect_speed
, { "Connect Speed", "l2tp.avp.connect_speed", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3001 { &hf_l2tp_avp_physical_channel
, { "Physical Channel", "l2tp.avp.physical_channel", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3002 { &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
}},
3003 { &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
}},
3004 { &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
}},
3005 { &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
}},
3006 { &hf_l2tp_avp_proxy_authen_name
, { "Proxy Authen Name", "l2tp.avp.proxy_authen_name", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3007 { &hf_l2tp_avp_proxy_authen_challenge
, { "Proxy Authen Challenge", "l2tp.avp.proxy_authen_challenge", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3008 { &hf_l2tp_avp_proxy_authen_id
, { "Proxy Authen ID", "l2tp.avp.proxy_authen_id", FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3009 { &hf_l2tp_avp_proxy_authen_response
, { "Proxy Authen Response", "l2tp.avp.proxy_authen_response", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3010 { &hf_l2tp_avp_crc_errors
, { "CRC Errors", "l2tp.avp.crc_errors", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3011 { &hf_l2tp_avp_framing_errors
, { "Framing Errors", "l2tp.avp.framing_errors", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3012 { &hf_l2tp_avp_hardware_overruns
, { "Hardware Overruns", "l2tp.avp.hardware_overruns", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3013 { &hf_l2tp_avp_buffer_overruns
, { "Buffer Overruns", "l2tp.avp.buffer_overruns", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3014 { &hf_l2tp_avp_time_out_errors
, { "Time-out Errors", "l2tp.avp.time_out_errors", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3015 { &hf_l2tp_avp_alignment_errors
, { "Alignment Errors", "l2tp.avp.alignment_errors", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3016 { &hf_l2tp_avp_send_accm
, { "Send ACCM", "l2tp.avp.send_accm", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3017 { &hf_l2tp_avp_receive_accm
, { "Receive ACCM", "l2tp.avp.receive_accm", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3018 { &hf_l2tp_avp_random_vector
, { "Random Vector", "l2tp.avp.random_vector", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3019 { &hf_l2tp_avp_private_group_id
, { "Private Group ID", "l2tp.avp.private_group_id", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3020 { &hf_l2tp_avp_rx_connect_speed
, { "Rx Connect Speed", "l2tp.avp.rx_connect_speed", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3021 { &hf_l2tp_avp_disconnect_code
, { "Disconnect Code", "l2tp.avp.disconnect_code", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3022 { &hf_l2tp_avp_control_protocol_number
, { "Control Protocol Number", "l2tp.avp.control_protocol_number", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3023 { &hf_l2tp_avp_cause_code_direction
, { "Direction", "l2tp.avp.cause_code_direction", FT_UINT8
, BASE_DEC
, VALS(cause_code_direction_vals
), 0x0, NULL
, HFILL
}},
3024 { &hf_l2tp_avp_cause_code_message
, { "Message", "l2tp.avp.cause_code_message", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3025 { &hf_l2tp_avp_message_digest
, { "Message Digest", "l2tp.avp.message_digest", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3026 { &hf_l2tp_avp_router_id
, { "Router ID", "l2tp.avp.router_id", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
3027 { &hf_l2tp_avp_pw_type
, { "PW Type", "l2tp.avp.pw_type", FT_UINT16
, BASE_DEC
, VALS(pw_types_vals
), 0x0, NULL
, HFILL
}},
3028 { &hf_l2tp_avp_assigned_cookie
, { "Assigned Cookie", "l2tp.avp.assigned_cookie", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3029 { &hf_l2tp_avp_remote_end_id
, { "Remote End ID", "l2tp.avp.remote_end_id", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3030 { &hf_l2tp_avp_pseudowire_type
, { "Pseudowire Type", "l2tp.avp.pseudowire_type", FT_UINT16
, BASE_DEC
, VALS(pw_types_vals
), 0x0, NULL
, HFILL
}},
3031 { &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
}},
3032 { &hf_l2tp_avp_data_sequencing
, { "Data Sequencing", "l2tp.avp.data_sequencing", FT_UINT16
, BASE_DEC
, VALS(data_sequencing_vals
), 0x0, NULL
, HFILL
}},
3033 { &hf_l2tp_avp_circuit_status
, { "Circuit Status", "l2tp.avp.circuit_status", FT_BOOLEAN
, 16, TFS(&tfs_up_down
), 0x0001, NULL
, HFILL
}},
3034 { &hf_l2tp_avp_circuit_type
, { "Circuit Type", "l2tp.avp.circuit_type", FT_BOOLEAN
, 16, TFS(&tfs_new_existing
), 0x0002, NULL
, HFILL
}},
3035 { &hf_l2tp_avp_preferred_language
, { "Preferred Language", "l2tp.avp.preferred_language", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3036 { &hf_l2tp_avp_nonce
, { "Nonce", "l2tp.avp.nonce", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
3037 { &hf_l2tp_avp_tx_connect_speed_v3
, { "Tx Connect Speed v3", "l2tp.avp.tx_connect_speed_v3", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
3038 { &hf_l2tp_avp_rx_connect_speed_v3
, { "Rx Connect Speed v3", "l2tp.avp.rx_connect_speed_v3", FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
3041 static gint
*ett
[] = {
3050 static ei_register_info ei
[] = {
3051 { &ei_l2tp_incorrect_digest
, { "l2tp.incorrect_digest", PI_CHECKSUM
, PI_WARN
, "Incorrect Digest", EXPFILL
}},
3054 module_t
*l2tp_module
;
3055 expert_module_t
* expert_l2tp
;
3057 proto_l2tp
= proto_register_protocol(
3058 "Layer 2 Tunneling Protocol", "L2TP", "l2tp");
3059 proto_register_field_array(proto_l2tp
, hf
, array_length(hf
));
3060 proto_register_subtree_array(ett
, array_length(ett
));
3061 expert_l2tp
= expert_register_protocol(proto_l2tp
);
3062 expert_register_field_array(expert_l2tp
, ei
, array_length(ei
));
3064 l2tp_vendor_avp_dissector_table
= register_dissector_table("l2tp.vendor_avp", "L2TP vendor AVP dissector table", FT_UINT32
, BASE_DEC
);
3066 l2tp_module
= prefs_register_protocol(proto_l2tp
, NULL
);
3068 prefs_register_enum_preference(l2tp_module
,
3070 "L2TPv3 Cookie Size",
3071 "L2TPv3 Cookie Size",
3076 prefs_register_enum_preference(l2tp_module
,
3078 "L2TPv3 L2-Specific Sublayer",
3079 "L2TPv3 L2-Specific Sublayer",
3080 &l2tpv3_l2_specific
,
3081 l2tpv3_l2_specifics
,
3084 prefs_register_enum_preference(l2tp_module
,
3086 "Decode L2TPv3 packet contents as this protocol",
3087 "Decode L2TPv3 packet contents as this protocol",
3092 prefs_register_string_preference(l2tp_module
,"shared_secret","Shared Secret",
3093 "Shared secret used for control message digest authentication",
3096 register_init_routine(init_l2tp_dissection
);
3100 proto_reg_handoff_l2tp(void)
3102 l2tp_udp_handle
= new_create_dissector_handle(dissect_l2tp_udp
, proto_l2tp
);
3103 dissector_add_uint("udp.port", UDP_PORT_L2TP
, l2tp_udp_handle
);
3105 l2tp_ip_handle
= create_dissector_handle(dissect_l2tp_ip
, proto_l2tp
);
3106 dissector_add_uint("ip.proto", IP_PROTO_L2TP
, l2tp_ip_handle
);
3109 * Get a handle for the PPP-in-HDLC-like-framing dissector.
3111 ppp_hdlc_handle
= find_dissector("ppp_hdlc");
3112 ppp_lcp_options_handle
= find_dissector("ppp_lcp_options");
3114 /* Register vendor AVP dissector(s)*/
3115 dissector_add_uint("l2tp.vendor_avp", VENDOR_CABLELABS
, new_create_dissector_handle(dissect_l2tp_vnd_cablelabs_avps
, proto_l2tp
));
3119 * Get a handle for the dissectors used in v3.
3121 eth_withoutfcs_handle
= find_dissector("eth_withoutfcs");
3122 chdlc_handle
= find_dissector("chdlc");
3123 fr_handle
= find_dissector("fr");
3124 ip_handle
= find_dissector("ip");
3125 mpls_handle
= find_dissector("mpls");
3126 atm_oam_handle
= find_dissector("atm_oam_cell");
3127 llc_handle
= find_dissector("llc");
3128 lapd_handle
= find_dissector("lapd");
3129 mp2t_handle
= find_dissector("mp2t");
3130 ehdlc_handle
= find_dissector("ehdlc");
3131 data_handle
= find_dissector("data");