diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2020-01-28 07:10:27 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-01-29 14:17:39 +0000 |
commit | 09dbf2c979ba5172af441c9e1d60776ba5f6d662 (patch) | |
tree | e412cf760911629f1f6645b8903eb60af645f53f /epan | |
parent | d24fbbc5a0cdfbeb0cb8d45d7e15f3139bbcb647 (diff) |
LLDP: Add ONOS TLV (Chassis, Port and TTL)
Based from https://github.com/opennetworkinglab/onos/blob/master/utils/misc/src/main/java/org/onlab/packet/LLDP.java
Bug: 16227
Change-Id: If35b7b9d6088caf7809f84b1569d7259421bc717
Reviewed-on: https://code.wireshark.org/review/35971
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-lldp.c | 67 | ||||
-rw-r--r-- | epan/oui.h | 1 |
2 files changed, 68 insertions, 0 deletions
diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index c949815f65..e734c976ab 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -443,6 +443,10 @@ static int hf_unknown_subtype_content = -1; static int hf_subtype_content_remaining = -1; static int hf_iana_subtype = -1; static int hf_iana_mudurl = -1; +static int hf_onos_subtype = -1; +static int hf_onos_chassis = -1; +static int hf_onos_port = -1; +static int hf_onos_ttl = -1; /* Initialize the subtree pointers */ static gint ett_lldp = -1; @@ -749,6 +753,19 @@ static const value_string ex_avaya_subtypes[] = { { 0, NULL } }; +/* ONOS subtypes */ +/* https://github.com/opennetworkinglab/onos/blob/master/utils/misc/src/main/java/org/onlab/packet/LLDP.java */ +#define ONOS_CHASSIS_TLV_TYPE 1 +#define ONOS_PORT_TLV_TYPE 2 +#define ONOS_TTL_TLV_TYPE 3 +static const value_string onos_subtypes[] = { + { ONOS_CHASSIS_TLV_TYPE, "ONOS Chassis" }, + { ONOS_PORT_TLV_TYPE, "ONOS Port" }, + { ONOS_TTL_TLV_TYPE, "ONOS TTL" }, + { 0, NULL } +}; + + /* Cisco Subtypes */ static const value_string cisco_subtypes[] = { /* UPOE: https://www.cisco.com/c/dam/en/us/solutions/collateral/workforce-experience/digital-building/digital-building-partner-guide.pdf */ @@ -4137,6 +4154,34 @@ dissect_iana_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) } } +static void +dissect_onos_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) +{ + guint16 msg_len; + guint32 subType; + guint32 offset = 0; + + proto_tree_add_item_ret_uint(tree, hf_onos_subtype, tvb, offset, 1, ENC_BIG_ENDIAN, &subType); + offset++; + + msg_len=tvb_reported_length_remaining(tvb, offset); + switch (subType) + { + case ONOS_CHASSIS_TLV_TYPE: + proto_tree_add_item(tree, hf_onos_chassis, tvb, offset, msg_len, ENC_ASCII|ENC_NA); + break; + case ONOS_PORT_TLV_TYPE: + proto_tree_add_item(tree, hf_onos_port, tvb, offset, msg_len, ENC_ASCII|ENC_NA); + break; + case ONOS_TTL_TLV_TYPE: + proto_tree_add_item(tree, hf_onos_ttl, tvb, offset, msg_len, ENC_NA); + break; + default: + proto_tree_add_item(tree, hf_unknown_subtype_content, tvb, offset, -1, ENC_NA); + break; + } +} + /* Dissect Organizational Specific TLV */ static gint32 @@ -4304,6 +4349,9 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre case OUI_IANA: subTypeStr = val_to_str(subType, iana_subtypes, "Unknown subtype (0x%x)"); break; + case OUI_ONOS: + subTypeStr = val_to_str(subType, onos_subtypes, "Unknown subtype (0x%x)"); + break; default: subTypeStr = wmem_strdup_printf(wmem_packet_scope(), "Unknown (%d)",subType); break; @@ -4361,6 +4409,9 @@ dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tre case OUI_AVAYA_EXTREME: dissect_extreme_avaya_tlv(tvb, pinfo, org_tlv_tree, (offset + 5),dataLen ); break; + case OUI_ONOS: + dissect_onos_tlv(vendor_tvb, pinfo, org_tlv_tree); + break; default: dissect_oui_default_tlv(vendor_tvb, pinfo, org_tlv_tree); } @@ -6024,6 +6075,22 @@ proto_register_lldp(void) { "Manufacturer Usage Description URL", "lldp.iana.mudurl", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_onos_subtype, + { "ONOS Subtype", "lldp.onos.subtype", FT_UINT8, BASE_HEX, + VALS(onos_subtypes), 0x0, NULL, HFILL } + }, + { &hf_onos_chassis, + { "Chassis", "lldp.onos.chassis", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL } + }, + { &hf_onos_port, + { "Port", "lldp.onos.port", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL } + }, + { &hf_onos_ttl, + { "ttl", "lldp.onos.ttl", FT_UINT32, BASE_DEC, + NULL, 0x0, NULL, HFILL } + }, { &hf_unknown_subtype, { "Unknown Subtype","lldp.unknown_subtype", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } diff --git a/epan/oui.h b/epan/oui.h index ef1f5f9604..6395aa3b3c 100644 --- a/epan/oui.h +++ b/epan/oui.h @@ -83,6 +83,7 @@ #define OUI_WFA 0x506F9A /* Wi-Fi Alliance */ #define OUI_MIST 0x5C5B35 /* Mist Systems */ #define OUI_SMPTE 0x6897E8 /* Society of Motion Picture and Television Engineers */ +#define OUI_ONOS 0xA42305 /* Open Networking Laboratory (ONOS) */ #define OUI_3GPP2 0xCF0002 /* 3GPP2 */ #endif |