From 5b9879806d293938820e657354e5e631437ce1bf Mon Sep 17 00:00:00 2001 From: Simon Zhong Date: Fri, 10 Mar 2017 13:49:29 -0500 Subject: BGP: Fix the issue that SAFI 72 (BGP-LS-VPN) was not decoded. Change-Id: I2aef41458c89975dddea4d8bb6355bb7aabd1cad Reviewed-on: https://code.wireshark.org/review/20488 Reviewed-by: Anders Broman --- epan/afn.c | 2 +- epan/afn.h | 2 +- epan/dissectors/packet-bgp.c | 24 +++++++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/epan/afn.c b/epan/afn.c index e1a70d17e1..4574dfa11c 100644 --- a/epan/afn.c +++ b/epan/afn.c @@ -57,7 +57,7 @@ const value_string afn_vals[] = { { AFNUM_EIGRP_IPV4, "EIGRP IPv4 Service Family" }, { AFNUM_EIGRP_IPV6, "EIGRP IPv6 Service Family" }, { AFNUM_LCAF, "LISP Canonical Address Format (LCAF)" }, - { AFNUM_LINK_STATE, "Link State and TE information" }, + { AFNUM_BGP_LS, "BGP-LS" }, { AFNUM_EUI48, "48-bit MAC Address" }, { AFNUM_EUI64, "64-bit MAC Address" }, { 65535, "Reserved" }, diff --git a/epan/afn.h b/epan/afn.h index 3b9fd56734..992e3b9d5d 100644 --- a/epan/afn.h +++ b/epan/afn.h @@ -64,7 +64,7 @@ extern "C" { #define AFNUM_EIGRP_IPV4 16385 /* EIGRP IPv4 Service Family */ #define AFNUM_EIGRP_IPV6 16386 /* EIGRP IPv6 Service Family */ #define AFNUM_LCAF 16387 /* LISP Canonical Address Format */ -#define AFNUM_LINK_STATE 16388 /* draft-ietf-idr-ls-distribution */ +#define AFNUM_BGP_LS 16388 /* RFC7752 */ #define AFNUM_EUI48 16389 /* 48-bit MAC Address */ #define AFNUM_EUI64 16390 /* 64-bit MAC Address */ diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index b3afc244c2..2efbeb9156 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -503,7 +503,8 @@ static dissector_handle_t bgp_handle; #define SAFNUM_VPLS 65 #define SAFNUM_MDT 66 /* rfc6037 */ #define SAFNUM_EVPN 70 /* EVPN RFC */ -#define SAFNUM_LINK_STATE 71 /* RFC7752 */ +#define SAFNUM_BGP_LS 71 /* RFC7752 */ +#define SAFNUM_BGP_LS_VPN 72 /* RFC7752 */ #define SAFNUM_LAB_VPNUNICAST 128 /* Draft-rosen-rfc2547bis-03 */ #define SAFNUM_LAB_VPNMULCAST 129 #define SAFNUM_LAB_VPNUNIMULC 130 @@ -1184,7 +1185,8 @@ static const value_string bgpattr_nlri_safi[] = { { SAFNUM_ENCAPSULATION, "Encapsulation"}, { SAFNUM_TUNNEL, "Tunnel"}, { SAFNUM_VPLS, "VPLS"}, - { SAFNUM_LINK_STATE, "Link State"}, + { SAFNUM_BGP_LS, "BGP-LS"}, + { SAFNUM_BGP_LS_VPN, "BGP-LS-VPN"}, { SAFNUM_LAB_VPNUNICAST, "Labeled VPN Unicast" }, /* draft-rosen-rfc2547bis-03 */ { SAFNUM_LAB_VPNMULCAST, "Labeled VPN Multicast" }, { SAFNUM_LAB_VPNUNIMULC, "Labeled VPN Unicast+Multicast" }, @@ -1646,7 +1648,7 @@ static int hf_bgp_mcast_vpn_nlri_route_key = -1; static int hf_bgp_ls_type = -1; static int hf_bgp_ls_length = -1; -static int hf_bgp_ls_safi72_nlri = -1; +static int hf_bgp_ls_nlri = -1; static int hf_bgp_ls_safi128_nlri = -1; static int hf_bgp_ls_safi128_nlri_route_distinguisher = -1; static int hf_bgp_ls_safi128_nlri_route_distinguisher_type = -1; @@ -3222,7 +3224,7 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, wmem_strbu break; } /* switch (safi) */ break; - case AFNUM_LINK_STATE: + case AFNUM_BGP_LS: length = nhlen; if (nhlen == 4) { wmem_strbuf_append(strbuf, tvb_ip_to_str(tvb, offset)); @@ -5275,14 +5277,14 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6, return -1; } /* switch (safi) */ break; - case AFNUM_LINK_STATE: + case AFNUM_BGP_LS: nlri_type = tvb_get_ntohs(tvb, offset); total_length = tvb_get_ntohs(tvb, offset + 2); length = total_length; total_length += 4; - if (safi == SAFNUM_LINK_STATE) { - ti = proto_tree_add_item(tree, hf_bgp_ls_safi72_nlri, tvb, offset, total_length , ENC_NA); + if (safi == SAFNUM_BGP_LS || safi == SAFNUM_BGP_LS_VPN) { + ti = proto_tree_add_item(tree, hf_bgp_ls_nlri, tvb, offset, total_length , ENC_NA); } else if (safi == SAFNUM_LAB_VPNUNICAST) { ti = proto_tree_add_item(tree, hf_bgp_ls_safi128_nlri, tvb, offset, total_length , ENC_NA); } else @@ -7049,7 +7051,7 @@ dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len, case AFNUM_INET6: case AFNUM_L2VPN: case AFNUM_L2VPN_OLD: - case AFNUM_LINK_STATE: + case AFNUM_BGP_LS: j = 0; while (j < nexthop_len) { @@ -7095,7 +7097,7 @@ dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len, ett_bgp_mp_reach_nlri, NULL, "Network layer reachability information (%u byte%s)", tlen, plurality(tlen, "", "s")); if (tlen) { - if (af != AFNUM_INET && af != AFNUM_INET6 && af != AFNUM_L2VPN && af != AFNUM_LINK_STATE) { + if (af != AFNUM_INET && af != AFNUM_INET6 && af != AFNUM_L2VPN && af != AFNUM_BGP_LS) { proto_tree_add_expert(subtree3, pinfo, &ei_bgp_unknown_afi, tvb, o + i + aoff, tlen); } else { while (tlen > 0) { @@ -9033,8 +9035,8 @@ proto_register_bgp(void) { &hf_bgp_ls_length, { "Length", "bgp.ls.length", FT_UINT16, BASE_DEC, NULL, 0x0, "The total length of the message payload in octets", HFILL }}, - { &hf_bgp_ls_safi72_nlri, - { "Link State SAFI 72 NLRI", "bgp.ls.nlri_safi72", FT_NONE, + { &hf_bgp_ls_nlri, + { "BGP-LS NLRI", "bgp.ls.nlri", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_bgp_ls_safi128_nlri, { "Link State SAFI 128 NLRI", "bgp.ls.nlri_safi128", FT_NONE, -- cgit v1.2.3