From 10dd94fa0ba446ca8edfd74290709b6621c4e776 Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Thu, 24 Jan 2013 18:08:25 +0000 Subject: [PATCH] Add support for HFI and infiniband interfaces in AIX iptrace files. svn path=/trunk/; revision=47258 --- epan/dissectors/packet-infiniband.c | 4 ++++ wiretap/iptrace.c | 36 ++++++++++++++++++++++++++++- wiretap/wtap.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c index 017dac8da1..074528822a 100644 --- a/epan/dissectors/packet-infiniband.c +++ b/epan/dissectors/packet-infiniband.c @@ -7509,6 +7509,7 @@ void proto_register_infiniband(void) void proto_reg_handoff_infiniband(void) { dissector_handle_t roce_handle; + dissector_handle_t ib_handle; ipv6_handle = find_dissector("ipv6"); data_handle = find_dissector("data"); @@ -7518,4 +7519,7 @@ void proto_reg_handoff_infiniband(void) /* create and announce an anonymous RoCE dissector */ roce_handle = create_dissector_handle(dissect_roce, proto_infiniband); dissector_add_uint("ethertype", ETHERTYPE_ROCE, roce_handle); + + ib_handle = create_dissector_handle(dissect_infiniband, proto_infiniband); + dissector_add_uint("wtap_encap", WTAP_ENCAP_INFINIBAND, ib_handle); } diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index 1c46890ab6..6fc466afd4 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -30,6 +30,9 @@ #include "atm.h" #include "iptrace.h" +#define IPTRACE_IFT_HF 0x3d /* Support for PERCS IP-HFI*/ +#define IPTRACE_IFT_IB 0xc7 /* IP over Infiniband. Number by IANA */ + static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off, @@ -425,12 +428,21 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info, wth->phdr.ts.secs = pntohl(&header[32]); wth->phdr.ts.nsecs = pntohl(&header[36]); +/* We used to error out if the interface in iptrace was unknown/unhandled, + * but an iptrace may contain packets from a variety of interfaces, ome known, + * and others unknown. It is better to display the data even for unknown interface + * types, isntead of erroring out. In the future, it would be nice to be able to + * flag which frames are shown as data because their interface type is unknown, + * and also preset the interface type number to the user so that it can be + * reported easily back to the Wireshark develoer. + if (wth->phdr.pkt_encap == WTAP_ENCAP_UNKNOWN) { *err = WTAP_ERR_UNSUPPORTED_ENCAP; *err_info = g_strdup_printf("iptrace: interface type IFT=0x%02x unknown or unsupported", pkt_hdr.if_type); return FALSE; } +*/ /* Fill in the pseudo-header. */ fill_in_pseudo_header(wth->phdr.pkt_encap, data_ptr, wth->phdr.caplen, @@ -669,6 +681,28 @@ wtap_encap_ift(unsigned int ift) return ift_encap[ift]; } else { - return WTAP_ENCAP_UNKNOWN; + switch(ift) { + /* Infiniband*/ + case IPTRACE_IFT_IB: + return WTAP_ENCAP_INFINIBAND; + break; + + /* Host Fabric Interface */ + case IPTRACE_IFT_HF: + /* The HFI interface on AIX provides raw IP + in the packet trace. It's unclear if the HFI + can be configured for any other protocol, and if + any field in the iptrace header indicates what + that protocol is. For now, we are hard-coding + this as RAW_IP, but if we find another iptrace file + using HFI that provides another protocol, we will + have to figure out which field in the iptrace file + encodes it. */ + return WTAP_ENCAP_RAW_IP; + break; + + default: + return WTAP_ENCAP_UNKNOWN; + } } } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 2c5b92e712..0990a2dff3 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -240,6 +240,7 @@ extern "C" { #define WTAP_ENCAP_AX25_KISS 148 #define WTAP_ENCAP_AX25 149 #define WTAP_ENCAP_SCTP 150 +#define WTAP_ENCAP_INFINIBAND 151 #define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()