From 01147f8369e76927d7a90cfa0b592457a1878839 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 26 Oct 2016 21:09:43 +0200 Subject: [PATCH] LACP: Add HP IRF vendor TLV Change-Id: I8c0d18f104bf37686b9b53ad9e7d1b9f8a709f5c Reviewed-on: https://code.wireshark.org/review/18519 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-lacp.c | 68 ++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-lacp.c b/epan/dissectors/packet-lacp.c index 052eae05d2..d0cd4c1f4c 100644 --- a/epan/dissectors/packet-lacp.c +++ b/epan/dissectors/packet-lacp.c @@ -95,6 +95,14 @@ static int hf_lacp_term_reserved = -1; static int hf_lacp_vendor = -1; +static int hf_lacp_vendor_hp_length = -1; +static int hf_lacp_vendor_hp_irf_domain = -1; +static int hf_lacp_vendor_hp_irf_mac = -1; +static int hf_lacp_vendor_hp_irf_switch = -1; +static int hf_lacp_vendor_hp_irf_port = -1; +static int hf_lacp_vendor_hp_unknown = -1; + + /* Initialise the subtree pointers */ static gint ett_lacp = -1; @@ -339,7 +347,39 @@ dissect_lacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if(length_remaining) { proto_tree_add_item(lacpdu_tree, hf_lacp_vendor, tvb, offset, length_remaining, ENC_NA); - offset += length_remaining; + /* HP LACP MAD IRF, first bytes is always 0x64 and second bytes is the rest of length */ + if (length_remaining > 2 && (tvb_get_guint8(tvb, offset) == 0x64) && ((length_remaining -2) == tvb_get_guint8(tvb, offset+1)) ) + { + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_unknown, tvb, offset, 1, ENC_NA); + offset += 1; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_length, tvb, offset, 1, ENC_NA); + offset += 1; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_unknown, tvb, offset, 2, ENC_NA); + offset += 2; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_irf_domain, tvb, offset, 2, ENC_NA); + offset += 2; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_irf_mac, tvb, offset, 6, ENC_NA); + offset += 6; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_unknown, tvb, offset, 8, ENC_NA); + offset += 8; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_irf_switch, tvb, offset, 2, ENC_NA); + offset += 2; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_irf_port, tvb, offset, 2, ENC_NA); + offset += 2; + + proto_tree_add_item(lacpdu_tree, hf_lacp_vendor_hp_unknown, tvb, offset, 2, ENC_NA); + offset += 2; + + } else { + offset += length_remaining; + } } return offset; @@ -576,6 +616,32 @@ proto_register_lacp(void) { "Unknown vendor", "lacp.vendor", FT_BYTES, BASE_NONE, NULL, 0x0, "Some extra bytes (Vendor Specific ?)", HFILL }}, + + /* HP IRF MAD LACP */ + { &hf_lacp_vendor_hp_length, + { "Length", "lacp.vendor.hp.length", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The length of HP TLV", HFILL }}, + { &hf_lacp_vendor_hp_irf_domain, + { "IRF Domain", "lacp.vendor.hp.irf_domain", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + { &hf_lacp_vendor_hp_irf_mac, + { "IRF MAC", "lacp.vendor.hp.irf_mac", + FT_ETHER, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_lacp_vendor_hp_irf_switch, + { "IRF Switch", "lacp.vendor.hp.irf_switch", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of switch on the IRF stack", HFILL }}, + { &hf_lacp_vendor_hp_irf_port, + { "IRF Port", "lacp.vendor.hp.irf_port", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Stack ID where the LACP is attached", HFILL }}, + { &hf_lacp_vendor_hp_unknown, + { "Unknown", "lacp.vendor.hp.unknown", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; /* Setup protocol subtree array */