From 9b4e0a8dd3f2b4c15b63e1502558e667c2993107 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 29 Dec 1999 05:20:00 +0000 Subject: [PATCH] Put a list of known OUIs in "oui.h", along with a declaration of "value_string" array for OUIs. Add the OUI for the ATM Forum to that list. Handle the OUI for the ATM Forum in the layer 3 information for ISO TR 9577 in a Broadband Low Layer Information information element (for ATM LANE). Add an initial version of the dissection of TLV values in LANE LE Control frames (I have no frames with TLV values against which to test it, alas). svn path=/trunk/; revision=1385 --- Makefile.am | 3 +- oui.h | 31 +++++++++++++++++++++ packet-atm.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++---- packet-llc.c | 13 ++++----- packet-q2931.c | 34 +++++++++++++++++++---- 5 files changed, 136 insertions(+), 19 deletions(-) create mode 100644 oui.h diff --git a/Makefile.am b/Makefile.am index ecdb615006..bcb2748a8e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.139 1999/12/26 22:37:19 gerald Exp $ +# $Id: Makefile.am,v 1.140 1999/12/29 05:19:58 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -206,6 +206,7 @@ ethereal_SOURCES = \ ipproto.c \ ipv4.c \ ipv4.h \ + oui.h \ packet.c \ packet.h \ plugins.c \ diff --git a/oui.h b/oui.h new file mode 100644 index 0000000000..94f02778bd --- /dev/null +++ b/oui.h @@ -0,0 +1,31 @@ +/* oui.h + * Definitions of OUIs + * Gilbert Ramirez + * + * $Id: oui.h,v 1.1 1999/12/29 05:19:58 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */ +#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */ +#define OUI_APPLE_ATALK 0x080007 /* Appletalk */ + +extern const value_string oui_vals[]; diff --git a/packet-atm.c b/packet-atm.c index 7d4a6f48e6..4296753d3f 100644 --- a/packet-atm.c +++ b/packet-atm.c @@ -1,7 +1,7 @@ /* packet-atm.c * Routines for ATM packet disassembly * - * $Id: packet-atm.c,v 1.10 1999/12/05 02:32:41 guy Exp $ + * $Id: packet-atm.c,v 1.11 1999/12/29 05:20:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -34,6 +34,7 @@ #include #include #include "packet.h" +#include "oui.h" #include "resolv.h" #include "packet-snmp.h" @@ -49,6 +50,7 @@ static gint ett_atm_lane = -1; static gint ett_atm_lane_lc_lan_dest = -1; static gint ett_atm_lane_lc_lan_dest_rd = -1; static gint ett_atm_lane_lc_flags = -1; +static gint ett_atm_lane_lc_tlv = -1; static gint ett_ilmi = -1; /* @@ -172,7 +174,7 @@ dissect_lan_destination(const u_char *pd, int offset, const char *type, proto_tr tag = pntohs(&pd[offset]); proto_tree_add_text(dest_tree, offset, 2, "Tag: %s", val_to_str(tag, le_control_landest_tag_vals, - "Unknown (%x)")); + "Unknown (0x%04X)")); offset += 2; switch (tag) { @@ -198,6 +200,46 @@ dissect_lan_destination(const u_char *pd, int offset, const char *type, proto_tr } } +/* + * TLV values in LE Control frames. + */ +#define TLV_TYPE(oui, ident) (((oui) << 8) | (ident)) + +#define LE_CONTROL_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x01) +#define LE_MAX_UNK_FRAME_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x02) +#define LE_MAX_UNK_FRAME_TIME TLV_TYPE(OUI_ATM_FORUM, 0x03) +#define LE_VCC_TIMEOUT_PERIOD TLV_TYPE(OUI_ATM_FORUM, 0x04) +#define LE_MAX_RETRY_COUNT TLV_TYPE(OUI_ATM_FORUM, 0x05) +#define LE_AGING_TIME TLV_TYPE(OUI_ATM_FORUM, 0x06) +#define LE_FORWARD_DELAY_TIME TLV_TYPE(OUI_ATM_FORUM, 0x07) +#define LE_EXPECTED_ARP_RESPONSE_TIME TLV_TYPE(OUI_ATM_FORUM, 0x08) +#define LE_FLUSH_TIMEOUT TLV_TYPE(OUI_ATM_FORUM, 0x09) +#define LE_PATH_SWITCHING_DELAY TLV_TYPE(OUI_ATM_FORUM, 0x0A) +#define LE_LOCAL_SEGMENT_ID TLV_TYPE(OUI_ATM_FORUM, 0x0B) +#define LE_MCAST_SEND_VCC_TYPE TLV_TYPE(OUI_ATM_FORUM, 0x0C) +#define LE_MCAST_SEND_VCC_AVGRATE TLV_TYPE(OUI_ATM_FORUM, 0x0D) +#define LE_MCAST_SEND_VCC_PEAKRATE TLV_TYPE(OUI_ATM_FORUM, 0x0E) +#define LE_CONN_COMPLETION_TIMER TLV_TYPE(OUI_ATM_FORUM, 0x0F) + +static const value_string le_tlv_type_vals[] = { + { LE_CONTROL_TIMEOUT, "Control Time-out" }, + { LE_MAX_UNK_FRAME_COUNT, "Maximum Unknown Frame Count" }, + { LE_MAX_UNK_FRAME_TIME, "Maximum Unknown Frame Time" }, + { LE_VCC_TIMEOUT_PERIOD, "VCC Time-out" }, + { LE_MAX_RETRY_COUNT, "Maximum Retry Count" }, + { LE_AGING_TIME, "Aging Time" }, + { LE_FORWARD_DELAY_TIME, "Forwarding Delay Time" }, + { LE_EXPECTED_ARP_RESPONSE_TIME, "Expected LE_ARP Response Time" }, + { LE_FLUSH_TIMEOUT, "Flush Time-out" }, + { LE_PATH_SWITCHING_DELAY, "Path Switching Delay" }, + { LE_LOCAL_SEGMENT_ID, "Local Segment ID" }, + { LE_MCAST_SEND_VCC_TYPE, "Mcast Send VCC Type" }, + { LE_MCAST_SEND_VCC_AVGRATE, "Mcast Send VCC AvgRate" }, + { LE_MCAST_SEND_VCC_PEAKRATE, "Mcast Send VCC PeakRate" }, + { LE_CONN_COMPLETION_TIMER, "Connection Completion Timer" }, + { 0, NULL }, +}; + static void dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { @@ -205,8 +247,13 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre proto_tree *lane_tree; proto_item *tf; proto_tree *flags_tree; + proto_item *ttlv; + proto_tree *tlv_tree; guint16 opcode; guint16 flags; + guint8 num_tlvs; + guint32 tlv_type; + guint8 tlv_length; if (check_col(fd, COL_INFO)) col_add_str(fd, COL_INFO, "LE Control"); @@ -231,7 +278,7 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre opcode = pntohs(&pd[offset]); proto_tree_add_text(lane_tree, offset, 2, "Opcode: %s", val_to_str(opcode, le_control_opcode_vals, - "Unknown (%x)")); + "Unknown (0x%04X)")); offset += 2; if (opcode == READY_QUERY || opcode == READY_IND) { @@ -243,7 +290,7 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre /* Response; decode status. */ proto_tree_add_text(lane_tree, offset, 2, "Status: %s", val_to_str(pntohs(&pd[offset]), le_control_status_vals, - "Unknown (%x)")); + "Unknown (0x%04X)")); } offset += 2; @@ -282,15 +329,16 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre proto_tree_add_text(lane_tree, offset, 1, "LAN type: %s", val_to_str(pd[offset], le_control_lan_type_vals, - "Unknown (%x)")); + "Unknown (0x%02X)")); offset += 1; proto_tree_add_text(lane_tree, offset, 1, "Maximum frame size: %u", pd[offset]); offset += 1; + num_tlvs = pd[offset]; proto_tree_add_text(lane_tree, offset, 1, "Number of TLVs: %u", - pd[offset]); + num_tlvs); offset += 1; proto_tree_add_text(lane_tree, offset, 1, "ELAN name size: %u", @@ -304,6 +352,19 @@ dissect_le_control(const u_char *pd, int offset, frame_data *fd, proto_tree *tre proto_tree_add_text(lane_tree, offset, 32, "ELAN name: %s", bytes_to_str(&pd[offset], 32)); offset += 32; + + while (num_tlvs != 0) { + tlv_type = pntohl(&pd[offset]); + tlv_length = pd[offset+4]; + ttlv = proto_tree_add_text(lane_tree, offset, 5+tlv_length, "TLV type: %s", + val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)")); + tlv_tree = proto_item_add_subtree(ttlv, ett_atm_lane_lc_tlv); + proto_tree_add_text(tlv_tree, offset, 4, "TLV Type: %s", + val_to_str(tlv_type, le_tlv_type_vals, "Unknown (0x%08x)")); + proto_tree_add_text(tlv_tree, offset+4, 1, "TLV Length: %u", tlv_length); + offset += 5+tlv_length; + num_tlvs--; + } } } @@ -698,6 +759,7 @@ proto_register_atm(void) &ett_atm_lane_lc_lan_dest, &ett_atm_lane_lc_lan_dest_rd, &ett_atm_lane_lc_flags, + &ett_atm_lane_lc_tlv, }; proto_atm = proto_register_protocol("ATM", "atm"); proto_register_field_array(proto_atm, hf, array_length(hf)); diff --git a/packet-llc.c b/packet-llc.c index cbea2d434e..be89fa47b5 100644 --- a/packet-llc.c +++ b/packet-llc.c @@ -2,7 +2,7 @@ * Routines for IEEE 802.2 LLC layer * Gilbert Ramirez * - * $Id: packet-llc.c,v 1.35 1999/12/14 07:22:56 guy Exp $ + * $Id: packet-llc.c,v 1.36 1999/12/29 05:20:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -34,6 +34,7 @@ #include #include "packet.h" +#include "oui.h" #include "xdlc.h" static int proto_llc = -1; @@ -150,10 +151,7 @@ static const value_string llc_ctrl_vals[] = { { 0, NULL } }; -#define OUI_ENCAP_ETHER 0x000000 -#define OUI_APPLE_ATALK 0x080007 - -static const value_string llc_oui_vals[] = { +const value_string oui_vals[] = { { OUI_ENCAP_ETHER, "Encapsulated Ethernet" }, /* http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/ibm_r/brprt1/brsrb.htm @@ -161,6 +159,7 @@ http://www.cisco.com/univercd/cc/td/doc/product/software/ios113ed/113ed_cr/ibm_r { 0x00000c, "Cisco" }, { 0x0000f8, "Cisco 90-Compatible" }, { 0x0080c2, "Bridged Frame-Relay" }, /* RFC 2427 */ + { OUI_ATM_FORUM, "ATM Forum" }, { OUI_APPLE_ATALK, "Apple (AppleTalk)" }, { 0, NULL } }; @@ -344,7 +343,7 @@ dissect_llc(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { etype = pntohs(&pd[offset+6]); if (check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "SNAP, OUI 0x%06X (%s), PID 0x%04X", - oui, val_to_str(oui, llc_oui_vals, "Unknown"), + oui, val_to_str(oui, oui_vals, "Unknown"), etype); } if (tree) { @@ -444,7 +443,7 @@ proto_register_llc(void) { &hf_llc_oui, { "Organization Code", "llc.oui", FT_UINT24, BASE_HEX, - VALS(llc_oui_vals), 0x0, ""}}, + VALS(oui_vals), 0x0, ""}}, { &hf_llc_pid, { "Protocol ID", "llc.pid", FT_UINT16, BASE_HEX, diff --git a/packet-q2931.c b/packet-q2931.c index 52ab8fd553..106c1e9c23 100644 --- a/packet-q2931.c +++ b/packet-q2931.c @@ -2,7 +2,7 @@ * Routines for Q.2931 frame disassembly * Guy Harris * - * $Id: packet-q2931.c,v 1.5 1999/11/27 04:48:13 guy Exp $ + * $Id: packet-q2931.c,v 1.6 1999/12/29 05:19:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -36,6 +36,7 @@ #include #include #include "packet.h" +#include "oui.h" #include "packet-q931.h" #include "packet-arp.h" @@ -776,6 +777,15 @@ static const value_string q2931_uil3_tr_9577_vals[] = { { 0x00, NULL } }; +static const value_string lane_pid_vals[] = { + { 0x0001, "LE Configuration Direct/Control Direct/Control Distribute" }, + { 0x0002, "Ethernet/IEEE 002.3 LE Data Direct" }, + { 0x0003, "IEEE 802.5 LE Data Direct" }, + { 0x0004, "Ethernet/IEEE 802.3 LE Multicast Send/Multicast Forward" }, + { 0x0005, "IEEE 802.5 LE Multicast Send/Multicast Forward" }, + { 0, NULL }, +}; + /* * Dissect a broadband low layer information information element. */ @@ -936,22 +946,36 @@ l2_done: organization_code = pd[offset] << 16 | pd[offset+1] << 8 | pd[offset+2]; proto_tree_add_text(tree, offset, 3, - "Organization Code: 0x%06X", - organization_code); + "Organization Code: 0x%06X (%s)", + organization_code, + val_to_str(organization_code, oui_vals, + "Unknown")); offset += 3; len -= 3; if (len < 2) return; pid = pntohs(&pd[offset]); - if (organization_code == 0x000000) { + switch (organization_code) { + + case OUI_ENCAP_ETHER: proto_tree_add_text(tree, offset, 2, "Ethernet type: %s", val_to_str(pid, etype_vals, "Unknown (0x%04X)")); - } else { + break; + + case OUI_ATM_FORUM: + proto_tree_add_text(tree, offset, 2, + "LANE Protocol ID: %s", + val_to_str(pid, lane_pid_vals, + "Unknown (0x%04X)")); + break; + + default: proto_tree_add_text(tree, offset, 2, "Protocol ID: 0x%04X", pid); + break; } } break;