diff options
author | Michael Pergament <mpergament@googlemail.com> | 2019-11-26 17:00:56 +0100 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2019-11-28 13:34:45 +0000 |
commit | 43701644196eba7b0114bf882ebb48fe35669816 (patch) | |
tree | 3b29605923b94c671cf72d166c95ef8b13ccdeb0 /epan/dissectors/packet-bgp.c | |
parent | 7c3ae2b5ab0b9f4c683c3dc8b520ed3c0cd99726 (diff) |
BGP: Add D-PATH Attribute
Add D-PATH Attribute as described in
draft-rabadan-sajassi-bess-evpn-ipvpn-interworking
Bug: 16238
Change-Id: If40699304fca1409a195b83075dd40c6769c2df4
Reviewed-on: https://code.wireshark.org/review/35223
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-bgp.c')
-rw-r--r-- | epan/dissectors/packet-bgp.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 78107d460d..465f30a412 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -229,6 +229,7 @@ static dissector_handle_t bgp_handle; #define BGPTYPE_31 31 /* Deprecated [RFC8093] */ #define BGPTYPE_LARGE_COMMUNITY 32 /* RFC8092 */ #define BGPTYPE_BGPSEC_PATH 33 /* BGPsec_PATH [RFC8205] */ +#define BGPTYPE_D_PATH 36 /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */ #define BGPTYPE_BGP_PREFIX_SID 40 /* BGP Prefix-SID [draft-ietf-idr-bgp-prefix-sid] */ #define BGPTYPE_LINK_STATE_OLD_ATTR 99 /* squatted value used by at least 2 implementations before IANA assignment */ @@ -985,6 +986,7 @@ static const value_string bgpattr_type[] = { { BGPTYPE_31, "Deprecated" }, { BGPTYPE_LARGE_COMMUNITY, "LARGE_COMMUNITY" }, { BGPTYPE_BGPSEC_PATH, "BGPsec_PATH" }, + { BGPTYPE_D_PATH, "D_PATH" }, { BGPTYPE_BGP_PREFIX_SID, "BGP Prefix-SID" }, { BGPTYPE_LINK_STATE_OLD_ATTR, "LINK_STATE (unofficial code point)" }, { BGPTYPE_ATTR_SET, "ATTR_SET" }, @@ -1677,6 +1679,11 @@ static int hf_bgp_update_path_attribute_bgpsec_sp_len = -1; static int hf_bgp_update_path_attribute_bgpsec_ski = -1; static int hf_bgp_update_path_attribute_bgpsec_sig_len = -1; static int hf_bgp_update_path_attribute_bgpsec_sig = -1; +static int hf_bgp_update_path_attribute_d_path = -1; +static int hf_bgp_d_path_ga = -1; +static int hf_bgp_d_path_la = -1; +static int hf_bgp_d_path_length = -1; +static int hf_bgp_d_path_isf_safi = -1; static int hf_bgp_evpn_nlri = -1; static int hf_bgp_evpn_nlri_rt = -1; static int hf_bgp_evpn_nlri_len = -1; @@ -2246,6 +2253,7 @@ static gint ett_bgp_mpls_labels = -1; static gint ett_bgp_pmsi_tunnel_id = -1; static gint ett_bgp_aigp_attr = -1; static gint ett_bgp_large_communities = -1; +static gint ett_bgp_dpath = -1; static gint ett_bgp_prefix_sid_originator_srgb = -1; static gint ett_bgp_prefix_sid_originator_srgb_block = -1; static gint ett_bgp_prefix_sid_originator_srgb_blocks = -1; @@ -8180,6 +8188,48 @@ dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len, alen, plurality(alen, "", "s")); } break; + case BGPTYPE_D_PATH: + if(tlen < 8){ + proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen, + "D-PATH attribute has invalid length (invalid): %u byte%s", tlen, + plurality(tlen, "", "s")); + break; + } + q = o + i + aoff; + end = q + tlen; + wmem_strbuf_t *dpath_strbuf; + dpath_strbuf = wmem_strbuf_new_label(wmem_packet_scope()); + guint8 dpath_len; + dpath_len = tvb_get_guint8(tvb, q); + proto_tree_add_item(subtree2, hf_bgp_d_path_length, tvb, + q, 1, ENC_BIG_ENDIAN); + q += 1; + while (dpath_len > 0 && q < end) { + guint32 ad; + guint16 ld; + ad = tvb_get_ntohl(tvb, q); + ld = tvb_get_ntohs(tvb, q+4); + ti = proto_tree_add_string_format(subtree2, hf_bgp_update_path_attribute_d_path, tvb, q, 6, NULL, "Domain ID: %u:%u", ad, ld); + subtree3 = proto_item_add_subtree(ti, ett_bgp_dpath); + proto_tree_add_item(subtree3, hf_bgp_d_path_ga, tvb, + q, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree3, hf_bgp_d_path_la, tvb, + q + 4, 2, ENC_BIG_ENDIAN); + wmem_strbuf_append_printf(dpath_strbuf, " %u:%u", ad, ld); + q += 6; + dpath_len -= 1; + } + if (dpath_len != 0 || q >= end) { + proto_tree_add_expert_format(subtree2, pinfo, &ei_bgp_length_invalid, tvb, o + i + aoff, tlen, + "D-PATH list (invalid): %u byte%s", tlen, + plurality(tlen, "", "s")); + break; + } + proto_item_append_text(ti_pa, ":%s", wmem_strbuf_get_str(dpath_strbuf)); + + proto_tree_add_item(subtree2, hf_bgp_d_path_isf_safi, tvb, + q, 1, ENC_BIG_ENDIAN); + break; default: proto_tree_add_item(subtree2, hf_bgp_update_path_attributes_unknown, tvb, o + i + aoff, tlen, ENC_NA); break; @@ -9338,6 +9388,23 @@ proto_register_bgp(void) {"Tunnel type ingress replication IP end point", "bgp.update.path_attribute.pmsi.ingress_rep_ip", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + /* https://tools.ietf.org/html/draft-rabadan-sajassi-bess-evpn-ipvpn-interworking-02 */ + { &hf_bgp_update_path_attribute_d_path, + { "Domain Path Attribute", "bgp.update.path_attribute.dpath", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + { &hf_bgp_d_path_length, + {"Domain Path Attribute length", "bgp.update.attribute.dpath.length", FT_UINT16, BASE_DEC, + NULL, 0x0, NULL, HFILL}}, + { &hf_bgp_d_path_ga, + { "Global Administrator", "bgp.update.attribute.dpath.ga", FT_UINT32, BASE_DEC, + NULL, 0x0, "A four-octet namespace identifier. This SHOULD be an Autonomous System Number", HFILL }}, + { &hf_bgp_d_path_la, + { "Local Administrator", "bgp.update.attribute.dpath.la", FT_UINT16, BASE_DEC, + NULL, 0x0, "A two-octet operator-defined value", HFILL }}, + { &hf_bgp_d_path_isf_safi, + { "Inter-Subnet Forwarding SAFI type", "bgp.update.attribute.dpath.isf.safi", FT_UINT8, BASE_DEC, + NULL, 0x0, NULL, HFILL }}, + /* RFC7311 */ { &hf_bgp_update_path_attribute_aigp, { "AIGP Attribute", "bgp.update.path_attribute.aigp", FT_NONE, BASE_NONE, @@ -10657,6 +10724,7 @@ proto_register_bgp(void) &ett_bgp_pmsi_tunnel_id, &ett_bgp_aigp_attr, &ett_bgp_large_communities, + &ett_bgp_dpath, &ett_bgp_prefix_sid_label_index, &ett_bgp_prefix_sid_ipv6, &ett_bgp_prefix_sid_originator_srgb, |