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 <a.broman58@gmail.com>
This commit is contained in:
Simon Zhong 2017-03-10 13:49:29 -05:00 committed by Anders Broman
parent 7119b6691f
commit 5b9879806d
3 changed files with 15 additions and 13 deletions

View File

@ -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" },

View File

@ -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 */

View File

@ -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,