forked from osmocom/wireshark
support for IP-over-Infiniband - pcap encapsulation
Bug: 12279 Change-Id: Ib6c54f8b86d95c5546bc800749f124cd0dbb8ff0 Reviewed-on: https://code.wireshark.org/review/14585 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
parent
ac1bb6584c
commit
5ca557c31e
|
@ -30,11 +30,21 @@
|
|||
void proto_register_ipoib(void);
|
||||
void proto_reg_handoff_ipoib(void);
|
||||
|
||||
static int proto_ipoib = -1;
|
||||
static int hf_type = -1;
|
||||
static int hf_reserved = -1;
|
||||
static int proto_ipoib = -1;
|
||||
static int hf_dgid = -1;
|
||||
static int hf_daddr = -1;
|
||||
static int hf_daddr_qpn = -1;
|
||||
static int hf_grh = -1;
|
||||
static int hf_grh_ip_version = -1;
|
||||
static int hf_grh_traffic_class = -1;
|
||||
static int hf_grh_flow_label = -1;
|
||||
static int hf_grh_sqpn = -1;
|
||||
static int hf_grh_sgid = -1;
|
||||
static int hf_type = -1;
|
||||
static int hf_reserved = -1;
|
||||
|
||||
static gint ett_raw = -1;
|
||||
static gint ett_hdr = -1;
|
||||
|
||||
static dissector_handle_t arp_handle;
|
||||
static dissector_handle_t ip_handle;
|
||||
|
@ -44,9 +54,14 @@ static int
|
|||
dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
||||
{
|
||||
proto_tree *fh_tree;
|
||||
proto_tree *fh_subtree;
|
||||
proto_item *ti;
|
||||
tvbuff_t *next_tvb;
|
||||
guint16 type;
|
||||
int grh_size = 0;
|
||||
|
||||
if (pinfo->phdr->pkt_encap == WTAP_ENCAP_IP_OVER_IB_PCAP)
|
||||
grh_size = 40;
|
||||
|
||||
/* load the top pane info. This should be overwritten by
|
||||
the next protocol in the stack */
|
||||
|
@ -55,16 +70,40 @@ dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
|
|||
|
||||
/* populate a tree in the second pane with the IPoIB header data */
|
||||
if (tree) {
|
||||
ti = proto_tree_add_item (tree, proto_ipoib, tvb, 0, 4, ENC_NA);
|
||||
ti = proto_tree_add_item (tree, proto_ipoib, tvb, 0, grh_size + 4, ENC_NA);
|
||||
fh_tree = proto_item_add_subtree(ti, ett_raw);
|
||||
|
||||
proto_tree_add_item(fh_tree, hf_type, tvb, 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_tree, hf_reserved, tvb, 2, 2, ENC_BIG_ENDIAN);
|
||||
/* for PCAP data populate subtree with GRH pseudo header data */
|
||||
if (pinfo->phdr->pkt_encap == WTAP_ENCAP_IP_OVER_IB_PCAP) {
|
||||
|
||||
/* Zero means GRH is not valid (unicast). Only destination
|
||||
address is set. */
|
||||
if (tvb_get_ntohs(tvb, 0) == 0) {
|
||||
ti = proto_tree_add_item (fh_tree, hf_daddr, tvb, 20, 20, ENC_NA);
|
||||
fh_subtree = proto_item_add_subtree(ti, ett_hdr);
|
||||
|
||||
proto_tree_add_item(fh_subtree, hf_daddr_qpn, tvb, 21, 3, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_subtree, hf_dgid, tvb, 24, 16, ENC_NA);
|
||||
} else {
|
||||
ti = proto_tree_add_item (fh_tree, hf_grh, tvb, 0, 40, ENC_NA);
|
||||
fh_subtree = proto_item_add_subtree(ti, ett_hdr);
|
||||
|
||||
proto_tree_add_item(fh_subtree, hf_grh_ip_version, tvb, 0, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_subtree, hf_grh_traffic_class, tvb, 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_subtree, hf_grh_flow_label,tvb, 0, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_subtree, hf_grh_sqpn, tvb, 5, 3, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_subtree, hf_grh_sgid, tvb, 8, 16, ENC_NA);
|
||||
proto_tree_add_item(fh_subtree, hf_dgid, tvb, 24, 16, ENC_NA);
|
||||
}
|
||||
}
|
||||
|
||||
proto_tree_add_item(fh_tree, hf_type, tvb, grh_size + 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fh_tree, hf_reserved, tvb, grh_size + 2, 2, ENC_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
next_tvb = tvb_new_subset_remaining(tvb, 4);
|
||||
next_tvb = tvb_new_subset_remaining(tvb, grh_size + 4);
|
||||
|
||||
type = tvb_get_ntohs(tvb, 0);
|
||||
type = tvb_get_ntohs(tvb, grh_size + 0);
|
||||
switch (type) {
|
||||
case ETHERTYPE_IP:
|
||||
call_dissector(ip_handle, next_tvb, pinfo, tree);
|
||||
|
@ -86,6 +125,42 @@ void
|
|||
proto_register_ipoib(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_daddr,
|
||||
{ "Destination address", "ipoib.daddr",
|
||||
FT_NONE, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL}},
|
||||
{ &hf_daddr_qpn,
|
||||
{ "Destination QPN", "ipoib.daddr.qpn",
|
||||
FT_UINT24, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL}},
|
||||
{ &hf_dgid,
|
||||
{ "Destination GID", "ipoib.dgid",
|
||||
FT_IPv6, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_grh,
|
||||
{ "Global Route Header", "ipoib.grh",
|
||||
FT_NONE, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL}},
|
||||
{ &hf_grh_ip_version, {
|
||||
"IP Version", "ipoib.grh.ipver",
|
||||
FT_UINT8, BASE_DEC, NULL, 0xF0,
|
||||
NULL, HFILL}},
|
||||
{ &hf_grh_traffic_class, {
|
||||
"Traffic Class", "ipoib.grh.tclass",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0FF0,
|
||||
NULL, HFILL}},
|
||||
{ &hf_grh_flow_label, {
|
||||
"Flow Label", "ipoib.grh.flowlabel",
|
||||
FT_UINT32, BASE_DEC, NULL, 0x000FFFFF,
|
||||
NULL, HFILL}},
|
||||
{ &hf_grh_sqpn,
|
||||
{ "Source QPN", "ipoib.grh.sqpn",
|
||||
FT_UINT24, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL}},
|
||||
{ &hf_grh_sgid,
|
||||
{ "Source GID", "ipoib.grh.sgid",
|
||||
FT_IPv6, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_type,
|
||||
{ "Type", "ipoib.type",
|
||||
FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
|
||||
|
@ -97,7 +172,8 @@ proto_register_ipoib(void)
|
|||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_raw
|
||||
&ett_raw,
|
||||
&ett_hdr
|
||||
};
|
||||
|
||||
proto_ipoib = proto_register_protocol("IP over Infiniband", "IPoIB", "ipoib");
|
||||
|
@ -118,7 +194,8 @@ proto_reg_handoff_ipoib(void)
|
|||
ipv6_handle = find_dissector_add_dependency("ipv6", proto_ipoib);
|
||||
|
||||
ipoib_handle = create_dissector_handle(dissect_ipoib, proto_ipoib);
|
||||
dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_IB, ipoib_handle);
|
||||
dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_IB_SNOOP, ipoib_handle);
|
||||
dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_IB_PCAP, ipoib_handle);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -399,7 +399,7 @@ static const struct {
|
|||
/* netANALYZER pseudo-header in transparent mode */
|
||||
{ 241, WTAP_ENCAP_NETANALYZER_TRANSPARENT },
|
||||
/* IP-over-Infiniband, as specified by RFC 4391 section 6 */
|
||||
{ 242, WTAP_ENCAP_IP_OVER_IB },
|
||||
{ 242, WTAP_ENCAP_IP_OVER_IB_PCAP },
|
||||
/* ISO/IEC 13818-1 MPEG2-TS packets */
|
||||
{ 243, WTAP_ENCAP_MPEG_2_TS },
|
||||
/* NFC LLCP */
|
||||
|
|
|
@ -210,7 +210,7 @@ wtap_open_return_val snoop_open(wtap *wth, int *err, gchar **err_info)
|
|||
WTAP_ENCAP_UNKNOWN, /* 100VG-AnyLAN Token Ring */
|
||||
WTAP_ENCAP_UNKNOWN, /* "ISO 8802/3 and Ethernet" */
|
||||
WTAP_ENCAP_UNKNOWN, /* 100BaseT (but that's just Ethernet) */
|
||||
WTAP_ENCAP_IP_OVER_IB, /* Infiniband */
|
||||
WTAP_ENCAP_IP_OVER_IB_SNOOP, /* Infiniband */
|
||||
};
|
||||
#define NUM_SNOOP_ENCAPS (sizeof snoop_encap / sizeof snoop_encap[0])
|
||||
#define SNOOP_PRIVATE_BIT 0x80000000
|
||||
|
|
|
@ -224,7 +224,7 @@ extern "C" {
|
|||
#define WTAP_ENCAP_MIME 134
|
||||
#define WTAP_ENCAP_NETANALYZER 135
|
||||
#define WTAP_ENCAP_NETANALYZER_TRANSPARENT 136
|
||||
#define WTAP_ENCAP_IP_OVER_IB 137
|
||||
#define WTAP_ENCAP_IP_OVER_IB_SNOOP 137
|
||||
#define WTAP_ENCAP_MPEG_2_TS 138
|
||||
#define WTAP_ENCAP_PPP_ETHER 139
|
||||
#define WTAP_ENCAP_NFC_LLCP 140
|
||||
|
@ -267,6 +267,7 @@ extern "C" {
|
|||
#define WTAP_ENCAP_ISO14443 177
|
||||
#define WTAP_ENCAP_GFP_T 178
|
||||
#define WTAP_ENCAP_GFP_F 179
|
||||
#define WTAP_ENCAP_IP_OVER_IB_PCAP 180
|
||||
/* After adding new item here, please also add new item to encap_table_base array */
|
||||
|
||||
#define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()
|
||||
|
|
Loading…
Reference in New Issue