diff options
author | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-11-28 17:59:54 +0000 |
---|---|---|
committer | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-11-28 17:59:54 +0000 |
commit | 2b89c2a0c94fa72880cc4566ee0514b340c69070 (patch) | |
tree | b146bf32d53ea6c5a732d1d65c5d6fbb91a09ba0 /epan/dissectors | |
parent | 9549d911d740dc1bbb4e3af4a91c8d62a9d5e9d5 (diff) |
From Krishnamurthy Mayya:
Part of patch:
2. BFD extension has been added as per RFC 6428, to decode the BFD packet with
ACH encapsulation(without IP/UDP header encapsulation). The channel type in ACH
header identifies the BFD payload as BFD CC or CV packet. Also decoding for
MPLS-TP source MEP-ID TLV in BFD CV packet has been added.
applied with a change to add packet-bfd.h
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6610#add_comment
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40029 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-bfd.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-bfd.h | 30 | ||||
-rw-r--r-- | epan/dissectors/packet-mpls.c | 61 | ||||
-rw-r--r-- | epan/dissectors/packet-mpls.h | 1 |
4 files changed, 97 insertions, 3 deletions
diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c index 08db74e778..9594010512 100644 --- a/epan/dissectors/packet-bfd.c +++ b/epan/dissectors/packet-bfd.c @@ -37,6 +37,8 @@ #include <epan/packet.h> #include <epan/expert.h> +#include "packet-bfd.h" + #define UDP_PORT_BFD_1HOP_CONTROL 3784 /* draft-katz-ward-bfd-v4v6-1hop-00.txt */ #define UDP_PORT_BFD_MULTIHOP_CONTROL 4784 /* draft-ietf-bfd-multihop-05.txt */ @@ -357,7 +359,8 @@ static void dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_ } -void dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +void +dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gint bfd_version = -1; gint bfd_diag = -1; @@ -553,7 +556,8 @@ void dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* BFD CV Source MEP-ID TLV Decoder, As per RFC 6428 : http://tools.ietf.org/html/rfc6428 sections - 3.5.1, 3.5.2, 3.5.3 */ -void dissect_bfd_mep (tvbuff_t *tvb, proto_tree *tree) +void +dissect_bfd_mep (tvbuff_t *tvb, proto_tree *tree) { gint offset = 0, mep_offset = 0; gint mep_type = -1; diff --git a/epan/dissectors/packet-bfd.h b/epan/dissectors/packet-bfd.h new file mode 100644 index 0000000000..a52f91541a --- /dev/null +++ b/epan/dissectors/packet-bfd.h @@ -0,0 +1,30 @@ +/* packet-bfd.h + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef PACKET_BFD_H +#define PACKET_BFD_H + +void dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +void dissect_bfd_mep (tvbuff_t *tvb, proto_tree *tree); + +#endif
\ No newline at end of file diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index f7cf91685d..981dc0a32a 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -56,6 +56,8 @@ # include "config.h" #endif +#include <string.h> + #include <epan/packet.h> #include <epan/ppptypes.h> @@ -63,10 +65,17 @@ #include <epan/prefs.h> #include <epan/ipproto.h> #include <epan/addr_resolv.h> + #include "packet-ppp.h" #include "packet-mpls.h" #include "packet-pw-common.h" -#include <string.h> +#include "packet-bfd.h" + +/* As per RFC 6428 http://tools.ietf.org/html/rfc6428, Section: 3.3 */ +#define ACH_TYPE_BFD_CC 0x0022 +#define ACH_TYPE_BFD_CV 0x0023 +/* As RFC 6426:http://tools.ietf.org/html/rfc6426, Section: 7.4 */ +#define ACH_TYPE_ONDEMAND_CV 0x0025 static gint proto_mpls = -1; static gint proto_pw_ach = -1; @@ -381,6 +390,7 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *mpls_pw_ach_tree = NULL; proto_item *ti = NULL; tvbuff_t *next_tvb = NULL; + int offset = 0; guint8 ver = 0; guint16 res = 0; guint16 channel_type = 0; @@ -407,6 +417,55 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "Error: this byte is reserved and must be 0"); else PROTO_ITEM_SET_HIDDEN(ti); + + if ((channel_type == ACH_TYPE_BFD_CC) || (channel_type == ACH_TYPE_BFD_CV) || + (channel_type == ACH_TYPE_ONDEMAND_CV)) { + switch (channel_type) { + case ACH_TYPE_BFD_CC: + + proto_tree_add_uint_format (mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type, + tvb, (offset + 2), 2, channel_type, + "Channel Type: %s (0x%04x)", + val_to_str (channel_type, mpls_pwac_types, + "BFD CC"), channel_type); + offset = offset + 4; + next_tvb = tvb_new_subset_remaining (tvb, offset); + dissect_bfd_control (next_tvb, pinfo, tree); + + break; + + case ACH_TYPE_BFD_CV: + + proto_tree_add_uint_format (mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type, + tvb, (offset + 2), 2, channel_type, + "Channel Type: %s (0x%04x)", + val_to_str (channel_type, mpls_pwac_types, + "BFD CV"), channel_type); + offset = offset + 4; + next_tvb = tvb_new_subset_remaining (tvb, offset); + dissect_bfd_control (next_tvb, pinfo, tree); + next_tvb = tvb_new_subset_remaining (tvb, offset); + dissect_bfd_mep (next_tvb, tree); + + break; + + case ACH_TYPE_ONDEMAND_CV: + + proto_tree_add_uint_format (mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type, + tvb, (offset + 2), 2, channel_type, + "Channel Type: %s (0x%04x)", + val_to_str (channel_type, mpls_pwac_types, "On-Demand CV"), + channel_type); + offset = offset + 4; + next_tvb = tvb_new_subset_remaining (tvb, offset); + dissect_mpls_echo (next_tvb, pinfo, tree); + + break; + } + return; + } + + proto_tree_add_uint_format(mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type, tvb, 2, 2, channel_type, "Channel Type: %s (0x%04x)", diff --git a/epan/dissectors/packet-mpls.h b/epan/dissectors/packet-mpls.h index 46e330a313..df038c61d3 100644 --- a/epan/dissectors/packet-mpls.h +++ b/epan/dissectors/packet-mpls.h @@ -50,5 +50,6 @@ extern void decode_mpls_label(tvbuff_t *tvb, int offset, guint8 *bos, guint8 *ttl); extern gboolean dissect_try_cw_first_nibble( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ); +void dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); #endif |