4 * Routines for MPLS-TP Lock Instruct Protocol : RFC 6435
5 * MPLS-TP Fault-Management Protocol : RFC 6427
8 * Krishnamurthy Mayya <krishnamurthymayya@gmail.com>
9 * Nikitha Malgi <nikitha01@gmail.com>
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
33 #include <packet-ip.h>
34 #include <epan/dissectors/packet-bfd.h>
36 /* MPLS-TP FM protocol specific variables */
37 static gint proto_mplstp_fm
= -1;
38 static gint ett_mplstp_fm
= -1;
39 static gint ett_mplstp_fm_flags
= -1;
40 static gint ett_mplstp_fm_tlv_tree
= -1;
42 static int hf_mplstp_fm_version
= -1;
44 static int hf_mplstp_fm_reserved
= -1;
45 static int hf_mplstp_fm_msg_type
= -1;
46 static int hf_mplstp_fm_flags
= -1;
47 static int hf_mplstp_fm_flags_l
= -1;
48 static int hf_mplstp_fm_flags_r
= -1;
49 static int hf_mplstp_fm_refresh_timer
= -1;
50 static int hf_mplstp_fm_total_tlv_len
= -1;
51 static int hf_mplstp_fm_if_tlv_type
= -1;
52 static int hf_mplstp_fm_global_tlv_type
= -1;
53 static int hf_mplstp_fm_tlv_len
= -1;
54 static int hf_mplstp_fm_node_id
= -1;
55 static int hf_mplstp_fm_if_num
= -1;
56 static int hf_mplstp_fm_global_id
= -1;
58 static const value_string fm_msg_type
[] = {
59 {0, "No Return Code"},
60 {1, "Alarm-Indication Signal(A)"},
61 {2, "Lock-Report(L)"},
65 /* MPLS-TP Lock protocol specific variables */
66 static gint proto_mplstp_lock
= -1;
67 static gint ett_mplstp_lock
= -1;
69 static int hf_mplstp_lock_version
= -1;
70 static int hf_mplstp_lock_reserved
= -1;
71 static int hf_mplstp_lock_refresh_timer
= -1;
74 dissect_mplstp_fm_tlv (tvbuff_t
*tvb
, proto_tree
*tree
)
77 proto_tree
*fm_tlv_tree
;
84 ti
= proto_tree_add_protocol_format (tree
, proto_mplstp_fm
, tvb
, offset
, 16,
85 "Fault-Management TLVs");
87 fm_tlv_tree
= proto_item_add_subtree (ti
, ett_mplstp_fm_tlv_tree
);
89 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_if_tlv_type
, tvb
, offset
,
92 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_tlv_len
, tvb
, offset
,
95 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_node_id
, tvb
, offset
,
98 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_if_num
, tvb
, offset
,
101 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_global_tlv_type
, tvb
, offset
,
104 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_tlv_len
, tvb
, offset
,
107 proto_tree_add_item (fm_tlv_tree
, hf_mplstp_fm_global_id
, tvb
, offset
,
109 /* offset = offset + 4; */
114 /* Dissector for MPLS-TP LI protocol: RFC 6435 */
116 dissect_mplstp_lock(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
119 proto_tree
*lock_tree
;
124 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "MPLS-TP LI");
125 col_clear(pinfo
->cinfo
, COL_INFO
);
130 ti
= proto_tree_add_item(tree
, proto_mplstp_lock
, tvb
, 0, -1, ENC_NA
);
132 lock_tree
= proto_item_add_subtree (ti
, ett_mplstp_lock
);
135 proto_tree_add_item (lock_tree
, hf_mplstp_lock_version
, tvb
, offset
,
139 proto_tree_add_item (lock_tree
, hf_mplstp_lock_reserved
, tvb
, offset
,
143 /* Refresh-Timer field */
144 proto_tree_add_item (lock_tree
, hf_mplstp_lock_refresh_timer
, tvb
, offset
,
148 /* Source-MEP TLVs */
149 next_tvb
= tvb_new_subset_remaining (tvb
, offset
);
150 dissect_bfd_mep (next_tvb
, tree
, proto_mplstp_lock
);
156 /* Dissector for MPLS-TP FM protocol: RFC 6427 */
158 dissect_mplstp_fm(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
160 proto_item
*ti
, *ti_flags
;
161 proto_tree
*fm_tree
, *fm_flags
;
166 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "MPLS-TP FM");
167 col_clear(pinfo
->cinfo
, COL_INFO
);
169 tlv_len
= tvb_get_guint8 (tvb
, (offset
+ 4));
174 ti
= proto_tree_add_item(tree
, proto_mplstp_fm
, tvb
, 0, (tlv_len
+ 5), ENC_NA
);
175 fm_tree
= proto_item_add_subtree (ti
, ett_mplstp_fm
);
177 /* Version and Reserved fields */
178 proto_tree_add_item (fm_tree
, hf_mplstp_fm_version
, tvb
, offset
,
180 proto_tree_add_item (fm_tree
, hf_mplstp_fm_reserved
, tvb
, offset
,
184 /* FM-Message type field */
185 proto_tree_add_item (fm_tree
, hf_mplstp_fm_msg_type
, tvb
, offset
,
190 ti_flags
= proto_tree_add_item (fm_tree
, hf_mplstp_fm_flags
, tvb
,
191 offset
, 1, ENC_BIG_ENDIAN
);
192 fm_flags
= proto_item_add_subtree(ti_flags
, ett_mplstp_fm_flags
);
194 proto_tree_add_item (fm_flags
, hf_mplstp_fm_flags_l
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
195 proto_tree_add_item (fm_flags
, hf_mplstp_fm_flags_r
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
198 /* Refresh-Timer field */
199 proto_tree_add_item (fm_tree
, hf_mplstp_fm_refresh_timer
, tvb
, offset
,
203 /* FM-TLV Length field*/
204 proto_tree_add_item (fm_tree
, hf_mplstp_fm_total_tlv_len
, tvb
, offset
,
213 next_tvb
= tvb_new_subset_remaining (tvb
, offset
);
214 dissect_mplstp_fm_tlv (next_tvb
, tree
);
220 proto_register_mplstp_lock(void)
222 static hf_register_info hf
[] = {
224 {&hf_mplstp_lock_version
,
225 {"Version", "mplstp_lock.version", FT_UINT8
,
226 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
228 {&hf_mplstp_lock_reserved
,
229 {"Reserved", "mplstp_lock.reserved", FT_UINT24
,
230 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
232 {&hf_mplstp_lock_refresh_timer
,
233 {"Refresh-timer value", "mplstp_lock.refresh-timer", FT_UINT8
,
234 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
237 static gint
*ett
[] = {
242 proto_register_protocol("MPLS-TP Lock-Instruct", "MPLS[-TP] Lock-Instruct "
243 "Lock-Instruct (LI) Protocol",
246 proto_register_field_array(proto_mplstp_lock
, hf
, array_length(hf
));
247 proto_register_subtree_array(ett
, array_length(ett
));
249 register_dissector("mplstp_lock", dissect_mplstp_lock
, proto_mplstp_lock
);
253 proto_register_mplstp_fm(void)
255 static hf_register_info hf
[] = {
257 {&hf_mplstp_fm_version
,
258 {"Version", "mplstp_oam.version", FT_UINT8
,
259 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
261 {&hf_mplstp_fm_reserved
,
262 {"Reserved", "mplstp_oam.reserved", FT_UINT8
,
263 BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}},
265 {&hf_mplstp_fm_refresh_timer
,
266 {"Refresh-timer value", "mplstp_oam.refresh.timer", FT_UINT8
,
267 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
269 {&hf_mplstp_fm_total_tlv_len
,
270 {"FM TLV Length", "mplstp_oam.total.tlv.len", FT_UINT8
,
271 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
273 {&hf_mplstp_fm_if_tlv_type
,
274 {"Type : IF-ID TLV", "mplstp_oam.if_id_tlv_type", FT_UINT8
,
275 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
277 {&hf_mplstp_fm_global_tlv_type
,
278 {"Type : GLOBAL-ID TLV", "mplstp_oam.global_id_tlv_type", FT_UINT8
,
279 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
281 {&hf_mplstp_fm_tlv_len
,
282 {"Length", "mplstp_oam.tlv_len", FT_UINT8
,
283 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
285 {&hf_mplstp_fm_node_id
,
286 {"Node id", "mplstp_oam.node_id", FT_IPv4
,
287 BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}},
289 {&hf_mplstp_fm_if_num
,
290 {"Interface Number", "mplstp_oam.if_num", FT_UINT32
,
291 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
293 {&hf_mplstp_fm_global_id
,
294 {"Global id", "mplstp_oam.global_id", FT_UINT32
,
295 BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}},
297 {&hf_mplstp_fm_msg_type
,
298 {"Message Type", "mplstp_oam.message.type", FT_UINT8
,
299 BASE_DEC
, VALS(fm_msg_type
), 0x0, "MPLS-TP FM Message Type", HFILL
}},
301 { &hf_mplstp_fm_flags
,
302 { "FM Flags", "mplstp_oam.flags",
303 FT_UINT8
, BASE_HEX
, NULL
, 0x0000, "MPLS-TP FM Flags", HFILL
}
306 { &hf_mplstp_fm_flags_l
,
307 { "Link Down Indication", "mplstp_oam.flag_l",
308 FT_BOOLEAN
, 8, NULL
, 0x0002, NULL
, HFILL
}
311 { &hf_mplstp_fm_flags_r
,
312 { "FM Condition Cleared", "mplstp_oam.flag_r",
313 FT_BOOLEAN
, 8, NULL
, 0x0001, "Fault Condition Cleared", HFILL
}
317 static gint
*ett
[] = {
319 &ett_mplstp_fm_tlv_tree
,
320 &ett_mplstp_fm_flags
,
324 proto_register_protocol("MPLS-TP Fault-Management", "MPLS[-TP] Fault-Management "
325 "Fault-Management (FM) Protocol",
328 proto_register_field_array(proto_mplstp_fm
, hf
, array_length(hf
));
329 proto_register_subtree_array(ett
, array_length(ett
));
331 register_dissector("mplstp_fm", dissect_mplstp_fm
, proto_mplstp_fm
);