Coverage Report

Created: 2026-09-28 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-ldp.c
Line
Count
Source
1
/* packet-ldp.c
2
 * Routines for LDP (RFC 3036) packet disassembly
3
 *
4
 * Copyright (c) November 2000 by Richard Sharpe <rsharpe@ns.aus.com>
5
 *
6
 * CRLDP (RFC3212) is now supported
7
 *   - (c) 2002 Michael Rozhavsky <mike[AT]tochna.technion.ac.il>
8
 *
9
 * (c) Copyright 2011, Shobhank Sharma <ssharma5@ncsu.edu>
10
 *   -  update the VCCV bitmaps as per RFC 5885
11
 *
12
 * (c) Copyright 2012, Aditya Ambadkar and Diana Chris <arambadk,dvchris@ncsu.edu>
13
 *   -  support for the flowlabel sub-tlv as per RFC 6391
14
 *
15
 * (c) Copyright 2013, Gaurav Patwardhan <gspatwar@ncsu.edu>
16
 *   -  support for the GTSM flag as per RFC 6720
17
 *
18
 * (c) Copyright 2013, Rupesh Patro <rbpatro@ncsu.edu>
19
 *   -  Support for Upstream-Assigned Label TLVs and Sub-TLVs as per RFC 6389
20
 *
21
 * Wireshark - Network traffic analyzer
22
 * By Gerald Combs <gerald@wireshark.org>
23
 * Copyright 1999 Gerald Combs
24
 *
25
 * SPDX-License-Identifier: GPL-2.0-or-later
26
 */
27
28
#include "config.h"
29
30
#include <epan/packet.h>
31
#include <epan/exceptions.h>
32
#include <epan/addr_resolv.h>
33
#include <epan/prefs.h>
34
#include <epan/expert.h>
35
#include <epan/show_exception.h>
36
#include <epan/tfs.h>
37
#include <epan/iana-info.h>
38
#include <wsutil/array.h>
39
40
#include "packet-diffserv-mpls-common.h"
41
#include "packet-ldp.h"
42
43
16
#define TCP_PORT_LDP 646
44
16
#define UDP_PORT_LDP 646
45
46
47
void proto_register_ldp(void);
48
void proto_reg_handoff_ldp(void);
49
50
static dissector_handle_t ldp_tcp_handle, ldp_handle;
51
52
static int proto_ldp;
53
54
/* Delete the following if you do not use it, or add to it if you need */
55
/* static int hf_ldp_req; */
56
/* static int hf_ldp_rsp; */
57
static int hf_ldp_version;
58
static int hf_ldp_pdu_len;
59
static int hf_ldp_lsr;
60
static int hf_ldp_ls_id;
61
static int hf_ldp_msg_ubit;
62
static int hf_ldp_msg_type;
63
static int hf_ldp_msg_len;
64
static int hf_ldp_msg_id;
65
static int hf_ldp_msg_vendor_id;
66
static int hf_ldp_msg_experiment_id;
67
static int hf_ldp_tlv_value;
68
static int hf_ldp_tlv_type;
69
static int hf_ldp_tlv_unknown;
70
static int hf_ldp_tlv_len;
71
static int hf_ldp_tlv_val_hold;
72
static int hf_ldp_tlv_val_target;
73
static int hf_ldp_tlv_val_request;
74
static int hf_ldp_tlv_val_res;
75
static int hf_ldp_tlv_val_gtsm_flag;
76
static int hf_ldp_tlv_ipv4_taddr;
77
static int hf_ldp_tlv_config_seqno;
78
static int hf_ldp_tlv_ipv6_taddr;
79
static int hf_ldp_tlv_fec_wc;
80
static int hf_ldp_tlv_fec_af;
81
static int hf_ldp_tlv_fec_len;
82
static int hf_ldp_tlv_fec_pfval;
83
static int hf_ldp_tlv_fec_hoval;
84
static int hf_ldp_tlv_addrl_addr_family;
85
static int hf_ldp_tlv_addrl_addr;
86
static int hf_ldp_tlv_hc_value;
87
static int hf_ldp_tlv_pv_lsrid;
88
static int hf_ldp_tlv_generic_label;
89
static int hf_ldp_tlv_atm_label_vbits;
90
static int hf_ldp_tlv_atm_label_vpi;
91
static int hf_ldp_tlv_atm_label_vci;
92
static int hf_ldp_tlv_fr_label_len;
93
static int hf_ldp_tlv_fr_label_dlci;
94
static int hf_ldp_tlv_ft_protect_sequence_num;
95
static int hf_ldp_tlv_status_ebit;
96
static int hf_ldp_tlv_status_fbit;
97
static int hf_ldp_tlv_status_data;
98
static int hf_ldp_tlv_status_msg_id;
99
static int hf_ldp_tlv_status_msg_type;
100
static int hf_ldp_tlv_extstatus_data;
101
static int hf_ldp_tlv_returned_version;
102
static int hf_ldp_tlv_returned_pdu_len;
103
static int hf_ldp_tlv_returned_lsr;
104
static int hf_ldp_tlv_returned_ls_id;
105
static int hf_ldp_tlv_returned_msg_ubit;
106
static int hf_ldp_tlv_returned_msg_type;
107
static int hf_ldp_tlv_returned_msg_len;
108
static int hf_ldp_tlv_returned_msg_id;
109
static int hf_ldp_tlv_mac;
110
static int hf_ldp_tlv_sess_ver;
111
static int hf_ldp_tlv_sess_ka;
112
static int hf_ldp_tlv_sess_advbit;
113
static int hf_ldp_tlv_sess_ldetbit;
114
static int hf_ldp_tlv_sess_pvlim;
115
static int hf_ldp_tlv_sess_mxpdu;
116
static int hf_ldp_tlv_sess_rxlsr;
117
static int hf_ldp_tlv_sess_rxls;
118
static int hf_ldp_tlv_sess_atm_merge;
119
static int hf_ldp_tlv_sess_atm_lr;
120
static int hf_ldp_tlv_sess_atm_dir;
121
static int hf_ldp_tlv_sess_atm_minvpi;
122
static int hf_ldp_tlv_sess_atm_maxvpi;
123
static int hf_ldp_tlv_sess_atm_minvci;
124
static int hf_ldp_tlv_sess_atm_maxvci;
125
static int hf_ldp_tlv_sess_fr_merge;
126
static int hf_ldp_tlv_sess_fr_lr;
127
static int hf_ldp_tlv_sess_fr_dir;
128
static int hf_ldp_tlv_sess_fr_len;
129
static int hf_ldp_tlv_sess_fr_mindlci;
130
static int hf_ldp_tlv_sess_fr_maxdlci;
131
static int hf_ldp_tlv_ft_sess_flags;
132
static int hf_ldp_tlv_ft_sess_flag_r;
133
static int hf_ldp_tlv_ft_sess_flag_res;
134
static int hf_ldp_tlv_ft_sess_flag_s;
135
static int hf_ldp_tlv_ft_sess_flag_a;
136
static int hf_ldp_tlv_ft_sess_flag_c;
137
static int hf_ldp_tlv_ft_sess_flag_l;
138
static int hf_ldp_tlv_ft_sess_res;
139
static int hf_ldp_tlv_ft_sess_reconn_to;
140
static int hf_ldp_tlv_ft_sess_recovery_time;
141
static int hf_ldp_tlv_ft_ack_sequence_num;
142
static int hf_ldp_tlv_lbl_req_msg_id;
143
static int hf_ldp_tlv_vendor_id;
144
static int hf_ldp_tlv_experiment_id;
145
static int hf_ldp_tlv_fec_vc_controlword;
146
static int hf_ldp_tlv_fec_vc_vctype;
147
static int hf_ldp_tlv_fec_vc_infolength;
148
static int hf_ldp_tlv_fec_vc_groupid;
149
static int hf_ldp_tlv_fec_vc_vcid;
150
static int hf_ldp_tlv_fec_vc_intparam_length;
151
static int hf_ldp_tlv_fec_vc_intparam_mtu;
152
static int hf_ldp_tlv_fec_vc_intparam_tdmbps;
153
static int hf_ldp_tlv_fec_vc_intparam_id;
154
static int hf_ldp_tlv_fec_vc_intparam_maxcatmcells;
155
static int hf_ldp_tlv_fec_vc_intparam_desc;
156
static int hf_ldp_tlv_fec_vc_intparam_cepbytes;
157
static int hf_ldp_tlv_fec_vc_intparam_cepopt_ais;
158
static int hf_ldp_tlv_fec_vc_intparam_cepopt_une;
159
static int hf_ldp_tlv_fec_vc_intparam_cepopt_rtp;
160
static int hf_ldp_tlv_fec_vc_intparam_cepopt_ebm;
161
static int hf_ldp_tlv_fec_vc_intparam_cepopt_mah;
162
static int hf_ldp_tlv_fec_vc_intparam_cepopt_res;
163
static int hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype;
164
static int hf_ldp_tlv_fec_vc_intparam_cepopt_t3;
165
static int hf_ldp_tlv_fec_vc_intparam_cepopt_e3;
166
static int hf_ldp_tlv_fec_vc_intparam_vlanid;
167
static int hf_ldp_tlv_fec_vc_intparam_dlcilen;
168
static int hf_ldp_tlv_fec_vc_intparam_fcslen;
169
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_r;
170
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_d;
171
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_f;
172
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_res1;
173
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_pt;
174
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_res2;
175
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_freq;
176
static int hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc;
177
static int hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw;
178
static int hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra;
179
static int hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1;
180
static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping;
181
static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping;
182
static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1;
183
static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2;
184
static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3;
185
static int hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4;
186
static int hf_ldp_tlv_fec_vc_intparam_flowlabel_t;                    /* Flow label interface parameter RFC6391 */
187
static int hf_ldp_tlv_fec_vc_intparam_flowlabel_r;                    /* Flow label interface parameter RFC6391 */
188
static int hf_ldp_tlv_fec_vc_intparam_flowlabel_res;                  /* Flow label interface parameter RFC6391 */
189
static int hf_ldp_tlv_lspid_act_flg;
190
static int hf_ldp_tlv_lspid_cr_lsp;
191
static int hf_ldp_tlv_lspid_ldpid;
192
static int hf_ldp_tlv_er_hop_loose;
193
static int hf_ldp_tlv_er_hop_prelen;
194
static int hf_ldp_tlv_er_hop_prefix4;
195
static int hf_ldp_tlv_er_hop_prefix6;
196
static int hf_ldp_tlv_er_hop_as;
197
static int hf_ldp_tlv_er_hop_cr_lsp;
198
static int hf_ldp_tlv_er_hop_ldpid;
199
static int hf_ldp_tlv_flags_reserv;
200
static int hf_ldp_tlv_flags_weight;
201
static int hf_ldp_tlv_flags_ebs;
202
static int hf_ldp_tlv_flags_cbs;
203
static int hf_ldp_tlv_flags_cdr;
204
static int hf_ldp_tlv_flags_pbs;
205
static int hf_ldp_tlv_flags_pdr;
206
static int hf_ldp_tlv_frequency;
207
static int hf_ldp_tlv_pdr;
208
static int hf_ldp_tlv_pbs;
209
static int hf_ldp_tlv_cdr;
210
static int hf_ldp_tlv_cbs;
211
static int hf_ldp_tlv_ebs;
212
static int hf_ldp_tlv_weight;
213
static int hf_ldp_tlv_set_prio;
214
static int hf_ldp_tlv_hold_prio;
215
static int hf_ldp_tlv_route_pinning;
216
static int hf_ldp_tlv_resource_class;
217
/* static int hf_ldp_tlv_diffserv; */
218
static int hf_ldp_tlv_diffserv_type;
219
static int hf_ldp_tlv_diffserv_mapnb;
220
static int hf_ldp_tlv_diffserv_map;
221
static int hf_ldp_tlv_diffserv_map_exp;
222
static int hf_ldp_tlv_diffserv_phbid;
223
static int hf_ldp_tlv_diffserv_phbid_dscp;
224
static int hf_ldp_tlv_diffserv_phbid_code;
225
static int hf_ldp_tlv_diffserv_phbid_bit14;
226
static int hf_ldp_tlv_diffserv_phbid_bit15;
227
static int hf_ldp_tlv_fec_gen_agi_type;
228
static int hf_ldp_tlv_fec_gen_agi_length;
229
static int hf_ldp_tlv_fec_gen_agi_value;
230
static int hf_ldp_tlv_fec_gen_saii_type;
231
static int hf_ldp_tlv_fec_gen_saii_length;
232
static int hf_ldp_tlv_fec_gen_saii_value;
233
static int hf_ldp_tlv_fec_gen_taii_type;
234
static int hf_ldp_tlv_fec_gen_taii_length;
235
static int hf_ldp_tlv_fec_gen_taii_value;
236
static int hf_ldp_tlv_fec_gen_aai_globalid;
237
static int hf_ldp_tlv_fec_gen_aai_prefix;
238
static int hf_ldp_tlv_fec_gen_aai_ac_id;
239
static int hf_ldp_tlv_fec_pw_controlword;
240
static int hf_ldp_tlv_fec_pw_pwtype;
241
static int hf_ldp_tlv_fec_pw_infolength;
242
static int hf_ldp_tlv_fec_pw_groupid;
243
static int hf_ldp_tlv_fec_pw_pwid;
244
static int hf_ldp_tlv_pw_status_data;
245
static int hf_ldp_tlv_pw_not_forwarding;
246
static int hf_ldp_tlv_pw_lac_ingress_recv_fault;
247
static int hf_ldp_tlv_pw_lac_egress_recv_fault;
248
static int hf_ldp_tlv_pw_psn_pw_ingress_recv_fault;
249
static int hf_ldp_tlv_pw_psn_pw_egress_recv_fault;
250
static int hf_ldp_tlv_pw_grouping_value;
251
static int hf_ldp_tlv_intparam_length;
252
static int hf_ldp_tlv_intparam_mtu;
253
static int hf_ldp_tlv_intparam_tdmbps;
254
static int hf_ldp_tlv_intparam_id;
255
static int hf_ldp_tlv_intparam_maxcatmcells;
256
static int hf_ldp_tlv_intparam_desc;
257
static int hf_ldp_tlv_intparam_cepbytes;
258
static int hf_ldp_tlv_intparam_cepopt_ais;
259
static int hf_ldp_tlv_intparam_cepopt_une;
260
static int hf_ldp_tlv_intparam_cepopt_rtp;
261
static int hf_ldp_tlv_intparam_cepopt_ebm;
262
static int hf_ldp_tlv_intparam_cepopt_mah;
263
static int hf_ldp_tlv_intparam_cepopt_res;
264
static int hf_ldp_tlv_intparam_cepopt_ceptype;
265
static int hf_ldp_tlv_intparam_cepopt_t3;
266
static int hf_ldp_tlv_intparam_cepopt_e3;
267
static int hf_ldp_tlv_intparam_vlanid;
268
static int hf_ldp_tlv_intparam_dlcilen;
269
static int hf_ldp_tlv_intparam_fcslen;
270
static int hf_ldp_tlv_intparam_tdmopt_r;
271
static int hf_ldp_tlv_intparam_tdmopt_d;
272
static int hf_ldp_tlv_intparam_tdmopt_f;
273
static int hf_ldp_tlv_intparam_tdmopt_res1;
274
static int hf_ldp_tlv_intparam_tdmopt_pt;
275
static int hf_ldp_tlv_intparam_tdmopt_res2;
276
static int hf_ldp_tlv_intparam_tdmopt_freq;
277
static int hf_ldp_tlv_intparam_tdmopt_ssrc;
278
static int hf_ldp_tlv_intparam_vccv_cctype_cw;
279
static int hf_ldp_tlv_intparam_vccv_cctype_mplsra;
280
static int hf_ldp_tlv_intparam_vccv_cctype_ttl1;
281
static int hf_ldp_tlv_intparam_vccv_cvtype_icmpping;
282
static int hf_ldp_tlv_intparam_vccv_cvtype_lspping;
283
static int hf_ldp_tlv_intparam_vccv_cvtype_bfd;
284
static int hf_ldp_tlv_upstr_sbit;
285
static int hf_ldp_tlv_upstr_lbl_req_resvbit;
286
static int hf_ldp_tlv_upstr_ass_lbl;
287
static int hf_ldp_tlv_upstr_lbl_resvbit;
288
static int hf_ldp_tlv_ipv4_intID_hop_addr;
289
static int hf_ldp_tlv_logical_intID;
290
static int hf_ldp_tlv_ip_multicast_srcaddr;
291
static int hf_ldp_tlv_ip_multicast_mltcstaddr;
292
static int hf_ldp_tlv_ldp_p2mp_lsptype;
293
static int hf_ldp_tlv_ip_mpls_context_srcaddr;
294
static int hf_ldp_tlv_ldp_p2mp_addrfam;
295
static int hf_ldp_tlv_ldp_p2mp_addrlen;
296
static int hf_ldp_tlv_ldp_p2mp_rtnodeaddr;
297
static int hf_ldp_tlv_ldp_p2mp_oplength;
298
static int hf_ldp_tlv_ldp_p2mp_opvalue;
299
static int hf_ldp_tlv_rsvp_te_p2mp_id;
300
static int hf_ldp_tlv_must_be_zero;
301
static int hf_ldp_tlv_tunnel_id;
302
static int hf_ldp_tlv_ext_tunnel_id;
303
static int hf_ldp_tlv_inv_length;
304
static int hf_ldp_returned_pdu_data;
305
static int hf_ldp_returned_message_parameters;
306
static int hf_ldp_data;
307
static int hf_ldp_unknown_data;
308
309
310
static int ett_ldp;
311
static int ett_ldp_header;
312
static int ett_ldp_ldpid;
313
static int ett_ldp_message;
314
static int ett_ldp_tlv;
315
static int ett_ldp_tlv_val;
316
static int ett_ldp_tlv_ft_flags;
317
static int ett_ldp_fec;
318
static int ett_ldp_fec_vc_interfaceparam;
319
static int ett_ldp_fec_vc_interfaceparam_cepopt;
320
static int ett_ldp_fec_vc_interfaceparam_vccvtype;
321
static int ett_ldp_diffserv_map;
322
static int ett_ldp_diffserv_map_phbid;
323
static int ett_ldp_gen_agi;
324
static int ett_ldp_gen_saii;
325
static int ett_ldp_gen_taii;
326
static int ett_ldp_gen_aai_type2;
327
static int ett_ldp_sub_tlv;
328
329
static expert_field ei_ldp_dtsm_and_target;
330
static expert_field ei_ldp_gtsm_supported;
331
static expert_field ei_ldp_gtsm_not_supported_basic_discovery;
332
static expert_field ei_ldp_gtsm_not_supported;
333
static expert_field ei_ldp_inv_length;
334
static expert_field ei_ldp_tlv_fec_vc_infolength;
335
static expert_field ei_ldp_tlv_fec_type;
336
static expert_field ei_ldp_tlv_fec_len;
337
static expert_field ei_ldp_malformed_data;
338
static expert_field ei_ldp_address_family_not_implemented;
339
static expert_field ei_ldp_malformed_interface_parameter;
340
static expert_field ei_ldp_tlv_fec;
341
342
/* desegmentation of LDP over TCP */
343
static bool ldp_desegment = true;
344
345
/*
346
 * The following define all the TLV types I know about
347
 * http://www.iana.org/assignments/ldp-namespaces
348
 */
349
#define TLV_SEQUENCE_NUMBER                     0x0001  /* [RFC7769] */
350
16
#define TLV_FEC                                 0x0100  /* [RFC5036] */
351
10
#define TLV_ADDRESS_LIST                        0x0101  /* [RFC5036] */
352
1
#define TLV_HOP_COUNT                           0x0103  /* [RFC5036] */
353
8
#define TLV_PATH_VECTOR                         0x0104  /* [RFC5036] */
354
7
#define TLV_GENERIC_LABEL                       0x0200  /* [RFC5036] */
355
1
#define TLV_ATM_LABEL                           0x0201  /* [RFC5036] */
356
3
#define TLV_FRAME_RELAY_LABEL                   0x0202  /* [RFC5036] */
357
2
#define TLV_FT_PROTECTION                       0x0203  /* [RFC3479] */
358
6
#define TLV_LDP_UPSTREAM_ASSIGNED_LABEL         0x0204  /* [RFC6389] */
359
0
#define TLV_LDP_UPSTREAM_ASSIGNED_LABEL_REQUEST 0x0205  /* [RFC6389] */
360
0
#define TLV_ENTROPY_LABEL_CAPA                  0x0206  /* [RFC6790] */
361
3
#define TLV_STATUS                              0x0300  /* [RFC5036] */
362
1
#define TLV_EXTENDED_STATUS                     0x0301  /* [RFC5036] */
363
1
#define TLV_RETURNED_PDU                        0x0302  /* [RFC5036] */
364
11
#define TLV_RETURNED_MESSAGE                    0x0303  /* [RFC5036] */
365
#define TLV_RETURNED_TLVS                       0x0304  /* [RFC5561] */
366
5
#define TLV_COMMON_HELLO_PARAMS                 0x0400  /* [RFC5036] */
367
1
#define TLV_IPV4_TRANSPORT_ADDRESS              0x0401  /* [RFC5036] */
368
1
#define TLV_CONFIGURATION_SEQUENCE_NUMBER       0x0402  /* [RFC5036] */
369
1
#define TLV_IPV6_TRANSPORT_ADDRESS              0x0403  /* [RFC5036] */
370
19
#define TLV_MAC                                 0x0404  /* [RFC4762] */
371
#define TLV_CRYPTOGRAPHIC_AUTHENTICATION        0x0405  /* [RFC7349] */
372
#define TLV_MAC_FLUSH_PARAMS                    0x0406  /* [RFC7361] */
373
#define TLV_PBB_B_MAC_LIST_SUB                  0x0407  /* [RFC7361] */
374
#define TLV_PBB_I_SID_LIST_SUB                  0x0408  /* [RFC7361] */
375
3
#define TLV_COMMON_SESSION_PARAMS               0x0500  /* [RFC5036] */
376
0
#define TLV_ATM_SESSION_PARAMS                  0x0501  /* [RFC5036] */
377
8
#define TLV_FRAME_RELAY_SESSION_PARAMS          0x0502  /* [RFC5036] */
378
0
#define TLV_FT_SESSION                          0x0503  /* [RFC3479] */
379
1
#define TLV_FT_ACK                              0x0504  /* [RFC3479] */
380
2
#define TLV_FT_CORK                             0x0505  /* [RFC3479] */
381
#define TLV_DYNAMIC_CAPA_ANNOUNCEMENT           0x0506  /* [RFC5561] */
382
0
#define TLV_LDP_UPSTREAM_LABEL_ASSIGNMENT_CAPA  0x0507  /* [RFC6389] */
383
#define TLV_P2MP_CAPA_PARAM                     0x0508  /* [RFC6388] */
384
#define TLV_MP2MP_CAPA_PARAM                    0x0509  /* [RFC6388] */
385
#define TLV_MBB_CAPA_PARAM                      0x050A  /* [RFC6388] */
386
#define TLV_TYPED_WILDCARD_FEC_CAPA             0x050B  /* [RFC5918] */
387
#define TLV_MULTI_TOPOLOGY_CAPA                 0x050C  /* [RFC7307] */
388
#define TLV_STATE_ADVERTISEMENT_CONTROL_CAPA    0x050D  /* [RFC7473] */
389
#define TLV_MRT_CAPA                            0x050E  /* [RFC8320] */
390
#define TLV_TARGETED_APPLICATION_CAPA           0x050F  /* [RFC8223] */
391
#define TLV_MT_MULTIPOINT_CAPA                  0x0510  /* [RFC9658] */
392
0
#define TLV_LABEL_REQUEST_MESSAGE_ID            0x0600  /* [RFC5036] */
393
#define TLV_MTU                                 0x0601  /* [RFC3988] */
394
#define TLV_UNRECOGNIZED_NOTIFICATION_CAPA      0x0603  /* [RFC5919] */
395
#define TLV_ICCP_CAPA                           0x0700  /* [RFC7275] */
396
#define TLV_DUAL_STACK_CAPA                     0x0701  /* [RFC7552] */
397
#define TLV_P2MP_PW_CAPA                        0x0703  /* [RFC8338] */
398
#define TLV_EXPLICIT_ROUTE                      0x0800  /* [RFC3212] */
399
1
#define TLV_IPV4_PREFIX_ER_HOP                  0x0801  /* [RFC3212] */
400
0
#define TLV_IPV6_PREFIX_ER_HOP                  0x0802  /* [RFC3212] */
401
0
#define TLV_AUTONOMOUS_SYSTEM_NUMBER_ER_HOP     0x0803  /* [RFC3212] */
402
0
#define TLV_LSP_ID_ER_HOP                       0x0804  /* [RFC3212] */
403
#define TLV_L2_PW_ADDRESS_OF_SWITCHING_POINT    0x0805  /* [RFC7392] */
404
1
#define TLV_TRAFFIC_PARAMS                      0x0810  /* [RFC3212] */
405
0
#define TLV_PREEMPTION                          0x0820  /* [RFC3212] */
406
0
#define TLV_LSPID                               0x0821  /* [RFC3212] */
407
0
#define TLV_RESOURCE_CLASS                      0x0822  /* [RFC3212] */
408
0
#define TLV_ROUTE_PINNING                       0x0823  /* [RFC3212] */
409
#define TLV_GENERALIZED_LABEL_REQUEST           0x0824  /* [RFC3472] */
410
#define TLV_GENERALIZED_LABEL                   0x0825  /* [RFC3472] */
411
#define TLV_UPSTREAM_LABEL                      0x0826  /* [RFC3472] */
412
#define TLV_LABEL_SET                           0x0827  /* [RFC3472] */
413
#define TLV_WAVEBAND_LABEL                      0x0828  /* [RFC3472] */
414
0
#define TLV_ER_HOP                              0x0829  /* [RFC3472] */
415
#define TLV_ACCEPTABLE_LABEL_SET                0x082A  /* [RFC3472] */
416
#define TLV_ADMIN_STATUS                        0x082B  /* [RFC3472] */
417
#define TLV_INTERFACE_ID                        0x082C  /* [RFC3472] */
418
0
#define TLV_IPV4_INTERFACE_ID                   0x082D  /* [RFC3472] */
419
#define TLV_IPV6_INTERFACE_ID                   0x082E  /* [RFC3472] */
420
#define TLV_IPV4_IF_ID_STATUS                   0x082F  /* [RFC3472] */
421
#define TLV_IPV6_IF_ID_STATUS                   0x0830  /* [RFC3472] */
422
#define TLV_OP_SP_CALL_ID                       0x0831  /* [RFC3475] */
423
#define TLV_GU_CALL_ID                          0x0832  /* [RFC3475] */
424
#define TLV_CALL_CAPA                           0x0833  /* [RFC3475] */
425
#define TLV_CRANKBACK                           0x0834  /* [RFC3475] */
426
#define TLV_PROTECTION                          0x0835  /* [RFC3472] */
427
#define TLV_LSP_TUNNEL_INTERFACE_ID             0x0836  /* [RFC3480] */
428
#define TLV_UNNUMBERED_INTERFACE_ID             0x0837  /* [RFC3480] */
429
#define TLV_SONET_SDH_TRAFFIC_PARAMS            0x0838  /* [RFC4606] */
430
8
#define TLV_DIFF_SERV                           0x0901  /* [RFC3270] */
431
0
#define TLV_HSMP_LSP_CAPA_PARAM                 0x0902  /* [RFC7140] */
432
#define TLV_IPV4_SOURCE_ID                      0x0960  /* [RFC3476] */
433
#define TLV_IPV6_SOURCE_ID                      0x0961  /* [RFC3476] */
434
#define TLV_NSAP_SOURCE_ID                      0x0962  /* [RFC3476] */
435
#define TLV_IPV4_DESTINATION_ID                 0x0963  /* [RFC3476] */
436
#define TLV_IPV6_DESTINATION_ID                 0x0964  /* [RFC3476] */
437
#define TLV_NSAP_DESTINATION_ID                 0x0965  /* [RFC3476] */
438
#define TLV_EGRESS_LABEL                        0x0966  /* [RFC3476] */
439
#define TLV_LOCAL_CONNECTION_ID                 0x0967  /* [RFC3476] */
440
#define TLV_DIVERSITY                           0x0968  /* [RFC3476] */
441
#define TLV_CONTRACT_ID                         0x0969  /* [RFC3476] */
442
0
#define TLV_PW_STATUS                           0x096A  /* [RFC8077] */
443
0
#define TLV_PW_INTERFACE_PARAMS                 0x096B  /* [RFC8077] */
444
0
#define TLV_PW_GROUP_ID                         0x096C  /* [RFC8077] */
445
#define TLV_PSEUDOWIRE_SWITCHING_POINT_PE       0x096D  /* [RFC6073] */
446
#define TLV_BANDWIDTH                           0x096E  /* [RFC7267] */
447
#define TLV_LDP_MP_STATUS_TLV_TYPE              0x096F  /* [RFC6388] */
448
#define TLV_UNI_SERVICE_LEVEL                   0x0970  /* [RFC3476] */
449
#define TLV_QUEUE_REQUEST                       0x0971  /* [RFC7032] */
450
#define TLV_MP_NODE_PROTECTION_CAPA             0x0972  /* [RFC7715] */
451
#define TLV_PSN_TUNNEL_BINDING                  0x0973  /* [RFC7965] */
452
#define TLV_EGRESS_PROTECTION_CAPA              0x0974  /* [RFC8104] */
453
454
/* Not in IANA list */
455
2
#define TLV_RSVP_TE_P2MP_LSP         0x001C
456
0
#define TLV_LDP_P2MP_LSP             0x001D
457
2
#define TLV_IP_MULTICAST_TUNNEL      0x001E
458
0
#define TLV_MPLS_CONTEXT_LBL         0x001F
459
1.20k
#define TLV_VENDOR_PRIVATE_START     0x3E00
460
22
#define TLV_VENDOR_PRIVATE_END       0x3EFF
461
1.21k
#define TLV_EXPERIMENTAL_START       0x3F00
462
15
#define TLV_EXPERIMENTAL_END         0x3FFF
463
464
static const value_string tlv_type_names[] = {
465
    { TLV_SEQUENCE_NUMBER,                     "Sequence Number TLV"                    },
466
    { TLV_FEC,                                 "FEC"                                    },
467
    { TLV_ADDRESS_LIST,                        "Address List"                           },
468
    { TLV_HOP_COUNT,                           "Hop Count"                              },
469
    { TLV_PATH_VECTOR,                         "Path Vector"                            },
470
    { TLV_GENERIC_LABEL,                       "Generic Label"                          },
471
    { TLV_ATM_LABEL,                           "ATM Label"                              },
472
    { TLV_FRAME_RELAY_LABEL,                   "Frame Relay Label"                      },
473
    { TLV_FT_PROTECTION,                       "FT Protection TLV"                      },
474
    { TLV_LDP_UPSTREAM_ASSIGNED_LABEL,         "LDP Upstream-Assigned Label TLV"        },
475
    { TLV_LDP_UPSTREAM_ASSIGNED_LABEL_REQUEST, "LDP Upstream-Assigned Label Request TLV" },
476
    { TLV_ENTROPY_LABEL_CAPA,                  "Entropy Label Capability TLV"           },
477
    { TLV_STATUS,                              "Status"                                 },
478
    { TLV_EXTENDED_STATUS,                     "Extended Status"                        },
479
    { TLV_RETURNED_PDU,                        "Returned PDU"                           },
480
    { TLV_RETURNED_MESSAGE,                    "Returned Message"                       },
481
    { TLV_RETURNED_TLVS,                       "Returned TLVs"                          },
482
    { TLV_COMMON_HELLO_PARAMS,                 "Common Hello Parameters"                },
483
    { TLV_IPV4_TRANSPORT_ADDRESS,              "IPv4 Transport Address"                 },
484
    { TLV_CONFIGURATION_SEQUENCE_NUMBER,       "Configuration Sequence Number"          },
485
    { TLV_IPV6_TRANSPORT_ADDRESS,              "IPv6 Transport Address"                 },
486
    { TLV_MAC,                                 "MAC TLV"                                },
487
    { TLV_CRYPTOGRAPHIC_AUTHENTICATION,        "Cryptographic Authentication TLV"       },
488
    { TLV_MAC_FLUSH_PARAMS,                    "MAC Flush Parameters TLV"               },
489
    { TLV_PBB_B_MAC_LIST_SUB,                  "PBB B-MAC List Sub-TLV"                 },
490
    { TLV_PBB_I_SID_LIST_SUB,                  "PBB I-SID List Sub-TLV"                 },
491
    { TLV_COMMON_SESSION_PARAMS,               "Common Session Parameters"              },
492
    { TLV_ATM_SESSION_PARAMS,                  "ATM Session Parameters"                 },
493
    { TLV_FRAME_RELAY_SESSION_PARAMS,          "Frame Relay Session Parameters"         },
494
    { TLV_FT_SESSION,                          "FT Session TLV"                         },
495
    { TLV_FT_ACK,                              "FT Ack TLV"                             },
496
    { TLV_FT_CORK,                             "FT Cork TLV"                            },
497
    { TLV_DYNAMIC_CAPA_ANNOUNCEMENT,           "Dynamic Capability Announcement"        },
498
    { TLV_LDP_UPSTREAM_LABEL_ASSIGNMENT_CAPA,  "LDP Upstream Label Assignment Capability TLV" },
499
    { TLV_P2MP_CAPA_PARAM,                     "P2MP Capability Parameter"              },
500
    { TLV_MP2MP_CAPA_PARAM,                    "MP2MP Capability Parameter"             },
501
    { TLV_MBB_CAPA_PARAM,                      "MBB Capability Parameter"               },
502
    { TLV_TYPED_WILDCARD_FEC_CAPA,             "Typed Wildcard FEC Capability"          },
503
    { TLV_MULTI_TOPOLOGY_CAPA,                 "Multi-Topology Capability"              },
504
    { TLV_STATE_ADVERTISEMENT_CONTROL_CAPA,    "State Advertisement Control Capability" },
505
    { TLV_TARGETED_APPLICATION_CAPA,           "Targeted Application Capability"        },
506
    { TLV_MT_MULTIPOINT_CAPA,                  "MT Multipoint Capability"               },
507
    { TLV_LABEL_REQUEST_MESSAGE_ID,            "Label Request Message ID"               },
508
    { TLV_MTU,                                 "MTU TLV"                                },
509
    { TLV_UNRECOGNIZED_NOTIFICATION_CAPA,      "Unrecognized Notification Capability"   },
510
    { TLV_ICCP_CAPA,                           "ICCP capability TLV"                    },
511
    { TLV_DUAL_STACK_CAPA,                     "Dual-Stack capability"                  },
512
    { TLV_P2MP_PW_CAPA,                        "P2MP PW Capability"                     },
513
    { TLV_EXPLICIT_ROUTE,                      "Explicit Route TLV"                     },
514
    { TLV_IPV4_PREFIX_ER_HOP,                  "Ipv4 Prefix ER-Hop TLV"                 },
515
    { TLV_IPV6_PREFIX_ER_HOP,                  "Ipv6 Prefix ER-Hop TLV"                 },
516
    { TLV_AUTONOMOUS_SYSTEM_NUMBER_ER_HOP,     "Autonomous System Number ER-Hop TLV"    },
517
    { TLV_LSP_ID_ER_HOP,                       "LSP-ID ER-HOP TLV"                      },
518
    { TLV_L2_PW_ADDRESS_OF_SWITCHING_POINT,    "L2 PW Address of Switching Point"       },
519
    { TLV_TRAFFIC_PARAMS,                      "Traffic Parameters TLV"                 },
520
    { TLV_PREEMPTION,                          "Preemption TLV"                         },
521
    { TLV_LSPID,                               "LSPID TLV"                              },
522
    { TLV_RESOURCE_CLASS,                      "Resource Class TLV"                     },
523
    { TLV_ROUTE_PINNING,                       "Route Pinning TLV"                      },
524
    { TLV_GENERALIZED_LABEL_REQUEST,           "Generalized Label Request TLV"          },
525
    { TLV_GENERALIZED_LABEL,                   "Generalized Label TLV"                  },
526
    { TLV_UPSTREAM_LABEL,                      "Upstream Label TLV"                     },
527
    { TLV_LABEL_SET,                           "Label Set TLV"                          },
528
    { TLV_WAVEBAND_LABEL,                      "Waveband Label TLV"                     },
529
    { TLV_ER_HOP,                              "ER-Hop TLV"                             },
530
    { TLV_ACCEPTABLE_LABEL_SET,                "Acceptable Label Set TLV"               },
531
    { TLV_ADMIN_STATUS,                        "Admin Status TLV"                       },
532
    { TLV_INTERFACE_ID,                        "Interface ID TLV"                       },
533
    { TLV_IPV4_INTERFACE_ID,                   "IPV4 Interface ID TLV"                  },
534
    { TLV_IPV6_INTERFACE_ID,                   "IPV6 Interface ID TLV"                  },
535
    { TLV_IPV4_IF_ID_STATUS,                   "IPv4 IF_ID Status TLV"                  },
536
    { TLV_IPV6_IF_ID_STATUS,                   "IPv6 IF_ID Status TLV"                  },
537
    { TLV_OP_SP_CALL_ID,                       "Op-Sp Call ID TLV"                      },
538
    { TLV_GU_CALL_ID,                          "GU Call ID TLV"                         },
539
    { TLV_CALL_CAPA,                           "Call Capability TLV"                    },
540
    { TLV_CRANKBACK,                           "Crankback TLV"                          },
541
    { TLV_PROTECTION,                          "Protection TLV"                         },
542
    { TLV_LSP_TUNNEL_INTERFACE_ID,             "LSP_TUNNEL_INTERFACE_ID TLV"            },
543
    { TLV_UNNUMBERED_INTERFACE_ID,             "Unnumbered Interface ID TLV"            },
544
    { TLV_SONET_SDH_TRAFFIC_PARAMS,            "SONET/SDH Traffic Parameters TLV"       },
545
    { TLV_DIFF_SERV,                           "Diff-Serv TLV"                          },
546
    { TLV_HSMP_LSP_CAPA_PARAM,                 "HSMP LSP Capability Parameter"          },
547
    { TLV_IPV4_SOURCE_ID,                      "IPv4 Source ID TLV"                     },
548
    { TLV_IPV6_SOURCE_ID,                      "IPv6 Source ID TLV"                     },
549
    { TLV_NSAP_SOURCE_ID,                      "NSAP Source ID TLV"                     },
550
    { TLV_IPV4_DESTINATION_ID,                 "IPv4 Destination ID TLV"                },
551
    { TLV_IPV6_DESTINATION_ID,                 "IPv6 Destination ID TLV"                },
552
    { TLV_NSAP_DESTINATION_ID,                 "NSAP Destination ID TLV"                },
553
    { TLV_EGRESS_LABEL,                        "Egress Label TLV"                       },
554
    { TLV_LOCAL_CONNECTION_ID,                 "Local Connection ID TLV"                },
555
    { TLV_DIVERSITY,                           "Diversity TLV"                          },
556
    { TLV_CONTRACT_ID,                         "Contract ID TLV"                        },
557
    { TLV_PW_STATUS,                           "PW Status TLV"                          },
558
    { TLV_PW_INTERFACE_PARAMS,                 "PW Interface Parameters TLV"            },
559
    { TLV_PW_GROUP_ID,                         "PW Group ID TLV"                        },
560
    { TLV_PSEUDOWIRE_SWITCHING_POINT_PE,       "Pseudowire Switching Point PE TLV"      },
561
    { TLV_BANDWIDTH,                           "Bandwidth TLV"                          },
562
    { TLV_LDP_MP_STATUS_TLV_TYPE,              "LDP MP Status TLV Type"                 },
563
    { TLV_UNI_SERVICE_LEVEL,                   "UNI Service Level TLV"                  },
564
    { TLV_QUEUE_REQUEST,                       "Queue Request TLV"                      },
565
    { TLV_MP_NODE_PROTECTION_CAPA,             "MP Node Protection Capability"          },
566
    { TLV_PSN_TUNNEL_BINDING,                  "PSN Tunnel Binding TLV"                 },
567
    { TLV_EGRESS_PROTECTION_CAPA,              "Egress Protection Capability"           },
568
569
    { TLV_RSVP_TE_P2MP_LSP,                    "RSVP-TE P2MP LSP TLV"                   },
570
    { TLV_LDP_P2MP_LSP,                        "LDP P2MP LSP TLV"                       },
571
    { TLV_IP_MULTICAST_TUNNEL,                 "IP Multicast Tunnel TLV"                },
572
573
    { 0, NULL}
574
};
575
576
/*
577
 * https://www.iana.org/assignments/ldp-namespaces
578
 */
579
580
#define LDP_NOTIFICATION                0x0001  /* [RFC5036] */
581
#define LDP_HELLO                       0x0100  /* [RFC5036] */
582
#define LDP_INITIALIZATION              0x0200  /* [RFC5036] */
583
#define LDP_KEEPALIVE                   0x0201  /* [RFC5036] */
584
#define LDP_CAPABILITY                  0x0202  /* [RFC5561] */
585
#define LDP_ADDRESS                     0x0300  /* [RFC5036] */
586
#define LDP_ADDRESS_WITHDRAWAL          0x0301  /* [RFC5036] */
587
#define LDP_LABEL_MAPPING               0x0400  /* [RFC5036] */
588
#define LDP_LABEL_REQUEST               0x0401  /* [RFC5036] */
589
#define LDP_LABEL_WITHDRAWAL            0x0402  /* [RFC5036] */
590
#define LDP_LABEL_RELEASE               0x0403  /* [RFC5036] */
591
#define LDP_LABEL_ABORT_REQUEST         0x0404  /* [RFC5036] */
592
#define LDP_CALL_SETUP                  0x0500  /* [RFC3475] */
593
#define LDP_CALL_RELEASE                0x0501  /* [RFC3475] */
594
#define LDP_RG_CONNECT_MESSAGE          0x0700  /* [RFC7275] */
595
#define LDP_RG_DISCONNECT_MESSAGE       0x0701  /* [RFC7275] */
596
#define LDP_RG_NOTIFICATION_MESSAGE     0x0702  /* [RFC7275] */
597
#define LDP_RG_APPLICATION_DATA_MESSAGE 0x0703  /* [RFC7275] */
598
497
#define LDP_VENDOR_PRIVATE_START        0x3E00
599
74
#define LDP_VENDOR_PRIVATE_END          0x3EFF
600
458
#define LDP_EXPERIMENTAL_MESSAGE_START  0x3F00
601
68
#define LDP_EXPERIMENTAL_MESSAGE_END    0x3FFF
602
603
static const value_string ldp_message_types[] = {
604
    {LDP_NOTIFICATION,                 "Notification Message"},
605
    {LDP_HELLO,                        "Hello Message"},
606
    {LDP_INITIALIZATION,               "Initialization Message"},
607
    {LDP_KEEPALIVE,                    "Keep Alive Message"},
608
    {LDP_CAPABILITY,                   "Capability Message"},
609
    {LDP_ADDRESS,                      "Address Message"},
610
    {LDP_ADDRESS_WITHDRAWAL,           "Address Withdrawal Message"},
611
    {LDP_LABEL_MAPPING,                "Label Mapping Message"},
612
    {LDP_LABEL_REQUEST,                "Label Request Message"},
613
    {LDP_LABEL_WITHDRAWAL,             "Label Withdrawal Message"},
614
    {LDP_LABEL_RELEASE,                "Label Release Message"},
615
    {LDP_LABEL_ABORT_REQUEST,          "Label Abort Request Message"},
616
    {LDP_CALL_SETUP,                   "Call Setup Message"},
617
    {LDP_CALL_RELEASE,                 "Call Release Message"},
618
    {LDP_RG_CONNECT_MESSAGE,           "RG Connect Message"},
619
    {LDP_RG_DISCONNECT_MESSAGE,        "RG Disconnect Message"},
620
    {LDP_RG_NOTIFICATION_MESSAGE,      "RG Notification Message"},
621
    {LDP_RG_APPLICATION_DATA_MESSAGE,  "RG Application Data Message"},
622
    {LDP_VENDOR_PRIVATE_START,         "Vendor-Private Message"},
623
    {LDP_EXPERIMENTAL_MESSAGE_START,   "Experimental Message"},
624
    {0, NULL}
625
};
626
627
static const true_false_string ldp_message_ubit = {
628
    "Unknown bit set",
629
    "Unknown bit not set"
630
};
631
632
static const true_false_string hello_targeted_vals = {
633
    "Targeted Hello",
634
    "Link Hello"
635
};
636
637
static const value_string tlv_unknown_vals[] = {
638
    {0, "Known TLV, do not Forward"},
639
    {1, "Known TLV, do Forward"},
640
    {2, "Unknown TLV, do not Forward"},
641
    {3, "Unknown TLV, do Forward"},
642
    {0, NULL}
643
};
644
645
1
#define WILDCARD_FEC                  0x01    /* [RFC5036][RFC7358] */
646
1
#define PREFIX_FEC                    0x02    /* [RFC5036][RFC7358] */
647
0
#define HOST_FEC                      0x03    /* "Unassigned" according to IANA */
648
1
#define CRLSP_FEC                     0x04    /* [RFC3212][RFC7358] */
649
0
#define TYPED_WILDCARD_FEC            0x05    /* [RFC5918][RFC7358] */
650
0
#define P2MP_FEC                      0x06    /* [RFC6388][RFC7358] */
651
0
#define MP2MP_FEC_UP                  0x07    /* [RFC6388][RFC7358] */
652
4
#define MP2MP_FEC_DOWN                0x08    /* [RFC6388][RFC7358] */
653
6
#define HSMP_UPSTREAM                 0x09    /* [RFC7140][RFC7358] */
654
6
#define HSMP_DOWNSTREAM               0x0A    /* [RFC7140][RFC7358] */
655
1
#define PWID_FEC_ELEMENT              0x80    /* [RFC8077][RFC7358] */
656
0
#define GENERALIZED_PWID_FEC          0x81    /* [RFC8077][RFC7358] */
657
2
#define P2MP_PW_UPSTREAM_FEC          0x82    /* [RFC8338][RFC7358] */
658
#define PROTECTION_FEC                0x83    /* [RFC8104][RFC7358] */
659
#define P2MP_PW_DOWNSTREAM_FEC        0x84    /* [RFC8338][RFC7358] */
660
661
const value_string fec_types_vals[] = {
662
  {WILDCARD_FEC,                      "Wildcard FEC"},
663
  {PREFIX_FEC,                        "Prefix FEC"},
664
  {HOST_FEC,                          "Host Address FEC"},
665
  {CRLSP_FEC,                         "CR LSP FEC"},
666
  {TYPED_WILDCARD_FEC,                "Typed Wildcard FEC Element"},
667
  {P2MP_FEC,                          "P2MP"},
668
  {MP2MP_FEC_UP,                      "MP2MP-up"},
669
  {MP2MP_FEC_DOWN,                    "MP2MP-down"},
670
  {HSMP_UPSTREAM,                     "HSMP-upstream"},
671
  {HSMP_DOWNSTREAM,                   "HSMP-downstream"},
672
  {PWID_FEC_ELEMENT,                  "PWid FEC Element"},
673
  {GENERALIZED_PWID_FEC,              "Generalized PWid FEC Element"},
674
  {P2MP_PW_UPSTREAM_FEC,              "P2MP PW Upstream FEC Element"},
675
  {PROTECTION_FEC,                    "Protection FEC Element"},
676
  {P2MP_PW_DOWNSTREAM_FEC,            "P2MP PW Downstream FEC Element"},
677
678
  {0, NULL}
679
};
680
681
682
/*
683
 * MPLS Pseudowire Types
684
 *
685
 * RFC 4446
686
 *
687
 * https://www.iana.org/assignments/pwe3-parameters/pwe3-parameters.xhtml#pwe3-parameters-2
688
 */
689
const value_string fec_vc_types_vals[] = {
690
    {0x0001, "Frame Relay DLCI (Martini Mode)"},
691
    {0x0002, "ATM AAL5 SDU VCC transport"},
692
    {0x0003, "ATM transparent cell transport"},
693
    {0x0004, "Ethernet Tagged Mode"},
694
    {0x0005, "Ethernet"},
695
    {0x0006, "HDLC"},
696
    {0x0007, "PPP"},
697
    {0x0008, "SONET/SDH Circuit Emulation Service"},
698
    {0x0009, "ATM n-to-one VCC cell transport"},
699
    {0x000A, "ATM n-to-one VPC cell transport"},
700
    {0x000B, "IP layer2 transport"},
701
    {0x000C, "ATM one-to-one VCC Cell Mode"},
702
    {0x000D, "ATM one-to-one VPC Cell Mode"},
703
    {0x000E, "ATM AAL5 PDU VCC transport"},
704
    {0x000F, "Frame-Relay Port mode"},
705
    {0x0010, "SONET/SDH Circuit Emulation over Packet"},
706
    {0x0011, "Structure-agnostic E1 over Packet"},
707
    {0x0012, "Structure-agnostic T1 (DS1) over Packet"},
708
    {0x0013, "Structure-agnostic E3 over Packet"},
709
    {0x0014, "Structure-agnostic T3 (DS3) over Packet"},
710
    {0x0015, "CESoPSN basic mode"},
711
    {0x0016, "TDMoIP AAL1 Mode"},
712
    {0x0017, "CESoPSN TDM with CAS"},
713
    {0x0018, "TDMoIP AAL2 Mode"},
714
    {0x0019, "Frame Relay DLCI"},
715
    {0x001A, "ROHC Transport Header-compressed Packets"},
716
    {0x001B, "ECRTP Transport Header-compressed Packets"},
717
    {0x001C, "IPHC Transport Header-compressed Packets"},
718
    {0x001D, "cRTP Transport Header-compressed Packets"},
719
    {0x001E, "ATM VP Virtual Trunk"},
720
    {0x001F, "FC Port Mode"},
721
722
    {0, NULL}
723
};
724
725
726
static const value_string fec_vc_ceptype_vals[] = {
727
    {0, "SPE mode (STS-1/STS-Mc)"},
728
    {1, "VT mode (VT1.5/VT2/VT3/VT6)"},
729
    {2, "Fractional SPE (STS-1/VC-3/VC-4)"},
730
    {0, NULL}
731
};
732
733
static const true_false_string fec_vc_tdmopt_r = {
734
    "Expects to receive RTP Header",
735
    "Does not expect to receive RTP Header"
736
};
737
738
static const true_false_string fec_vc_tdmopt_d = {
739
    "Expects the peer to use Differential timestamping",
740
    "Does not expect the peer to use Differential timestamping"
741
};
742
743
static const true_false_string fec_vc_tdmopt_f = {
744
    "Expects TDMoIP encapsulation",
745
    "Expects CESoPSN encapsulation"
746
};
747
748
749
0
#define FEC_VC_INTERFACEPARAM_MTU          0x01
750
0
#define FEC_VC_INTERFACEPARAM_MAXCATMCELLS 0x02
751
0
#define FEC_VC_INTERFACEPARAM_DESCRIPTION  0x03
752
0
#define FEC_VC_INTERFACEPARAM_CEPBYTES     0x04
753
0
#define FEC_VC_INTERFACEPARAM_CEPOPTIONS   0x05
754
0
#define FEC_VC_INTERFACEPARAM_VLANID       0x06
755
0
#define FEC_VC_INTERFACEPARAM_TDMBPS       0x07
756
0
#define FEC_VC_INTERFACEPARAM_FRDLCILEN    0x08
757
0
#define FEC_VC_INTERFACEPARAM_FRAGIND      0x09
758
0
#define FEC_VC_INTERFACEPARAM_FCSRETENT    0x0A
759
0
#define FEC_VC_INTERFACEPARAM_TDMOPTION    0x0B
760
0
#define FEC_VC_INTERFACEPARAM_VCCV         0x0C
761
#define FEC_VC_INTERFACEPARAM_ROHCOMPLS    0x0D
762
#define FEC_VC_INTERFACEPARAM_TDMOIPAAL1C  0x0E
763
#define FEC_VC_INTERFACEPARAM_CEIOMPLS     0x0F
764
#define FEC_VC_INTERFACEPARAM_TDMOIPAAL1   0x10
765
#define FEC_VC_INTERFACEPARAM_TDMOIPAAL2   0x11
766
#define FEC_VC_INTERFACEPARAM_STACK        0x16
767
0
#define FEC_VC_INTERFACEPARAM_FLOWLABEL    0x17
768
#define FEC_VC_INTERFACEPARAM_PWGENFLAGS   0x18
769
#define FEC_VC_INTERFACEPARAM_VCCVEXTCV    0x19
770
#define FEC_VC_INTERFACEPARAM_ETREE        0x1A
771
#define FEC_VC_INTERFACEPARAM_ZTEPRIVATE   0xFD
772
773
774
static const value_string fec_vc_interfaceparm[] = {
775
  {FEC_VC_INTERFACEPARAM_MTU,           "Interface MTU"},
776
  {FEC_VC_INTERFACEPARAM_MAXCATMCELLS,  "Max Concatenated ATM cells"},
777
  {FEC_VC_INTERFACEPARAM_DESCRIPTION,   "Interface Description"},
778
  {FEC_VC_INTERFACEPARAM_CEPBYTES,      "CEP/TDM Payload Bytes"},
779
  {FEC_VC_INTERFACEPARAM_CEPOPTIONS,    "CEP options"},
780
  {FEC_VC_INTERFACEPARAM_VLANID,        "Requested VLAN ID"},
781
  {FEC_VC_INTERFACEPARAM_TDMBPS,        "CEP/TDM bit-rate"},
782
  {FEC_VC_INTERFACEPARAM_FRDLCILEN,     "Frame-Relay DLCI Length"},
783
  {FEC_VC_INTERFACEPARAM_FRAGIND,       "Fragmentation indicator"},
784
  {FEC_VC_INTERFACEPARAM_FCSRETENT,     "FCS retention indicator"},
785
  {FEC_VC_INTERFACEPARAM_TDMOPTION,     "TDM options"},
786
  {FEC_VC_INTERFACEPARAM_VCCV,          "VCCV"},
787
  {FEC_VC_INTERFACEPARAM_ROHCOMPLS,     "ROHC over MPLS configuration"},
788
  {FEC_VC_INTERFACEPARAM_TDMOIPAAL1C,   "TDMoIP AAL1 cells per packet"},
789
  {FEC_VC_INTERFACEPARAM_CEIOMPLS,      "CRTP/ECRTP/IPHC HC over MPLS configuration"},
790
  {FEC_VC_INTERFACEPARAM_TDMOIPAAL1,    "TDMoIP AAL1 mode"},
791
  {FEC_VC_INTERFACEPARAM_TDMOIPAAL2,    "TDMoIP AAL2 Options"},
792
  {FEC_VC_INTERFACEPARAM_STACK,         "Stack capability"},
793
  {FEC_VC_INTERFACEPARAM_FLOWLABEL,     "Flow Label"},
794
  {FEC_VC_INTERFACEPARAM_PWGENFLAGS,    "PW Generic Protocol Flags"},
795
  {FEC_VC_INTERFACEPARAM_VCCVEXTCV,     "VCCV Extended CV Parameter"},
796
  {FEC_VC_INTERFACEPARAM_ETREE,         "E-Tree"},
797
  {FEC_VC_INTERFACEPARAM_ZTEPRIVATE,    "Zte optional Supplier private interface parameters"},
798
799
  {0, NULL},
800
};
801
802
static const true_false_string fec_vc_cbit = {
803
    "Control Word Present",
804
    "Control Word NOT Present"
805
};
806
807
static const value_string tlv_atm_merge_vals[] = {
808
    {0, "Merge not supported"},
809
    {1, "VP merge supported"},
810
    {2, "VC merge supported"},
811
    {3, "VP & VC merge supported"},
812
    {0, NULL}
813
};
814
815
static const value_string tlv_atm_vbits_vals[] = {
816
    {0, "VPI & VCI Significant"},
817
    {1, "Only VPI Significant"},
818
    {2, "Only VCI Significant"},
819
    {3, "VPI & VCI not Significant, nonsense"},
820
    {0, NULL}
821
};
822
823
static const value_string tlv_fr_merge_vals[] = {
824
    {0, "Merge not supported"},
825
    {1, "Merge supported"},
826
    {2, "Unspecified"},
827
    {3, "Unspecified"},
828
    {0, NULL}
829
};
830
831
static const value_string tlv_fr_len_vals[] = {
832
    {0, "10 bits"},
833
    {1, "Reserved"},
834
    {2, "23 bits"},
835
    {3, "Reserved"},
836
    {0, NULL}
837
};
838
839
static const value_string tlv_ft_flags[] = {
840
    { 0, "Invalid"},
841
    { 1, "Using LDP Graceful Restart"},
842
    { 2, "Check-Pointing of all labels"},
843
    { 3, "Invalid"},
844
    { 4, "Invalid"},
845
    { 5, "Invalid"},
846
    { 6, "Check-Pointing of all labels"},
847
    { 7, "Invalid"},
848
    { 8, "Full FT on selected labels"},
849
    { 9, "Invalid"},
850
    {10, "Full FT on selected labels"},
851
    {11, "Invalid"},
852
    {12, "Full FT on all labels"},
853
    {13, "Invalid"},
854
    {14, "Full FT on all labels"},
855
    {15, "Invalid"},
856
    {0, NULL}
857
};
858
859
static const true_false_string tlv_ft_r = {
860
    "LSR has preserved state and resources for all FT-Labels",
861
    "LSR has not preserved state and resources for all FT-Labels"
862
};
863
864
static const true_false_string tlv_ft_s = {
865
    "FT Protection TLV supported on other than KeepAlive",
866
    "FT Protection TLV not supported on other than KeepAlive"
867
};
868
869
static const true_false_string tlv_ft_a = {
870
    "Treat all labels as Sequence Numbered FT Labels",
871
    "May treat some labels as FT and others as non-FT"
872
};
873
874
static const true_false_string tlv_ft_c = {
875
    "Check-Pointing procedures in use",
876
    "Check-Pointing procedures not in use"
877
};
878
879
static const true_false_string tlv_ft_l = {
880
    "Re-learn the state from the network",
881
    "Do not re-learn the state from the network"
882
};
883
884
static const value_string ldp_act_flg_vals[] = {
885
    {0, "indicates initial LSP setup"},
886
    {1, "indicates modify LSP"},
887
    {0, NULL}
888
};
889
890
static const value_string route_pinning_vals[] = {
891
    {0, "route pinning is not requested"},
892
    {1, "route pinning is requested"},
893
    {0, NULL}
894
};
895
896
static const value_string diffserv_type_vals[] = {
897
    {0, "E-LSP"},
898
    {1, "L-LSP"},
899
    {0, NULL}
900
};
901
902
static const value_string ldp_loose_vals[] = {
903
    {0, "strict hop"},
904
    {1, "loose hop"},
905
    {0, NULL}
906
};
907
908
static const true_false_string tlv_negotiable = {
909
    "Negotiable",
910
    "Not negotiable"
911
};
912
913
static const value_string freq_values[] = {
914
    {0, "Unspecified"},
915
    {1, "Frequent"},
916
    {2, "VeryFrequent"},
917
    {0, NULL}
918
};
919
920
static const true_false_string tlv_atm_dirbit = {
921
    "Bidirectional capability",
922
    "Unidirectional capability"
923
};
924
925
static const true_false_string hello_requested_vals = {
926
    "Source requests periodic hellos",
927
    "Source does not request periodic hellos"
928
};
929
930
static const true_false_string tlv_sess_advbit_vals = {
931
    "Downstream On Demand proposed",
932
    "Downstream Unsolicited proposed"
933
};
934
935
static const true_false_string tlv_sess_ldetbit_vals = {
936
    "Loop Detection Enabled",
937
    "Loop Detection Disabled"
938
};
939
940
static const true_false_string tlv_status_ebit = {
941
    "Fatal Error Notification",
942
    "Advisory Notification"
943
};
944
945
static const true_false_string tlv_status_fbit = {
946
    "Notification should be Forwarded",
947
    "Notification should NOT be Forwarded"
948
};
949
950
static const value_string tlv_status_data[] = {
951
    { 0x00000000, "Success"                                },
952
    { 0x00000001, "Bad LDP Identifier"                     },
953
    { 0x00000002, "Bad Protocol Version"                   },
954
    { 0x00000003, "Bad PDU Length"                         },
955
    { 0x00000004, "Unknown Message Type"                   },
956
    { 0x00000005, "Bad Message Length"                     },
957
    { 0x00000006, "Unknown TLV"                            },
958
    { 0x00000007, "Bad TLV Length"                         },
959
    { 0x00000008, "Malformed TLV Value"                    },
960
    { 0x00000009, "Hold Timer Expired"                     },
961
    { 0x0000000A, "Shutdown"                               },
962
    { 0x0000000B, "Loop Detected"                          },
963
    { 0x0000000C, "Unknown FEC"                            },
964
    { 0x0000000D, "No Route"                               },
965
    { 0x0000000E, "No Label Resources"                     },
966
    { 0x0000000F, "Label Resources/Available"              },
967
    { 0x00000010, "Session Rejected/No Hello"              },
968
    { 0x00000011, "Session Rejected/Parameters Advertisement Mode" },
969
    { 0x00000012, "Session Rejected/Parameters Max PDU Length" },
970
    { 0x00000013, "Session Rejected/Parameters Label Range" },
971
    { 0x00000014, "KeepAlive Timer Expired"                },
972
    { 0x00000015, "Label Request Aborted"                  },
973
    { 0x00000016, "Missing Message Parameters"             },
974
    { 0x00000017, "Unsupported Address Family"             },
975
    { 0x00000018, "Session Rejected/Bad KeepAlive Time"    },
976
    { 0x00000019, "Internal Error"                         },
977
    { 0x0000001A, "No LDP Session"                         },
978
    { 0x0000001B, "Zero FT seqnum"                         },
979
    { 0x0000001C, "Unexpected TLV / Session Not FT"        },
980
    { 0x0000001D, "Unexpected TLV / Label Not FT"          },
981
    { 0x0000001E, "Missing FT Protection TLV"              },
982
    { 0x0000001F, "FT ACK sequence error"                  },
983
    { 0x00000020, "Temporary Shutdown"                     },
984
    { 0x00000021, "FT Seq Numbers Exhausted"               },
985
    { 0x00000022, "FT Session parameters / changed"        },
986
    { 0x00000023, "Unexpected FT Cork TLV"                 },
987
    { 0x00000024, "Illegal C-Bit"                          },
988
    { 0x00000025, "Wrong C-Bit"                            },
989
    { 0x00000026, "Incompatible bit-rate"                  },
990
    { 0x00000027, "CEP-TDM mis-configuration"              },
991
    { 0x00000028, "PW Status"                              },
992
    { 0x0000002A, "Generic Misconfiguration Error"         },
993
    { 0x0000002B, "Label Withdraw PW Status Method Not Supported" },
994
    { 0x0000002C, "IP Address of CE"                       },
995
    { 0x0000002D, "Attachment Circuit bound to different remote Attachment Circuit" },
996
    { 0x0000002E, "Unsupported Capability"                 },
997
    { 0x0000002F, "End-of-LIB"                             },
998
    { 0x00000030, "Attachment Circuit bound to different PE" },
999
    { 0x00000031, "Invalid Topology ID"                    },
1000
    { 0x00000032, "Transport Connection Mismatch"          },
1001
    { 0x00000033, "Dual-Stack Noncompliance"               },
1002
    { 0x00000034, "MRT Capability negotiated without MT Capability" },
1003
    { 0x00000035, "VCCV Type Error"                        },
1004
    { 0x00000037, "Bandwidth resources unavailable"        },
1005
    { 0x00000038, "Resources Unavailable"                  },
1006
    { 0x00000039, "AII Unreachable"                        },
1007
    { 0x0000003A, "PW Loop Detected"                       },
1008
    { 0x0000003B, "Reject - unable to use the suggested tunnel/LSPs" },
1009
    { 0x0000003C, "The C-bit or S-bit unknown"             },
1010
    { 0x00000040, "LDP MP status"                          },
1011
    { 0x0000004A, "IP Address Type Mismatch"               },
1012
    { 0x0000004B, "Wrong IP Address Type"                  },
1013
    { 0x0000004C, "Session Rejected/Targeted Application Capability Mismatch" },
1014
    { 0x00010001, "Unknown ICCP RG"                        },
1015
    { 0x00010002, "ICCP Connection Count Exceeded"         },
1016
    { 0x00010003, "ICCP Application Connection Count Exceeded" },
1017
    { 0x00010004, "ICCP Application not in RG"             },
1018
    { 0x00010005, "Incompatible ICCP Protocol Version"     },
1019
    { 0x00010006, "ICCP Rejected Message"                  },
1020
    { 0x00010007, "ICCP Administratively Disabled"         },
1021
    { 0x00010010, "ICCP RG Removed"                        },
1022
    { 0x00010011, "ICCP Application Removed from RG"       },
1023
    { 0x01000001, "Unexpected Diff-Serv TLV"               },
1024
    { 0x01000002, "Unsupported PHB"                        },
1025
    { 0x01000003, "Invalid EXP<-->PHB mapping"             },
1026
    { 0x01000004, "Unsupported PSC"                        },
1027
    { 0x01000005, "Per-LSP context allocation failure"     },
1028
    { 0x04000001, "Bad Explicit Routing TLV Error"         },
1029
    { 0x04000002, "Bad Strict Node Error"                  },
1030
    { 0x04000003, "Bad Loose Node Error"                   },
1031
    { 0x04000004, "Bad Initial ER-Hop Error"               },
1032
    { 0x04000005, "Resource Unavailable"                   },
1033
    { 0x04000006, "Traffic Parameters Unavailable"         },
1034
    { 0x04000007, "LSP Preempted"                          },
1035
    { 0x04000008, "Modify Request Not Supported"           },
1036
    { 0x04000009, "Invalid SNP ID"                         },
1037
    { 0x0400000A, "Calling Party busy"                     },
1038
    { 0x0400000B, "Unavailable SNP ID"                     },
1039
    { 0x0400000C, "Invalid SNPP ID"                        },
1040
    { 0x0400000D, "Unavailable SNPP ID"                    },
1041
    { 0x0400000E, "Failed to create SNC"                   },
1042
    { 0x0400000F, "Failed to establish LC"                 },
1043
    { 0x04000010, "Invalid A End-User Name"                },
1044
    { 0x04000011, "Invalid Z End-User Name"                },
1045
    { 0x04000012, "Invalid CoS"                            },
1046
    { 0x04000013, "Unavailable CoS"                        },
1047
    { 0x04000014, "Invalid GoS"                            },
1048
    { 0x04000015, "Unavailable GoS"                        },
1049
    { 0x04000016, "Failed Security Check"                  },
1050
    { 0x04000017, "TimeOut"                                },
1051
    { 0x04000018, "Invalid Call Name"                      },
1052
    { 0x04000019, "Failed to Release SNC"                  },
1053
    { 0x0400001A, "Failed to Free LC"                      },
1054
    { 0x20000000, "Unknown VPN ID"                         },
1055
    { 0x20000001, "Illegal C-Bit"                          },
1056
    { 0x20000002, "Wrong C-Bit"                            },
1057
    { 0x20000003, "E-Tree VLAN mapping not supported"      },
1058
    { 0x20000004, "Leaf-to-Leaf PW released"               },
1059
1060
    {0, NULL}
1061
};
1062
1063
static const true_false_string tlv_upstr_sbit_vals = {
1064
    "LSR is advertising the capability to distribute and receive upstream-assigned label bindings",
1065
    "LSR is withdrawing the capability to distribute and receive upstream-assigned label bindings"
1066
};
1067
1068
16
#define PW_NOT_FORWARDING               0x00000001
1069
16
#define PW_LAC_INGRESS_RECV_FAULT       0x00000002
1070
16
#define PW_LAC_EGRESS_TRANS_FAULT       0x00000004
1071
16
#define PW_PSN_PW_INGRESS_RECV_FAULT    0x00000008
1072
16
#define PW_PSN_PW_EGRESS_TRANS_FAULT    0x00000010
1073
1074
static void
1075
dissect_subtlv_interface_parameters(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int rem, int *interface_parameters_hf[]);
1076
1077
static void
1078
dissect_genpwid_fec_aai_type2_parameter(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem);
1079
1080
/* Dissect FEC TLV */
1081
1082
static void
1083
dissect_tlv_fec(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1084
16
{
1085
16
    static int *interface_params_header_fields[] = {
1086
16
        &hf_ldp_tlv_fec_vc_intparam_length ,
1087
16
        &hf_ldp_tlv_fec_vc_intparam_mtu ,
1088
16
        &hf_ldp_tlv_fec_vc_intparam_tdmbps ,
1089
16
        &hf_ldp_tlv_fec_vc_intparam_id ,
1090
16
        &hf_ldp_tlv_fec_vc_intparam_maxcatmcells ,
1091
16
        &hf_ldp_tlv_fec_vc_intparam_desc ,
1092
16
        &hf_ldp_tlv_fec_vc_intparam_cepbytes ,
1093
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_ais ,
1094
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_une ,
1095
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_rtp ,
1096
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_ebm ,
1097
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_mah ,
1098
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_res ,
1099
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype ,
1100
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_t3 ,
1101
16
        &hf_ldp_tlv_fec_vc_intparam_cepopt_e3 ,
1102
16
        &hf_ldp_tlv_fec_vc_intparam_vlanid ,
1103
16
        &hf_ldp_tlv_fec_vc_intparam_dlcilen ,
1104
16
        &hf_ldp_tlv_fec_vc_intparam_fcslen ,
1105
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_r ,
1106
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_d ,
1107
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_f ,
1108
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_res1 ,
1109
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_pt ,
1110
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_res2 ,
1111
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_freq ,
1112
16
        &hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc ,
1113
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw ,
1114
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra ,
1115
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1 ,
1116
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping ,
1117
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping ,
1118
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1,
1119
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
1120
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
1121
16
        &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
1122
16
        &hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
1123
16
        &hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
1124
16
        &hf_ldp_tlv_fec_vc_intparam_flowlabel_res,
1125
16
    };
1126
1127
16
    proto_tree *ti, *ti2, *val_tree, *fec_tree=NULL;
1128
16
    proto_tree *agi_tree=NULL, *saii_tree=NULL, *taii_tree=NULL;
1129
16
    uint16_t    family, ix=1, ax;
1130
16
    uint16_t    op_length = tvb_get_bits16(tvb, ((offset+8)*8), 16, ENC_BIG_ENDIAN);
1131
16
    uint8_t     addr_size=0, *addr, implemented, prefix_len_octets, prefix_len, host_len, vc_len;
1132
16
    uint8_t     intparam_len, aai_type = 0;
1133
16
    uint32_t    pwid_len, agi_aii_len;
1134
16
    const char *str;
1135
16
    uint8_t gen_fec_id_len = 0;
1136
16
    address_type addr_type;
1137
16
    address      addr_str;
1138
1139
16
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "FEC Elements");
1140
1141
23
    while (rem > 0){
1142
17
        switch (tvb_get_uint8(tvb, offset)) {
1143
1
        case WILDCARD_FEC:
1144
1
        case CRLSP_FEC:
1145
1
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 1,
1146
1
                                        ett_ldp_fec, NULL, "FEC Element %u", ix);
1147
1
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc,tvb, offset, 1, ENC_BIG_ENDIAN);
1148
1
            rem -= 1;
1149
1
            offset += 1;
1150
1
            break;
1151
1152
1
        case PREFIX_FEC:
1153
1
            if ( rem < 4 ){/*not enough*/
1154
0
                proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1155
0
                return;
1156
0
            }
1157
1
            family=tvb_get_ntohs(tvb, offset+1);
1158
1
            prefix_len=tvb_get_uint8(tvb, offset+3);
1159
1
            prefix_len_octets=(prefix_len+7)/8;
1160
1161
1
            implemented=1;
1162
1
            switch(family) {
1163
0
            case AFNUM_IP: /*IPv4*/
1164
0
                addr_size=4;
1165
0
                addr_type = AT_IPv4;
1166
0
                break;
1167
0
            case AFNUM_IP6: /*IPv6*/
1168
0
                addr_size=16;
1169
0
                addr_type = AT_IPv6;
1170
0
                break;
1171
1
            default:
1172
1
                implemented=0;
1173
1
                break;
1174
1
            }
1175
1176
1
            if ( !implemented ) {
1177
1
                uint16_t noctets;
1178
1179
1
                noctets= rem>4+prefix_len_octets?4+prefix_len_octets:rem;
1180
1
                proto_tree_add_expert(val_tree, pinfo, &ei_ldp_address_family_not_implemented, tvb, offset, noctets);
1181
1
                offset+=noctets;
1182
1
                rem-=noctets;
1183
1
                break;
1184
1
            }
1185
1186
0
            if ( rem < 4+MIN(addr_size, prefix_len_octets) ){
1187
0
                proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1188
0
                return;
1189
0
            }
1190
1191
            /*Add a subtree for this*/
1192
0
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+MIN(addr_size, prefix_len_octets),
1193
0
                                            ett_ldp_fec, NULL, "FEC Element %u", ix);
1194
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1195
0
            offset += 1;
1196
1197
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, ENC_BIG_ENDIAN);
1198
0
            offset += 2;
1199
1200
0
            ti = proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1201
0
            offset += 1;
1202
1203
1204
0
            if ( addr_size < prefix_len_octets) {
1205
0
                offset+=addr_size;
1206
0
                rem-=addr_size;
1207
0
                expert_add_info_format(pinfo, ti, &ei_ldp_tlv_fec_len,
1208
0
                                    "Invalid prefix %u length for family %s",
1209
0
                                    prefix_len, val_to_str_const(family, afn_vals, "Unknown Family"));
1210
0
                break;
1211
0
            }
1212
1213
0
            addr=(uint8_t *)wmem_alloc0(pinfo->pool, addr_size);
1214
1215
0
            for(ax=0; ax+1 <= prefix_len_octets; ax++)
1216
0
                addr[ax]=tvb_get_uint8(tvb, offset+ax);
1217
0
            if ( prefix_len % 8 )
1218
0
                addr[ax-1] = addr[ax-1]&(0xFF<<(8-prefix_len%8));
1219
1220
0
            set_address(&addr_str, addr_type, addr_size, addr);
1221
0
            str = address_to_str(pinfo->pool, &addr_str);
1222
0
            proto_tree_add_string_format(fec_tree, hf_ldp_tlv_fec_pfval, tvb, offset, prefix_len_octets,
1223
0
                                         str, "Prefix: %s", str);
1224
1225
0
            offset += prefix_len_octets;
1226
0
            rem -= 4+prefix_len_octets;
1227
0
            break;
1228
1229
0
        case HOST_FEC:
1230
0
            if ( rem < 4 ){/*not enough*/
1231
0
                proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1232
0
                return;
1233
0
            }
1234
0
            family=tvb_get_ntohs(tvb, offset+1);
1235
0
            host_len=tvb_get_uint8(tvb, offset+3);
1236
1237
0
            implemented=1;
1238
0
            switch(family) {
1239
0
            case AFNUM_IP: /*IPv4*/
1240
0
                addr_size=4;
1241
0
                addr_type = AT_IPv4;
1242
0
                break;
1243
0
            case AFNUM_IP6: /*IPv6*/
1244
0
                addr_size=16;
1245
0
                addr_type = AT_IPv6;
1246
0
                break;
1247
0
            default:
1248
0
                implemented=0;
1249
0
                break;
1250
0
            }
1251
1252
0
            if ( !implemented ) {
1253
0
                uint16_t noctets;
1254
1255
0
                noctets= rem>4+host_len?4+host_len:rem;
1256
0
                proto_tree_add_expert(val_tree, pinfo, &ei_ldp_address_family_not_implemented, tvb, offset, noctets);
1257
0
                offset+=noctets;
1258
0
                rem-=noctets;
1259
0
                break;
1260
0
            }
1261
1262
0
            if ( rem < 4+addr_size ){
1263
0
                proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1264
0
                return;
1265
0
            }
1266
1267
            /*Add a subtree for this*/
1268
0
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+addr_size, ett_ldp_fec, NULL, "FEC Element %u", ix);
1269
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1270
0
            offset += 1;
1271
1272
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, ENC_BIG_ENDIAN);
1273
0
            offset += 2;
1274
1275
0
            ti = proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1276
0
            offset += 1;
1277
1278
1279
0
            if ( addr_size != host_len) {
1280
0
                offset+=addr_size;
1281
0
                rem-=addr_size;
1282
0
                expert_add_info_format(pinfo, ti, &ei_ldp_tlv_fec_len,
1283
0
                                    "Invalid address length %u length for family %s",
1284
0
                                    host_len, val_to_str_const(family, afn_vals, "Unknown Family"));
1285
0
                break;
1286
0
            }
1287
1288
0
            addr=(uint8_t *)wmem_alloc0(pinfo->pool, addr_size);
1289
1290
0
            for(ax=0; ax+1 <= host_len; ax++)
1291
0
                addr[ax]=tvb_get_uint8(tvb, offset+ax);
1292
1293
0
            set_address(&addr_str, addr_type, addr_size, addr);
1294
0
            str = address_to_str(pinfo->pool, &addr_str);
1295
0
            proto_tree_add_string_format(fec_tree, hf_ldp_tlv_fec_hoval, tvb, offset, host_len,
1296
0
                                         str, "Address: %s", str);
1297
1298
0
            offset += host_len;
1299
0
            rem -= 4+host_len;
1300
0
            break;
1301
1302
0
        case TYPED_WILDCARD_FEC:
1303
0
            if ( rem < 8 ){/*not enough bytes for a minimal TYPED_WILDCARD_FEC*/
1304
0
                proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1305
0
                return;
1306
0
            }
1307
0
            vc_len = tvb_get_uint8 (tvb, offset+3);
1308
1309
1310
0
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 8+vc_len, ett_ldp_fec, &ti, "FEC Element %u", ix);
1311
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1312
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1313
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vctype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1314
0
            ti2 = proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_infolength, tvb, offset+3,1,ENC_BIG_ENDIAN);
1315
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_groupid,tvb, offset +4, 4, ENC_BIG_ENDIAN);
1316
0
            rem -=8;
1317
0
            offset +=8;
1318
1319
0
            if ( (vc_len > 3) && ( rem > 3 ) ) { /* there is enough room for vcid */
1320
0
                proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vcid,tvb, offset, 4, ENC_BIG_ENDIAN);
1321
0
                proto_item_append_text (ti," VCID: %u",tvb_get_ntohl(tvb,offset));
1322
1323
0
            } else {
1324
0
                expert_add_info(pinfo, ti2, &ei_ldp_tlv_fec_vc_infolength);
1325
0
                return;
1326
0
            }
1327
0
            rem -= 4;
1328
0
            vc_len -= 4;
1329
0
            offset += 4;
1330
1331
0
            while ( (vc_len > 1) && (rem > 1) ) {   /* enough to include id and length */
1332
0
                intparam_len = tvb_get_uint8(tvb, offset+1);
1333
0
                if (intparam_len < 2){ /* At least Type and Len, protect against len = 0 */
1334
0
                    proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_malformed_interface_parameter, tvb, offset +1, 1);
1335
0
                    return;
1336
0
                }
1337
1338
0
                if ( (vc_len -intparam_len) <0 && (rem -intparam_len) <0 ) { /* error condition */
1339
0
                    proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_malformed_data, tvb, offset +2, MIN(vc_len,rem));
1340
0
                    return;
1341
0
                }
1342
0
                dissect_subtlv_interface_parameters(tvb, offset, fec_tree, intparam_len, interface_params_header_fields);
1343
1344
0
                rem -= intparam_len;
1345
0
                vc_len -= intparam_len;
1346
0
                offset += intparam_len;
1347
0
            }
1348
0
            break;
1349
1350
2
        case P2MP_PW_UPSTREAM_FEC:
1351
2
        {
1352
            /* Ref: RFC 4447 */
1353
2
            if ( rem < 4 ){/*not enough bytes for a minimal TYPED_WILDCARD_FEC*/
1354
0
                proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec, tvb, offset, rem, "Error in FEC Element %u", ix);
1355
0
                return;
1356
0
            }
1357
2
            vc_len = tvb_get_uint8 (tvb, offset+3);
1358
1359
            /* Add the FEC to the tree */
1360
2
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 8+vc_len, ett_ldp_fec, NULL, "FEC Element %u", ix);
1361
2
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1362
2
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1363
2
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_vctype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1364
2
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_vc_infolength, tvb, offset+3,1,ENC_BIG_ENDIAN);
1365
2
            rem -= 4;
1366
2
            offset += 4;
1367
1368
2
            if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for AGI */
1369
2
                gen_fec_id_len = tvb_get_uint8 (tvb, offset+1);
1370
                /* Add AGI to the tree */
1371
2
                agi_tree = proto_tree_add_subtree_format(fec_tree, tvb, offset, 2 + gen_fec_id_len, ett_ldp_gen_agi, NULL, "AGI");
1372
2
                proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1373
2
                proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1374
2
                if ( gen_fec_id_len > 0)
1375
2
                {
1376
2
                    proto_tree_add_item(agi_tree, hf_ldp_tlv_fec_gen_agi_value, tvb, offset+2, gen_fec_id_len , ENC_NA );
1377
2
                }
1378
2
                rem -= 2 + gen_fec_id_len;
1379
2
                vc_len -= 2 + gen_fec_id_len;
1380
2
                offset += 2 + gen_fec_id_len;
1381
1382
2
            } else {
1383
0
                proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 +vc_len, "Generalized FEC: AGI size format error");
1384
0
                return;
1385
0
            }
1386
1387
2
            if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for SAII */
1388
2
                gen_fec_id_len = tvb_get_uint8 (tvb, offset+1);
1389
                /* Add SAII to the tree */
1390
2
                aai_type = tvb_get_uint8(tvb, offset);
1391
2
                if ( aai_type == 2 && gen_fec_id_len != 12)
1392
0
                {
1393
                    /* According to RFC 5003, for Type 2 AAI, the length should be 12 bytes */
1394
0
                    proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 + gen_fec_id_len, "Generalized FEC: SAII size format error");
1395
0
                }
1396
2
                else
1397
2
                {
1398
2
                    saii_tree = proto_tree_add_subtree(fec_tree, tvb, offset, 2 + gen_fec_id_len, ett_ldp_gen_saii, NULL, "SAII");
1399
2
                    proto_tree_add_item(saii_tree, hf_ldp_tlv_fec_gen_saii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1400
2
                    proto_tree_add_item(saii_tree, hf_ldp_tlv_fec_gen_saii_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1401
2
                    if ( gen_fec_id_len > 0)
1402
1
                    {
1403
                        /* Get the AAI Type. */
1404
                        /* If it is  Type 2 (RFC 5003), then the length is 12 bytes, */
1405
                        /* and the following fields exist. */
1406
                        /*    0                   1                   2                   3    */
1407
                        /*    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1  */
1408
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1409
                        /*   |  AII Type=02  |    Length     |        Global ID              | */
1410
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1411
                        /*   |       Global ID (contd.)      |        Prefix                 | */
1412
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1413
                        /*   |       Prefix (contd.)         |        AC ID                  | */
1414
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1415
                        /*   |      AC ID                    | */
1416
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1417
1418
1
                        if ( aai_type == 2)
1419
0
                        {
1420
0
                            dissect_genpwid_fec_aai_type2_parameter(tvb, pinfo, offset +2, saii_tree, gen_fec_id_len);
1421
0
                        }
1422
1
                        else
1423
1
                        {
1424
1
                            proto_tree_add_item(saii_tree,
1425
1
                                                hf_ldp_tlv_fec_gen_saii_value,
1426
1
                                                tvb,
1427
1
                                                offset+2,
1428
1
                                                gen_fec_id_len ,
1429
1
                                                ENC_NA );
1430
1
                        }
1431
1
                    }
1432
2
                }
1433
2
                rem -= 2 + gen_fec_id_len;
1434
2
                vc_len -= 2 + gen_fec_id_len;
1435
2
                offset += 2 + gen_fec_id_len;
1436
1437
2
            } else {
1438
0
                proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 + vc_len, "Generalized FEC: SAII size format error");
1439
0
                return;
1440
0
            }
1441
1442
2
            if ( (vc_len > 1) && ( rem > 1 ) ) { /* there is enough room for TAII */
1443
1
                gen_fec_id_len = tvb_get_uint8 (tvb, offset+1);
1444
                /* Add TAII to the tree */
1445
1
                aai_type = tvb_get_uint8(tvb, offset);
1446
1
                if ( aai_type == 2 && gen_fec_id_len != 12)
1447
0
                {
1448
                    /* According to RFC 5003, for Type 2 AAI, the length should be 12 bytes */
1449
0
                    proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 + gen_fec_id_len, "Generalized FEC: TAII size format error");
1450
0
                }
1451
1
                else
1452
1
                {
1453
1
                    taii_tree = proto_tree_add_subtree(fec_tree, tvb, offset, 2 + gen_fec_id_len, ett_ldp_gen_taii, NULL, "TAII");
1454
1
                    proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1455
1
                    proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_length,tvb, offset + 1, 1, ENC_BIG_ENDIAN);
1456
1
                    if ( gen_fec_id_len > 0)
1457
1
                    {
1458
                        /* Get the AAI Type. */
1459
                        /* If it is  Type 2 (RFC 5003), then the length is 12 bytes, */
1460
                        /* and the following fields exist. */
1461
                        /*    0                   1                   2                   3    */
1462
                        /*    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1  */
1463
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1464
                        /*   |  AII Type=02  |    Length     |        Global ID              | */
1465
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1466
                        /*   |       Global ID (contd.)      |        Prefix                 | */
1467
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1468
                        /*   |       Prefix (contd.)         |        AC ID                  | */
1469
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1470
                        /*   |      AC ID                    | */
1471
                        /*   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
1472
1473
1
                        if ( aai_type == 2)
1474
0
                        {
1475
0
                            dissect_genpwid_fec_aai_type2_parameter(tvb, pinfo, offset +2, taii_tree, gen_fec_id_len);
1476
0
                        }
1477
1
                        else
1478
1
                        {
1479
1
                            proto_tree_add_item(taii_tree, hf_ldp_tlv_fec_gen_taii_value, tvb, offset+2, gen_fec_id_len , ENC_NA);
1480
1
                        }
1481
1
                    }
1482
1
                }
1483
1
                rem -= 2 + gen_fec_id_len;
1484
                /*vc_len -= 2 + gen_fec_id_len;*/
1485
1
                offset += 2 + gen_fec_id_len;
1486
1487
1488
1
            } else {
1489
1
                proto_tree_add_expert_format(fec_tree, pinfo, &ei_ldp_tlv_fec_vc_infolength, tvb, offset, 2 +vc_len, "Generalized FEC: TAII size format error");
1490
1
                return;
1491
1
            }
1492
1493
1
            break;
1494
2
        }
1495
1
        case P2MP_FEC:
1496
0
        case MP2MP_FEC_UP:
1497
4
        case MP2MP_FEC_DOWN:
1498
6
        case HSMP_UPSTREAM:
1499
6
        case HSMP_DOWNSTREAM:
1500
6
        {
1501
6
            if (rem < 4 ){/*not enough*/
1502
0
                proto_item* inv_length;
1503
0
                inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
1504
0
                expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
1505
0
                return;
1506
0
            }
1507
1508
6
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+tvb_get_uint8 (tvb, offset+1),
1509
6
                                                            ett_ldp_fec, NULL, "FEC Element %u", ix);
1510
6
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1511
6
            offset += 1;
1512
1513
6
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_af, tvb, offset, 2, ENC_BIG_ENDIAN);
1514
6
            offset += 2;
1515
6
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_len, tvb, offset, 1, ENC_BIG_ENDIAN);
1516
6
            offset += 1;
1517
1518
6
            proto_tree_add_item(fec_tree, hf_ldp_tlv_ldp_p2mp_rtnodeaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
1519
6
            proto_tree_add_item(fec_tree, hf_ldp_tlv_ldp_p2mp_oplength, tvb,offset + 4, 2, ENC_BIG_ENDIAN);
1520
6
            proto_tree_add_item(fec_tree, hf_ldp_tlv_ldp_p2mp_opvalue, tvb,offset + 6, op_length, ENC_NA);
1521
1522
6
            offset = offset + 6 + op_length;
1523
6
            rem = rem - 10 - op_length;
1524
1525
6
            break;
1526
6
        }
1527
1528
1
        case PWID_FEC_ELEMENT:
1529
1
        {
1530
1
            if (rem < 8 ){/*not enough*/
1531
0
                proto_item* inv_length;
1532
0
                inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
1533
0
                expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
1534
0
                return;
1535
0
            }
1536
1537
1
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 8+tvb_get_uint8 (tvb, offset+3),
1538
1
                                                            ett_ldp_fec, NULL, "FEC Element %u", ix);
1539
1
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1540
1
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_pw_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1541
1
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_pw_pwtype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1542
1
            proto_tree_add_item_ret_uint(fec_tree, hf_ldp_tlv_fec_pw_infolength, tvb, offset+3,1,ENC_BIG_ENDIAN, &pwid_len);
1543
1
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_pw_groupid,tvb, offset +4, 4, ENC_BIG_ENDIAN);
1544
1
            rem -=8;
1545
1
            offset +=8;
1546
1547
1
            if ( (pwid_len > 3) && ( rem > 3 ) ) { /* there is enough room for pwid */
1548
0
                proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_pw_pwid,tvb, offset, 4, ENC_BIG_ENDIAN);
1549
0
                rem -=4;
1550
0
                offset +=4;
1551
1552
0
            }
1553
1554
1
            while ( (pwid_len > 1) && (rem > 1) ) {   /* enough to include id and length */
1555
0
                intparam_len = tvb_get_uint8(tvb, offset+1);
1556
0
                if (intparam_len < 2){ /* At least Type and Len, protect against len = 0 */
1557
0
                    proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_malformed_interface_parameter, tvb, offset +1, 1);
1558
0
                    return;
1559
0
                }
1560
1561
0
                if ( ((uint32_t)intparam_len > pwid_len) && (rem -intparam_len) <0 ) { /* error condition */
1562
0
                    proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_malformed_data, tvb, offset +2, MIN(pwid_len,(uint32_t)rem));
1563
0
                    return;
1564
0
                }
1565
0
                dissect_subtlv_interface_parameters(tvb, offset, fec_tree, intparam_len, interface_params_header_fields);
1566
1567
0
                rem -= intparam_len;
1568
0
                pwid_len -= intparam_len;
1569
0
                offset += intparam_len;
1570
0
            }
1571
1572
1
            break;
1573
1
        }
1574
1575
1
        case GENERALIZED_PWID_FEC:
1576
0
        {
1577
0
            if (rem < 4 ){/*not enough*/
1578
0
                proto_item* inv_length;
1579
0
                inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
1580
0
                expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
1581
0
                return;
1582
0
            }
1583
1584
0
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4+tvb_get_uint8 (tvb, offset+3),
1585
0
                                                            ett_ldp_fec, NULL, "FEC Element %u", ix);
1586
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_wc, tvb, offset, 1, ENC_BIG_ENDIAN);
1587
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_pw_controlword, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1588
0
            proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_pw_pwtype, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1589
0
            proto_tree_add_item_ret_uint(fec_tree, hf_ldp_tlv_fec_pw_infolength, tvb, offset+3,1,ENC_BIG_ENDIAN, &pwid_len);
1590
0
            rem -= 4;
1591
0
            offset += 4;
1592
0
            if ( (pwid_len > 5) && ( rem > 5 ) ) { /* there is enough room for AGI/AII data */
1593
0
                proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_gen_agi_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1594
0
                rem -= 1;
1595
0
                offset += 1;
1596
0
                proto_tree_add_item_ret_uint(fec_tree, hf_ldp_tlv_fec_gen_agi_length, tvb, offset,1,ENC_BIG_ENDIAN, &agi_aii_len);
1597
0
                rem -= 1;
1598
0
                offset += 1;
1599
0
                if ( agi_aii_len > 0)
1600
0
                {
1601
0
                    proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_gen_agi_value, tvb, offset, agi_aii_len , ENC_NA );
1602
0
                    rem -= agi_aii_len;
1603
0
                    offset += agi_aii_len;
1604
0
                }
1605
0
                proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_gen_saii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1606
0
                rem -= 1;
1607
0
                offset += 1;
1608
0
                proto_tree_add_item_ret_uint(fec_tree, hf_ldp_tlv_fec_gen_saii_length, tvb, offset,1,ENC_BIG_ENDIAN, &agi_aii_len);
1609
0
                rem -= 1;
1610
0
                offset += 1;
1611
0
                if ( agi_aii_len > 0)
1612
0
                {
1613
0
                    proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_gen_saii_value, tvb, offset, agi_aii_len , ENC_NA );
1614
0
                    rem -= agi_aii_len;
1615
0
                    offset += agi_aii_len;
1616
0
                }
1617
0
                proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_gen_taii_type,tvb, offset, 1, ENC_BIG_ENDIAN);
1618
0
                rem -= 1;
1619
0
                offset += 1;
1620
0
                proto_tree_add_item_ret_uint(fec_tree, hf_ldp_tlv_fec_gen_taii_length, tvb, offset,1,ENC_BIG_ENDIAN, &agi_aii_len);
1621
0
                rem -= 1;
1622
0
                offset += 1;
1623
0
                if ( agi_aii_len > 0)
1624
0
                {
1625
0
                    proto_tree_add_item(fec_tree, hf_ldp_tlv_fec_gen_taii_value, tvb, offset, agi_aii_len , ENC_NA );
1626
0
                    rem -= agi_aii_len;
1627
0
                    offset += agi_aii_len;
1628
0
                }
1629
0
            }
1630
0
            break;
1631
0
        }
1632
1633
6
        default:  /* Unknown */
1634
            /* XXX - do all FEC's have a length that's a multiple of 4? */
1635
            /* Hmmm, don't think so. Will check. RJS. */
1636
            /* If we don't know its structure, we have to exit */
1637
6
            fec_tree = proto_tree_add_subtree_format(val_tree, tvb, offset, 4, ett_ldp_fec, NULL, "FEC Element %u", ix);
1638
6
            proto_tree_add_expert(fec_tree, pinfo, &ei_ldp_tlv_fec_type, tvb, offset, rem);
1639
6
            return;
1640
17
        }
1641
7
        ix++;
1642
7
    }
1643
16
}
1644
1645
/* Dissect Address List TLV */
1646
1647
static void
1648
dissect_tlv_address_list(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1649
10
{
1650
10
    proto_tree *val_tree;
1651
10
    uint16_t    family, ix;
1652
10
    uint8_t     addr_size, *addr;
1653
10
    const char *str;
1654
10
    address_type addr_type;
1655
10
    address      addr_str;
1656
1657
10
    if ( rem < 2 ) {
1658
2
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1659
2
                            "Error processing Address List TLV: length is %d, should be >= 2",
1660
2
                            rem);
1661
2
        return;
1662
2
    }
1663
1664
8
    family=tvb_get_ntohs(tvb, offset);
1665
8
    proto_tree_add_item(tree, hf_ldp_tlv_addrl_addr_family, tvb,
1666
8
                        offset, 2, ENC_BIG_ENDIAN);
1667
8
    switch(family) {
1668
2
    case AFNUM_IP: /*IPv4*/
1669
2
        addr_size=4;
1670
2
        addr_type = AT_IPv4;
1671
2
        break;
1672
0
    case AFNUM_IP6: /*IPv6*/
1673
0
        addr_size=16;
1674
0
        addr_type = AT_IPv6;
1675
0
        break;
1676
6
    default:
1677
6
        proto_tree_add_expert(tree, pinfo, &ei_ldp_address_family_not_implemented, tvb, offset+2, rem-2);
1678
6
        return;
1679
8
    }
1680
1681
2
    offset+=2; rem-=2;
1682
2
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Addresses");
1683
1684
2
    addr=(uint8_t *)wmem_alloc(pinfo->pool, addr_size);
1685
1686
31
    for(ix=1; rem >= addr_size; ix++, offset += addr_size,
1687
29
            rem -= addr_size) {
1688
29
        if ( (tvb_memcpy(tvb, addr, offset, addr_size))
1689
29
             == NULL)
1690
0
            break;
1691
1692
29
        set_address(&addr_str, addr_type, addr_size, addr);
1693
29
        str = address_to_str(pinfo->pool, &addr_str);
1694
29
        proto_tree_add_string_format(val_tree,
1695
29
                                     hf_ldp_tlv_addrl_addr, tvb, offset, addr_size, str,
1696
29
                                     "Address %u: %s", ix, str);
1697
29
    }
1698
2
    if (rem)
1699
1
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing TLV: Extra data at end of address list");
1700
2
}
1701
1702
/* Dissect Path Vector TLV */
1703
1704
static void
1705
dissect_tlv_path_vector(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1706
8
{
1707
8
    proto_tree *val_tree;
1708
8
    uint8_t     ix;
1709
8
    uint32_t addr;
1710
1711
8
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "LSR IDs");
1712
1713
250
    for(ix=1; rem >= 4; ix++, offset += 4, rem -= 4) {
1714
242
        addr = tvb_get_ipv4(tvb, offset);
1715
242
        proto_tree_add_ipv4_format(val_tree,
1716
242
                                   hf_ldp_tlv_pv_lsrid, tvb, offset, 4,
1717
242
                                   addr, "LSR Id %u: %s", ix,
1718
242
                                   tvb_ip_to_str(pinfo->pool, tvb, offset));
1719
242
    }
1720
8
    if (rem)
1721
6
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing TLV: Extra data at end of path vector");
1722
8
}
1723
1724
/* Dissect ATM Label TLV */
1725
1726
static void
1727
dissect_tlv_atm_label(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1728
1
{
1729
1
    proto_tree *val_tree;
1730
1731
1
    if (rem != 4){
1732
1
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing ATM Label TLV: length is %d, should be 4", rem);
1733
1
        return;
1734
1
    }
1735
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ATM Label");
1736
1737
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vbits, tvb, offset, 1, ENC_BIG_ENDIAN);
1738
1739
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vpi, tvb, offset, 2, ENC_BIG_ENDIAN);
1740
1741
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_atm_label_vci, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1742
0
}
1743
1744
/* Dissect FRAME RELAY Label TLV */
1745
1746
static void
1747
dissect_tlv_frame_label(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1748
3
{
1749
3
    proto_tree *val_tree;
1750
3
    uint8_t     len;
1751
1752
3
    if (rem != 4){
1753
3
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1754
3
                            "Error processing Frame Relay Label TLV: length is %d, should be 4",
1755
3
                            rem);
1756
3
        return;
1757
3
    }
1758
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Frame Relay Label");
1759
1760
0
    len=(uint8_t)(tvb_get_ntohs(tvb, offset)>>7) & 0x03;
1761
0
    proto_tree_add_uint_format_value(val_tree, hf_ldp_tlv_fr_label_len, tvb, offset, 2, len,
1762
0
                               "%s (%u)", val_to_str_const(len, tlv_fr_len_vals, "Unknown Length"), len);
1763
1764
0
    proto_tree_add_item(val_tree,
1765
0
                               hf_ldp_tlv_fr_label_dlci, tvb, offset+1, 3, ENC_BIG_ENDIAN);
1766
0
}
1767
1768
/* Dissect STATUS TLV */
1769
1770
static void
1771
dissect_tlv_status(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1772
3
{
1773
3
    proto_tree *val_tree;
1774
3
    uint32_t    data;
1775
1776
3
    if (rem != 10){
1777
3
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1778
3
                            "Error processing Status TLV: length is %d, should be 10",
1779
3
                            rem);
1780
3
        return;
1781
3
    }
1782
1783
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Status");
1784
1785
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_status_ebit, tvb, offset, 1, ENC_BIG_ENDIAN);
1786
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_status_fbit, tvb, offset, 1, ENC_BIG_ENDIAN);
1787
1788
0
    data=tvb_get_ntohl(tvb, offset)&0x3FFFFFFF;
1789
0
    proto_tree_add_uint_format_value(val_tree, hf_ldp_tlv_status_data, tvb, offset, 4,
1790
0
                               data, "%s (0x%X)", val_to_str_const(data, tlv_status_data, "Unknown Status Data"), data);
1791
1792
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_status_msg_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1793
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_status_msg_type, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1794
0
}
1795
1796
/* Dissect Returned PDU TLV */
1797
1798
static void
1799
dissect_tlv_returned_pdu(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1800
1
{
1801
1
    proto_tree *val_tree;
1802
1803
1
    if (rem < 10){
1804
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1805
0
                            "Error processing Returned PDU TLV: length is %d, should be >= 10",
1806
0
                            rem);
1807
0
        return;
1808
0
    }
1809
1
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Returned PDU");
1810
1811
1
    proto_tree_add_item(val_tree, hf_ldp_tlv_returned_version, tvb, offset, 2, ENC_BIG_ENDIAN);
1812
1
    proto_tree_add_item(val_tree, hf_ldp_tlv_returned_pdu_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1813
1
    proto_tree_add_item(val_tree, hf_ldp_tlv_returned_lsr, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1814
1
    proto_tree_add_item(val_tree, hf_ldp_tlv_returned_ls_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
1815
1
    offset += 10;
1816
1
    rem -= 10;
1817
1818
1
    if ( rem > 0 ) {
1819
        /*XXX - dissect returned pdu data*/
1820
1
        proto_tree_add_item(val_tree, hf_ldp_returned_pdu_data, tvb, offset, rem, ENC_NA);
1821
1
    }
1822
1
}
1823
1824
/* Dissect Returned MESSAGE TLV */
1825
1826
static void
1827
dissect_tlv_returned_message(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1828
11
{
1829
11
    proto_tree *val_tree;
1830
11
    uint16_t    type;
1831
1832
11
    if (rem < 4) {
1833
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1834
0
                            "Error processing Returned Message TLV: length is %d, should be >= 4",
1835
0
                            rem);
1836
0
        return;
1837
0
    }
1838
11
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Returned Message");
1839
1840
11
    proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_ubit, tvb, offset, 1, ENC_BIG_ENDIAN);
1841
1842
11
    type=tvb_get_ntohs(tvb, offset)&0x7FFF;
1843
    /*chk for vendor-private*/
1844
11
    if (type>=LDP_VENDOR_PRIVATE_START && type<=LDP_VENDOR_PRIVATE_END){
1845
0
        proto_tree_add_uint_format(val_tree, hf_ldp_tlv_returned_msg_type, tvb, offset, 2,
1846
0
                                   type, "Message Type: Vendor Private (0x%X)", type);
1847
        /*chk for experimental*/
1848
11
    } else if (type>=LDP_EXPERIMENTAL_MESSAGE_START && type<=LDP_EXPERIMENTAL_MESSAGE_END){
1849
0
        proto_tree_add_uint_format(val_tree, hf_ldp_tlv_returned_msg_type, tvb, offset, 2,
1850
0
                                   type, "Message Type: Experimental (0x%X)", type);
1851
11
    } else {
1852
11
        proto_tree_add_uint_format(val_tree, hf_ldp_tlv_returned_msg_type, tvb, offset, 2,
1853
11
                                   type, "Message Type: %s (0x%X)", val_to_str_const(type, ldp_message_types,"Unknown Message Type"), type);
1854
11
    }
1855
1856
11
    proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1857
11
    offset += 4;
1858
11
    rem    -= 4;
1859
1860
11
    if ( rem >= 4  ) { /*have msg_id*/
1861
11
        proto_tree_add_item(val_tree, hf_ldp_tlv_returned_msg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1862
11
        offset += 4;
1863
11
        rem -= 4;
1864
11
    }
1865
1866
11
    if ( rem > 0 ) {
1867
        /*XXX - dissect returned msg parameters*/
1868
11
        proto_tree_add_item(val_tree, hf_ldp_returned_message_parameters, tvb, offset, rem, ENC_NA);
1869
11
    }
1870
11
}
1871
1872
/* Dissect the common hello params */
1873
1874
static void
1875
#if 0
1876
dissect_tlv_common_hello_parms(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1877
#else
1878
dissect_tlv_common_hello_parms(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree)
1879
#endif
1880
5
{
1881
#if 0
1882
    proto_tree *ti;
1883
#endif
1884
5
    proto_tree *val_tree;
1885
5
    proto_item *gtsm_flag_item;
1886
5
    uint16_t gtsm_flag_buffer;
1887
#if 0
1888
    ti = proto_tree_add_item(tree, hf_ldp_tlv_value, tvb, offset, rem, ENC_NA);
1889
    val_tree = proto_item_add_subtree(ti, ett_ldp_tlv_val);
1890
#else
1891
5
    val_tree=tree;
1892
5
#endif
1893
5
    proto_tree_add_item(val_tree, hf_ldp_tlv_val_hold, tvb, offset, 2, ENC_BIG_ENDIAN);
1894
5
    proto_tree_add_item(val_tree, hf_ldp_tlv_val_target, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1895
5
    proto_tree_add_item(val_tree, hf_ldp_tlv_val_request, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1896
5
    gtsm_flag_item = proto_tree_add_item(val_tree, hf_ldp_tlv_val_gtsm_flag, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1897
1898
5
    gtsm_flag_buffer = tvb_get_bits16(tvb, ((offset+2)*8), 16, ENC_BIG_ENDIAN);
1899
1900
5
    if ( gtsm_flag_buffer & 0x2000 ) {
1901
2
        if ( gtsm_flag_buffer & 0x8000 ) {
1902
1
            expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_dtsm_and_target);
1903
1
        } else {
1904
1
            expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_supported);
1905
1
        }
1906
3
    } else {
1907
3
        if ( gtsm_flag_buffer & 0x8000 ) {
1908
2
                expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_not_supported_basic_discovery);
1909
2
        } else {
1910
1
                expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_not_supported);
1911
1
        }
1912
3
    }
1913
1914
5
    proto_tree_add_item(val_tree, hf_ldp_tlv_val_res, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
1915
5
}
1916
1917
/* Dissect MAC TLV */
1918
1919
static void
1920
dissect_tlv_mac(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1921
19
{
1922
19
    proto_tree   *val_tree;
1923
1924
19
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "MAC addresses");
1925
1926
333
    for(; rem >= 6; offset += 6, rem -= 6) {
1927
314
        proto_tree_add_item(val_tree, hf_ldp_tlv_mac, tvb, offset, 6, ENC_NA);
1928
314
    }
1929
19
    if (rem)
1930
14
        proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing TLV: Extra data at end of path vector");
1931
19
}
1932
1933
1934
1935
/* Dissect the common session params */
1936
1937
static void
1938
dissect_tlv_common_session_parms(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1939
3
{
1940
3
    proto_tree *val_tree;
1941
1942
3
    if ( rem != 14) { /*length of Comm Sess Parms tlv*/
1943
3
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem, "Error processing Common Session Parameters TLV: length is %d, should be 14", rem);
1944
3
        return;
1945
3
    }
1946
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Parameters");
1947
1948
    /*Protocol Version*/
1949
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ver, tvb,offset, 2, ENC_BIG_ENDIAN);
1950
1951
    /*KeepAlive Time*/
1952
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ka, tvb,offset + 2, 2, ENC_BIG_ENDIAN);
1953
1954
    /*A bit*/
1955
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_advbit,tvb, offset + 4, 1, ENC_BIG_ENDIAN);
1956
1957
    /*D bit*/
1958
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_ldetbit,tvb, offset + 4, 1, ENC_BIG_ENDIAN);
1959
1960
    /*Path Vector Limit*/
1961
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_pvlim,tvb, offset + 5, 1, ENC_BIG_ENDIAN);
1962
1963
    /*Max PDU Length*/
1964
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_mxpdu,tvb, offset + 6, 2, ENC_BIG_ENDIAN);
1965
1966
    /*Rx LSR*/
1967
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_rxlsr,tvb, offset + 8, 4, ENC_BIG_ENDIAN);
1968
1969
    /*Rx LS*/
1970
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_rxls,tvb, offset + 12, 2, ENC_BIG_ENDIAN);
1971
0
}
1972
1973
/* Dissect the atm session params */
1974
1975
static void
1976
dissect_tlv_atm_session_parms(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
1977
0
{
1978
0
    proto_tree *val_tree, *lbl_tree;
1979
0
    uint8_t     numlr, ix;
1980
1981
0
    if (rem < 4) {
1982
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
1983
0
                            "Error processing ATM Parameters TLV: length is %d, should be >= 4",
1984
0
                            rem);
1985
0
        return;
1986
0
    }
1987
1988
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ATM Parameters");
1989
1990
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_atm_merge,tvb, offset, 1, ENC_BIG_ENDIAN);
1991
1992
    /*get the number of label ranges*/
1993
0
    numlr=(tvb_get_uint8(tvb, offset)>>2) & 0x0F;
1994
0
    proto_tree_add_uint_format(val_tree, hf_ldp_tlv_sess_atm_lr,
1995
0
                               tvb, offset, 1, numlr, "Number of Label Range components: %u",
1996
0
                               numlr);
1997
1998
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_atm_dir,tvb, offset, 1, ENC_BIG_ENDIAN);
1999
2000
    /*move into range components*/
2001
0
    offset += 4;
2002
0
    rem    -= 4;
2003
0
    val_tree=proto_tree_add_subtree(val_tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ATM Label Range Components");
2004
2005
    /*now dissect ranges*/
2006
0
    for(ix=1; numlr > 0 && rem >= 8; ix++, rem-=8, numlr--) {
2007
0
        lbl_tree=proto_tree_add_subtree_format(val_tree, tvb, offset, 8,
2008
0
                               ett_ldp_tlv_val, NULL, "ATM Label Range Component %u", ix);
2009
2010
0
        proto_tree_add_item(lbl_tree,
2011
0
                                   hf_ldp_tlv_sess_atm_minvpi,
2012
0
                                   tvb, offset, 2,
2013
0
                                   ENC_BIG_ENDIAN);
2014
0
        proto_tree_add_item(lbl_tree,
2015
0
                                   hf_ldp_tlv_sess_atm_maxvpi,
2016
0
                                   tvb, (offset+4), 2, ENC_BIG_ENDIAN);
2017
2018
0
        proto_tree_add_item(lbl_tree,
2019
0
                                   hf_ldp_tlv_sess_atm_minvci,
2020
0
                                   tvb, offset+2, 2, ENC_BIG_ENDIAN);
2021
0
        proto_tree_add_item(lbl_tree,
2022
0
                                   hf_ldp_tlv_sess_atm_maxvci,
2023
0
                                   tvb, offset+6, 2, ENC_BIG_ENDIAN);
2024
2025
0
        offset += 8;
2026
0
    }
2027
0
    if( rem || numlr)
2028
0
        proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2029
0
                            "Error processing TLV: Extra data at end of TLV");
2030
0
}
2031
2032
/* Dissect the frame relay session params */
2033
2034
static void
2035
dissect_tlv_frame_relay_session_parms(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2036
8
{
2037
8
    proto_tree *val_tree, *lbl_tree;
2038
8
    uint8_t     numlr, ix, len;
2039
2040
8
    if(rem < 4) {
2041
1
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2042
1
                            "Error processing Frame Relay Parameters TLV: length is %d, should be >= 4",
2043
1
                            rem);
2044
1
        return;
2045
1
    }
2046
2047
7
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Frame Relay Parameters");
2048
2049
7
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_fr_merge,
2050
7
                        tvb, offset, 1, ENC_BIG_ENDIAN);
2051
2052
    /*get the number of label ranges*/
2053
7
    numlr=(tvb_get_uint8(tvb, offset)>>2) & 0x0F;
2054
7
    proto_tree_add_uint_format(val_tree, hf_ldp_tlv_sess_fr_lr,
2055
7
                               tvb, offset, 1, numlr, "Number of Label Range components: %u",
2056
7
                               numlr);
2057
2058
7
    proto_tree_add_item(val_tree, hf_ldp_tlv_sess_fr_dir,
2059
7
                        tvb, offset, 1, ENC_BIG_ENDIAN);
2060
2061
    /*move into range components*/
2062
7
    offset += 4;
2063
7
    rem    -= 4;
2064
7
    val_tree=proto_tree_add_subtree(val_tree, tvb, offset, rem, ett_ldp_tlv_val, NULL,
2065
7
                             "Frame Relay Label Range Components");
2066
2067
    /*now dissect ranges*/
2068
36
    for(ix=1; numlr > 0 && rem >= 8; ix++, rem-=8, numlr--) {
2069
29
        lbl_tree=proto_tree_add_subtree_format(val_tree, tvb, offset, 8,
2070
29
                               ett_ldp_tlv_val, NULL, "Frame Relay Label Range Component %u", ix);
2071
2072
29
        len=(uint8_t)(tvb_get_ntohs(tvb, offset)>>7) & 0x03;
2073
29
        proto_tree_add_uint_format_value(lbl_tree, hf_ldp_tlv_sess_fr_len, tvb, offset, 2, len,
2074
29
                                   "%s (%u)", val_to_str_const(len, tlv_fr_len_vals, "Unknown Length"), len);
2075
2076
29
        proto_tree_add_item(lbl_tree, hf_ldp_tlv_sess_fr_mindlci, tvb, offset+1, 3, ENC_BIG_ENDIAN);
2077
29
        proto_tree_add_item(lbl_tree, hf_ldp_tlv_sess_fr_maxdlci, tvb, offset+5, 3, ENC_BIG_ENDIAN);
2078
2079
29
        offset += 8;
2080
29
    }
2081
2082
7
    if( rem || numlr)
2083
7
        proto_tree_add_expert_format(val_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2084
7
                            "Error processing TLV: Extra data at end of TLV");
2085
7
}
2086
2087
/* Dissect the Fault Tolerant (FT) Session TLV */
2088
2089
static void
2090
dissect_tlv_ft_session(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2091
0
{
2092
0
    proto_tree *ti, *val_tree, *flags_tree;
2093
0
    uint16_t flags;
2094
2095
0
    if(rem != 12){
2096
        /* error, length must be 12 bytes */
2097
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2098
0
                            "Error processing FT Session TLV: length is %d, should be 12",
2099
0
                            rem);
2100
0
        return;
2101
0
    }
2102
2103
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "FT Session Parameters");
2104
2105
    /* Flags */
2106
0
    ti = proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
2107
0
    flags_tree = proto_item_add_subtree(ti,  ett_ldp_tlv_ft_flags);
2108
2109
0
    flags = tvb_get_ntohs(tvb, offset);
2110
0
    proto_item_append_text(ti, " (%s%s)", (flags & 0x8000) ? "R, " : "",
2111
0
                           val_to_str_const(flags & 0xF, tlv_ft_flags, "Invalid"));
2112
0
    proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_r, tvb, offset, 2, ENC_BIG_ENDIAN);
2113
0
    proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_res, tvb, offset, 2, ENC_BIG_ENDIAN);
2114
0
    proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_s, tvb, offset, 2, ENC_BIG_ENDIAN);
2115
0
    proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_a, tvb, offset, 2, ENC_BIG_ENDIAN);
2116
0
    proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_c, tvb, offset, 2, ENC_BIG_ENDIAN);
2117
0
    proto_tree_add_item(flags_tree, hf_ldp_tlv_ft_sess_flag_l, tvb, offset, 2, ENC_BIG_ENDIAN);
2118
2119
    /* Reserved */
2120
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_res, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2121
2122
    /* FT Reconnect TO */
2123
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_reconn_to, tvb, offset + 4,
2124
0
                        4, ENC_BIG_ENDIAN);
2125
2126
    /* Recovery Time */
2127
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_ft_sess_recovery_time, tvb, offset + 8,
2128
0
                        4, ENC_BIG_ENDIAN);
2129
0
}
2130
2131
static void
2132
dissect_tlv_lspid(tvbuff_t *tvb, packet_info *pinfo, unsigned offset,proto_tree *tree, int rem)
2133
0
{
2134
0
    proto_tree *val_tree;
2135
2136
0
    if(rem != 8) {
2137
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2138
0
                            "Error processing LSP ID TLV: length is %d, should be 8",
2139
0
                            rem);
2140
0
        return;
2141
0
    }
2142
2143
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "LSP ID");
2144
2145
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_act_flg,
2146
0
                        tvb, offset, 2, ENC_BIG_ENDIAN);
2147
0
    offset += 2;
2148
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_cr_lsp,
2149
0
                        tvb, offset, 2, ENC_BIG_ENDIAN);
2150
0
    offset += 2;
2151
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_lspid_ldpid,
2152
0
                        tvb, offset, 4, ENC_BIG_ENDIAN);
2153
0
}
2154
2155
static void
2156
dissect_tlv_er_hop_ipv4(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2157
1
{
2158
1
    proto_tree *val_tree;
2159
2160
1
    if(rem != 8) {
2161
1
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2162
1
                            "Error processing ER HOP IPv4 TLV: length is %d, should be 8",
2163
1
                            rem);
2164
1
        return;
2165
1
    }
2166
0
    val_tree=proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP IPv4");
2167
2168
0
    if(val_tree != NULL) {
2169
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
2170
0
                            tvb, offset, 3, ENC_BIG_ENDIAN);
2171
0
        offset += 3;
2172
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prelen,
2173
0
                            tvb, offset, 1, ENC_BIG_ENDIAN);
2174
0
        offset ++;
2175
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prefix4,
2176
0
                            tvb, offset, 4, ENC_BIG_ENDIAN);
2177
0
    }
2178
0
}
2179
2180
static void
2181
dissect_tlv_er_hop_ipv6(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2182
0
{
2183
0
    proto_tree *val_tree;
2184
2185
0
    if(rem != 20) {
2186
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2187
0
                            "Error processing ER HOP IPv6 TLV: length is %d, should be 20",
2188
0
                            rem);
2189
0
        return;
2190
0
    }
2191
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP IPv6");
2192
2193
0
    if(val_tree != NULL) {
2194
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
2195
0
                            tvb, offset, 3, ENC_BIG_ENDIAN);
2196
0
        offset += 3;
2197
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prelen,
2198
0
                            tvb, offset, 1, ENC_BIG_ENDIAN);
2199
0
        offset ++;
2200
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_prefix6,
2201
0
                            tvb, offset, 16, ENC_NA);
2202
0
    }
2203
0
}
2204
2205
static void
2206
dissect_tlv_er_hop_as(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2207
0
{
2208
0
    proto_tree *val_tree;
2209
2210
0
    if(rem != 4) {
2211
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2212
0
                            "Error processing ER HOP AS TLV: length is %d, should be 4",
2213
0
                            rem);
2214
0
        return;
2215
0
    }
2216
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP AS");
2217
2218
0
    if(val_tree != NULL) {
2219
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
2220
0
                            tvb, offset, 2, ENC_BIG_ENDIAN);
2221
0
        offset += 2;
2222
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_as,
2223
0
                            tvb, offset, 2, ENC_BIG_ENDIAN);
2224
0
    }
2225
0
}
2226
2227
static void
2228
dissect_tlv_er_hop_lspid(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2229
0
{
2230
0
    proto_tree *val_tree;
2231
2232
0
    if(rem != 8) {
2233
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2234
0
                            "Error processing ER HOP LSPID TLV: length is %d, should be 8",
2235
0
                            rem);
2236
0
        return;
2237
0
    }
2238
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "ER HOP LSPID");
2239
2240
0
    if(val_tree != NULL) {
2241
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_loose,
2242
0
                            tvb, offset, 2, ENC_BIG_ENDIAN);
2243
0
        offset += 2;
2244
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_cr_lsp,
2245
0
                            tvb, offset, 2, ENC_BIG_ENDIAN);
2246
0
        offset += 2;
2247
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_er_hop_ldpid,
2248
0
                            tvb, offset, 4, ENC_BIG_ENDIAN);
2249
0
    }
2250
0
}
2251
2252
static void
2253
dissect_tlv_traffic(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2254
1
{
2255
1
    proto_tree *val_tree;
2256
1
    uint8_t val_8;
2257
1
    float   val_f;
2258
1
    proto_item *pi;
2259
2260
1
    if(rem != 24) {
2261
1
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2262
1
                            "Error processing Traffic Parameters TLV: length is %d, should be 24",
2263
1
                            rem);
2264
1
        return;
2265
1
    }
2266
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Traffic parameters");
2267
2268
0
    if(val_tree != NULL) {
2269
        /* flags */
2270
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_reserv, tvb, offset, 1, ENC_BIG_ENDIAN);
2271
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
2272
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_ebs, tvb, offset, 1, ENC_BIG_ENDIAN);
2273
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_cbs, tvb, offset, 1, ENC_BIG_ENDIAN);
2274
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_cdr, tvb, offset, 1, ENC_BIG_ENDIAN);
2275
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_pbs, tvb, offset, 1, ENC_BIG_ENDIAN);
2276
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_flags_pdr, tvb, offset, 1, ENC_BIG_ENDIAN);
2277
2278
0
        offset ++;
2279
        /* frequency */
2280
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_frequency, tvb, offset, 1, ENC_BIG_ENDIAN);
2281
0
        offset ++;
2282
2283
        /* reserver byte */
2284
0
        offset ++;
2285
2286
        /* weight */
2287
0
        pi = proto_tree_add_item(val_tree, hf_ldp_tlv_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
2288
0
        val_8 = tvb_get_uint8(tvb, offset);
2289
0
        if (val_8 == 0)
2290
0
            proto_item_set_text(pi, "Weight: Not applicable");
2291
0
        offset ++;
2292
2293
        /* PDR */
2294
0
        val_f = tvb_get_ntohieee_float (tvb, offset);
2295
0
        proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_pdr, tvb, offset,
2296
0
                                     4, val_f, "%.10g Bps", val_f);
2297
0
        offset += 4;
2298
        /* PBS */
2299
0
        val_f = tvb_get_ntohieee_float (tvb, offset);
2300
0
        proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_pbs, tvb, offset,
2301
0
                                     4, val_f, "%.10g Bytes", val_f);
2302
0
        offset += 4;
2303
2304
        /* CDR */
2305
0
        val_f = tvb_get_ntohieee_float (tvb, offset);
2306
0
        proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_cdr, tvb, offset,
2307
0
                                     4, val_f, "%.10g Bps", val_f);
2308
0
        offset += 4;
2309
2310
        /* CBS */
2311
0
        val_f = tvb_get_ntohieee_float (tvb, offset);
2312
0
        proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_cbs, tvb, offset,
2313
0
                                     4, val_f, "%.10g Bytes", val_f);
2314
0
        offset += 4;
2315
2316
        /* EBS */
2317
0
        val_f = tvb_get_ntohieee_float (tvb, offset);
2318
0
        proto_tree_add_double_format_value(val_tree, hf_ldp_tlv_ebs, tvb, offset,
2319
0
                                     4, val_f, "%.10g Bytes", val_f);
2320
2321
0
    }
2322
0
}
2323
2324
static void
2325
dissect_tlv_route_pinning(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2326
0
{
2327
0
    proto_tree *val_tree;
2328
2329
0
    if(rem != 4) {
2330
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2331
0
                            "Error processing Route Pinning TLV: length is %d, should be 4",
2332
0
                            rem);
2333
0
        return;
2334
0
    }
2335
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Route Pinning");
2336
2337
0
    if(val_tree != NULL) {
2338
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_route_pinning,
2339
0
                            tvb, offset, 4, ENC_BIG_ENDIAN);
2340
0
    }
2341
0
}
2342
2343
2344
static void
2345
dissect_tlv_resource_class(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2346
0
{
2347
0
    proto_tree *val_tree;
2348
2349
0
    if(rem != 4) {
2350
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2351
0
                            "Error processing Resource Class TLV: length is %d, should be 4",
2352
0
                            rem);
2353
0
        return;
2354
0
    }
2355
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Resource Class");
2356
2357
0
    if(val_tree != NULL) {
2358
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_resource_class,
2359
0
                            tvb, offset, 4, ENC_BIG_ENDIAN);
2360
0
    }
2361
0
}
2362
2363
2364
static void
2365
dissect_tlv_preemption(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2366
0
{
2367
0
    proto_tree *val_tree;
2368
2369
0
    if(rem != 4) {
2370
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2371
0
                            "Error processing Preemption TLV: length is %d, should be 4",
2372
0
                            rem);
2373
0
        return;
2374
0
    }
2375
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Preemption");
2376
2377
0
    if(val_tree != NULL) {
2378
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_set_prio,
2379
0
                            tvb, offset, 1, ENC_BIG_ENDIAN);
2380
0
        offset += 1;
2381
0
        proto_tree_add_item(val_tree, hf_ldp_tlv_hold_prio,
2382
0
                            tvb, offset, 1, ENC_BIG_ENDIAN);
2383
0
    }
2384
0
}
2385
2386
2387
static void
2388
dissect_tlv_diffserv(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2389
8
{
2390
8
    static int *hfindexes[] = {
2391
8
        &hf_ldp_tlv_diffserv_map,
2392
8
        &hf_ldp_tlv_diffserv_map_exp,
2393
8
        &hf_ldp_tlv_diffserv_phbid,
2394
8
        &hf_ldp_tlv_diffserv_phbid_dscp,
2395
8
        &hf_ldp_tlv_diffserv_phbid_code,
2396
8
        &hf_ldp_tlv_diffserv_phbid_bit14,
2397
8
        &hf_ldp_tlv_diffserv_phbid_bit15
2398
8
    };
2399
8
    static int *etts[] = {
2400
8
        &ett_ldp_diffserv_map,
2401
8
        &ett_ldp_diffserv_map_phbid
2402
8
    };
2403
8
    int type, mapnb, count;
2404
2405
8
    if (rem < 4) {
2406
3
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2407
3
                            "Error processing Diff-Serv TLV: length is %d, should be >= 4", rem);
2408
3
        return;
2409
3
    }
2410
5
    proto_tree_add_uint(tree, hf_ldp_tlv_diffserv_type, tvb, offset, 1,
2411
5
                        type = tvb_get_uint8(tvb, offset));
2412
5
    type = (type >> 7) + 1;
2413
5
    if (type == 1) {
2414
        /* E-LSP */
2415
5
        offset += 3;
2416
5
        proto_tree_add_uint(tree, hf_ldp_tlv_diffserv_mapnb, tvb, offset,
2417
5
                            1, mapnb = tvb_get_uint8(tvb, offset) & 15);
2418
5
        offset += 1;
2419
33
        for (count = 0; count < mapnb; count++) {
2420
28
            dissect_diffserv_mpls_common(tvb, tree, type, offset, hfindexes, etts);
2421
28
            offset += 4;
2422
28
        }
2423
5
    }
2424
0
    else if (type == 2) {
2425
        /* L-LSP */
2426
0
        dissect_diffserv_mpls_common(tvb, tree, type, offset + 2, hfindexes, etts);
2427
0
    }
2428
5
}
2429
2430
2431
static int
2432
dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem);
2433
2434
static void
2435
// NOLINTNEXTLINE(misc-no-recursion)
2436
dissect_tlv_er(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2437
0
{
2438
0
    proto_tree *val_tree;
2439
0
    int len;
2440
2441
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Explicit route");
2442
2443
0
    if(val_tree != NULL) {
2444
0
        while (rem > 0) {
2445
0
            len = dissect_tlv (tvb, pinfo, offset, val_tree, rem);
2446
0
            offset += len;
2447
0
            rem -= len;
2448
0
        }
2449
0
    }
2450
0
}
2451
2452
2453
static void
2454
dissect_tlv_pw_status(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem);
2455
2456
static void
2457
dissect_tlv_pw_grouping(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int rem);
2458
2459
/* Dissect Upstream Label Assignment Capability TLV */
2460
static void
2461
dissect_tlv_upstrm_lbl_ass_cap(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2462
0
{
2463
0
    proto_tree *val_tree;
2464
2465
0
    if ( rem != 1)
2466
0
    {
2467
0
        proto_item* inv_length;
2468
0
        inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2469
0
        expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2470
0
        return;
2471
0
    }
2472
2473
    /*State bit*/
2474
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "State Bit");
2475
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_sbit, tvb,offset, 1, ENC_BIG_ENDIAN);
2476
0
}
2477
/*Dissect Upstream Assigned Label Request TLV*/
2478
static void
2479
dissect_tlv_upstrm_ass_lbl_req(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2480
0
{
2481
0
    if ( rem != 4)
2482
0
    {
2483
0
        proto_item* inv_length;
2484
0
        inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2485
0
        expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2486
0
        return;
2487
0
    }
2488
2489
    /*Reserved Bits*/
2490
0
    proto_tree_add_item(tree, hf_ldp_tlv_upstr_lbl_req_resvbit, tvb,offset, 4, ENC_BIG_ENDIAN);
2491
0
}
2492
2493
/*Dissect Upstream Assigned Label TLV*/
2494
static void
2495
dissect_tlv_upstrm_ass_lbl(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2496
6
{
2497
6
    proto_tree *val_tree;
2498
2499
6
    if ( rem != 8)
2500
6
    {
2501
6
        proto_item* inv_length;
2502
6
        inv_length = proto_tree_add_item(tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2503
6
        expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2504
6
        return;
2505
6
    }
2506
    /*Value Field starts here*/
2507
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "Upstream-Assigned Label");
2508
2509
    /*Reserved bits*/
2510
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_lbl_resvbit, tvb,offset, 4, ENC_BIG_ENDIAN);
2511
2512
    /*The Upstream Label*/
2513
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_upstr_ass_lbl, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2514
0
}
2515
/*Dissect IPv4 Interface ID TLV*/
2516
static void
2517
// NOLINTNEXTLINE(misc-no-recursion)
2518
dissect_tlv_ipv4_interface_id(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2519
0
{
2520
0
    proto_tree *val_tree, *sub_tree;
2521
2522
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "IPv4 Interface ID");
2523
2524
    /*Dissect IPv4 Next/Previous Hop Address*/
2525
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_ipv4_intID_hop_addr, tvb,offset, 4, ENC_BIG_ENDIAN);
2526
2527
    /*Dissect Logical Interface ID*/
2528
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_logical_intID, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2529
2530
0
    sub_tree = proto_tree_add_subtree(val_tree, tvb, offset + 8, rem, ett_ldp_sub_tlv, NULL, "Sub TLV");
2531
2532
0
    if(rem != 20 && rem != 24 && rem != 28 && rem != 29)
2533
0
    {
2534
        /*rem = 20 >> Length of IP Multicast Tunnel TLV
2535
          rem = 29 >> Length of LDP P2MP LSV TLV
2536
          rem = 24 >> Length of RSVP-TE P2MP LSP TLV
2537
          rem = 28 >> Length of MPLS Context Label TLV*/
2538
2539
0
        proto_item* inv_length;
2540
0
        inv_length = proto_tree_add_item(val_tree, hf_ldp_tlv_inv_length, tvb, offset, rem, ENC_BIG_ENDIAN);
2541
0
        expert_add_info(pinfo, inv_length, &ei_ldp_inv_length);
2542
0
    }
2543
0
    else
2544
0
    {
2545
0
        rem = rem - 8;
2546
0
        dissect_tlv(tvb, pinfo, offset + 8, sub_tree, rem);
2547
0
    }
2548
0
}
2549
/*Dissect IP Multicast Tunnel TLV*/
2550
static void
2551
dissect_tlv_ip_multicast_tunnel(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int rem)
2552
2
{
2553
2
    proto_tree *val_tree;
2554
2555
2
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "IP Multicast Label");
2556
2557
2
    proto_tree_add_item(val_tree, hf_ldp_tlv_ip_multicast_srcaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
2558
2
    proto_tree_add_item(val_tree, hf_ldp_tlv_ip_multicast_mltcstaddr, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2559
2
}
2560
2561
static void
2562
// NOLINTNEXTLINE(misc-no-recursion)
2563
dissect_tlv_mpls_context_lbl(tvbuff_t *tvb,packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2564
0
{
2565
0
    proto_tree *val_tree;
2566
2567
0
    proto_tree_add_item(tree, hf_ldp_tlv_ip_mpls_context_srcaddr, tvb,offset, 4, ENC_BIG_ENDIAN);
2568
0
    val_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_tlv_val, NULL, "MPLS Context Label");
2569
0
    dissect_tlv(tvb, pinfo, offset + 4, val_tree, rem);
2570
0
}
2571
2572
static void
2573
dissect_tlv_ldp_p2mp_lsp(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
2574
0
{
2575
0
    uint32_t addr_length, opcode_length;
2576
2577
0
    proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_lsptype, tvb, offset, 1, ENC_BIG_ENDIAN);
2578
0
    proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_addrfam, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
2579
0
    proto_tree_add_item_ret_uint(tree, hf_ldp_tlv_ldp_p2mp_addrlen, tvb, offset + 3, 1, ENC_BIG_ENDIAN, &addr_length);
2580
0
    proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_rtnodeaddr, tvb, offset + 4, addr_length, ENC_BIG_ENDIAN);
2581
0
    proto_tree_add_item_ret_uint(tree, hf_ldp_tlv_ldp_p2mp_oplength, tvb,offset + 4 + addr_length, 2, ENC_BIG_ENDIAN, &opcode_length);
2582
0
    proto_tree_add_item(tree, hf_ldp_tlv_ldp_p2mp_opvalue, tvb, offset + 4 + addr_length + 2, opcode_length, ENC_NA);
2583
0
}
2584
2585
static void
2586
dissect_tlv_rsvp_te_p2mp_lsp(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
2587
2
{
2588
2589
2
    proto_tree_add_item(tree, hf_ldp_tlv_rsvp_te_p2mp_id, tvb,offset, 4, ENC_BIG_ENDIAN);
2590
2
    proto_tree_add_item(tree, hf_ldp_tlv_must_be_zero, tvb,offset + 4, 2, ENC_BIG_ENDIAN);
2591
2
    proto_tree_add_item(tree, hf_ldp_tlv_tunnel_id, tvb,offset + 6, 2, ENC_BIG_ENDIAN);
2592
2
    proto_tree_add_item(tree, hf_ldp_tlv_ext_tunnel_id, tvb,offset + 8, 4, ENC_BIG_ENDIAN);
2593
2
}
2594
2595
/* Dissect a TLV and return the number of bytes consumed ... */
2596
2597
static int
2598
// NOLINTNEXTLINE(misc-no-recursion)
2599
dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
2600
604
{
2601
604
    uint16_t type, typebak;
2602
604
    int length;
2603
2604
604
    length=tvb_reported_length_remaining(tvb, offset);
2605
604
    rem=MIN(rem, length);
2606
2607
604
    if( rem < 4 ) {/*chk for minimum header*/
2608
9
        if (tree) {
2609
9
            proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
2610
9
                                "Error processing TLV: length is %d, should be >= 4",
2611
9
                                rem);
2612
9
        }
2613
9
        return rem;
2614
9
    }
2615
595
    type = tvb_get_ntohs(tvb, offset) & 0x3FFF;
2616
2617
595
    length = tvb_get_ntohs(tvb, offset + 2);
2618
595
    rem -= 4; /*do not count header*/
2619
595
    length = MIN(length, rem);  /* Don't go haywire if a problem ... */
2620
2621
595
    increment_dissection_depth(pinfo);
2622
2623
595
    if (tree) {
2624
591
        proto_tree *tlv_tree;
2625
        /*chk for vendor-private*/
2626
591
        if(type>=TLV_VENDOR_PRIVATE_START && type<=TLV_VENDOR_PRIVATE_END){
2627
7
            typebak=type;               /*keep type*/
2628
7
            type=TLV_VENDOR_PRIVATE_START;
2629
7
            tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_tlv, NULL, "Vendor Private TLV");
2630
            /*chk for experimental*/
2631
584
        } else if(type>=TLV_EXPERIMENTAL_START && type<=TLV_EXPERIMENTAL_END){
2632
15
            typebak=type;               /*keep type*/
2633
15
            type=TLV_EXPERIMENTAL_START;
2634
15
            tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_tlv, NULL, "Experimental TLV");
2635
569
        } else {
2636
569
            typebak=0;
2637
569
            tlv_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_tlv, NULL,
2638
569
                                     val_to_str(pinfo->pool, type, tlv_type_names, "Unknown TLV type (0x%04X)"));
2639
569
        }
2640
2641
591
        proto_tree_add_item(tlv_tree, hf_ldp_tlv_unknown, tvb, offset, 1, ENC_BIG_ENDIAN);
2642
2643
591
        switch (type) {
2644
7
        case TLV_VENDOR_PRIVATE_START:
2645
7
            proto_tree_add_uint_format_value(tlv_tree, hf_ldp_tlv_type, tvb, offset, 2,
2646
7
                                       typebak, "Vendor Private (0x%X)", typebak);
2647
7
            break;
2648
15
        case TLV_EXPERIMENTAL_START:
2649
15
            proto_tree_add_uint_format_value(tlv_tree, hf_ldp_tlv_type, tvb, offset, 2,
2650
15
                                       typebak, "Experimental (0x%X)", typebak);
2651
15
            break;
2652
569
        default:
2653
569
            proto_tree_add_uint_format(tlv_tree, hf_ldp_tlv_type, tvb, offset, 2,
2654
569
                                       type, "TLV Type: %s (0x%X)", val_to_str_const(type, tlv_type_names, "Unknown TLV type"), type );
2655
591
        }
2656
2657
591
        proto_tree_add_item(tlv_tree, hf_ldp_tlv_len, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2658
2659
591
        switch (type) {
2660
2661
16
        case TLV_FEC:
2662
16
            dissect_tlv_fec(tvb, pinfo, offset + 4, tlv_tree, length);
2663
16
            break;
2664
2665
10
        case TLV_ADDRESS_LIST:
2666
10
            dissect_tlv_address_list(tvb, pinfo, offset + 4, tlv_tree, length);
2667
10
            break;
2668
2669
1
        case TLV_HOP_COUNT:
2670
1
            if( length != 1 ) /*error, only one byte*/
2671
1
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4,length,
2672
1
                                    "Error processing Hop Count TLV: length is %d, should be 1",
2673
1
                                    length);
2674
0
            else
2675
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_hc_value, tvb,offset + 4, length, ENC_BIG_ENDIAN);
2676
1
            break;
2677
2678
8
        case TLV_PATH_VECTOR:
2679
8
            dissect_tlv_path_vector(tvb, pinfo, offset + 4, tlv_tree, length);
2680
8
            break;
2681
2682
7
        case TLV_GENERIC_LABEL:
2683
7
            if( length != 4 ) /*error, need only label*/
2684
7
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2685
7
                                    "Error processing Generic Label TLV: length is %d, should be 4",
2686
7
                                    length);
2687
0
            else {
2688
0
                uint32_t label=tvb_get_ntohl(tvb, offset+4) & 0x000FFFFF;
2689
2690
0
                proto_tree_add_uint(tlv_tree, hf_ldp_tlv_generic_label,
2691
0
                                           tvb, offset+4, length, label);
2692
0
            }
2693
7
            break;
2694
2695
1
        case TLV_ATM_LABEL:
2696
1
            dissect_tlv_atm_label(tvb, pinfo, offset + 4, tlv_tree, length);
2697
1
            break;
2698
2699
3
        case TLV_FRAME_RELAY_LABEL:
2700
3
            dissect_tlv_frame_label(tvb, pinfo, offset + 4, tlv_tree, length);
2701
3
            break;
2702
2703
2
        case TLV_FT_PROTECTION:
2704
2
            if( length != 4 ) /* Length must be 4 bytes */
2705
2
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2706
2
                                    "Error processing FT Protection TLV: length is %d, should be 4",
2707
2
                                    length);
2708
0
            else
2709
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_ft_protect_sequence_num, tvb,
2710
0
                                    offset + 4,length, ENC_BIG_ENDIAN);
2711
2
            break;
2712
2713
0
        case TLV_ENTROPY_LABEL_CAPA:
2714
0
            if( length != 0 ) /* Length must be 0 bytes */
2715
0
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2716
0
                                    "Error processing Entropy Label Capability TLV: length is %d, should be 0",
2717
0
                                    length);
2718
0
            break;
2719
2720
3
        case TLV_STATUS:
2721
3
            dissect_tlv_status(tvb, pinfo, offset + 4, tlv_tree, length);
2722
3
            break;
2723
2724
1
        case TLV_EXTENDED_STATUS:
2725
1
            if( length != 4 ) /*error, need only status_code(uint32_t)*/
2726
1
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2727
1
                                    "Error processing Extended Status TLV: length is %d, should be 4",
2728
1
                                    length);
2729
0
            else {
2730
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_extstatus_data, tvb, offset + 4, length, ENC_BIG_ENDIAN);
2731
0
            }
2732
1
            break;
2733
2734
1
        case TLV_RETURNED_PDU:
2735
1
            dissect_tlv_returned_pdu(tvb, pinfo, offset + 4, tlv_tree, length);
2736
1
            break;
2737
2738
11
        case TLV_RETURNED_MESSAGE:
2739
11
            dissect_tlv_returned_message(tvb, pinfo, offset + 4, tlv_tree, length);
2740
11
            break;
2741
2742
5
        case TLV_COMMON_HELLO_PARAMS:
2743
#if 0
2744
            dissect_tlv_common_hello_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2745
#else
2746
5
            dissect_tlv_common_hello_parms(tvb, pinfo, offset + 4, tlv_tree);
2747
5
#endif
2748
5
            break;
2749
2750
1
        case TLV_IPV4_TRANSPORT_ADDRESS:
2751
1
            if( length != 4 ) /*error, need only ipv4*/
2752
1
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2753
1
                                    "Error processing IPv4 Transport Address TLV: length is %d, should be 4",
2754
1
                                    length);
2755
0
            else {
2756
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_ipv4_taddr, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2757
0
            }
2758
1
            break;
2759
2760
1
        case TLV_CONFIGURATION_SEQUENCE_NUMBER:
2761
1
            if( length != 4 ) /*error, need only seq_num(uint32_t)*/
2762
1
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2763
1
                                    "Error processing Configuration Sequence Number TLV: length is %d, should be 4",
2764
1
                                    length);
2765
0
            else {
2766
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_config_seqno, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
2767
0
            }
2768
1
            break;
2769
2770
1
        case TLV_IPV6_TRANSPORT_ADDRESS:
2771
1
            if( length != 16 ) /*error, need only ipv6*/
2772
1
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2773
1
                                    "Error processing IPv6 Transport Address TLV: length is %d, should be 16",
2774
1
                                    length);
2775
0
            else {
2776
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_ipv6_taddr, tvb, offset + 4, 16, ENC_NA);
2777
0
            }
2778
1
            break;
2779
2780
19
        case TLV_MAC: /* draft-lasserre-vkompella-ppvpn-vpls-02.txt */
2781
19
            dissect_tlv_mac(tvb, pinfo, offset + 4, tlv_tree, length);
2782
19
            break;
2783
2784
3
        case TLV_COMMON_SESSION_PARAMS:
2785
3
            dissect_tlv_common_session_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2786
3
            break;
2787
2788
0
        case TLV_ATM_SESSION_PARAMS:
2789
0
            dissect_tlv_atm_session_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2790
0
            break;
2791
2792
8
        case TLV_FRAME_RELAY_SESSION_PARAMS:
2793
8
            dissect_tlv_frame_relay_session_parms(tvb, pinfo, offset + 4, tlv_tree, length);
2794
8
            break;
2795
2796
0
        case TLV_FT_SESSION:
2797
            /* Used in RFC3478 LDP Graceful Restart */
2798
0
            dissect_tlv_ft_session(tvb, pinfo, offset + 4, tlv_tree, length);
2799
0
            break;
2800
2801
1
        case TLV_FT_ACK:
2802
1
            if( length != 4 ) /* Length must be 4 bytes */
2803
1
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2804
1
                                    "Error processing FT ACK TLV: length is %d, should be 4",
2805
1
                                    length);
2806
0
            else
2807
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_ft_ack_sequence_num, tvb,
2808
0
                                    offset + 4,length, ENC_BIG_ENDIAN);
2809
1
            break;
2810
2811
2
        case TLV_FT_CORK:
2812
2
            if( length != 0 ) /* Length must be 0 bytes */
2813
2
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2814
2
                                    "Error processing FT Cork TLV: length is %d, should be 0",
2815
2
                                    length);
2816
2
            break;
2817
2818
0
        case TLV_LABEL_REQUEST_MESSAGE_ID:
2819
0
            if( length != 4 ) /*error, need only one msgid*/
2820
0
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2821
0
                                    "Error processing Label Request Message ID TLV: length is %d, should be 4",
2822
0
                                    length);
2823
0
            else
2824
0
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_lbl_req_msg_id, tvb,offset + 4,length, ENC_BIG_ENDIAN);
2825
0
            break;
2826
2827
0
        case TLV_LSPID:
2828
0
            dissect_tlv_lspid(tvb, pinfo, offset + 4, tlv_tree, length);
2829
0
            break;
2830
2831
0
        case TLV_ER_HOP:
2832
0
            dissect_tlv_er(tvb, pinfo, offset + 4, tlv_tree, length);
2833
0
            break;
2834
2835
1
        case TLV_IPV4_PREFIX_ER_HOP:
2836
1
            dissect_tlv_er_hop_ipv4(tvb, pinfo, offset + 4, tlv_tree, length);
2837
1
            break;
2838
2839
0
        case TLV_IPV6_PREFIX_ER_HOP:
2840
0
            dissect_tlv_er_hop_ipv6(tvb, pinfo, offset +4, tlv_tree, length);
2841
0
            break;
2842
2843
0
        case TLV_AUTONOMOUS_SYSTEM_NUMBER_ER_HOP:
2844
0
            dissect_tlv_er_hop_as(tvb, pinfo, offset + 4, tlv_tree, length);
2845
0
            break;
2846
2847
0
        case TLV_LSP_ID_ER_HOP:
2848
0
            dissect_tlv_er_hop_lspid(tvb, pinfo, offset +4, tlv_tree, length);
2849
0
            break;
2850
2851
1
        case TLV_TRAFFIC_PARAMS:
2852
1
            dissect_tlv_traffic(tvb, pinfo, offset +4, tlv_tree, length);
2853
1
            break;
2854
2855
0
        case TLV_PREEMPTION:
2856
0
            dissect_tlv_preemption(tvb, pinfo, offset +4, tlv_tree, length);
2857
0
            break;
2858
2859
0
        case TLV_RESOURCE_CLASS:
2860
0
            dissect_tlv_resource_class(tvb, pinfo, offset +4, tlv_tree, length);
2861
0
            break;
2862
2863
0
        case TLV_ROUTE_PINNING:
2864
0
            dissect_tlv_route_pinning(tvb, pinfo, offset +4, tlv_tree, length);
2865
0
            break;
2866
2867
8
        case TLV_DIFF_SERV:
2868
8
            dissect_tlv_diffserv(tvb, pinfo, offset +4, tlv_tree, length);
2869
8
            break;
2870
2871
0
        case TLV_HSMP_LSP_CAPA_PARAM:
2872
0
            dissect_tlv_upstrm_lbl_ass_cap(tvb, pinfo, offset + 4, tlv_tree, length);
2873
0
            break;
2874
2875
7
        case TLV_VENDOR_PRIVATE_START:
2876
7
            if( length < 4 ) /*error, at least Vendor ID*/
2877
2
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2878
2
                                    "Error processing Vendor Private Start TLV: length is %d, should be >= 4",
2879
2
                                    length);
2880
5
            else {
2881
5
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_vendor_id, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2882
5
                if( length > 4 )  /*have data*/
2883
5
                    proto_tree_add_item(tlv_tree, hf_ldp_data, tvb, offset + 8, length-4, ENC_NA);
2884
5
            }
2885
7
            break;
2886
2887
15
        case TLV_EXPERIMENTAL_START:
2888
15
            if( length < 4 ) /*error, at least Experiment ID*/
2889
2
                proto_tree_add_expert_format(tlv_tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset + 4, length,
2890
2
                                    "Error processing Experimental Start TLV: length is %d, should be >= 4",
2891
2
                                    length);
2892
13
            else {
2893
13
                proto_tree_add_item(tlv_tree, hf_ldp_tlv_experiment_id, tvb,offset + 4, 4, ENC_BIG_ENDIAN);
2894
13
                if( length > 4 )  /*have data*/
2895
13
                    proto_tree_add_item(tlv_tree, hf_ldp_data, tvb, offset + 8, length-4, ENC_NA);
2896
13
            }
2897
15
            break;
2898
2899
0
        case TLV_PW_STATUS:
2900
0
        {
2901
            /* Ref: RFC 4447  and 4446*/
2902
0
            dissect_tlv_pw_status(tvb, pinfo, offset +4, tlv_tree, length);
2903
0
            break;
2904
0
        }
2905
0
        case TLV_PW_INTERFACE_PARAMS:
2906
0
        {
2907
            /* Ref: RFC 4447 */
2908
0
            static int *interface_params_header_fields[] = {
2909
0
                &hf_ldp_tlv_intparam_length ,
2910
0
                &hf_ldp_tlv_intparam_mtu ,
2911
0
                &hf_ldp_tlv_intparam_tdmbps ,
2912
0
                &hf_ldp_tlv_intparam_id ,
2913
0
                &hf_ldp_tlv_intparam_maxcatmcells ,
2914
0
                &hf_ldp_tlv_intparam_desc ,
2915
0
                &hf_ldp_tlv_intparam_cepbytes ,
2916
0
                &hf_ldp_tlv_intparam_cepopt_ais ,
2917
0
                &hf_ldp_tlv_intparam_cepopt_une ,
2918
0
                &hf_ldp_tlv_intparam_cepopt_rtp ,
2919
0
                &hf_ldp_tlv_intparam_cepopt_ebm ,
2920
0
                &hf_ldp_tlv_intparam_cepopt_mah ,
2921
0
                &hf_ldp_tlv_intparam_cepopt_res ,
2922
0
                &hf_ldp_tlv_intparam_cepopt_ceptype ,
2923
0
                &hf_ldp_tlv_intparam_cepopt_t3 ,
2924
0
                &hf_ldp_tlv_intparam_cepopt_e3 ,
2925
0
                &hf_ldp_tlv_intparam_vlanid ,
2926
0
                &hf_ldp_tlv_intparam_dlcilen ,
2927
0
                &hf_ldp_tlv_intparam_fcslen ,
2928
0
                &hf_ldp_tlv_intparam_tdmopt_r ,
2929
0
                &hf_ldp_tlv_intparam_tdmopt_d ,
2930
0
                &hf_ldp_tlv_intparam_tdmopt_f ,
2931
0
                &hf_ldp_tlv_intparam_tdmopt_res1 ,
2932
0
                &hf_ldp_tlv_intparam_tdmopt_pt ,
2933
0
                &hf_ldp_tlv_intparam_tdmopt_res2 ,
2934
0
                &hf_ldp_tlv_intparam_tdmopt_freq ,
2935
0
                &hf_ldp_tlv_intparam_tdmopt_ssrc ,
2936
0
                &hf_ldp_tlv_intparam_vccv_cctype_cw ,
2937
0
                &hf_ldp_tlv_intparam_vccv_cctype_mplsra ,
2938
0
                &hf_ldp_tlv_intparam_vccv_cctype_ttl1 ,
2939
0
                &hf_ldp_tlv_intparam_vccv_cvtype_icmpping ,
2940
0
                &hf_ldp_tlv_intparam_vccv_cvtype_lspping ,
2941
0
                &hf_ldp_tlv_intparam_vccv_cvtype_bfd,
2942
0
                &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
2943
0
                &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
2944
0
                &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
2945
0
                &hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
2946
0
                &hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
2947
0
                &hf_ldp_tlv_fec_vc_intparam_flowlabel_res
2948
0
            };
2949
0
            int vc_len = length;
2950
0
            offset += 4;
2951
0
            while ( (vc_len > 1) && (rem > 1) ) {       /* enough to include id and length */
2952
0
                int intparam_len = tvb_get_uint8(tvb, offset+1);
2953
0
                if (intparam_len < 2){ /* At least Type and Len, protect against len = 0 */
2954
0
                    proto_tree_add_expert(tlv_tree, pinfo, &ei_ldp_malformed_interface_parameter, tvb, offset +1, 1);
2955
0
                    break;
2956
0
                }
2957
2958
0
                if ( (vc_len -intparam_len) <0 && (rem -intparam_len) <0 ) { /* error condition */
2959
0
                    proto_tree_add_expert(tlv_tree, pinfo, &ei_ldp_malformed_data, tvb, offset +2, MIN(vc_len,rem));
2960
0
                    break;
2961
0
                }
2962
0
                dissect_subtlv_interface_parameters(tvb, offset, tlv_tree, intparam_len, interface_params_header_fields);
2963
2964
0
                rem -= intparam_len;
2965
0
                vc_len -= intparam_len;
2966
0
                offset += intparam_len;
2967
0
            }
2968
0
            break;
2969
0
        }
2970
0
        case TLV_PW_GROUP_ID:
2971
0
        {
2972
            /* Ref: RFC 4447 */
2973
0
            dissect_tlv_pw_grouping(tvb, offset +4, tlv_tree, length);
2974
0
            break;
2975
0
        }
2976
0
        case TLV_LDP_UPSTREAM_LABEL_ASSIGNMENT_CAPA:
2977
0
            dissect_tlv_upstrm_lbl_ass_cap(tvb, pinfo, offset + 4, tlv_tree, length);
2978
0
            break;
2979
0
        case TLV_LDP_UPSTREAM_ASSIGNED_LABEL_REQUEST:
2980
0
            dissect_tlv_upstrm_ass_lbl_req(tvb, pinfo, offset + 4, tlv_tree, length);
2981
0
            break;
2982
6
        case TLV_LDP_UPSTREAM_ASSIGNED_LABEL:
2983
6
            dissect_tlv_upstrm_ass_lbl(tvb, pinfo, offset + 4, tlv_tree, length);
2984
6
            break;
2985
0
        case TLV_IPV4_INTERFACE_ID:
2986
0
            dissect_tlv_ipv4_interface_id(tvb, pinfo, offset + 4, tlv_tree, length);
2987
            /*dissect_tlv_ipv4_interface_id(tvb, offset + 4, tlv_tree, length);*/
2988
0
            break;
2989
2
        case TLV_IP_MULTICAST_TUNNEL:
2990
2
            dissect_tlv_ip_multicast_tunnel(tvb, offset + 4, tlv_tree, rem);
2991
2
            break;
2992
0
        case TLV_MPLS_CONTEXT_LBL:
2993
0
            dissect_tlv_mpls_context_lbl(tvb, pinfo, offset + 4, tlv_tree, rem);
2994
0
            break;
2995
0
        case TLV_LDP_P2MP_LSP:
2996
0
            dissect_tlv_ldp_p2mp_lsp(tvb, offset + 4, tlv_tree);
2997
0
            break;
2998
2
        case TLV_RSVP_TE_P2MP_LSP:
2999
2
            dissect_tlv_rsvp_te_p2mp_lsp(tvb, offset + 4, tlv_tree);
3000
2
            break;
3001
444
        default:
3002
444
            proto_tree_add_item(tlv_tree, hf_ldp_tlv_value, tvb, offset + 4, length, ENC_NA);
3003
444
            break;
3004
591
        }
3005
591
    }
3006
3007
534
    decrement_dissection_depth(pinfo);
3008
534
    return length + 4;  /* Length of the value field + header */
3009
595
}
3010
3011
3012
/* Dissect a Message and return the number of bytes consumed ... */
3013
3014
static int
3015
dissect_msg(tvbuff_t *tvb, unsigned offset, packet_info *pinfo, proto_tree *tree)
3016
225
{
3017
225
    uint16_t    type, typebak;
3018
225
    uint8_t     extra=0;
3019
225
    int length, rem, ao=0, co;
3020
225
    proto_tree *msg_tree = NULL;
3021
3022
225
    rem=tvb_reported_length_remaining(tvb, offset);
3023
3024
225
    if( rem < 8 ) {/*chk for minimum header = type + length + msg_id*/
3025
3
        col_append_str(pinfo->cinfo, COL_INFO, "Bad Message");
3026
3
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_inv_length, tvb, offset, rem,
3027
3
                                "Error processing Message: length is %d, should be >= 8",
3028
3
                                rem);
3029
3
        return rem;
3030
3
    }
3031
222
    type = tvb_get_ntohs(tvb, offset) & 0x7FFF;
3032
3033
    /*chk for vendor-private*/
3034
222
    if(type>=LDP_VENDOR_PRIVATE_START && type<=LDP_VENDOR_PRIVATE_END){
3035
6
        typebak=type;           /*keep type*/
3036
6
        type=LDP_VENDOR_PRIVATE_START;
3037
6
        extra=4;
3038
        /*chk for experimental*/
3039
216
    } else if(type>=LDP_EXPERIMENTAL_MESSAGE_START && type<=LDP_EXPERIMENTAL_MESSAGE_END){
3040
1
        typebak=type;           /*keep type*/
3041
1
        type=LDP_EXPERIMENTAL_MESSAGE_START;
3042
1
        extra=4;
3043
215
    } else {
3044
215
        typebak=0;
3045
215
        extra=0;
3046
215
    }
3047
3048
222
    if( (length = tvb_get_ntohs(tvb, offset + 2)) < (4+extra) ) {/*not enough data for type*/
3049
18
        col_append_str(pinfo->cinfo, COL_INFO, "Bad Message Length ");
3050
18
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_inv_length, tvb, offset, rem,
3051
18
                                "Error processing Message Length: length is %d, should be >= %u",
3052
18
                                length, 4+extra);
3053
18
        return rem;
3054
18
    }
3055
204
    rem -= 4;
3056
204
    length = MIN(length, rem);  /* Don't go haywire if a problem ... */
3057
3058
204
    switch (type) {
3059
6
    case LDP_VENDOR_PRIVATE_START:
3060
6
        col_append_fstr(pinfo->cinfo, COL_INFO, "Vendor-Private Message (0x%04X) ", typebak);
3061
6
        break;
3062
1
    case LDP_EXPERIMENTAL_MESSAGE_START:
3063
1
        col_append_fstr(pinfo->cinfo, COL_INFO, "Experimental Message (0x%04X) ", typebak);
3064
1
        break;
3065
197
    default:
3066
197
        col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(pinfo->pool, type, ldp_message_types, "Unknown Message (0x%04X)"));
3067
204
    }
3068
3069
204
    if (tree) {
3070
3071
204
        switch (type) {
3072
6
        case LDP_VENDOR_PRIVATE_START:
3073
6
            msg_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_message, NULL, "Vendor-Private Message");
3074
6
            break;
3075
1
        case LDP_EXPERIMENTAL_MESSAGE_START:
3076
1
            msg_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_message, NULL, "Experimental Message");
3077
1
            break;
3078
197
        default:
3079
197
            msg_tree = proto_tree_add_subtree(tree, tvb, offset, length + 4, ett_ldp_message, NULL,
3080
197
                                     val_to_str(pinfo->pool, type, ldp_message_types, "Unknown Message type (0x%04X)"));
3081
204
        }
3082
3083
204
        proto_tree_add_item(msg_tree, hf_ldp_msg_ubit, tvb, offset, 1, ENC_BIG_ENDIAN);
3084
3085
204
        switch (type) {
3086
6
        case LDP_VENDOR_PRIVATE_START:
3087
6
            proto_tree_add_uint_format_value(msg_tree, hf_ldp_msg_type, tvb, offset, 2,
3088
6
                                       typebak, "Vendor Private (0x%X)", typebak);
3089
6
            break;
3090
1
        case LDP_EXPERIMENTAL_MESSAGE_START:
3091
1
            proto_tree_add_uint_format_value(msg_tree, hf_ldp_msg_type, tvb, offset, 2,
3092
1
                                       typebak, "Experimental (0x%X)", typebak);
3093
1
            break;
3094
197
        default:
3095
197
            proto_tree_add_uint_format(msg_tree, hf_ldp_msg_type, tvb, offset, 2,
3096
197
                                       type, "Message Type: %s (0x%X)", val_to_str_const(type, ldp_message_types,"Unknown Message Type"), type);
3097
204
        }
3098
3099
204
        proto_tree_add_item(msg_tree, hf_ldp_msg_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
3100
204
        proto_tree_add_item(msg_tree, hf_ldp_msg_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
3101
204
        if(extra){
3102
7
            proto_tree_add_item(msg_tree, (type == LDP_VENDOR_PRIVATE_START) ?
3103
6
                hf_ldp_msg_vendor_id : hf_ldp_msg_experiment_id, tvb, offset+8,
3104
7
                extra, ENC_BIG_ENDIAN);
3105
7
        }
3106
204
    }
3107
3108
204
    offset += (8+extra);
3109
204
    length -= (4+extra);
3110
3111
204
    if (tree) {
3112
808
        while ( (length-ao) > 0 ) {
3113
604
            co = dissect_tlv(tvb, pinfo, offset, msg_tree, length-ao);
3114
604
            offset += co;
3115
604
            ao += co;
3116
604
        }
3117
204
    }
3118
3119
204
    return length+8+extra;
3120
204
}
3121
3122
/* Dissect a PDU */
3123
static void
3124
dissect_ldp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3125
343
{
3126
343
    int offset = 0, co;
3127
343
    int rem, length;
3128
343
    proto_tree *ti=NULL, *pdu_tree = NULL;
3129
3130
343
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDP");
3131
3132
343
    col_clear(pinfo->cinfo, COL_INFO);
3133
3134
343
    if (tree) {
3135
343
        ti=proto_tree_add_item(tree, proto_ldp, tvb, 0, -1, ENC_NA);
3136
343
        pdu_tree = proto_item_add_subtree(ti, ett_ldp);
3137
3138
343
        proto_tree_add_item(pdu_tree, hf_ldp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
3139
343
    }
3140
3141
343
    length = tvb_get_ntohs(tvb, offset+2);
3142
343
    if (tree) {
3143
342
        proto_tree_add_uint(pdu_tree, hf_ldp_pdu_len, tvb, offset+2, 2, length);
3144
342
    }
3145
3146
343
    length += 4;        /* add the version and type sizes */
3147
343
    rem = tvb_reported_length_remaining(tvb, offset);
3148
343
    if (length < rem)
3149
1
        tvb_set_reported_length(tvb, length);
3150
3151
343
    if (tree) {
3152
342
        proto_tree_add_item(pdu_tree, hf_ldp_lsr, tvb, offset+4, 4, ENC_BIG_ENDIAN);
3153
342
        proto_tree_add_item(pdu_tree, hf_ldp_ls_id, tvb, offset+8, 2, ENC_BIG_ENDIAN);
3154
342
    }
3155
343
    offset += 10;
3156
3157
568
    while ( tvb_reported_length_remaining(tvb, offset) > 0 ) {
3158
225
        co = dissect_msg(tvb, offset, pinfo, pdu_tree);
3159
225
        offset += co;
3160
225
    }
3161
343
}
3162
3163
static int
3164
dissect_ldp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3165
59
{
3166
    /*
3167
     * Make sure the first PDU has a version number of 1;
3168
     * if not, reject this, so we don't get confused by
3169
     * packets that happen to be going to or from the
3170
     * LDP port but that aren't LDP packets.
3171
     */
3172
59
    if (tvb_captured_length(tvb) < 2) {
3173
        /*
3174
         * Not enough information to tell.
3175
         */
3176
4
        return 0;
3177
4
    }
3178
55
    if (tvb_get_ntohs(tvb, 0) != 1) {
3179
        /*
3180
         * Not version 1.
3181
         */
3182
10
        return 0;
3183
10
    }
3184
3185
45
    dissect_ldp_pdu(tvb, pinfo, tree);
3186
3187
    /*
3188
     * XXX - return minimum of this and the length of the PDU?
3189
     */
3190
45
    return tvb_captured_length(tvb);
3191
55
}
3192
3193
static void
3194
dissect_tlv_pw_status(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
3195
0
{
3196
0
    proto_tree *ti, *val_tree;
3197
3198
0
    if(rem != 4){
3199
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_tlv_fec_len, tvb, offset, rem,
3200
0
                            "Error processing PW Status TLV: length is %d, should be 4",
3201
0
                            rem);
3202
0
        return;
3203
0
    }
3204
3205
0
    ti = proto_tree_add_item(tree, hf_ldp_tlv_pw_status_data, tvb, offset, rem, ENC_BIG_ENDIAN);
3206
3207
0
    val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
3208
    /* Display the bits 0-4 if they are set or not set */
3209
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_pw_not_forwarding, tvb, offset, 4, ENC_BIG_ENDIAN);
3210
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_pw_lac_ingress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
3211
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_pw_lac_egress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
3212
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_pw_psn_pw_ingress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
3213
0
    proto_tree_add_item(val_tree, hf_ldp_tlv_pw_psn_pw_egress_recv_fault, tvb, offset, 4, ENC_BIG_ENDIAN);
3214
0
}
3215
3216
static void
3217
dissect_tlv_pw_grouping(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int rem _U_)
3218
0
{
3219
0
    proto_tree_add_item(tree,hf_ldp_tlv_pw_grouping_value,tvb,offset,4,ENC_BIG_ENDIAN);
3220
0
}
3221
3222
static void
3223
dissect_subtlv_interface_parameters(tvbuff_t *tvb, unsigned offset, proto_tree *tree, int rem, int *interface_parameters_hf[])
3224
0
{
3225
#if 0
3226
    static int interface_parameters_hf[] = {
3227
         0 - hf_ldp_tlv_fec_vc_intparam_length ,
3228
         1 - hf_ldp_tlv_fec_vc_intparam_mtu ,
3229
         2 - hf_ldp_tlv_fec_vc_intparam_tdmbps ,
3230
         3 - hf_ldp_tlv_fec_vc_intparam_id ,
3231
         4 - hf_ldp_tlv_fec_vc_intparam_maxcatmcells ,
3232
         5 - hf_ldp_tlv_fec_vc_intparam_desc ,
3233
         6 - hf_ldp_tlv_fec_vc_intparam_cepbytes ,
3234
         7 - hf_ldp_tlv_fec_vc_intparam_cepopt_ais ,
3235
         8 - hf_ldp_tlv_fec_vc_intparam_cepopt_une ,
3236
         9 - hf_ldp_tlv_fec_vc_intparam_cepopt_rtp ,
3237
        10 - hf_ldp_tlv_fec_vc_intparam_cepopt_ebm ,
3238
        11 - hf_ldp_tlv_fec_vc_intparam_cepopt_mah ,
3239
        12 - hf_ldp_tlv_fec_vc_intparam_cepopt_res ,
3240
        13 - hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype ,
3241
        14 - hf_ldp_tlv_fec_vc_intparam_cepopt_t3 ,
3242
        15 - hf_ldp_tlv_fec_vc_intparam_cepopt_e3 ,
3243
        16 - hf_ldp_tlv_fec_vc_intparam_vlanid ,
3244
        17 - hf_ldp_tlv_fec_vc_intparam_dlcilen ,
3245
        18 - hf_ldp_tlv_fec_vc_intparam_fcslen ,
3246
        19 - hf_ldp_tlv_fec_vc_intparam_tdmopt_r ,
3247
        20 - hf_ldp_tlv_fec_vc_intparam_tdmopt_d ,
3248
        21 - hf_ldp_tlv_fec_vc_intparam_tdmopt_f ,
3249
        22 - hf_ldp_tlv_fec_vc_intparam_tdmopt_res1 ,
3250
        23 - hf_ldp_tlv_fec_vc_intparam_tdmopt_pt ,
3251
        24 - hf_ldp_tlv_fec_vc_intparam_tdmopt_res2 ,
3252
        25 - hf_ldp_tlv_fec_vc_intparam_tdmopt_freq ,
3253
        26 - hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc ,
3254
        27 - hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw ,
3255
        28 - hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra ,
3256
        29 - hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1 ,
3257
        30 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping ,
3258
        31 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping ,
3259
        32 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1,
3260
        33 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
3261
        34 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
3262
        35 - hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
3263
        36 - hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
3264
        37 - hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
3265
        38 - hf_ldp_tlv_fec_vc_intparam_flowlabel_res
3266
    };
3267
#endif
3268
0
    proto_tree *ti;
3269
0
    proto_tree *cepopt_tree=NULL, *vccvtype_tree=NULL;
3270
0
    proto_tree *vcintparam_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_fec_vc_interfaceparam, &ti, "Interface Parameter");
3271
3272
0
    uint8_t intparam_len = rem;
3273
0
    proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[3],tvb,offset,1,ENC_BIG_ENDIAN);
3274
0
    proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[0],tvb, offset+1, 1, ENC_BIG_ENDIAN);
3275
3276
0
    switch (tvb_get_uint8(tvb, offset)) {
3277
0
    case FEC_VC_INTERFACEPARAM_MTU:
3278
0
        proto_item_append_text(ti,": MTU %u", tvb_get_ntohs(tvb,offset+2));
3279
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[1],tvb, offset+2, 2, ENC_BIG_ENDIAN);
3280
0
        break;
3281
0
    case FEC_VC_INTERFACEPARAM_TDMBPS:
3282
        /* RFC 4842 RFC 5287 */
3283
0
        proto_item_append_text(ti,": BPS %u", tvb_get_ntohl(tvb,offset+2));
3284
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[2],tvb, offset+2, 4, ENC_BIG_ENDIAN);
3285
0
        break;
3286
0
    case FEC_VC_INTERFACEPARAM_MAXCATMCELLS:
3287
0
        proto_item_append_text(ti,": Max ATM Concat Cells %u", tvb_get_ntohs(tvb,offset+2));
3288
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[4],tvb, offset+2, 2, ENC_BIG_ENDIAN);
3289
0
        break;
3290
0
    case FEC_VC_INTERFACEPARAM_DESCRIPTION:
3291
0
        proto_item_append_text(ti,": Description");
3292
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[5],tvb, offset+2, (intparam_len -2), ENC_ASCII|ENC_NA);
3293
0
        break;
3294
0
    case FEC_VC_INTERFACEPARAM_CEPBYTES:
3295
0
        proto_item_append_text(ti,": CEP/TDM Payload Bytes %u", tvb_get_ntohs(tvb,offset+2));
3296
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[6],tvb, offset+2, 2, ENC_BIG_ENDIAN);
3297
0
        break;
3298
0
    case FEC_VC_INTERFACEPARAM_CEPOPTIONS:
3299
        /* RFC 4842 */
3300
0
        proto_item_append_text(ti,": CEP Options");
3301
0
        cepopt_tree = proto_tree_add_subtree(vcintparam_tree, tvb, offset + 2, 2, ett_ldp_fec_vc_interfaceparam_cepopt, NULL, "CEP Options");
3302
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[7], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3303
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[8], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3304
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[9], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3305
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[10], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3306
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[11], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3307
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[12], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3308
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[13], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3309
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[14], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3310
0
        proto_tree_add_item(cepopt_tree, *interface_parameters_hf[15], tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3311
0
        break;
3312
0
    case FEC_VC_INTERFACEPARAM_VLANID:
3313
0
        proto_item_append_text(ti,": VLAN Id %u", tvb_get_ntohs(tvb,offset+2));
3314
0
        proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[16], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3315
0
        break;
3316
0
    case FEC_VC_INTERFACEPARAM_FRDLCILEN:
3317
0
        proto_item_append_text(ti,": DLCI Length %u", tvb_get_ntohs(tvb,offset+2));
3318
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[17], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3319
0
        break;
3320
0
    case FEC_VC_INTERFACEPARAM_FRAGIND:
3321
        /* RFC 4623 */
3322
0
        proto_item_append_text(ti,": Fragmentation");
3323
0
        break;
3324
0
    case FEC_VC_INTERFACEPARAM_FCSRETENT:
3325
        /* RFC 4446 RFC 4720 */
3326
0
        proto_item_append_text(ti,": FCS retention, FCS Length %u Bytes", tvb_get_ntohs(tvb,offset+2));
3327
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[18], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3328
0
        break;
3329
0
    case FEC_VC_INTERFACEPARAM_TDMOPTION:
3330
        /* RFC 5287 */
3331
0
        proto_item_append_text(ti,": TDM Options");
3332
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[19], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3333
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[20], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3334
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[21], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3335
0
        proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[22], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3336
0
        if (intparam_len >= 8){
3337
0
            proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[23], tvb, offset+4, 1, ENC_BIG_ENDIAN);
3338
0
            proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[24], tvb, offset+5, 1, ENC_BIG_ENDIAN);
3339
0
            proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[25], tvb, offset+6, 2, ENC_BIG_ENDIAN);
3340
0
        }
3341
0
        if (intparam_len >= 12){
3342
0
            proto_tree_add_item(vcintparam_tree,*interface_parameters_hf[26], tvb, offset+8, 4, ENC_BIG_ENDIAN);
3343
0
        }
3344
0
        break;
3345
0
    case FEC_VC_INTERFACEPARAM_VCCV:
3346
        /* RFC 4446 RFC 5085 */
3347
0
        proto_item_append_text(ti,": VCCV");
3348
0
        vccvtype_tree = proto_tree_add_subtree(vcintparam_tree, tvb, offset + 2, 1, ett_ldp_fec_vc_interfaceparam_vccvtype, NULL, "CC Type");
3349
0
        proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[27], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3350
0
        proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[28], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3351
0
        proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[29], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3352
0
        vccvtype_tree = proto_tree_add_subtree(vcintparam_tree, tvb, offset + 3, 1, ett_ldp_fec_vc_interfaceparam_vccvtype, NULL, "CV Type");
3353
0
        proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[30], tvb, offset+3, 1, ENC_BIG_ENDIAN);
3354
0
        proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[31], tvb, offset+3, 1, ENC_BIG_ENDIAN);
3355
0
        proto_tree_add_item(vccvtype_tree, *interface_parameters_hf[32], tvb, offset+3, 1, ENC_BIG_ENDIAN);
3356
0
        break;
3357
0
    case FEC_VC_INTERFACEPARAM_FLOWLABEL:
3358
0
        proto_item_append_text(ti,": Flow Label for Pseudowire");
3359
0
        proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[36], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3360
0
        proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[37], tvb, offset+2, 1, ENC_BIG_ENDIAN);
3361
0
        proto_tree_add_item(vcintparam_tree, *interface_parameters_hf[38], tvb, offset+2, 2, ENC_BIG_ENDIAN);
3362
0
        break;
3363
0
    default: /* unknown */
3364
0
        proto_item_append_text(ti," unknown");
3365
0
        proto_tree_add_item(vcintparam_tree, hf_ldp_unknown_data, tvb, offset+2, (intparam_len -2), ENC_NA);
3366
3367
0
        break;
3368
0
    }
3369
0
}
3370
3371
static void
3372
dissect_genpwid_fec_aai_type2_parameter(tvbuff_t *tvb, packet_info *pinfo, unsigned offset, proto_tree *tree, int rem)
3373
0
{
3374
0
    proto_tree *aai_param_tree = proto_tree_add_subtree(tree, tvb, offset, rem, ett_ldp_gen_aai_type2, NULL, "AAI");
3375
    /* check if the remaining length is 12 bytes or not... */
3376
0
    if ( rem != 12)
3377
0
    {
3378
0
        proto_tree_add_expert_format(tree, pinfo, &ei_ldp_inv_length, tvb, offset, rem,
3379
0
                            "Error processing AAI Parameter: length is %d, should be 12 bytes for Type 2.",
3380
0
                            rem);
3381
0
        return;
3382
3383
0
    }
3384
3385
0
    proto_tree_add_item(aai_param_tree,hf_ldp_tlv_fec_gen_aai_globalid,tvb,offset,4,ENC_BIG_ENDIAN);
3386
0
    proto_tree_add_item(aai_param_tree,hf_ldp_tlv_fec_gen_aai_prefix,tvb, offset+4, 4, ENC_BIG_ENDIAN);
3387
0
    proto_tree_add_item(aai_param_tree,hf_ldp_tlv_fec_gen_aai_ac_id,tvb, offset+4, 4, ENC_BIG_ENDIAN);
3388
0
}
3389
3390
static int
3391
dissect_ldp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
3392
91
{
3393
91
    volatile bool       first = true;
3394
91
    volatile int        offset = 0;
3395
91
    int                 length_remaining;
3396
91
    uint16_t            plen;
3397
91
    tvbuff_t *volatile  next_tvb;
3398
391
    while (tvb_reported_length_remaining(tvb, offset) != 0) {
3399
308
        length_remaining = tvb_captured_length_remaining(tvb, offset);
3400
3401
        /*
3402
         * Make sure the first PDU has a version number of 1;
3403
         * if not, reject this, so we don't get confused by
3404
         * packets that happen to be going to or from the
3405
         * LDP port but that aren't LDP packets.
3406
         *
3407
         * XXX - this means we can't handle an LDP PDU of which
3408
         * only one byte appears in a TCP segment.  If that's
3409
         * a problem, we'll either have to completely punt on
3410
         * rejecting non-LDP packets, or will have to assume
3411
         * that if we have only one byte, it's an LDP packet.
3412
         */
3413
308
        if (first) {
3414
91
            if (length_remaining < 2) {
3415
                /*
3416
                 * Not enough information to tell.
3417
                 */
3418
0
                return 0;
3419
0
            }
3420
91
            if (tvb_get_ntohs(tvb, offset) != 1) {
3421
                /*
3422
                 * Not version 1.
3423
                 */
3424
8
                return 0;
3425
8
            }
3426
83
            first = false;
3427
83
        }
3428
3429
        /*
3430
         * Can we do reassembly?
3431
         */
3432
300
        if (ldp_desegment && pinfo->can_desegment) {
3433
            /*
3434
             * Yes - is the LDP header split across segment
3435
             * boundaries?
3436
             */
3437
0
            if (length_remaining < 4) {
3438
                /*
3439
                 * Yes.  Tell the TCP dissector where the data for this message
3440
                 * starts in the data it handed us and that we need "some more
3441
                 * data."  Don't tell it exactly how many bytes we need because
3442
                 * if/when we ask for even more (after the header) that will
3443
                 * break reassembly.
3444
                 */
3445
0
                pinfo->desegment_offset = offset;
3446
0
                pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
3447
0
                return -((int32_t) pinfo->desegment_len);
3448
0
            }
3449
0
        }
3450
3451
        /*
3452
         * Get the length of the rest of the LDP packet.
3453
         * XXX - check for a version of 1 first?
3454
         */
3455
300
        plen = tvb_get_ntohs(tvb, offset + 2);
3456
3457
        /*
3458
         * Can we do reassembly?
3459
         */
3460
300
        if (ldp_desegment && pinfo->can_desegment) {
3461
            /*
3462
             * Yes - is the LDP packet split across segment
3463
             * boundaries?
3464
             */
3465
0
            if (length_remaining < plen + 4) {
3466
                /*
3467
                 * Yes.  Tell the TCP dissector where the
3468
                 * data for this message starts in the data
3469
                 * it handed us, and how many more bytes we
3470
                 * need, and return.
3471
                 */
3472
0
                pinfo->desegment_offset = offset;
3473
0
                pinfo->desegment_len = (plen + 4) - length_remaining;
3474
0
                return -((int32_t) pinfo->desegment_len);
3475
0
            }
3476
0
        }
3477
3478
        /*
3479
         * Construct a tvbuff containing the amount of the payload
3480
         * we have available.  Make its reported length the
3481
         * amount of data in the DNS-over-TCP packet.
3482
         */
3483
300
        next_tvb = tvb_new_subset_length(tvb, offset, plen + 4);
3484
3485
        /*
3486
         * Dissect the LDP packet.
3487
         *
3488
         * If it gets an error that means there's no point in
3489
         * dissecting any more PDUs, rethrow the exception in
3490
         * question.
3491
         *
3492
         * If it gets any other error, report it and continue, as that
3493
         * means that PDU got an error, but that doesn't mean we should
3494
         * stop dissecting PDUs within this frame or chunk of reassembled
3495
         * data.
3496
         */
3497
300
        TRY {
3498
298
            dissect_ldp_pdu(next_tvb, pinfo, tree);
3499
298
        }
3500
300
        CATCH_NONFATAL_ERRORS {
3501
214
            show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
3502
214
        }
3503
300
        ENDTRY;
3504
3505
        /*
3506
         * Skip the LDP header and the payload.
3507
         */
3508
300
        offset += plen + 4;
3509
300
    }
3510
83
    return tvb_captured_length(tvb);
3511
91
}
3512
3513
/* Register all the bits needed with the filtering engine */
3514
3515
void
3516
proto_register_ldp(void)
3517
16
{
3518
16
    static hf_register_info hf[] = {
3519
#if 0
3520
        { &hf_ldp_req,
3521
          /* Change the following to the type you need */
3522
          { "Request", "ldp.req", FT_BOOLEAN, BASE_NONE,
3523
            NULL, 0x0, NULL, HFILL }},
3524
#endif
3525
3526
#if 0
3527
        { &hf_ldp_rsp,
3528
          { "Response", "ldp.rsp", FT_BOOLEAN, BASE_NONE,
3529
            NULL, 0x0, NULL, HFILL }},
3530
#endif
3531
3532
16
        { &hf_ldp_version,
3533
16
          { "Version", "ldp.hdr.version", FT_UINT16, BASE_DEC,
3534
16
            NULL, 0x0, "LDP Version Number", HFILL }},
3535
3536
16
        { &hf_ldp_pdu_len,
3537
16
          { "PDU Length", "ldp.hdr.pdu_len", FT_UINT16, BASE_DEC,
3538
16
            NULL, 0x0, "LDP PDU Length", HFILL }},
3539
3540
16
        { &hf_ldp_lsr,
3541
16
          { "LSR ID", "ldp.hdr.ldpid.lsr", FT_IPv4, BASE_NONE,
3542
16
            NULL, 0x0, "LDP Label Space Router ID", HFILL }},
3543
3544
16
        { &hf_ldp_ls_id,
3545
16
          { "Label Space ID", "ldp.hdr.ldpid.lsid", FT_UINT16, BASE_DEC,
3546
16
            NULL, 0, "LDP Label Space ID", HFILL }},
3547
3548
16
        { &hf_ldp_msg_ubit,
3549
16
          { "U bit", "ldp.msg.ubit", FT_BOOLEAN, 8,
3550
16
            TFS(&ldp_message_ubit), 0x80, "Unknown Message Bit", HFILL }},
3551
3552
16
        { &hf_ldp_msg_type,
3553
16
          { "Message Type", "ldp.msg.type", FT_UINT16, BASE_HEX,
3554
16
            VALS(ldp_message_types), 0x7FFF, "LDP message type", HFILL }},
3555
3556
16
        { &hf_ldp_msg_len,
3557
16
          { "Message Length", "ldp.msg.len", FT_UINT16, BASE_DEC,
3558
16
            NULL, 0x0, "LDP Message Length (excluding message type and len)", HFILL }},
3559
3560
16
        { &hf_ldp_msg_id,
3561
16
          { "Message ID", "ldp.msg.id", FT_UINT32, BASE_HEX,
3562
16
            NULL, 0x0, "LDP Message ID", HFILL }},
3563
3564
16
        { &hf_ldp_msg_vendor_id,
3565
16
          { "Vendor ID", "ldp.msg.vendor.id", FT_UINT32, BASE_HEX,
3566
16
            NULL, 0x0, "LDP Vendor-private Message ID", HFILL }},
3567
3568
16
        { &hf_ldp_msg_experiment_id,
3569
16
          { "Experiment ID", "ldp.msg.experiment.id", FT_UINT32, BASE_HEX,
3570
16
            NULL, 0x0, "LDP Experimental Message ID", HFILL }},
3571
3572
16
        { &hf_ldp_tlv_unknown,
3573
16
          { "TLV Unknown bits", "ldp.msg.tlv.unknown", FT_UINT8, BASE_HEX,
3574
16
            VALS(tlv_unknown_vals), 0xC0, "TLV Unknown bits Field", HFILL }},
3575
3576
16
        { &hf_ldp_tlv_type,
3577
16
          { "TLV Type", "ldp.msg.tlv.type", FT_UINT16, BASE_HEX,
3578
16
            VALS(tlv_type_names), 0x3FFF, "TLV Type Field", HFILL }},
3579
3580
16
        { &hf_ldp_tlv_len,
3581
16
          { "TLV Length", "ldp.msg.tlv.len", FT_UINT16, BASE_DEC,
3582
16
            NULL, 0x0, "TLV Length Field", HFILL }},
3583
3584
16
        { &hf_ldp_tlv_value,
3585
16
          { "TLV Value", "ldp.msg.tlv.value", FT_BYTES, BASE_NONE,
3586
16
            NULL, 0x0, "TLV Value Bytes", HFILL }},
3587
3588
16
        { &hf_ldp_tlv_val_hold,
3589
16
          { "Hold Time", "ldp.msg.tlv.hello.hold", FT_UINT16, BASE_DEC,
3590
16
            NULL, 0x0, "Hello Common Parameters Hold Time", HFILL }},
3591
3592
16
        { &hf_ldp_tlv_val_target,
3593
16
          { "Targeted Hello", "ldp.msg.tlv.hello.targeted", FT_BOOLEAN, 16,
3594
16
            TFS(&hello_targeted_vals), 0x8000, "Hello Common Parameters Targeted Bit", HFILL }},
3595
3596
16
        { &hf_ldp_tlv_val_request,
3597
16
          { "Hello Requested", "ldp.msg.tlv.hello.requested", FT_BOOLEAN, 16,
3598
16
            TFS(&hello_requested_vals), 0x4000, "Hello Common Parameters Hello Requested Bit", HFILL }},
3599
3600
16
        { &hf_ldp_tlv_val_gtsm_flag,
3601
16
          { "GTSM Flag", "ldp.msg.tlv.hello.gtsm", FT_BOOLEAN, 16,
3602
16
            TFS(&tfs_set_notset), 0x2000, "Hello Common Parameters GTSM bit", HFILL }},
3603
3604
16
        { &hf_ldp_tlv_val_res,
3605
16
          { "Reserved", "ldp.msg.tlv.hello.res", FT_UINT16, BASE_HEX,
3606
16
            NULL, 0x1FFF, "Hello Common Parameters Reserved Field", HFILL }},
3607
3608
16
        { &hf_ldp_tlv_ipv4_taddr,
3609
16
          { "IPv4 Transport Address", "ldp.msg.tlv.ipv4.taddr", FT_IPv4, BASE_NONE,
3610
16
            NULL, 0x0, NULL, HFILL }},
3611
3612
16
        { &hf_ldp_tlv_config_seqno,
3613
16
          { "Configuration Sequence Number", "ldp.msg.tlv.hello.cnf_seqno", FT_UINT32, BASE_DEC,
3614
16
            NULL, 0x0, "Hello Configuration Sequence Number", HFILL }},
3615
3616
16
        { &hf_ldp_tlv_ipv6_taddr,
3617
16
          { "IPv6 Transport Address", "ldp.msg.tlv.ipv6.taddr", FT_IPv6, BASE_NONE,
3618
16
            NULL, 0x0, NULL, HFILL }},
3619
3620
16
        { &hf_ldp_tlv_fec_wc,
3621
16
          { "FEC Element Type", "ldp.msg.tlv.fec.type", FT_UINT8, BASE_DEC,
3622
16
            VALS(fec_types_vals), 0x0, "Forwarding Equivalence Class Element Types", HFILL }},
3623
3624
16
        { &hf_ldp_tlv_fec_af,
3625
16
          { "FEC Element Address Type", "ldp.msg.tlv.fec.af", FT_UINT16, BASE_DEC,
3626
16
            VALS(afn_vals), 0x0, "Forwarding Equivalence Class Element Address Family", HFILL }},
3627
3628
16
        { &hf_ldp_tlv_fec_len,
3629
16
          { "FEC Element Length", "ldp.msg.tlv.fec.len", FT_UINT8, BASE_DEC,
3630
16
            NULL, 0x0, "Forwarding Equivalence Class Element Length", HFILL }},
3631
3632
16
        { &hf_ldp_tlv_fec_pfval,
3633
16
          { "FEC Element Prefix Value", "ldp.msg.tlv.fec.pfval", FT_STRING, BASE_NONE,
3634
16
            NULL, 0x0, "Forwarding Equivalence Class Element Prefix", HFILL }},
3635
3636
16
        { &hf_ldp_tlv_fec_hoval,
3637
16
          { "FEC Element Host Address Value", "ldp.msg.tlv.fec.hoval", FT_STRING, BASE_NONE,
3638
16
            NULL, 0x0, "Forwarding Equivalence Class Element Address", HFILL }},
3639
3640
16
        { &hf_ldp_tlv_addrl_addr_family,
3641
16
          { "Address Family", "ldp.msg.tlv.addrl.addr_family", FT_UINT16, BASE_DEC,
3642
16
            VALS(afn_vals), 0x0, "Address Family List", HFILL }},
3643
3644
16
        { &hf_ldp_tlv_addrl_addr,
3645
16
          { "Address", "ldp.msg.tlv.addrl.addr", FT_STRING, BASE_NONE,
3646
16
            NULL, 0x0, NULL, HFILL }},
3647
3648
16
        { &hf_ldp_tlv_hc_value,
3649
16
          { "Hop Count Value", "ldp.msg.tlv.hc.value", FT_UINT8, BASE_DEC,
3650
16
            NULL, 0x0, NULL, HFILL }},
3651
3652
16
        { &hf_ldp_tlv_pv_lsrid,
3653
16
          { "LSR Id", "ldp.msg.tlv.pv.lsrid", FT_IPv4, BASE_NONE,
3654
16
            NULL, 0x0, "Path Vector LSR Id", HFILL }},
3655
3656
16
        { &hf_ldp_tlv_sess_ver,
3657
16
          { "Session Protocol Version", "ldp.msg.tlv.sess.ver", FT_UINT16, BASE_DEC,
3658
16
            NULL, 0x0, "Common Session Parameters Protocol Version", HFILL }},
3659
3660
16
        { &hf_ldp_tlv_sess_ka,
3661
16
          { "Session KeepAlive Time", "ldp.msg.tlv.sess.ka", FT_UINT16, BASE_DEC,
3662
16
            NULL, 0x0, "Common Session Parameters KeepAlive Time", HFILL }},
3663
3664
16
        { &hf_ldp_tlv_sess_advbit,
3665
16
          { "Session Label Advertisement Discipline", "ldp.msg.tlv.sess.advbit", FT_BOOLEAN, 8,
3666
16
            TFS(&tlv_sess_advbit_vals), 0x80, "Common Session Parameters Label Advertisement Discipline", HFILL }},
3667
3668
16
        { &hf_ldp_tlv_sess_ldetbit,
3669
16
          { "Session Loop Detection", "ldp.msg.tlv.sess.ldetbit", FT_BOOLEAN, 8,
3670
16
            TFS(&tlv_sess_ldetbit_vals), 0x40, "Common Session Parameters Loop Detection", HFILL }},
3671
3672
16
        { &hf_ldp_tlv_sess_pvlim,
3673
16
          { "Session Path Vector Limit", "ldp.msg.tlv.sess.pvlim", FT_UINT8, BASE_DEC,
3674
16
            NULL, 0x0, "Common Session Parameters Path Vector Limit", HFILL }},
3675
3676
16
        { &hf_ldp_tlv_sess_mxpdu,
3677
16
          { "Session Max PDU Length", "ldp.msg.tlv.sess.mxpdu", FT_UINT16, BASE_DEC,
3678
16
            NULL, 0x0, "Common Session Parameters Max PDU Length", HFILL }},
3679
3680
16
        { &hf_ldp_tlv_sess_rxlsr,
3681
16
          { "Session Receiver LSR Identifier", "ldp.msg.tlv.sess.rxlsr", FT_IPv4, BASE_NONE,
3682
16
            NULL, 0x0, "Common Session Parameters LSR Identifier", HFILL }},
3683
3684
16
        { &hf_ldp_tlv_sess_rxls,
3685
16
          { "Session Receiver Label Space Identifier", "ldp.msg.tlv.sess.rxls", FT_UINT16, BASE_DEC,
3686
16
            NULL, 0x0, "Common Session Parameters Receiver Label Space Identifier", HFILL }},
3687
3688
16
        { &hf_ldp_tlv_sess_atm_merge,
3689
16
          { "Session ATM Merge Parameter", "ldp.msg.tlv.sess.atm.merge", FT_UINT8, BASE_DEC,
3690
16
            VALS(tlv_atm_merge_vals), 0xC0, "Merge ATM Session Parameters", HFILL }},
3691
3692
16
        { &hf_ldp_tlv_sess_atm_lr,
3693
16
          { "Number of ATM Label Ranges", "ldp.msg.tlv.sess.atm.lr", FT_UINT8, BASE_DEC,
3694
16
            NULL, 0x3C, NULL, HFILL }},
3695
3696
16
        { &hf_ldp_tlv_sess_atm_dir,
3697
16
          { "Directionality", "ldp.msg.tlv.sess.atm.dir", FT_BOOLEAN, 8,
3698
16
            TFS(&tlv_atm_dirbit), 0x02, "Label Directionality", HFILL }},
3699
3700
16
        { &hf_ldp_tlv_sess_atm_minvpi,
3701
16
          { "Minimum VPI", "ldp.msg.tlv.sess.atm.minvpi", FT_UINT16, BASE_DEC,
3702
16
            NULL, 0x0FFF, NULL, HFILL }},
3703
3704
16
        { &hf_ldp_tlv_sess_atm_minvci,
3705
16
          { "Minimum VCI", "ldp.msg.tlv.sess.atm.minvci", FT_UINT16, BASE_DEC,
3706
16
            NULL, 0x0, NULL, HFILL }},
3707
3708
16
        { &hf_ldp_tlv_sess_atm_maxvpi,
3709
16
          { "Maximum VPI", "ldp.msg.tlv.sess.atm.maxvpi", FT_UINT16, BASE_DEC,
3710
16
            NULL, 0x0FFF, NULL, HFILL }},
3711
3712
16
        { &hf_ldp_tlv_sess_atm_maxvci,
3713
16
          { "Maximum VCI", "ldp.msg.tlv.sess.atm.maxvci", FT_UINT16, BASE_DEC,
3714
16
            NULL, 0x0, NULL, HFILL }},
3715
3716
16
        { &hf_ldp_tlv_sess_fr_merge,
3717
16
          { "Session Frame Relay Merge Parameter", "ldp.msg.tlv.sess.fr.merge", FT_UINT8, BASE_DEC,
3718
16
            VALS(tlv_fr_merge_vals), 0xC0, "Merge Frame Relay Session Parameters", HFILL }},
3719
3720
16
        { &hf_ldp_tlv_sess_fr_lr,
3721
16
          { "Number of Frame Relay Label Ranges", "ldp.msg.tlv.sess.fr.lr", FT_UINT8, BASE_DEC,
3722
16
            NULL, 0x3C, NULL, HFILL }},
3723
3724
16
        { &hf_ldp_tlv_sess_fr_dir,
3725
16
          { "Directionality", "ldp.msg.tlv.sess.fr.dir", FT_BOOLEAN, 8,
3726
16
            TFS(&tlv_atm_dirbit), 0x02, "Label Directionality", HFILL }},
3727
3728
16
        { &hf_ldp_tlv_sess_fr_len,
3729
16
          { "Number of DLCI bits", "ldp.msg.tlv.sess.fr.len", FT_UINT16, BASE_DEC,
3730
16
            VALS(tlv_fr_len_vals), 0x0180, NULL, HFILL }},
3731
3732
16
        { &hf_ldp_tlv_sess_fr_mindlci,
3733
16
          { "Minimum DLCI", "ldp.msg.tlv.sess.fr.mindlci", FT_UINT24, BASE_DEC,
3734
16
            NULL, 0x7FFFFF, NULL, HFILL }},
3735
3736
16
        { &hf_ldp_tlv_sess_fr_maxdlci,
3737
16
          { "Maximum DLCI", "ldp.msg.tlv.sess.fr.maxdlci", FT_UINT24, BASE_DEC,
3738
16
            NULL, 0x7FFFFF, NULL, HFILL }},
3739
3740
16
        { &hf_ldp_tlv_ft_sess_flags,
3741
16
          { "Flags", "ldp.msg.tlv.ft_sess.flags", FT_UINT16, BASE_HEX,
3742
16
            NULL, 0x0, "FT Session Flags", HFILL }},
3743
3744
16
        { &hf_ldp_tlv_ft_sess_flag_r,
3745
16
          { "R bit", "ldp.msg.tlv.ft_sess.flag_r", FT_BOOLEAN, 16,
3746
16
            TFS(&tlv_ft_r), 0x8000, "FT Reconnect Flag", HFILL }},
3747
3748
16
        { &hf_ldp_tlv_ft_sess_flag_res,
3749
16
          { "Reserved", "ldp.msg.tlv.ft_sess.flag_res", FT_UINT16, BASE_HEX,
3750
16
            NULL, 0x7FF0, "Reserved bits", HFILL }},
3751
3752
16
        { &hf_ldp_tlv_ft_sess_flag_s,
3753
16
          { "S bit", "ldp.msg.tlv.ft_sess.flag_s", FT_BOOLEAN, 16,
3754
16
            TFS(&tlv_ft_s), 0x8, "Save State Flag", HFILL }},
3755
3756
16
        { &hf_ldp_tlv_ft_sess_flag_a,
3757
16
          { "A bit", "ldp.msg.tlv.ft_sess.flag_a", FT_BOOLEAN, 16,
3758
16
            TFS(&tlv_ft_a), 0x4, "All-Label protection Required", HFILL }},
3759
3760
16
        { &hf_ldp_tlv_ft_sess_flag_c,
3761
16
          { "C bit", "ldp.msg.tlv.ft_sess.flag_c", FT_BOOLEAN, 16,
3762
16
            TFS(&tlv_ft_c), 0x2, "Check-Pointing Flag", HFILL }},
3763
3764
16
        { &hf_ldp_tlv_ft_sess_flag_l,
3765
16
          { "L bit", "ldp.msg.tlv.ft_sess.flag_l", FT_BOOLEAN, 16,
3766
16
            TFS(&tlv_ft_l), 0x1, "Learn From network Flag", HFILL }},
3767
3768
16
        { &hf_ldp_tlv_ft_sess_res,
3769
16
          { "Reserved", "ldp.msg.tlv.ft_sess.res", FT_UINT16, BASE_HEX,
3770
16
            NULL, 0x0, NULL, HFILL }},
3771
3772
16
        { &hf_ldp_tlv_ft_sess_reconn_to,
3773
16
          { "Reconnect Timeout", "ldp.msg.tlv.ft_sess.reconn_to", FT_UINT32, BASE_DEC,
3774
16
            NULL, 0x0, "FT Reconnect Timeout", HFILL }},
3775
3776
16
        { &hf_ldp_tlv_ft_sess_recovery_time,
3777
16
          { "Recovery Time", "ldp.msg.tlv.ft_sess.recovery_time", FT_UINT32, BASE_DEC,
3778
16
            NULL, 0x0, NULL, HFILL }},
3779
3780
16
        { &hf_ldp_tlv_ft_ack_sequence_num,
3781
16
          { "FT ACK Sequence Number", "ldp.msg.tlv.ft_ack.sequence_num", FT_UINT32, BASE_HEX,
3782
16
            NULL, 0x0, NULL, HFILL }},
3783
3784
16
        { &hf_ldp_tlv_lbl_req_msg_id,
3785
16
          { "Label Request Message ID", "ldp.msg.tlv.lbl_req_msg_id", FT_UINT32, BASE_HEX,
3786
16
            NULL, 0x0, "Label Request Message to be aborted", HFILL }},
3787
3788
16
        { &hf_ldp_tlv_vendor_id,
3789
16
          { "Vendor ID", "ldp.msg.tlv.vendor_id", FT_UINT32, BASE_HEX,
3790
16
            NULL, 0, "IEEE 802 Assigned Vendor ID", HFILL }},
3791
3792
16
        { &hf_ldp_tlv_experiment_id,
3793
16
          { "Experiment ID", "ldp.msg.tlv.experiment_id", FT_UINT32, BASE_HEX,
3794
16
            NULL, 0, NULL, HFILL }},
3795
3796
16
        { &hf_ldp_tlv_generic_label,
3797
16
          { "Generic Label", "ldp.msg.tlv.generic.label", FT_UINT32, BASE_DEC_HEX,
3798
16
            NULL, 0x000FFFFF, NULL, HFILL }},
3799
3800
16
        { &hf_ldp_tlv_atm_label_vbits,
3801
16
          { "V-bits", "ldp.msg.tlv.atm.label.vbits", FT_UINT8, BASE_HEX,
3802
16
            VALS(tlv_atm_vbits_vals), 0x30, "ATM Label V Bits", HFILL }},
3803
3804
16
        { &hf_ldp_tlv_atm_label_vpi,
3805
16
          { "VPI", "ldp.msg.tlv.atm.label.vpi", FT_UINT16, BASE_DEC,
3806
16
            NULL, 0x0FFF, "ATM Label VPI", HFILL }},
3807
3808
16
        { &hf_ldp_tlv_atm_label_vci,
3809
16
          { "VCI", "ldp.msg.tlv.atm.label.vci", FT_UINT16, BASE_DEC,
3810
16
            NULL, 0, "ATM Label VCI", HFILL }},
3811
3812
16
        { &hf_ldp_tlv_fr_label_len,
3813
16
          { "Number of DLCI bits", "ldp.msg.tlv.fr.label.len", FT_UINT16, BASE_DEC,
3814
16
            VALS(tlv_fr_len_vals), 0x0180, NULL, HFILL }},
3815
3816
16
        { &hf_ldp_tlv_fr_label_dlci,
3817
16
          { "DLCI", "ldp.msg.tlv.fr.label.dlci", FT_UINT24, BASE_DEC,
3818
16
            NULL, 0x7FFFFF, "FRAME RELAY Label DLCI", HFILL }},
3819
3820
16
        { &hf_ldp_tlv_ft_protect_sequence_num,
3821
16
          { "FT Sequence Number", "ldp.msg.tlv.ft_protect.sequence_num", FT_UINT32, BASE_HEX,
3822
16
            NULL, 0x0, NULL, HFILL }},
3823
3824
16
        { &hf_ldp_tlv_status_ebit,
3825
16
          { "E Bit", "ldp.msg.tlv.status.ebit", FT_BOOLEAN, 8,
3826
16
            TFS(&tlv_status_ebit), 0x80, "Fatal Error Bit", HFILL }},
3827
3828
16
        { &hf_ldp_tlv_status_fbit,
3829
16
          { "F Bit", "ldp.msg.tlv.status.fbit", FT_BOOLEAN, 8,
3830
16
            TFS(&tlv_status_fbit), 0x40, "Forward Bit", HFILL }},
3831
3832
16
        { &hf_ldp_tlv_status_data,
3833
16
          { "Status Data", "ldp.msg.tlv.status.data", FT_UINT32, BASE_HEX,
3834
16
            VALS(tlv_status_data), 0x3FFFFFFF, NULL, HFILL }},
3835
3836
16
        { &hf_ldp_tlv_status_msg_id,
3837
16
          { "Message ID", "ldp.msg.tlv.status.msg.id", FT_UINT32, BASE_HEX,
3838
16
            NULL, 0x0, "Identifies peer message to which Status TLV refers", HFILL }},
3839
3840
16
        { &hf_ldp_tlv_status_msg_type,
3841
16
          { "Message Type", "ldp.msg.tlv.status.msg.type", FT_UINT16, BASE_HEX,
3842
16
            VALS(ldp_message_types), 0x0, "Type of peer message to which Status TLV refers", HFILL }},
3843
3844
16
        { &hf_ldp_tlv_extstatus_data,
3845
16
          { "Extended Status Data", "ldp.msg.tlv.extstatus.data", FT_UINT32, BASE_HEX,
3846
16
            NULL, 0x0, NULL, HFILL }},
3847
3848
16
        { &hf_ldp_tlv_returned_version,
3849
16
          { "Returned PDU Version", "ldp.msg.tlv.returned.version", FT_UINT16, BASE_DEC,
3850
16
            NULL, 0x0, "LDP Version Number", HFILL }},
3851
3852
16
        { &hf_ldp_tlv_returned_pdu_len,
3853
16
          { "Returned PDU Length", "ldp.msg.tlv.returned.pdu_len", FT_UINT16, BASE_DEC,
3854
16
            NULL, 0x0, "LDP PDU Length", HFILL }},
3855
3856
16
        { &hf_ldp_tlv_returned_lsr,
3857
16
          { "Returned PDU LSR ID", "ldp.msg.tlv.returned.ldpid.lsr", FT_IPv4, BASE_NONE,
3858
16
            NULL, 0x0, "LDP Label Space Router ID", HFILL }},
3859
3860
16
        { &hf_ldp_tlv_returned_ls_id,
3861
16
          { "Returned PDU Label Space ID", "ldp.msg.tlv.returned.ldpid.lsid", FT_UINT16, BASE_HEX,
3862
16
            NULL, 0x0, "LDP Label Space ID", HFILL }},
3863
3864
16
        { &hf_ldp_tlv_returned_msg_ubit,
3865
16
          { "Returned Message Unknown bit", "ldp.msg.tlv.returned.msg.ubit", FT_BOOLEAN, 8,
3866
16
            TFS(&ldp_message_ubit), 0x80, NULL, HFILL }},
3867
3868
16
        { &hf_ldp_tlv_returned_msg_type,
3869
16
          { "Returned Message Type", "ldp.msg.tlv.returned.msg.type", FT_UINT16, BASE_HEX,
3870
16
            VALS(ldp_message_types), 0x7FFF, "LDP message type", HFILL }},
3871
3872
16
        { &hf_ldp_tlv_returned_msg_len,
3873
16
          { "Returned Message Length", "ldp.msg.tlv.returned.msg.len", FT_UINT16, BASE_DEC,
3874
16
            NULL, 0x0, "LDP Message Length (excluding message type and len)", HFILL }},
3875
3876
16
        { &hf_ldp_tlv_returned_msg_id,
3877
16
          { "Returned Message ID", "ldp.msg.tlv.returned.msg.id", FT_UINT32, BASE_HEX,
3878
16
            NULL, 0x0, "LDP Message ID", HFILL }},
3879
3880
16
        { &hf_ldp_tlv_mac,
3881
16
          { "MAC address", "ldp.msg.tlv.mac", FT_ETHER, BASE_NONE,
3882
16
            NULL, 0x0, NULL, HFILL}},
3883
3884
16
        { &hf_ldp_tlv_fec_vc_controlword,
3885
16
          { "C-bit", "ldp.msg.tlv.fec.vc.controlword", FT_BOOLEAN, 8,
3886
16
            TFS(&fec_vc_cbit), 0x80, "Control Word Present", HFILL }},
3887
3888
16
        { &hf_ldp_tlv_fec_vc_vctype,
3889
16
          { "VC Type", "ldp.msg.tlv.fec.vc.vctype", FT_UINT16, BASE_HEX,
3890
16
            VALS(fec_vc_types_vals), 0x7FFF, "Virtual Circuit Type", HFILL }},
3891
3892
16
        { &hf_ldp_tlv_fec_vc_infolength,
3893
16
          { "VC Info Length", "ldp.msg.tlv.fec.vc.infolength", FT_UINT8, BASE_DEC,
3894
16
            NULL, 0x0, "VC FEC Info Length", HFILL }},
3895
3896
16
        { &hf_ldp_tlv_fec_vc_groupid,
3897
16
          { "Group ID", "ldp.msg.tlv.fec.vc.groupid", FT_UINT32, BASE_DEC,
3898
16
            NULL, 0x0, "VC FEC Group ID", HFILL }},
3899
3900
16
        { &hf_ldp_tlv_fec_vc_vcid,
3901
16
          { "VC ID", "ldp.msg.tlv.fec.vc.vcid", FT_UINT32, BASE_DEC,
3902
16
            NULL, 0x0, "VC FEC VCID", HFILL }},
3903
3904
16
        { &hf_ldp_tlv_fec_vc_intparam_length,
3905
16
          { "Length", "ldp.msg.tlv.fec.vc.intparam.length", FT_UINT8, BASE_DEC,
3906
16
            NULL, 0x0, "VC FEC Interface Parameter Length", HFILL }},
3907
3908
16
        { &hf_ldp_tlv_fec_vc_intparam_mtu,
3909
16
          { "MTU", "ldp.msg.tlv.fec.vc.intparam.mtu", FT_UINT16, BASE_DEC,
3910
16
            NULL, 0x0, "VC FEC Interface Parameter MTU", HFILL }},
3911
3912
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmbps,
3913
16
          { "BPS", "ldp.msg.tlv.fec.vc.intparam.tdmbps", FT_UINT32, BASE_DEC,
3914
16
            NULL, 0x0, "VC FEC Interface Parameter CEP/TDM bit-rate", HFILL }},
3915
3916
16
        { &hf_ldp_tlv_fec_vc_intparam_id,
3917
16
          { "ID", "ldp.msg.tlv.fec.vc.intparam.id", FT_UINT8, BASE_HEX,
3918
16
            VALS(fec_vc_interfaceparm), 0x0, "VC FEC Interface Parameter ID", HFILL }},
3919
3920
16
        { &hf_ldp_tlv_fec_vc_intparam_maxcatmcells,
3921
16
          { "Number of Cells", "ldp.msg.tlv.fec.vc.intparam.maxatm", FT_UINT16, BASE_DEC,
3922
16
            NULL, 0x0, "VC FEC Interface Param Max ATM Concat Cells", HFILL }},
3923
3924
16
        { &hf_ldp_tlv_fec_vc_intparam_desc,
3925
16
          { "Description", "ldp.msg.tlv.fec.vc.intparam.desc", FT_STRING, BASE_NONE,
3926
16
            NULL, 0, "VC FEC Interface Description", HFILL }},
3927
3928
16
        { &hf_ldp_tlv_fec_vc_intparam_cepbytes,
3929
16
          { "Payload Bytes", "ldp.msg.tlv.fec.vc.intparam.cepbytes", FT_UINT16, BASE_DEC,
3930
16
            NULL, 0x0, "VC FEC Interface Param CEP/TDM Payload Bytes", HFILL }},
3931
3932
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_ais,
3933
16
          { "AIS", "ldp.msg.tlv.fec.vc.intparam.cepopt_ais", FT_BOOLEAN, 16,
3934
16
            NULL, 0x8000, "VC FEC Interface Param CEP Option AIS", HFILL }},
3935
3936
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_une,
3937
16
          { "UNE", "ldp.msg.tlv.fec.vc.intparam.cepopt_une", FT_BOOLEAN, 16,
3938
16
            NULL, 0x4000, "VC FEC Interface Param CEP Option Unequipped", HFILL }},
3939
3940
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_rtp,
3941
16
          { "RTP", "ldp.msg.tlv.fec.vc.intparam.cepopt_rtp", FT_BOOLEAN, 16,
3942
16
            NULL, 0x2000, "VC FEC Interface Param CEP Option RTP Header", HFILL }},
3943
3944
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_ebm,
3945
16
          { "EBM", "ldp.msg.tlv.fec.vc.intparam.cepopt_ebm", FT_BOOLEAN, 16,
3946
16
            NULL, 0x1000, "VC FEC Interface Param CEP Option EBM Header", HFILL }},
3947
3948
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_mah,
3949
16
          { "MAH", "ldp.msg.tlv.fec.vc.intparam.cepopt_mah", FT_BOOLEAN, 16,
3950
16
            NULL, 0x0800, "VC FEC Interface Param CEP Option MPLS Adaptation header", HFILL }},
3951
3952
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_res,
3953
16
          { "Reserved", "ldp.msg.tlv.fec.vc.intparam.cepopt_res", FT_UINT16, BASE_HEX,
3954
16
            NULL , 0x07E0, "VC FEC Interface Param CEP Option Reserved", HFILL }},
3955
3956
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_ceptype,
3957
16
          { "CEP Type", "ldp.msg.tlv.fec.vc.intparam.cepopt_ceptype", FT_UINT16, BASE_HEX,
3958
16
            VALS(fec_vc_ceptype_vals), 0x001C, "VC FEC Interface Param CEP Option CEP Type", HFILL }},
3959
3960
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_t3,
3961
16
          { "Async T3", "ldp.msg.tlv.fec.vc.intparam.cepopt_t3", FT_BOOLEAN, 16,
3962
16
            NULL, 0x0002, "VC FEC Interface Param CEP Option Async T3", HFILL }},
3963
3964
16
        { &hf_ldp_tlv_fec_vc_intparam_cepopt_e3,
3965
16
          { "Async E3", "ldp.msg.tlv.fec.vc.intparam.cepopt_e3", FT_BOOLEAN, 16,
3966
16
            NULL, 0x0001, "VC FEC Interface Param CEP Option Async E3", HFILL }},
3967
3968
16
        { &hf_ldp_tlv_fec_vc_intparam_vlanid,
3969
16
          { "VLAN Id", "ldp.msg.tlv.fec.vc.intparam.vlanid", FT_UINT16, BASE_DEC,
3970
16
            NULL, 0x0, "VC FEC Interface Param VLAN Id", HFILL }},
3971
3972
16
        { &hf_ldp_tlv_fec_vc_intparam_dlcilen,
3973
16
          { "DLCI Length", "ldp.msg.tlv.fec.vc.intparam.dlcilen", FT_UINT16, BASE_DEC,
3974
16
            NULL, 0x0, "VC FEC Interface Parameter Frame-Relay DLCI Length", HFILL }},
3975
3976
16
        { &hf_ldp_tlv_fec_vc_intparam_fcslen,
3977
16
          { "FCS Length", "ldp.msg.tlv.fec.vc.intparam.fcslen", FT_UINT16, BASE_DEC,
3978
16
            NULL, 0x0, "VC FEC Interface Parameter FCS Length", HFILL }},
3979
3980
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_r,
3981
16
          { "R Bit", "ldp.msg.tlv.fec.vc.intparam.tdmopt_r", FT_BOOLEAN, 16,
3982
16
            TFS(&fec_vc_tdmopt_r), 0x8000, "VC FEC Interface Param TDM Options RTP Header", HFILL }},
3983
3984
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_d,
3985
16
          { "D Bit", "ldp.msg.tlv.fec.vc.intparam.tdmopt_d", FT_BOOLEAN, 16,
3986
16
            TFS(&fec_vc_tdmopt_d), 0x4000, "VC FEC Interface Param TDM Options Dynamic Timestamp", HFILL }},
3987
3988
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_f,
3989
16
          { "F Bit", "ldp.msg.tlv.fec.vc.intparam.tdmopt_f", FT_BOOLEAN, 16,
3990
16
            TFS(&fec_vc_tdmopt_f), 0x2000, "VC FEC Interface Param TDM Options Flavor bit", HFILL }},
3991
3992
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_res1,
3993
16
          { "RSVD-1", "ldp.msg.tlv.fec.vc.intparam.tdmopt_res1", FT_UINT16, BASE_HEX,
3994
16
            NULL, 0x1FFF, "VC FEC Interface Param TDM Options Reserved", HFILL }},
3995
3996
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_pt,
3997
16
          { "PT", "ldp.msg.tlv.fec.vc.intparam.tdmopt_pt", FT_UINT8, BASE_DEC,
3998
16
            NULL, 0x7F, "VC FEC Interface Param TDM Options Payload Type", HFILL }},
3999
4000
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_res2,
4001
16
          { "RSVD-2", "ldp.msg.tlv.fec.vc.intparam.tdmopt_res2", FT_UINT8, BASE_HEX,
4002
16
            NULL, 0x00, "VC FEC Interface Param TDM Options Reserved", HFILL }},
4003
4004
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_freq,
4005
16
          { "FREQ", "ldp.msg.tlv.fec.vc.intparam.tdmopt_freq", FT_UINT16, BASE_DEC,
4006
16
            NULL, 0x00, "VC FEC Interface Param TDM Options Frequency", HFILL }},
4007
4008
16
        { &hf_ldp_tlv_fec_vc_intparam_tdmopt_ssrc,
4009
16
          { "SSRC", "ldp.msg.tlv.fec.vc.intparam.tdmopt_ssrc", FT_UINT32, BASE_HEX,
4010
16
            NULL, 0x00, "VC FEC Interface Param TDM Options SSRC", HFILL }},
4011
4012
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_cw,
4013
16
          { "PWE3 Control Word", "ldp.msg.tlv.fec.vc.intparam.vccv.cctype_cw", FT_BOOLEAN, 8,
4014
16
            NULL, 0x01, "VC FEC Interface Param VCCV CC Type PWE3 CW", HFILL }},
4015
4016
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_mplsra,
4017
16
          { "MPLS Router Alert", "ldp.msg.tlv.fec.vc.intparam.vccv.cctype_mplsra", FT_BOOLEAN, 8,
4018
16
            NULL, 0x02, "VC FEC Interface Param VCCV CC Type MPLS Router Alert", HFILL }},
4019
4020
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cctype_ttl1,
4021
16
          { "MPLS Inner Label TTL = 1", "ldp.msg.tlv.fec.vc.intparam.vccv.cctype_ttl1", FT_BOOLEAN, 8,
4022
16
            NULL, 0x04, "VC FEC Interface Param VCCV CC Type Inner Label TTL 1", HFILL }},
4023
4024
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_icmpping,
4025
16
          { "ICMP Ping", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_icmpping", FT_BOOLEAN, 8,
4026
16
            NULL, 0x01, "VC FEC Interface Param VCCV CV Type ICMP Ping", HFILL }},
4027
4028
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_lspping,
4029
16
          { "LSP Ping", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_lspping", FT_BOOLEAN, 8,
4030
16
            NULL, 0x02, "VC FEC Interface Param VCCV CV Type LSP Ping", HFILL }},
4031
4032
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd1,
4033
16
          { "BFD IP/UDP-encapsulated, for PW Fault Detection only", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd1", FT_BOOLEAN, 8,
4034
16
            NULL, 0x04, "VC FEC Interface Param VCCV CV Type BFD IP/UDP-encapsulated, for PW Fault Detection only", HFILL }},
4035
4036
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd2,
4037
16
          { "BFD IP/UDP-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd2", FT_BOOLEAN, 8,
4038
16
            NULL, 0x08, "VC FEC Interface Param VCCV CV Type BFD IP/UDP-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", HFILL }},
4039
4040
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd3,
4041
16
          { "BFD BFD PW-ACH-encapsulated, for PW Fault Detection only", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd3", FT_BOOLEAN, 8,
4042
16
            NULL, 0x10, "VC FEC Interface Param VCCV CV Type BFD PW-ACH-encapsulated, for PW Fault Detection only", HFILL }},
4043
4044
16
        { &hf_ldp_tlv_fec_vc_intparam_vccv_cvtype_bfd4,
4045
16
          { "BFD BFD PW-ACH-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", "ldp.msg.tlv.fec.vc.intparam.vccv.cvtype_bfd4", FT_BOOLEAN, 8,
4046
16
            NULL, 0x20, "VC FEC Interface Param VCCV CV Type BFD PW-ACH-encapsulated, for PW Fault Detection and AC/PW Fault Status Signaling", HFILL }},
4047
4048
16
        { &hf_ldp_tlv_fec_vc_intparam_flowlabel_t,
4049
16
          { "Flow Label Transmit bit", "ldp.msg.tlv.fec.vc.intparam.flowlabel.t", FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL}},
4050
4051
16
        { &hf_ldp_tlv_fec_vc_intparam_flowlabel_r,
4052
16
          { "Flow Label Receive bit", "ldp.msg.tlv.fec.vc.intparam.flowlabel.r", FT_UINT8, BASE_DEC, NULL, 0x40, NULL, HFILL}},
4053
4054
16
        { &hf_ldp_tlv_fec_vc_intparam_flowlabel_res,
4055
16
          { "Flow Label Reserved", "ldp.msg.tlv.fec.vc.intparam.flowlabel.res", FT_UINT16, BASE_HEX, NULL, 0x3FFF, NULL, HFILL}},
4056
4057
16
        { &hf_ldp_tlv_lspid_act_flg,
4058
16
          { "Action Indicator Flag", "ldp.msg.tlv.lspid.actflg", FT_UINT16, BASE_HEX,
4059
16
            VALS(ldp_act_flg_vals), 0x000F, NULL, HFILL}},
4060
4061
16
        { &hf_ldp_tlv_lspid_cr_lsp,
4062
16
          { "Local CR-LSP ID", "ldp.msg.tlv.lspid.locallspid", FT_UINT16, BASE_HEX,
4063
16
            NULL, 0x0, NULL, HFILL}},
4064
4065
16
        { &hf_ldp_tlv_lspid_ldpid,
4066
16
          { "Ingress LSR Router ID", "ldp.msg.tlv.lspid.lsrid", FT_IPv4, BASE_NONE,
4067
16
            NULL, 0x0, NULL, HFILL}},
4068
4069
16
        { &hf_ldp_tlv_er_hop_loose,
4070
16
          { "Loose route bit", "ldp.msg.tlv.er_hop.loose", FT_UINT24, BASE_HEX,
4071
16
            VALS(ldp_loose_vals), 0x800000, NULL, HFILL}},
4072
4073
16
        { &hf_ldp_tlv_er_hop_prelen,
4074
16
          { "Prefix length", "ldp.msg.tlv.er_hop.prefixlen", FT_UINT8, BASE_DEC,
4075
16
            NULL, 0x0, "Prefix len", HFILL}},
4076
4077
16
        { &hf_ldp_tlv_er_hop_prefix4,
4078
16
          { "IPv4 Address", "ldp.msg.tlv.er_hop.prefix4", FT_IPv4, BASE_NONE,
4079
16
            NULL, 0x0, NULL, HFILL}},
4080
4081
16
        { &hf_ldp_tlv_er_hop_prefix6,
4082
16
          { "IPv6 Address", "ldp.msg.tlv.er_hop.prefix6", FT_IPv6, BASE_NONE,
4083
16
            NULL, 0x0, NULL, HFILL}},
4084
4085
16
        { &hf_ldp_tlv_er_hop_as,
4086
16
          { "AS Number", "ldp.msg.tlv.er_hop.as", FT_UINT16, BASE_DEC,
4087
16
            NULL, 0x0, NULL, HFILL}},
4088
4089
16
        { &hf_ldp_tlv_er_hop_cr_lsp,
4090
16
          { "Local CR-LSP ID", "ldp.msg.tlv.er_hop.locallspid", FT_UINT16, BASE_DEC,
4091
16
            NULL, 0x0, NULL, HFILL}},
4092
4093
16
        { &hf_ldp_tlv_er_hop_ldpid,
4094
16
          { "Local CR-LSP ID", "ldp.msg.tlv.er_hop.lsrid", FT_IPv4, BASE_NONE,
4095
16
            NULL, 0x0, NULL, HFILL}},
4096
4097
16
        { &hf_ldp_tlv_flags_reserv,
4098
16
          { "Reserved", "ldp.msg.tlv.flags_reserv", FT_UINT8, BASE_HEX,
4099
16
            NULL, 0xC0, NULL, HFILL}},
4100
4101
16
        { &hf_ldp_tlv_flags_pdr,
4102
16
          { "PDR", "ldp.msg.tlv.flags_pdr", FT_BOOLEAN, 8,
4103
16
            TFS(&tlv_negotiable), 0x1, "PDR negotiability flag", HFILL}},
4104
4105
16
        { &hf_ldp_tlv_flags_pbs,
4106
16
          { "PBS", "ldp.msg.tlv.flags_pbs", FT_BOOLEAN, 8,
4107
16
            TFS(&tlv_negotiable), 0x2, "PBS negotiability flag", HFILL}},
4108
4109
16
        { &hf_ldp_tlv_flags_cdr,
4110
16
          { "CDR", "ldp.msg.tlv.flags_cdr", FT_BOOLEAN, 8,
4111
16
            TFS(&tlv_negotiable), 0x4, "CDR negotiability flag", HFILL}},
4112
4113
16
        { &hf_ldp_tlv_flags_cbs,
4114
16
          { "CBS", "ldp.msg.tlv.flags_cbs", FT_BOOLEAN, 8,
4115
16
            TFS(&tlv_negotiable), 0x8, "CBS negotiability flag", HFILL}},
4116
4117
16
        { &hf_ldp_tlv_flags_ebs,
4118
16
          { "EBS", "ldp.msg.tlv.flags_ebs", FT_BOOLEAN, 8,
4119
16
            TFS(&tlv_negotiable), 0x10, "EBS negotiability flag", HFILL}},
4120
4121
16
        { &hf_ldp_tlv_flags_weight,
4122
16
          { "Weight", "ldp.msg.tlv.flags_weight", FT_BOOLEAN, 8,
4123
16
            TFS(&tlv_negotiable), 0x20, "Weight negotiability flag", HFILL}},
4124
4125
16
        { &hf_ldp_tlv_frequency,
4126
16
          { "Frequency", "ldp.msg.tlv.frequency", FT_UINT8, BASE_DEC,
4127
16
            VALS(freq_values), 0, NULL, HFILL}},
4128
4129
16
        { &hf_ldp_tlv_weight,
4130
16
          { "Weight", "ldp.msg.tlv.weight", FT_UINT8, BASE_DEC,
4131
16
            NULL, 0, "Weight of the CR-LSP", HFILL}},
4132
4133
16
        { &hf_ldp_tlv_pdr,
4134
16
          { "PDR", "ldp.msg.tlv.pdr", FT_DOUBLE, BASE_NONE,
4135
16
            NULL, 0, "Peak Data Rate", HFILL}},
4136
4137
16
        { &hf_ldp_tlv_pbs,
4138
16
          { "PBS", "ldp.msg.tlv.pbs", FT_DOUBLE, BASE_NONE,
4139
16
            NULL, 0, "Peak Burst Size", HFILL}},
4140
4141
16
        { &hf_ldp_tlv_cdr,
4142
16
          { "CDR", "ldp.msg.tlv.cdr", FT_DOUBLE, BASE_NONE,
4143
16
            NULL, 0, "Committed Data Rate", HFILL}},
4144
4145
16
        { &hf_ldp_tlv_cbs,
4146
16
          { "CBS", "ldp.msg.tlv.cbs", FT_DOUBLE, BASE_NONE,
4147
16
            NULL, 0, "Committed Burst Size", HFILL}},
4148
4149
16
        { &hf_ldp_tlv_ebs,
4150
16
          { "EBS", "ldp.msg.tlv.ebs", FT_DOUBLE, BASE_NONE,
4151
16
            NULL, 0, "Excess Burst Size", HFILL}},
4152
4153
16
        { &hf_ldp_tlv_set_prio,
4154
16
          { "Set Prio", "ldp.msg.tlv.set_prio", FT_UINT8, BASE_DEC,
4155
16
            NULL, 0, "LSP setup priority", HFILL}},
4156
4157
16
        { &hf_ldp_tlv_hold_prio,
4158
16
          { "Hold Prio", "ldp.msg.tlv.hold_prio", FT_UINT8, BASE_DEC,
4159
16
            NULL, 0, "LSP hold priority", HFILL}},
4160
4161
16
        { &hf_ldp_tlv_route_pinning,
4162
16
          { "Route Pinning", "ldp.msg.tlv.route_pinning", FT_UINT32, BASE_DEC,
4163
16
            VALS(route_pinning_vals), 0x80000000, NULL, HFILL}},
4164
4165
16
        { &hf_ldp_tlv_resource_class,
4166
16
          { "Resource Class", "ldp.msg.tlv.resource_class", FT_UINT32, BASE_HEX,
4167
16
            NULL, 0, "Resource Class (Color)", HFILL}},
4168
4169
#if 0
4170
        { &hf_ldp_tlv_diffserv,
4171
          { "Diff-Serv TLV", "ldp.msg.tlv.diffserv", FT_NONE, BASE_NONE,
4172
            NULL, 0, "Diffserv TLV", HFILL}},
4173
#endif
4174
4175
16
        { &hf_ldp_tlv_diffserv_type,
4176
16
          { "LSP Type", "ldp.msg.tlv.diffserv.type", FT_UINT8, BASE_DEC,
4177
16
            VALS(diffserv_type_vals), 0x80, NULL, HFILL}},
4178
4179
16
        { &hf_ldp_tlv_diffserv_mapnb,
4180
16
          { "MAPnb", "ldp.msg.tlv.diffserv.mapnb", FT_UINT8, BASE_DEC,
4181
16
            NULL, 0, MAPNB_DESCRIPTION, HFILL}},
4182
4183
16
        { &hf_ldp_tlv_diffserv_map,
4184
16
          { "MAP", "ldp.msg.tlv.diffserv.map", FT_NONE, BASE_NONE,
4185
16
            NULL, 0, MAP_DESCRIPTION, HFILL}},
4186
4187
16
        { &hf_ldp_tlv_diffserv_map_exp,
4188
16
          { "EXP", "ldp.msg.tlv.diffserv.map.exp", FT_UINT8, BASE_DEC,
4189
16
            NULL, 0, EXP_DESCRIPTION, HFILL}},
4190
4191
16
        { &hf_ldp_tlv_diffserv_phbid,
4192
16
          { PHBID_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid", FT_NONE, BASE_NONE,
4193
16
            NULL, 0, NULL, HFILL}},
4194
4195
16
        { &hf_ldp_tlv_diffserv_phbid_dscp,
4196
16
          { PHBID_DSCP_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.dscp", FT_UINT16, BASE_DEC,
4197
16
            NULL, PHBID_DSCP_MASK, NULL, HFILL}},
4198
4199
16
        { &hf_ldp_tlv_diffserv_phbid_code,
4200
16
          { PHBID_CODE_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.code", FT_UINT16, BASE_DEC,
4201
16
            NULL, PHBID_CODE_MASK, NULL, HFILL}},
4202
4203
16
        { &hf_ldp_tlv_diffserv_phbid_bit14,
4204
16
          { PHBID_BIT14_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.bit14", FT_UINT16, BASE_DEC,
4205
16
            VALS(phbid_bit14_vals), PHBID_BIT14_MASK, NULL, HFILL}},
4206
4207
16
        { &hf_ldp_tlv_diffserv_phbid_bit15,
4208
16
          { PHBID_BIT15_DESCRIPTION, "ldp.msg.tlv.diffserv.phbid.bit15", FT_UINT16, BASE_DEC,
4209
16
            VALS(phbid_bit15_vals), PHBID_BIT15_MASK, NULL, HFILL}},
4210
4211
16
        { &hf_ldp_tlv_fec_gen_agi_type,
4212
16
          { "AGI Type", "ldp.msg.tlv.fec.gen.agi.type", FT_UINT8, BASE_DEC,
4213
16
            NULL, 0x0, "Attachment Group Identifier Type", HFILL}},
4214
4215
16
        { &hf_ldp_tlv_fec_gen_agi_length,
4216
16
          { "AGI Length", "ldp.msg.tlv.fec.gen.agi.length", FT_UINT8, BASE_DEC,
4217
16
            NULL, 0x0, "Attachment Group Identifier Length", HFILL}},
4218
4219
16
        { &hf_ldp_tlv_fec_gen_agi_value,
4220
16
          { "AGI Value", "ldp.msg.tlv.fec.gen.agi.value", FT_BYTES, BASE_NONE,
4221
16
            NULL, 0x0, "Attachment Group Identifier Value", HFILL}},
4222
4223
16
        { &hf_ldp_tlv_fec_gen_saii_type,
4224
16
          { "SAII Type", "ldp.msg.tlv.fec.gen.saii.type", FT_UINT8, BASE_DEC,
4225
16
            NULL, 0x0, "Source Attachment Individual Identifier Type", HFILL}},
4226
4227
16
        { &hf_ldp_tlv_fec_gen_saii_length,
4228
16
          { "SAII Length", "ldp.msg.tlv.fec.gen.saii.length", FT_UINT8, BASE_DEC,
4229
16
            NULL, 0x0, "Source Attachment Individual Identifier Length", HFILL}},
4230
4231
16
        { &hf_ldp_tlv_fec_gen_saii_value,
4232
16
          { "SAII Value", "ldp.msg.tlv.fec.gen.saii.value", FT_BYTES, BASE_NONE,
4233
16
            NULL, 0x0, "Source Attachment Individual Identifier Value", HFILL}},
4234
4235
16
        { &hf_ldp_tlv_fec_gen_taii_type,
4236
16
          { "TAII Type", "ldp.msg.tlv.fec.gen.taii.type", FT_UINT8, BASE_DEC,
4237
16
            NULL, 0x0, "Target Attachment Individual Identifier Type", HFILL}},
4238
4239
16
        { &hf_ldp_tlv_fec_gen_taii_length,
4240
16
          { "TAII length", "ldp.msg.tlv.fec.gen.taii.length", FT_UINT8, BASE_DEC,
4241
16
            NULL, 0x0, "Target Attachment Individual Identifier Length", HFILL}},
4242
4243
16
        { &hf_ldp_tlv_fec_gen_taii_value,
4244
16
          { "TAII Value", "ldp.msg.tlv.fec.gen.taii.value", FT_BYTES, BASE_NONE,
4245
16
            NULL, 0x0, "Target Attachment Individual Identifier Value", HFILL}},
4246
4247
16
        { &hf_ldp_tlv_fec_gen_aai_globalid,
4248
16
          { "Global Id", "ldp.msg.tlv.fec.gen.aii.globalid", FT_UINT32, BASE_DEC,
4249
16
            NULL, 0x0, "Attachment Individual Identifier Global Id", HFILL}},
4250
4251
16
        { &hf_ldp_tlv_fec_gen_aai_prefix,
4252
16
          { "Prefix", "ldp.msg.tlv.fec.gen.aii.prefix", FT_UINT32, BASE_DEC,
4253
16
            NULL, 0x0, "Attachment Individual Identifier Prefix", HFILL}},
4254
4255
16
        { &hf_ldp_tlv_fec_gen_aai_ac_id,
4256
16
          { "Prefix", "ldp.msg.tlv.fec.gen.aii.acid", FT_UINT32, BASE_DEC,
4257
16
            NULL, 0x0, "Attachment Individual Identifier AC Id", HFILL}},
4258
4259
16
        { &hf_ldp_tlv_fec_pw_controlword,
4260
16
          { "C-bit", "ldp.msg.tlv.fec.pw.controlword", FT_BOOLEAN, 8,
4261
16
            TFS(&fec_vc_cbit), 0x80, "Control Word Present", HFILL }},
4262
4263
16
        { &hf_ldp_tlv_fec_pw_pwtype,
4264
16
          { "PW Type", "ldp.msg.tlv.fec.pw.pwtype", FT_UINT16, BASE_HEX,
4265
16
            VALS(fec_vc_types_vals), 0x7FFF, "Virtual Circuit Type", HFILL }},
4266
4267
16
        { &hf_ldp_tlv_fec_pw_infolength,
4268
16
          { "PW Info Length", "ldp.msg.tlv.fec.pw.infolength", FT_UINT8, BASE_DEC,
4269
16
            NULL, 0x0, "PW FEC Info Length", HFILL }},
4270
4271
16
        { &hf_ldp_tlv_fec_pw_groupid,
4272
16
          { "Group ID", "ldp.msg.tlv.fec.pw.groupid", FT_UINT32, BASE_DEC,
4273
16
            NULL, 0x0, "PW FEC Group ID", HFILL }},
4274
4275
16
        { &hf_ldp_tlv_fec_pw_pwid,
4276
16
          { "PW ID", "ldp.msg.tlv.fec.pw.pwid", FT_UINT32, BASE_DEC,
4277
16
            NULL, 0x0, "PW FEC PWID", HFILL }},
4278
4279
16
        { &hf_ldp_tlv_pw_status_data,
4280
16
          { "PW Status", "ldp.msg.tlv.pwstatus.code", FT_UINT32, BASE_HEX,
4281
16
            NULL, 0, NULL, HFILL }},
4282
4283
16
        { &hf_ldp_tlv_pw_not_forwarding,
4284
16
          { "Pseudowire Not Forwarding", "ldp.msg.tlv.pwstatus.code.pwnotforward", FT_BOOLEAN, 32,
4285
16
            TFS(&tfs_set_notset), PW_NOT_FORWARDING, NULL, HFILL }},
4286
4287
16
        { &hf_ldp_tlv_pw_lac_ingress_recv_fault,
4288
16
          { "Local Attachment Circuit (ingress) Receive Fault", "ldp.msg.tlv.pwstatus.code.pwlacingressrecvfault",
4289
16
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_LAC_INGRESS_RECV_FAULT, NULL, HFILL }},
4290
4291
16
        { &hf_ldp_tlv_pw_lac_egress_recv_fault,
4292
16
          { "Local Attachment Circuit (egress) Transmit Fault", "ldp.msg.tlv.pwstatus.code.pwlacegresstransfault",
4293
16
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_LAC_EGRESS_TRANS_FAULT, NULL, HFILL }},
4294
4295
16
        { &hf_ldp_tlv_pw_psn_pw_ingress_recv_fault,
4296
16
          { "Local PSN-facing PW (ingress) Receive Fault", "ldp.msg.tlv.pwstatus.code.pwpsnpwingressrecvfault",
4297
16
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_PSN_PW_INGRESS_RECV_FAULT, NULL, HFILL }},
4298
4299
16
        { &hf_ldp_tlv_pw_psn_pw_egress_recv_fault,
4300
16
          { "Local PSN-facing PW (egress) Transmit Fault", "ldp.msg.tlv.pwstatus.code.pwpsnpwegresstransfault",
4301
16
            FT_BOOLEAN, 32, TFS(&tfs_set_notset), PW_PSN_PW_EGRESS_TRANS_FAULT, NULL, HFILL }},
4302
4303
16
        { &hf_ldp_tlv_pw_grouping_value,
4304
16
          { "Value", "ldp.msg.tlv.pwgrouping.value",
4305
16
            FT_UINT32, BASE_DEC, NULL, 0x0,
4306
16
            "PW Grouping Value", HFILL }},
4307
4308
16
        { &hf_ldp_tlv_intparam_length,
4309
16
          { "Length", "ldp.msg.tlv.intparam.length", FT_UINT8, BASE_DEC,
4310
16
            NULL, 0x0, "VC FEC Interface Parameter Length", HFILL }},
4311
4312
16
        { &hf_ldp_tlv_intparam_mtu,
4313
16
          { "MTU", "ldp.msg.tlv.intparam.mtu", FT_UINT16, BASE_DEC,
4314
16
            NULL, 0x0, "VC FEC Interface Parameter MTU", HFILL }},
4315
4316
16
        { &hf_ldp_tlv_intparam_tdmbps,
4317
16
          { "BPS", "ldp.msg.tlv.intparam.tdmbps", FT_UINT32, BASE_DEC,
4318
16
            NULL, 0x0, "VC FEC Interface Parameter CEP/TDM bit-rate", HFILL }},
4319
4320
16
        { &hf_ldp_tlv_intparam_id,
4321
16
          { "ID", "ldp.msg.tlv.intparam.id", FT_UINT8, BASE_HEX,
4322
16
            VALS(fec_vc_interfaceparm), 0x0, "VC FEC Interface Parameter ID", HFILL }},
4323
4324
16
        { &hf_ldp_tlv_intparam_maxcatmcells,
4325
16
          { "Number of Cells", "ldp.msg.tlv.intparam.maxatm", FT_UINT16, BASE_DEC,
4326
16
            NULL, 0x0, "VC FEC Interface Param Max ATM Concat Cells", HFILL }},
4327
4328
16
        { &hf_ldp_tlv_intparam_desc,
4329
16
          { "Description", "ldp.msg.tlv.intparam.desc", FT_STRING, BASE_NONE,
4330
16
            NULL, 0, "VC FEC Interface Description", HFILL }},
4331
4332
16
        { &hf_ldp_tlv_intparam_cepbytes,
4333
16
          { "Payload Bytes", "ldp.msg.tlv.intparam.cepbytes", FT_UINT16, BASE_DEC,
4334
16
            NULL, 0x0, "VC FEC Interface Param CEP/TDM Payload Bytes", HFILL }},
4335
4336
16
        { &hf_ldp_tlv_intparam_cepopt_ais,
4337
16
          { "AIS", "ldp.msg.tlv.intparam.cepopt_ais", FT_BOOLEAN, 16,
4338
16
            NULL, 0x8000, "VC FEC Interface Param CEP Option AIS", HFILL }},
4339
4340
16
        { &hf_ldp_tlv_intparam_cepopt_une,
4341
16
          { "UNE", "ldp.msg.tlv.intparam.cepopt_une", FT_BOOLEAN, 16,
4342
16
            NULL, 0x4000, "VC FEC Interface Param CEP Option Unequipped", HFILL }},
4343
4344
16
        { &hf_ldp_tlv_intparam_cepopt_rtp,
4345
16
          { "RTP", "ldp.msg.tlv.intparam.cepopt_rtp", FT_BOOLEAN, 16,
4346
16
            NULL, 0x2000, "VC FEC Interface Param CEP Option RTP Header", HFILL }},
4347
4348
16
        { &hf_ldp_tlv_intparam_cepopt_ebm,
4349
16
          { "EBM", "ldp.msg.tlv.intparam.cepopt_ebm", FT_BOOLEAN, 16,
4350
16
            NULL, 0x1000, "VC FEC Interface Param CEP Option EBM Header", HFILL }},
4351
4352
16
        { &hf_ldp_tlv_intparam_cepopt_mah,
4353
16
          { "MAH", "ldp.msg.tlv.intparam.cepopt_mah", FT_BOOLEAN, 16,
4354
16
            NULL, 0x0800, "VC FEC Interface Param CEP Option MPLS Adaptation header", HFILL }},
4355
4356
16
        { &hf_ldp_tlv_intparam_cepopt_res,
4357
16
          { "Reserved", "ldp.msg.tlv.intparam.cepopt_res", FT_UINT16, BASE_HEX,
4358
16
            NULL , 0x07E0, "VC FEC Interface Param CEP Option Reserved", HFILL }},
4359
4360
16
        { &hf_ldp_tlv_intparam_cepopt_ceptype,
4361
16
          { "CEP Type", "ldp.msg.tlv.intparam.cepopt_ceptype", FT_UINT16, BASE_HEX,
4362
16
            VALS(fec_vc_ceptype_vals), 0x001C, "VC FEC Interface Param CEP Option CEP Type", HFILL }},
4363
4364
16
        { &hf_ldp_tlv_intparam_cepopt_t3,
4365
16
          { "Async T3", "ldp.msg.tlv.intparam.cepopt_t3", FT_BOOLEAN, 16,
4366
16
            NULL, 0x0002, "VC FEC Interface Param CEP Option Async T3", HFILL }},
4367
4368
16
        { &hf_ldp_tlv_intparam_cepopt_e3,
4369
16
          { "Async E3", "ldp.msg.tlv.intparam.cepopt_e3", FT_BOOLEAN, 16,
4370
16
            NULL, 0x0001, "VC FEC Interface Param CEP Option Async E3", HFILL }},
4371
4372
16
        { &hf_ldp_tlv_intparam_vlanid,
4373
16
          { "VLAN Id", "ldp.msg.tlv.intparam.vlanid", FT_UINT16, BASE_DEC,
4374
16
            NULL, 0x0, "VC FEC Interface Param VLAN Id", HFILL }},
4375
4376
16
        { &hf_ldp_tlv_intparam_dlcilen,
4377
16
          { "DLCI Length", "ldp.msg.tlv.intparam.dlcilen", FT_UINT16, BASE_DEC,
4378
16
            NULL, 0x0, "VC FEC Interface Parameter Frame-Relay DLCI Length", HFILL }},
4379
4380
16
        { &hf_ldp_tlv_intparam_fcslen,
4381
16
          { "FCS Length", "ldp.msg.tlv.intparam.fcslen", FT_UINT16, BASE_DEC,
4382
16
            NULL, 0x0, "VC FEC Interface Parameter FCS Length", HFILL }},
4383
4384
16
        { &hf_ldp_tlv_intparam_tdmopt_r,
4385
16
          { "R Bit", "ldp.msg.tlv.intparam.tdmopt_r", FT_BOOLEAN, 16,
4386
16
            TFS(&fec_vc_tdmopt_r), 0x8000, "VC FEC Interface Param TDM Options RTP Header", HFILL }},
4387
4388
16
        { &hf_ldp_tlv_intparam_tdmopt_d,
4389
16
          { "D Bit", "ldp.msg.tlv.intparam.tdmopt_d", FT_BOOLEAN, 16,
4390
16
            TFS(&fec_vc_tdmopt_d), 0x4000, "VC FEC Interface Param TDM Options Dynamic Timestamp", HFILL }},
4391
4392
16
        { &hf_ldp_tlv_intparam_tdmopt_f,
4393
16
          { "F Bit", "ldp.msg.tlv.intparam.tdmopt_f", FT_BOOLEAN, 16,
4394
16
            TFS(&fec_vc_tdmopt_f), 0x2000, "VC FEC Interface Param TDM Options Flavor bit", HFILL }},
4395
4396
16
        { &hf_ldp_tlv_intparam_tdmopt_res1,
4397
16
          { "RSVD-1", "ldp.msg.tlv.intparam.tdmopt_res1", FT_UINT16, BASE_HEX,
4398
16
            NULL, 0x1FFF, "VC FEC Interface Param TDM Options Reserved", HFILL }},
4399
4400
16
        { &hf_ldp_tlv_intparam_tdmopt_pt,
4401
16
          { "PT", "ldp.msg.tlv.intparam.tdmopt_pt", FT_UINT8, BASE_DEC,
4402
16
            NULL, 0x7F, "VC FEC Interface Param TDM Options Payload Type", HFILL }},
4403
4404
16
        { &hf_ldp_tlv_intparam_tdmopt_res2,
4405
16
          { "RSVD-2", "ldp.msg.tlv.intparam.tdmopt_res2", FT_UINT8, BASE_HEX,
4406
16
            NULL, 0x00, "VC FEC Interface Param TDM Options Reserved", HFILL }},
4407
4408
16
        { &hf_ldp_tlv_intparam_tdmopt_freq,
4409
16
          { "FREQ", "ldp.msg.tlv.intparam.tdmopt_freq", FT_UINT16, BASE_DEC,
4410
16
            NULL, 0x00, "VC FEC Interface Param TDM Options Frequency", HFILL }},
4411
4412
16
        { &hf_ldp_tlv_intparam_tdmopt_ssrc,
4413
16
          { "SSRC", "ldp.msg.tlv.intparam.tdmopt_ssrc", FT_UINT32, BASE_HEX,
4414
16
            NULL, 0x00, "VC FEC Interface Param TDM Options SSRC", HFILL }},
4415
4416
16
        { &hf_ldp_tlv_intparam_vccv_cctype_cw,
4417
16
          { "PWE3 Control Word", "ldp.msg.tlv.intparam.vccv.cctype_cw", FT_BOOLEAN, 8,
4418
16
            NULL, 0x01, "VC FEC Interface Param VCCV CC Type PWE3 CW", HFILL }},
4419
4420
16
        { &hf_ldp_tlv_intparam_vccv_cctype_mplsra,
4421
16
          { "MPLS Router Alert", "ldp.msg.tlv.intparam.vccv.cctype_mplsra", FT_BOOLEAN, 8,
4422
16
            NULL, 0x02, "VC FEC Interface Param VCCV CC Type MPLS Router Alert", HFILL }},
4423
4424
16
        { &hf_ldp_tlv_intparam_vccv_cctype_ttl1,
4425
16
          { "MPLS Inner Label TTL = 1", "ldp.msg.tlv.intparam.vccv.cctype_ttl1", FT_BOOLEAN, 8,
4426
16
            NULL, 0x04, "VC FEC Interface Param VCCV CC Type Inner Label TTL 1", HFILL }},
4427
4428
16
        { &hf_ldp_tlv_intparam_vccv_cvtype_icmpping,
4429
16
          { "ICMP Ping", "ldp.msg.tlv.intparam.vccv.cvtype_icmpping", FT_BOOLEAN, 8,
4430
16
            NULL, 0x01, "VC FEC Interface Param VCCV CV Type ICMP Ping", HFILL }},
4431
4432
16
        { &hf_ldp_tlv_intparam_vccv_cvtype_lspping,
4433
16
          { "LSP Ping", "ldp.msg.tlv.intparam.vccv.cvtype_lspping", FT_BOOLEAN, 8,
4434
16
            NULL, 0x02, "VC FEC Interface Param VCCV CV Type LSP Ping", HFILL }},
4435
4436
16
        { &hf_ldp_tlv_intparam_vccv_cvtype_bfd,
4437
16
          { "BFD", "ldp.msg.tlv.intparam.vccv.cvtype_bfd", FT_BOOLEAN, 8,
4438
16
            NULL, 0x04, "VC FEC Interface Param VCCV CV Type BFD", HFILL }},
4439
4440
16
        { &hf_ldp_tlv_upstr_sbit,
4441
16
          { "S-Bit", "ldp.msg.tlv.upstream.sbit", FT_BOOLEAN, 8,
4442
16
            TFS(&tlv_upstr_sbit_vals), 0x80, "Upstream Label Assignment Capability State Bit", HFILL }},
4443
4444
16
        { &hf_ldp_tlv_upstr_lbl_req_resvbit,
4445
16
          { "Reserved Bits", "ldp.msg.tlv.upstream_label_req.resvbit", FT_UINT32, BASE_HEX,
4446
16
            NULL, 0x0, NULL, HFILL }},
4447
4448
16
        { &hf_ldp_tlv_upstr_ass_lbl,
4449
16
          { "Upstream-Assigned Label", "ldp.msg.tlv.upstream.label", FT_UINT32, BASE_HEX,
4450
16
            NULL, 0x0, NULL, HFILL }},
4451
4452
16
        { &hf_ldp_tlv_upstr_lbl_resvbit,
4453
16
          { "Reserved Bits", "ldp.msg.tlv.upstream.resvbit", FT_UINT32, BASE_HEX,
4454
16
            NULL, 0x0, NULL, HFILL }},
4455
4456
16
        { &hf_ldp_tlv_ipv4_intID_hop_addr,
4457
16
          { "IPv4 Next/Previous Hop Address", "ldp.msg.tlv.ipv4_interface_ID.hop_addr", FT_IPv4, BASE_NONE,
4458
16
            NULL, 0x0, NULL, HFILL }},
4459
4460
16
        { &hf_ldp_tlv_logical_intID,
4461
16
          { "Logical Interface ID", "ldp.msg.tlv.interface_ID.logical_intID", FT_UINT32, BASE_HEX,
4462
16
            NULL, 0x0, NULL, HFILL }},
4463
4464
16
        { &hf_ldp_tlv_ip_multicast_srcaddr,
4465
16
          { "Source Address", "ldp.msg.tlv.ip_multicast.ipv4_srcaddr", FT_IPv4, BASE_NONE,
4466
16
            NULL, 0x0, NULL, HFILL }},
4467
4468
16
        { &hf_ldp_tlv_ip_multicast_mltcstaddr,
4469
16
          { "Multicast Group Address", "ldp.msg.tlv.ip_multicast.ipv4_maddr", FT_IPv4, BASE_NONE,
4470
16
            NULL, 0x0, NULL, HFILL }},
4471
4472
16
        { &hf_ldp_tlv_ip_mpls_context_srcaddr,
4473
16
          { "Source Address", "ldp.msg.tlv.ip_mpls_context.ipv4_srcaddr", FT_IPv4, BASE_NONE,
4474
16
            NULL, 0x0, NULL, HFILL }},
4475
4476
16
        { &hf_ldp_tlv_ldp_p2mp_lsptype,
4477
16
          { "P2MP Type", "ldp.msg.tlv.ldp_p2mp.type", FT_UINT8, BASE_HEX,
4478
16
            NULL, 0x0, "TLV Type", HFILL }},
4479
4480
16
        { &hf_ldp_tlv_ldp_p2mp_addrfam,
4481
16
          { "Address Family", "ldp.msg.tlv.ldp_p2mp.addr_family", FT_UINT16, BASE_HEX,
4482
16
            NULL, 0x0, NULL, HFILL }},
4483
4484
16
        { &hf_ldp_tlv_ldp_p2mp_addrlen,
4485
16
          { "Address Length", "ldp.msg.tlv.ldp_p2mp.addr_len", FT_UINT8, BASE_HEX,
4486
16
            NULL, 0x0, NULL, HFILL }},
4487
4488
16
        { &hf_ldp_tlv_ldp_p2mp_rtnodeaddr,
4489
16
          { "Root Node Address", "ldp.msg.tlv.ldp_p2mp.ipv4_rtnodeaddr", FT_IPv4, BASE_NONE,
4490
16
            NULL, 0x0, NULL, HFILL }},
4491
4492
16
        { &hf_ldp_tlv_ldp_p2mp_oplength,
4493
16
          { "Opaque Length", "ldp.msg.tlv.ldp_p2mp.oplength", FT_UINT16, BASE_DEC,
4494
16
            NULL, 0x0, NULL, HFILL }},
4495
4496
16
        { &hf_ldp_tlv_ldp_p2mp_opvalue,
4497
16
          { "Opaque Value", "ldp.msg.tlv.ldp_p2mp.opvalue", FT_BYTES, BASE_NONE,
4498
16
            NULL, 0x0, NULL, HFILL }},
4499
4500
16
        { &hf_ldp_tlv_rsvp_te_p2mp_id,
4501
16
          { "P2MP ID", "ldp.msg.tlv.rsvp_te_p2mp.id", FT_UINT32, BASE_HEX,
4502
16
            NULL, 0x0, NULL, HFILL }},
4503
4504
16
        { &hf_ldp_tlv_must_be_zero,
4505
16
          { "MUST be zero", "ldp.msg.tlv.rsvp_te_p2mp.zero", FT_UINT16, BASE_HEX,
4506
16
            NULL, 0x0, NULL, HFILL }},
4507
4508
16
        { &hf_ldp_tlv_tunnel_id,
4509
16
          { "Tunnel ID", "ldp.msg.tlv.rsvp_te_p2mp.tunnel_id", FT_UINT16, BASE_HEX,
4510
16
            NULL, 0x0, NULL, HFILL }},
4511
4512
16
        { &hf_ldp_tlv_ext_tunnel_id,
4513
16
          { "Extended Tunnel ID", "ldp.msg.tlv.rsvp_te_p2mp.ipv4_ext_tunnel_id", FT_IPv4, BASE_NONE,
4514
16
            NULL, 0x0, NULL, HFILL }},
4515
4516
16
        { &hf_ldp_tlv_inv_length,
4517
16
          { "Invalid length", "ldp.msg.tlv.invalid.length", FT_UINT16, BASE_HEX,
4518
16
            NULL, 0x0, NULL, HFILL }},
4519
4520
16
        { &hf_ldp_returned_pdu_data,
4521
16
          { "Returned PDU Data", "ldp.returned_pdu_data", FT_BYTES, BASE_NONE,
4522
16
            NULL, 0x0, NULL, HFILL }},
4523
4524
16
        { &hf_ldp_returned_message_parameters,
4525
16
          { "Returned Message Parameters", "ldp.returned_message_parameters", FT_BYTES, BASE_NONE,
4526
16
            NULL, 0x0, NULL, HFILL }},
4527
4528
16
        { &hf_ldp_data,
4529
16
          { "Data", "ldp.data", FT_BYTES, BASE_NONE,
4530
16
            NULL, 0x0, NULL, HFILL }},
4531
4532
16
        { &hf_ldp_unknown_data,
4533
16
          { "Unknown Data", "ldp.unknown_data", FT_BYTES, BASE_NONE,
4534
16
            NULL, 0x0, NULL, HFILL }},
4535
16
    };
4536
4537
16
    static int *ett[] = {
4538
16
        &ett_ldp,
4539
16
        &ett_ldp_header,
4540
16
        &ett_ldp_ldpid,
4541
16
        &ett_ldp_message,
4542
16
        &ett_ldp_tlv,
4543
16
        &ett_ldp_tlv_val,
4544
16
        &ett_ldp_tlv_ft_flags,
4545
16
        &ett_ldp_fec,
4546
16
        &ett_ldp_fec_vc_interfaceparam,
4547
16
        &ett_ldp_fec_vc_interfaceparam_cepopt,
4548
16
        &ett_ldp_fec_vc_interfaceparam_vccvtype,
4549
16
        &ett_ldp_diffserv_map,
4550
16
        &ett_ldp_diffserv_map_phbid,
4551
16
        &ett_ldp_gen_agi,
4552
16
        &ett_ldp_gen_saii,
4553
16
        &ett_ldp_gen_taii,
4554
16
        &ett_ldp_gen_aai_type2,
4555
16
        &ett_ldp_sub_tlv
4556
16
    };
4557
4558
16
    static ei_register_info ei[] = {
4559
16
        { &ei_ldp_dtsm_and_target, { "ldp.dtsm_and_target", PI_PROTOCOL, PI_WARN, "ERROR - Both GTSM and Target Flag are enabled.", EXPFILL }},
4560
16
        { &ei_ldp_gtsm_supported, { "ldp.gtsm_supported", PI_PROTOCOL, PI_CHAT, "GTSM is supported by the source", EXPFILL }},
4561
16
        { &ei_ldp_gtsm_not_supported_basic_discovery, { "ldp.gtsm_not_supported_basic_discovery", PI_PROTOCOL, PI_WARN, "GTSM is not supported by the source, since basic discovery is not enabled", EXPFILL }},
4562
16
        { &ei_ldp_gtsm_not_supported, { "ldp.gtsm_not_supported", PI_PROTOCOL, PI_CHAT, "GTSM is not supported by the source", EXPFILL }},
4563
16
        { &ei_ldp_inv_length, { "ldp.invalid_length", PI_MALFORMED, PI_ERROR, "Length of the packet is malformed", EXPFILL }},
4564
16
        { &ei_ldp_address_family_not_implemented, { "ldp.address_family_not_implemented", PI_UNDECODED, PI_WARN, "Support for Address Family not implemented", EXPFILL }},
4565
16
        { &ei_ldp_tlv_fec, { "ldp.msg.tlv.fec.error", PI_PROTOCOL, PI_ERROR, "Error in FEC Element", EXPFILL }},
4566
        /* N.B. this one is being used for lots of length-related and bytes-remaining conditions.. */
4567
16
        { &ei_ldp_tlv_fec_len, { "ldp.msg.tlv.fec.len.invalid", PI_PROTOCOL, PI_ERROR, "Length Error", EXPFILL }},
4568
16
        { &ei_ldp_tlv_fec_vc_infolength, { "ldp.msg.tlv.fec.vc.infolength.invalid", PI_PROTOCOL, PI_ERROR, "VC FEC size format error", EXPFILL }},
4569
16
        { &ei_ldp_malformed_interface_parameter, { "ldp.malformed_interface_parameter", PI_MALFORMED, PI_ERROR, "Malformed interface parameter", EXPFILL }},
4570
16
        { &ei_ldp_malformed_data, { "ldp.malformed_data", PI_MALFORMED, PI_ERROR, "Malformed data", EXPFILL }},
4571
16
        { &ei_ldp_tlv_fec_type, { "ldp.msg.tlv.fec.unknown", PI_PROTOCOL, PI_WARN, "Unknown FEC TLV type", EXPFILL }},
4572
4573
16
    };
4574
4575
16
    module_t *ldp_module;
4576
16
    expert_module_t* expert_ldp;
4577
4578
16
    proto_ldp = proto_register_protocol("Label Distribution Protocol", "LDP", "ldp");
4579
4580
16
    proto_register_field_array(proto_ldp, hf, array_length(hf));
4581
16
    proto_register_subtree_array(ett, array_length(ett));
4582
16
    expert_ldp = expert_register_protocol(proto_ldp);
4583
16
    expert_register_field_array(expert_ldp, ei, array_length(ei));
4584
4585
16
    ldp_handle = register_dissector("ldp", dissect_ldp, proto_ldp);
4586
16
    ldp_tcp_handle = register_dissector("ldp.tcp", dissect_ldp_tcp, proto_ldp);
4587
4588
    /* Register our configuration options for , particularly our port */
4589
4590
16
    ldp_module = prefs_register_protocol(proto_ldp, NULL);
4591
4592
16
    prefs_register_bool_preference(ldp_module, "desegment_ldp_messages",
4593
16
                                   "Reassemble LDP messages spanning multiple TCP segments",
4594
16
                                   "Whether the LDP dissector should reassemble messages spanning multiple TCP segments."
4595
16
                                   " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\""
4596
16
                                   " in the TCP protocol settings.",
4597
16
                                   &ldp_desegment);
4598
16
}
4599
4600
/* The registration hand-off routine */
4601
void
4602
proto_reg_handoff_ldp(void)
4603
16
{
4604
16
    dissector_add_uint_with_preference("tcp.port", TCP_PORT_LDP, ldp_tcp_handle);
4605
16
    dissector_add_uint_with_preference("udp.port", UDP_PORT_LDP, ldp_handle);
4606
16
}
4607
4608
/*
4609
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
4610
 *
4611
 * Local variables:
4612
 * c-basic-offset: 4
4613
 * tab-width: 8
4614
 * indent-tabs-mode: nil
4615
 * End:
4616
 *
4617
 * vi: set shiftwidth=4 tabstop=8 expandtab:
4618
 * :indentSize=4:tabSize=8:noTabs=true:
4619
 */