Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-msdp.c
blobce580cb70ccac36dba7d4b4cc021c93594e808ef
1 /* packet-msdp.c
2 * Routines for Multicast Source Discovery Protocol (MSDP) dissection.
3 * RFC 3618
5 * Copyright 2001, Heikki Vatiainen <hessu@cs.tut.fi>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/to_str.h>
18 #include <epan/expert.h>
20 void proto_register_msdp(void);
21 void proto_reg_handoff_msdp(void);
23 /* MSDP (Type-Length-Value) TLV types. The messages are a sequence of TLVs. */
24 enum { MSDP_SA = 1,
25 MSDP_SA_REQ,
26 MSDP_SA_RSP,
27 MSDP_KEEP_ALIVE,
28 MSDP_NOTIFICATION, /* draft 10, but not RFC 3618 */
30 /* These are only assigned in MSDP spec. Their use is specified
31 * elsewhere */
32 MSDP_TRACE_IN_PROGRESS,
33 MSDP_TRACE_REPLY
36 static const value_string msdp_types[] = {
37 { MSDP_SA, "IPv4 Source-Active" },
38 { MSDP_SA_REQ, "IPv4 Source-Active Request" },
39 { MSDP_SA_RSP, "IPv4 Source-Active Response" },
40 { MSDP_KEEP_ALIVE, "KeepAlive" },
41 { MSDP_NOTIFICATION, "Notification" },
43 { MSDP_TRACE_IN_PROGRESS, "MSDP traceroute in progress" },
44 { MSDP_TRACE_REPLY, "MSDP traceroute reply" },
45 { 0, NULL },
49 /* Error codes */
50 enum { MESSAGE_HEADER_ERROR = 1,
51 SA_REQUEST_ERROR,
52 SA_MESSAGE_SA_RESPONSE_ERROR,
53 HOLD_TIMER_EXPIRED,
54 FSM_ERROR,
55 NOTIFICATION,
56 CEASE
59 static const value_string error_vals[] = {
60 { MESSAGE_HEADER_ERROR, "Message Header Error" },
61 { SA_REQUEST_ERROR, "SA-Request Error" },
62 { SA_MESSAGE_SA_RESPONSE_ERROR, "SA-Message/SA-Response Error" },
63 { HOLD_TIMER_EXPIRED, "Hold Timer Expired" },
64 { FSM_ERROR, "Finite State Machine Error" },
65 { NOTIFICATION, "Notification" },
66 { CEASE, "Cease" },
67 { 0, NULL },
71 /* Message Header Error subcodes */
72 static const value_string hdr_error_vals[] = {
73 { 0, "Unspecific" },
74 { 2, "Bad Message Length" },
75 { 3, "Bad Message Type" },
76 { 0, NULL },
79 /* SA-Request Error subcodes (the O-bit is always clear) */
80 static const value_string sa_req_error_vals[] = {
81 { 0, "Unspecific" },
82 { 1, "Invalid Group" },
83 { 0, NULL },
86 /* SA-Message/SA-Response Error subcodes */
87 static const value_string sa_msg_error_vals[] = {
88 { 0, "Unspecific" },
89 { 1, "Invalid Entry Count" },
90 { 2, "Invalid RP Address" },
91 { 3, "Invalid Group Address" },
92 { 4, "Invalid Source Address" },
93 { 5, "Invalid Sprefix Length" },
94 { 6, "Looping SA (Self is RP)" },
95 { 7, "Unknown Encapsulation" },
96 { 8, "Administrative Scope Boundary Violated" },
97 { 0, NULL },
100 /* Finite State Machine Error subcodes (the O-bit is always clear) */
101 static const value_string fsm_error_vals[] = {
102 { 0, "Unspecific" },
103 { 1, "Unexpected Message Type FSM Error" },
104 { 0, NULL },
108 * Hold Timer Expired subcodes (the O-bit is always clear):
109 * Notification subcodes (the O-bit is always clear):
110 * Cease subcodes (the O-bit is always clear):
112 * These have only "Unspecific" specified.
114 static const value_string sa_unspec_error_vals[] = {
115 { 0, "Unspecific" },
116 { 0, NULL },
119 #define MSDP_PORT 639
121 /* Initialize the protocol and registered fields */
122 static int proto_msdp;
123 static int hf_msdp_type;
124 static int hf_msdp_length;
126 static int hf_msdp_sa_entry_count;
127 static int hf_msdp_sa_rp_addr;
128 static int hf_msdp_sa_reserved;
129 static int hf_msdp_sa_sprefix_len;
130 static int hf_msdp_sa_group_addr;
131 static int hf_msdp_sa_src_addr;
133 static int hf_msdp_sa_req_res;
134 static int hf_msdp_sa_req_group;
136 static int hf_msdp_not_o;
137 static int hf_msdp_not_error;
138 static int hf_msdp_not_error_sub;
140 static int hf_msdp_not_group_address;
141 static int hf_msdp_not_rp_address;
142 static int hf_msdp_not_source_address;
143 static int hf_msdp_not_res;
144 static int hf_msdp_not_entry_count;
145 static int hf_msdp_not_sprefix_len;
147 static int hf_msdp_tlv_contents;
148 static int hf_msdp_trailing_junk;
149 static int hf_msdp_unknown_data;
151 static int ett_msdp;
152 static int ett_msdp_sa_entry;
153 static int ett_msdp_sa_enc_data;
154 static int ett_msdp_not_data;
156 static expert_field ei_msdp_tlv_len_too_short;
157 static expert_field ei_msdp_tlv_len_too_long;
159 static dissector_handle_t msdp_handle;
160 static dissector_handle_t ip_handle;
163 static void
164 dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
165 int *offset, int length, proto_item *length_item);
166 static void
167 dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
168 int *offset, uint16_t tlv_len, proto_item *length_item);
171 static int
172 // NOLINTNEXTLINE(misc-no-recursion)
173 dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
175 proto_item *ti;
176 proto_tree *msdp_tree;
177 proto_item *length_item;
178 int offset;
179 uint32_t type;
180 uint32_t length;
183 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSDP");
185 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_uint8(tvb, 0),
186 msdp_types,
187 "<Unknown MSDP TLV type>"));
189 ti = proto_tree_add_item(tree, proto_msdp, tvb, 0, -1, ENC_NA);
190 msdp_tree = proto_item_add_subtree(ti, ett_msdp);
192 offset = 0;
193 increment_dissection_depth(pinfo);
194 while (tvb_reported_length_remaining(tvb, offset) != 0) {
195 proto_tree_add_item_ret_uint(msdp_tree, hf_msdp_type, tvb, offset, 1, ENC_BIG_ENDIAN, &type);
196 length_item = proto_tree_add_item_ret_uint(msdp_tree, hf_msdp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN, &length);
197 if (length < 3) {
198 expert_add_info_format(pinfo, length_item,
199 &ei_msdp_tlv_len_too_short,
200 "TLV length < 3");
201 break;
203 offset += 3;
204 length -= 3;
206 switch (type) {
207 case MSDP_SA:
208 dissect_msdp_sa(tvb, pinfo, msdp_tree, &offset,
209 length, length_item);
210 break;
211 case MSDP_SA_REQ:
213 * This type is mentioned in the RFC but the format
214 * isn't described.
216 if (length < 1) {
217 expert_add_info_format(pinfo, length_item,
218 &ei_msdp_tlv_len_too_short,
219 "TLV length for IPv4 Source-Active Request < 8");
220 break;
222 proto_tree_add_item(msdp_tree, hf_msdp_sa_req_res, tvb, offset, 1, ENC_BIG_ENDIAN);
223 offset += 1;
224 length -= 1;
225 if (length < 4) {
226 expert_add_info_format(pinfo, length_item,
227 &ei_msdp_tlv_len_too_short,
228 "TLV length for IPv4 Source-Active Request < 8");
229 offset += length;
230 break;
232 proto_tree_add_item(msdp_tree, hf_msdp_sa_req_group, tvb, offset, 4, ENC_BIG_ENDIAN);
233 offset += 4;
234 length -= 4;
235 if (length > 0) {
236 expert_add_info_format(pinfo, length_item,
237 &ei_msdp_tlv_len_too_long,
238 "TLV length for KeepAlive > 8");
239 proto_tree_add_item(tree, hf_msdp_trailing_junk, tvb, offset, length, ENC_NA);
240 offset += length;
242 break;
243 case MSDP_SA_RSP:
245 * This type is mentioned in the RFC but the format
246 * isn't described.
248 dissect_msdp_sa(tvb, pinfo, msdp_tree, &offset,
249 length, length_item);
250 break;
251 case MSDP_KEEP_ALIVE:
252 if (length > 0) {
253 expert_add_info_format(pinfo, length_item,
254 &ei_msdp_tlv_len_too_long,
255 "TLV length for KeepAlive > 3");
256 proto_tree_add_item(tree, hf_msdp_trailing_junk, tvb, offset, length, ENC_NA);
257 offset += length;
259 break;
260 case MSDP_NOTIFICATION:
262 * This was in draft 10, but is reserved in the
263 * RFC.
265 dissect_msdp_notification(tvb, pinfo, msdp_tree, &offset, length, length_item);
266 break;
267 default:
268 if (length > 0)
269 proto_tree_add_item(msdp_tree, hf_msdp_tlv_contents, tvb, offset, length, ENC_NA);
270 offset += length;
271 break;
274 decrement_dissection_depth(pinfo);
276 return tvb_captured_length(tvb);
279 /* Both Source-Active and Source-Active Response have the same format
280 * with one exception. Encapsulated multicast data is not allowed in
281 * SA Response.
283 static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo,
284 proto_tree *tree, int *offset, int length, proto_item *length_item)
286 uint32_t entries;
288 if (length < 1) {
289 expert_add_info_format(pinfo, length_item,
290 &ei_msdp_tlv_len_too_short,
291 "TLV length for IPv4 Source-Active or Source-Active Response < 5");
292 return;
294 proto_tree_add_item_ret_uint(tree, hf_msdp_sa_entry_count, tvb, *offset, 1, ENC_BIG_ENDIAN, &entries);
295 *offset += 1;
296 length -= 1;
298 if (length < 4) {
299 expert_add_info_format(pinfo, length_item,
300 &ei_msdp_tlv_len_too_short,
301 "TLV length for IPv4 Source-Active or Source-Active Response < 5");
302 *offset += length;
303 return;
305 proto_tree_add_item(tree, hf_msdp_sa_rp_addr, tvb, *offset, 4, ENC_BIG_ENDIAN);
306 *offset += 4;
307 length -= 4;
309 /* Put each of the (S,G) entries in their own subtree.
310 * This is probably visually better.
312 while (entries-- > 0) {
313 proto_tree *entry_tree;
315 if (length < 12) {
316 expert_add_info_format(pinfo, length_item,
317 &ei_msdp_tlv_len_too_short,
318 "TLV length for IPv4 Source-Active or Source-Active Response too short");
319 *offset += length;
320 return;
322 entry_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 12, ett_msdp_sa_entry, NULL,
323 "(S,G) block: %s/%u -> %s",
324 tvb_ip_to_str(pinfo->pool, tvb, *offset + 8),
325 tvb_get_uint8(tvb, *offset + 3),
326 tvb_ip_to_str(pinfo->pool, tvb, *offset + 4));
328 proto_tree_add_item(entry_tree, hf_msdp_sa_reserved, tvb, *offset, 3, ENC_BIG_ENDIAN);
329 *offset += 3;
330 length -= 3;
331 proto_tree_add_item(entry_tree, hf_msdp_sa_sprefix_len, tvb, *offset, 1, ENC_BIG_ENDIAN);
332 *offset += 1;
333 length -= 1;
334 proto_tree_add_item(entry_tree, hf_msdp_sa_group_addr, tvb, *offset, 4, ENC_BIG_ENDIAN);
335 *offset += 4;
336 length -= 4;
337 proto_tree_add_item(entry_tree, hf_msdp_sa_src_addr, tvb, *offset, 4, ENC_BIG_ENDIAN);
338 *offset += 4;
339 length -= 4;
343 * Check if an encapsulated multicast IPv4 packet follows
345 if (length > 0) {
346 proto_tree *enc_tree;
347 int reported_length;
348 tvbuff_t *next_tvb;
350 enc_tree = proto_tree_add_subtree_format(tree, tvb, *offset, length,
351 ett_msdp_sa_enc_data, NULL, "Encapsulated IPv4 packet: %u bytes",
352 length);
354 reported_length = tvb_reported_length_remaining(tvb, *offset);
355 DISSECTOR_ASSERT(reported_length >= 0);
356 if (reported_length > length)
357 reported_length = length;
359 next_tvb = tvb_new_subset_length(tvb, *offset, reported_length);
360 /* Set the protocol and information columns read-only so
361 * that they reflect the MSDP packet rather than the
362 * encapsulated packet.
364 col_set_writable(pinfo->cinfo, COL_PROTOCOL, false);
365 col_set_writable(pinfo->cinfo, COL_INFO, false);
366 call_dissector(ip_handle, next_tvb, pinfo, enc_tree);
368 *offset += length;
370 return;
373 /* Note: updates *offset */
374 static void add_notification_data_ipv4addr(tvbuff_t *tvb, proto_tree *tree, int *offset, int hf_addr)
376 proto_tree_add_item(tree, hf_msdp_not_res, tvb, *offset, 3, ENC_BIG_ENDIAN);
377 *offset += 3;
378 proto_tree_add_item(tree, hf_addr, tvb, *offset, 4, ENC_BIG_ENDIAN);
379 *offset += 4;
381 return;
384 // NOLINTNEXTLINE(misc-no-recursion)
385 static void dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, uint16_t tlv_len, proto_item *length_item)
387 uint8_t error, error_sub;
388 const value_string *vals;
389 int reported_length;
390 tvbuff_t *next_tvb;
392 if (tlv_len < 1) {
393 expert_add_info_format(pinfo, length_item,
394 &ei_msdp_tlv_len_too_short,
395 "TLV length for Notification < 4");
396 return;
398 proto_tree_add_item(tree, hf_msdp_not_o, tvb, *offset, 1, ENC_BIG_ENDIAN);
399 proto_tree_add_item(tree, hf_msdp_not_error, tvb, *offset, 1, ENC_BIG_ENDIAN);
400 error = tvb_get_uint8(tvb, *offset);
401 error &= 0x7F; /* Error is 7-bit field. O-bit is bit 8 */
402 *offset += 1;
403 tlv_len -= 1;
405 /* Depending on the Error Code, we collect the correct
406 * value_strings for the Error subcode
408 switch (error) {
409 case MESSAGE_HEADER_ERROR:
410 vals = hdr_error_vals;
411 break;
412 case SA_REQUEST_ERROR:
413 vals = sa_req_error_vals;
414 break;
415 case SA_MESSAGE_SA_RESPONSE_ERROR:
416 vals = sa_msg_error_vals;
417 break;
418 case FSM_ERROR:
419 vals = fsm_error_vals;
420 break;
421 case HOLD_TIMER_EXPIRED:
422 case NOTIFICATION:
423 case CEASE:
424 vals = sa_unspec_error_vals;
425 break;
426 default:
427 vals = sa_unspec_error_vals;
428 break;
431 if (tlv_len < 1) {
432 expert_add_info_format(pinfo, length_item,
433 &ei_msdp_tlv_len_too_short,
434 "TLV length for Notification < 5");
435 return;
437 error_sub = tvb_get_uint8(tvb, *offset);
438 proto_tree_add_uint_format_value(tree, hf_msdp_not_error_sub, tvb, *offset, 1,
439 error_sub, "%s (%u)",
440 val_to_str_const(error_sub, vals, "<Unknown Error subcode>"),
441 error_sub);
442 *offset += 1;
443 tlv_len -= 1;
445 /* Do switch again, this time to dissect the data portion
446 * correctly. Ugly.
448 switch (error) {
449 case SA_REQUEST_ERROR:
450 if (tlv_len < 7) {
451 expert_add_info_format(pinfo, length_item,
452 &ei_msdp_tlv_len_too_short,
453 "TLV length for Notification SA-Request Error < 12");
454 *offset += tlv_len;
455 return;
457 add_notification_data_ipv4addr(tvb, tree, offset, hf_msdp_not_group_address);
458 tlv_len -= 7;
459 break;
460 case SA_MESSAGE_SA_RESPONSE_ERROR:
461 if (error_sub == 0) {
462 break;
463 } else if (error_sub == 1) {
464 if (tlv_len < 1) {
465 expert_add_info_format(pinfo, length_item,
466 &ei_msdp_tlv_len_too_short,
467 "TLV length for Notification SA-Response Invalid Entry Count Error < 6");
468 return;
470 proto_tree_add_item(tree, hf_msdp_not_entry_count, tvb, *offset, 1, ENC_BIG_ENDIAN);
471 *offset += 1;
472 tlv_len -= 1;
473 break;
474 } else if (error_sub == 2) {
475 if (tlv_len < 7) {
476 expert_add_info_format(pinfo, length_item,
477 &ei_msdp_tlv_len_too_short,
478 "TLV length for Notification SA-Response Invalid RP Address Error < 12");
479 *offset += tlv_len;
480 return;
482 add_notification_data_ipv4addr(tvb, tree, offset, hf_msdp_not_rp_address);
483 tlv_len -= 7;
484 break;
485 } else if (error_sub == 3 || error_sub == 8) {
486 if (tlv_len < 7) {
487 expert_add_info_format(pinfo, length_item,
488 &ei_msdp_tlv_len_too_short,
489 "TLV length for Notification SA-Response %s Error < 12",
490 (error_sub == 3) ? "Invalid Group Address"
491 : "Administrative Scope Boundary Violated");
492 *offset += tlv_len;
493 return;
495 add_notification_data_ipv4addr(tvb, tree, offset, hf_msdp_not_group_address);
496 tlv_len -= 7;
497 break;
498 } else if (error_sub == 4) {
499 if (tlv_len < 7) {
500 expert_add_info_format(pinfo, length_item,
501 &ei_msdp_tlv_len_too_short,
502 "TLV length for Notification SA-Response Invalid Source Address Error < 12");
503 *offset += tlv_len;
504 return;
506 add_notification_data_ipv4addr(tvb, tree, offset, hf_msdp_not_source_address);
507 tlv_len -= 7;
508 break;
509 } else if (error_sub == 5) {
510 if (tlv_len < 1) {
511 expert_add_info_format(pinfo, length_item,
512 &ei_msdp_tlv_len_too_short,
513 "TLV length for Notification SA-Response Invalid Sprefix Length Error < 6");
514 return;
516 proto_tree_add_item(tree, hf_msdp_not_sprefix_len, tvb, *offset, 1, ENC_BIG_ENDIAN);
517 *offset += 1;
518 tlv_len -= 1;
519 break;
520 } else if (error_sub == 6) {
521 if (tlv_len > 0) {
522 reported_length = tvb_reported_length_remaining(tvb, *offset);
523 DISSECTOR_ASSERT(reported_length >= 0);
524 if (reported_length > tlv_len)
525 reported_length = tlv_len;
526 next_tvb = tvb_new_subset_length(tvb, *offset, reported_length);
527 dissect_msdp(next_tvb, pinfo, tree, NULL);
529 *offset += tlv_len;
530 tlv_len = 0;
531 } else if (error_sub == 7) {
532 if (tlv_len > 0) {
533 reported_length = tvb_reported_length_remaining(tvb, *offset);
534 DISSECTOR_ASSERT(reported_length >= 0);
535 if (reported_length > tlv_len)
536 reported_length = tlv_len;
537 next_tvb = tvb_new_subset_length(tvb, *offset, reported_length);
538 dissect_msdp(next_tvb, pinfo, tree, NULL);
540 *offset += tlv_len;
541 tlv_len = 0;
542 break;
543 } else {
544 if (tlv_len > 0)
545 proto_tree_add_item(tree, hf_msdp_unknown_data, tvb, *offset, tlv_len, ENC_NA);
546 *offset += tlv_len;
547 tlv_len = 0;
548 break;
550 break;
551 case MESSAGE_HEADER_ERROR:
552 case NOTIFICATION:
553 /* Data contains the message that had an error. Even a
554 * broken Notification message causes a Notification
555 * message with Error Code set to Notification to be
556 * sent back.
558 if (tlv_len > 0) {
559 reported_length = tvb_reported_length_remaining(tvb, *offset);
560 DISSECTOR_ASSERT(reported_length >= 0);
561 if (reported_length > tlv_len)
562 reported_length = tlv_len;
563 next_tvb = tvb_new_subset_length(tvb, *offset, reported_length);
564 dissect_msdp(next_tvb, pinfo, tree, NULL);
566 *offset += tlv_len;
567 tlv_len = 0;
568 break;
569 case FSM_ERROR:
570 case HOLD_TIMER_EXPIRED:
571 case CEASE:
572 /* Do nothing. These contain no data */
573 break;
574 default:
575 if (tlv_len > 0)
576 proto_tree_add_item(tree, hf_msdp_unknown_data, tvb, *offset, tlv_len, ENC_NA);
577 *offset += tlv_len;
578 tlv_len = 0;
579 break;
581 if (tlv_len != 0) {
582 expert_add_info_format(pinfo, length_item,
583 &ei_msdp_tlv_len_too_long,
584 "TLV length too long");
585 proto_tree_add_item(tree, hf_msdp_trailing_junk, tvb, *offset, tlv_len, ENC_NA);
586 *offset += tlv_len;
589 return;
592 void
593 proto_register_msdp(void)
595 static hf_register_info hf[] = {
596 { &hf_msdp_type,
597 { "Type", "msdp.type",
598 FT_UINT8, BASE_DEC, VALS(msdp_types), 0,
599 "MSDP TLV type", HFILL }
601 { &hf_msdp_length,
602 { "Length", "msdp.length",
603 FT_UINT16, BASE_DEC, NULL, 0,
604 "MSDP TLV Length", HFILL }
606 { &hf_msdp_sa_entry_count,
607 { "Entry Count", "msdp.sa.entry_count",
608 FT_UINT8, BASE_DEC, NULL, 0,
609 "MSDP SA Entry Count", HFILL }
611 { &hf_msdp_sa_rp_addr,
612 { "RP Address", "msdp.sa.rp_addr",
613 FT_IPv4, BASE_NONE, NULL, 0,
614 "Active source's RP address", HFILL }
616 { &hf_msdp_sa_reserved,
617 { "Reserved", "msdp.sa.reserved",
618 FT_UINT24, BASE_HEX, NULL, 0,
619 "Transmitted as zeros and ignored by a receiver", HFILL }
621 { &hf_msdp_sa_sprefix_len,
622 { "Sprefix len", "msdp.sa.sprefix_len",
623 FT_UINT8, BASE_DEC, NULL, 0,
624 "The route prefix length associated with source address", HFILL }
626 { &hf_msdp_sa_group_addr,
627 { "Group Address", "msdp.sa.group_addr",
628 FT_IPv4, BASE_NONE, NULL, 0,
629 "The group address the active source has sent data to", HFILL }
631 { &hf_msdp_sa_src_addr,
632 { "Source Address", "msdp.sa.src_addr",
633 FT_IPv4, BASE_NONE, NULL, 0,
634 "The IP address of the active source", HFILL }
636 { &hf_msdp_sa_req_res,
637 { "Reserved", "msdp.sa_req.res",
638 FT_UINT8, BASE_HEX, NULL, 0,
639 "Transmitted as zeros and ignored by a receiver", HFILL }
641 { &hf_msdp_sa_req_group,
642 { "Group Address", "msdp.sa_req.group_addr",
643 FT_IPv4, BASE_NONE, NULL, 0,
644 "The group address the MSDP peer is requesting", HFILL }
646 { &hf_msdp_not_o,
647 { "Open-bit", "msdp.not.o",
648 FT_UINT8, BASE_HEX, NULL, 0x80,
649 "If clear, the connection will be closed", HFILL }
651 { &hf_msdp_not_error,
652 { "Error Code", "msdp.not.error",
653 FT_UINT8, BASE_DEC, VALS(error_vals), 0x7F,
654 "Indicates the type of Notification", HFILL }
656 { &hf_msdp_not_error_sub,
657 { "Error subcode", "msdp.not.error_sub",
658 FT_UINT8, BASE_DEC, NULL, 0,
659 NULL, HFILL }
661 { &hf_msdp_not_group_address,
662 { "Group address", "msdp.not.group_address",
663 FT_IPv4, BASE_NONE, NULL, 0,
664 "Group address in Notification messages", HFILL }
666 { &hf_msdp_not_rp_address,
667 { "RP address", "msdp.not.rp_address",
668 FT_IPv4, BASE_NONE, NULL, 0,
669 "RP address in Notification messages", HFILL }
671 { &hf_msdp_not_source_address,
672 { "Source address", "msdp.not.source_address",
673 FT_IPv4, BASE_NONE, NULL, 0,
674 "Source address in Notification messages", HFILL }
676 { &hf_msdp_not_res,
677 { "Reserved", "msdp.not.res",
678 FT_UINT24, BASE_HEX, NULL, 0,
679 "Reserved field in Notification messages", HFILL }
681 { &hf_msdp_not_entry_count,
682 { "Entry Count", "msdp.not.entry_count",
683 FT_UINT24, BASE_HEX, NULL, 0,
684 "Entry Count in Notification messages", HFILL }
686 { &hf_msdp_not_sprefix_len,
687 { "Sprefix len", "msdp.not.sprefix_len",
688 FT_UINT8, BASE_DEC, NULL, 0,
689 "Source prefix length in Notification messages", HFILL }
691 { &hf_msdp_tlv_contents,
692 { "TLV contents", "msdp.tlv_contents",
693 FT_BYTES, BASE_NONE, NULL, 0,
694 NULL, HFILL }
696 { &hf_msdp_trailing_junk,
697 { "Trailing junk", "msdp.trailing_junk",
698 FT_BYTES, BASE_NONE, NULL, 0,
699 NULL, HFILL }
701 { &hf_msdp_unknown_data,
702 { "Unknown data", "msdp.unknown_data",
703 FT_BYTES, BASE_NONE, NULL, 0,
704 NULL, HFILL }
708 static int *ett[] = {
709 &ett_msdp,
710 &ett_msdp_sa_entry,
711 &ett_msdp_sa_enc_data,
712 &ett_msdp_not_data,
715 static ei_register_info ei[] = {
716 { &ei_msdp_tlv_len_too_long,
717 { "msdp.tlv_len.too_long", PI_PROTOCOL, PI_WARN,
718 "TLV length too long", EXPFILL }
720 { &ei_msdp_tlv_len_too_short,
721 { "msdp.tlv_len.too_short", PI_MALFORMED, PI_ERROR,
722 "TLV length too short", EXPFILL }
726 expert_module_t *expert_msdp;
728 proto_msdp = proto_register_protocol("Multicast Source Discovery Protocol",
729 "MSDP", "msdp");
730 msdp_handle = register_dissector("msdp", dissect_msdp, proto_msdp);
732 proto_register_field_array(proto_msdp, hf, array_length(hf));
733 proto_register_subtree_array(ett, array_length(ett));
734 expert_msdp = expert_register_protocol(proto_msdp);
735 expert_register_field_array(expert_msdp, ei, array_length(ei));
738 void
739 proto_reg_handoff_msdp(void)
741 dissector_add_uint_with_preference("tcp.port", MSDP_PORT, msdp_handle);
743 ip_handle = find_dissector_add_dependency("ip", proto_msdp);
747 * Editor modelines
749 * Local Variables:
750 * c-basic-offset: 8
751 * tab-width: 8
752 * indent-tabs-mode: nil
753 * End:
755 * ex: set shiftwidth=8 tabstop=8 expandtab:
756 * :indentSize=8:tabSize=8:noTabs=true: