2 * Lnet packet dissection
3 * Author: Laurent George <george@ocre.cea.fr>
4 * based on packet-agentx.c and packet-afs.c
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1999 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 #include <epan/packet.h>
38 #include <epan/conversation.h>
39 #include <epan/prefs.h>
40 #include <epan/emem.h>
42 #include <epan/dissectors/packet-tcp.h>
44 /* how much data has at least to be available to be able to determine the
45 * length of the lnet message */
46 #define LNET_HEADER_LEN 52
47 #define LNET_NID_DEST_OFFSET 24
48 #define LNET_NID_SRC_OFFSET 32
49 #define LNET_MSG_TYPE_OFFSET 48
51 static guint global_lnet_tcp_port = 988;
52 static guint lnet_tcp_port = 988;
54 void proto_reg_handoff_lnet(void);
56 #define LNET_PTL_INDEX_OFFSET_PUT 88
58 /* Define the lnet proto */
59 static int proto_lnet = -1;
61 static int hf_lnet_src_nid = -1 ;
62 static int hf_lnet_src_nid_addr = -1 ;
63 static int hf_lnet_src_nid_lnet_type = -1 ;
64 static int hf_lnet_src_nid_interface = -1 ;
66 static int hf_lnet_ksm_type = -1 ;
67 static int hf_lnet_ksm_csum= -1;
68 static int hf_lnet_ksm_zc_req_cookie=-1;
69 static int hf_lnet_ksm_zc_ack_cookie=-1;
71 static int hf_lnet_dest_nid = -1 ;
72 static int hf_lnet_dest_nid_addr = -1 ;
73 static int hf_lnet_dest_nid_lnet_type = -1 ;
74 static int hf_lnet_dest_nid_interface = -1 ;
76 static int hf_lnet_dest_pid = -1 ;
77 static int hf_lnet_src_pid = -1 ;
79 static int hf_lnet_msg_type = -1 ;
80 static int hf_lnet_payload_length = -1;
81 static int hf_lnet_payload = -1 ;
82 static int hf_lnet_msg_header = -1 ;
83 static int hf_lnet_msg_filler = -1 ;
85 static int hf_dst_wmd = -1 ;
86 static int hf_dst_wmd_interface = -1 ;
87 static int hf_dst_wmd_object = -1 ;
89 static int hf_match_bits = -1 ;
90 static int hf_mlength = -1 ;
92 static int hf_hdr_data = -1 ;
93 static int hf_ptl_index = -1 ;
94 static int hf_offset = -1 ;
95 static gint ett_lnet = -1;
97 static int hf_src_offset = -1;
98 static int hf_sink_length = -1;
100 static int hf_hello_incarnation = -1 ;
101 static int hf_hello_type = -1 ;
103 static gint ett_lnet_dest_nid= -1;
104 static gint ett_lnet_src_nid= -1;
108 /*static heur_dissector_list_t heur_subdissector_list; */
109 static dissector_table_t subdissector_table;
111 static const value_string lnetnames[] = {
134 static const value_string lnet_msg_type_t[] = {
135 { LNET_MSG_ACK , "ACK"},
136 { LNET_MSG_PUT , "PUT"},
137 { LNET_MSG_GET , "GET"},
138 { LNET_MSG_REPLY, "REPLY"},
139 { LNET_MSG_HELLO, "HELLO"}
142 /* defined in lustre/include/lustre/lustre_idl.h */
143 static const value_string portal_indices[] = {
144 { 1 , "CONNMGR_REQUEST_PORTAL"},
145 { 2 , "CONNMGR_REPLY_PORTAL"},
146 { 3 , "OSC_REQUEST_PORTAL(obsolete)"},
147 { 4 , "OSC_REPLY_PORTAL"},
148 { 5 , "OSC_BULK_PORTAL(obsolete)"},
149 { 6 , "OST_IO_PORTAL"},
150 { 7 , "OST_CREATE_PORTAL"},
151 { 8 , "OST_BULK_PORTAL"},
152 { 9 , "MDC_REQUEST_PORTAL(obsolete)"},
153 { 10 , "MDC_REPLY_PORTAL"},
154 { 11 , "MDC_BULK_PORTAL(obsolete)"},
155 { 12 , "MDS_REQUEST_PORTAL"},
156 { 13 , "MDS_REPLY_PORTAL(obsolete)"},
157 { 14 , "MDS_BULK_PORTAL"},
158 { 15 , "LDLM_CB_REQUEST_PORTAL"},
159 { 16 , "LDLM_CB_REPLY_PORTAL"},
160 { 17 , "LDLM_CANCEL_REQUEST_PORTAL"},
161 { 18 , "LDLM_CANCEL_REPLY_PORTAL"},
162 { 19 , "PTLBD_REQUEST_PORTAL(obsolete)"},
163 { 20 , "PTLBD_REPLY_PORTAL(obsolete)"},
164 { 21 , "PTLBD_BULK_PORTAL(obsolete)"},
165 { 22 , "MDS_SETATTR_PORTAL"},
166 { 23 , "MDS_READPAGE_PORTAL"},
167 { 25 , "MGC_REPLY_PORTAL"},
168 { 26 , "MGS_REQUEST_PORTAL"},
169 { 27 , "MGS_REPLY_PORTAL"},
170 { 28 , "OST_REQUEST_PORTAL"}
173 #define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */
174 #define KSOCK_MSG_LNET 0xc1 /* lnet msg */
176 static const value_string ksm_type_t[] = {
177 {0xc0, "KSOCK_MSG_NOOP"},/* ksm_u empty */
178 {0xc1, "KSOCK_MSG_LNET"} /* lnet msg */
182 static int dissect_csum(tvbuff_t * tvb, proto_tree *tree, int offset)
185 csum = tvb_get_letohl(tvb, offset);
187 proto_tree_add_text(tree, tvb, offset, 4, "checksum disabled");
189 proto_tree_add_item(tree, hf_lnet_ksm_csum, tvb, offset, 4, TRUE);
196 static int dissect_req_cookie(tvbuff_t * tvb, proto_tree *tree, int offset)
199 req= tvb_get_letoh64(tvb, offset);
201 proto_tree_add_text(tree, tvb, offset, 8, "ack not required");
203 proto_tree_add_item(tree, hf_lnet_ksm_zc_req_cookie, tvb, offset, 8, TRUE);
208 static int dissect_ack_cookie(tvbuff_t * tvb, proto_tree *tree, int offset)
211 ack= tvb_get_letoh64(tvb, offset);
213 proto_tree_add_text(tree, tvb, offset, 8, "not ack");
215 proto_tree_add_item(tree, hf_lnet_ksm_zc_ack_cookie, tvb, offset, 8, TRUE);
221 dissect_ksock_msg_noop( tvbuff_t * tvb, packet_info *pinfo _U_ , proto_tree *tree)
225 proto_tree_add_item(tree, hf_lnet_ksm_type, tvb, offset, 4, TRUE);offset+=4;
226 offset=dissect_csum(tvb,tree,offset);
227 offset=dissect_req_cookie(tvb, tree, offset);
228 offset=dissect_ack_cookie(tvb,tree,offset);
232 static int dissect_ksock_msg(tvbuff_t * tvb, proto_tree *tree, int offset)
234 proto_tree_add_item(tree, hf_lnet_ksm_type, tvb, offset, 4, TRUE);offset+=4;
235 offset=dissect_csum(tvb,tree,offset);
236 offset=dissect_req_cookie(tvb, tree, offset);
237 offset=dissect_ack_cookie(tvb,tree,offset);
241 static int dissect_dest_nid(tvbuff_t * tvb, proto_tree *tree, int offset)
243 proto_tree_add_item(tree, hf_lnet_dest_nid_addr, tvb, offset, 4, TRUE);offset+=4;
244 proto_tree_add_item(tree, hf_lnet_dest_nid_interface, tvb, offset, 2, TRUE);offset+=2;
245 proto_tree_add_item(tree, hf_lnet_dest_nid_lnet_type, tvb, offset, 2, TRUE);offset+=2;
250 static int dissect_src_nid(tvbuff_t * tvb, proto_tree *tree, int offset)
252 proto_tree_add_item(tree, hf_lnet_src_nid_addr, tvb, offset, 4, TRUE);offset+=4;
253 proto_tree_add_item(tree, hf_lnet_src_nid_interface, tvb, offset, 2, TRUE);offset+=2;
254 proto_tree_add_item(tree, hf_lnet_src_nid_lnet_type, tvb, offset, 2, TRUE);offset+=2;
258 static int dissect_lnet_put(tvbuff_t * tvb, proto_tree *tree, int offset, packet_info *pinfo _U_)
260 /* typedef struct lnet_put {
261 lnet_handle_wire_t ack_wmd;
266 } WIRE_ATTR lnet_put_t; */
268 gboolean little_endian=TRUE ;
270 proto_tree_add_item(tree,hf_dst_wmd_interface,tvb,offset,8,little_endian); offset+=8;
271 proto_tree_add_item(tree,hf_dst_wmd_object,tvb,offset,8,little_endian);offset+=8;
273 proto_tree_add_item(tree,hf_match_bits,tvb,offset,8,little_endian);offset+=8;
274 proto_tree_add_item(tree,hf_hdr_data,tvb,offset,8,little_endian);offset+=8;
275 if (check_col(pinfo->cinfo, COL_INFO))
276 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", val_to_str(tvb_get_letohl(tvb,offset), portal_indices, "Unknow")); /* add some nice value */
277 proto_item_append_text(tree, ", %s" , val_to_str(tvb_get_letohl(tvb,offset), portal_indices, "Unknow")); /* print ptl_index */
278 proto_tree_add_item(tree,hf_ptl_index,tvb,offset,4,little_endian);offset+=4;
279 proto_tree_add_item(tree,hf_offset,tvb,offset,4,little_endian);offset+=4;
283 static int dissect_lnet_get(tvbuff_t * tvb, proto_tree *tree, int offset, packet_info *pinfo _U_)
285 /* typedef struct lnet_get {
286 lnet_handle_wire_t return_wmd;
291 } WIRE_ATTR lnet_get_t; */
293 gboolean little_endian=TRUE ;
294 proto_tree_add_item(tree,hf_dst_wmd_interface,tvb,offset,8,little_endian);offset+=8;
295 proto_tree_add_item(tree,hf_dst_wmd_object,tvb,offset,8,little_endian);offset+=8;
296 /*if (check_col(pinfo->cinfo, COL_INFO))*/
297 /* col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, " %" G_GINT64_MODIFIER "u ", tvb_get_letoh64(tvb,offset) );*/
299 proto_tree_add_item(tree,hf_match_bits,tvb,offset,8,little_endian);offset+=8;
300 if (check_col(pinfo->cinfo, COL_INFO))
301 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", val_to_str(tvb_get_letohl(tvb,offset), portal_indices, "Unknow"));
302 proto_item_append_text(tree, ", %s" , val_to_str(tvb_get_letohl(tvb,offset), portal_indices, "Unknow")); /* print ptl_index */
303 proto_tree_add_item(tree,hf_ptl_index,tvb,offset,4,little_endian);offset+=4;
304 proto_tree_add_item(tree,hf_src_offset,tvb,offset,4,little_endian);offset+=4;
305 proto_tree_add_item(tree,hf_sink_length,tvb,offset,4,little_endian);offset+=4;
309 static int dissect_lnet_reply(tvbuff_t * tvb, proto_tree *tree, int offset)
311 /* typedef struct lnet_reply {
312 lnet_handle_wire_t dst_wmd;
313 } WIRE_ATTR lnet_reply_t; */
315 gboolean little_endian=TRUE ;
316 proto_tree_add_item(tree,hf_dst_wmd_interface,tvb,offset,8,little_endian);offset+=8;
317 proto_tree_add_item(tree,hf_dst_wmd_object,tvb,offset,8,little_endian);offset+=8;
323 static int dissect_lnet_hello(tvbuff_t * tvb, proto_tree *tree, int offset)
325 /* typedef struct lnet_hello {
328 } WIRE_ATTR lnet_hello_t; */
330 gboolean little_endian=TRUE ;
331 proto_tree_add_item(tree,hf_hello_incarnation,tvb,offset,8,little_endian); offset+=8;
332 proto_tree_add_item(tree,hf_hello_type,tvb,offset,4,little_endian); offset+=4;
336 static int dissect_lnet_ack(tvbuff_t * tvb, proto_tree *tree, int offset, packet_info *pinfo _U_)
338 /* typedef struct lnet_ack {
339 lnet_handle_wire_t dst_wmd;
342 } WIRE_ATTR lnet_ack_t; */
344 proto_tree_add_item(tree,hf_dst_wmd_interface,tvb,offset,8,TRUE); offset+=8;
345 proto_tree_add_item(tree,hf_dst_wmd_object,tvb,offset,8,TRUE);offset+=8;
346 proto_tree_add_item(tree,hf_match_bits,tvb,offset,8,TRUE);offset+=8;
347 proto_tree_add_item(tree,hf_mlength, tvb,offset,4,TRUE); offset+=4;
351 static void dissect_lnet_message(tvbuff_t * tvb, packet_info *pinfo, proto_tree *tree);
352 /* return the pdu length */
354 get_lnet_message_len(packet_info __attribute__((__unused__))*pinfo, tvbuff_t *tvb, int offset)
357 * Get the payload length
360 plen = tvb_get_letohl(tvb,offset+28+24); /*24 = ksm header, 28 = le reste des headers*/
363 * That length doesn't include the header; add that in.
365 return plen + 72 +24 ; /* +24 == ksock msg header.. :D */
370 get_noop_message_len(packet_info __attribute__((__unused__))*pinfo, tvbuff_t *tvb _U_ , int offset _U_)
376 dissect_lnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
378 /* TODO : correct this, now we do a difference between packet with NOOP and others ..
379 but I don't find how to use pdu_dissect with a variable length<=LNET_HEADER_LEN */
380 switch(tvb_get_letohl(tvb,0)){
382 /*g_print("ksock noop %d \n", pinfo->fd->num);*/
383 tcp_dissect_pdus(tvb,pinfo,tree,TRUE,0, get_noop_message_len,dissect_ksock_msg_noop);
386 tcp_dissect_pdus(tvb,pinfo,tree,TRUE,LNET_HEADER_LEN, get_lnet_message_len,dissect_lnet_message);
392 typedef struct t_nid {
398 static t_nid get_nid(tvbuff_t *tvb, gint offset)
401 nid.addr = g_htonl(tvb_get_ipv4(tvb,offset));
402 nid.interface = tvb_get_letohs(tvb,offset+4);
403 nid.proto = tvb_get_letohs(tvb,offset+6);
406 * get_nid(tvb, LNET_NID_DEST_OFFSET);
407 * get_nid(tvb, LNET_NID_SRC_OFFSET);
411 /*----------------------------------------------------------- */
412 /* For the conversation */
419 typedef struct lnet_request_key {
421 guint32 conversation;
422 } lnet_request_key_t;
424 typedef struct lnet_request_val {
426 guint32 packet_num_parent;
427 } lnet_request_val_t;
430 static GHashTable *lnet_request_hash = NULL;
436 lnet_equal(gconstpointer v, gconstpointer w)
438 const struct lnet_request_key *v1 = (const struct lnet_request_key *)v;
439 const struct lnet_request_key *v2 = (const struct lnet_request_key *)w;
441 if (v1 -> conversation == v2 -> conversation &&
442 v1 -> match_bits == v2 -> match_bits)
452 lnet_hash (gconstpointer v)
454 const struct lnet_request_key *key = (const struct lnet_request_key *)v;
457 val = key -> conversation + key -> match_bits ;
464 lnet_init_protocol(void)
466 if (lnet_request_hash)
467 g_hash_table_destroy(lnet_request_hash);
469 lnet_request_hash = g_hash_table_new(lnet_hash, lnet_equal);
473 static lnet_request_val_t*
474 get_lnet_conv(packet_info * pinfo , GHashTable * lnet_hash_table, guint64 match_bits )
476 conversation_t * conversation ;
477 lnet_request_key_t request_key, *new_request_key;
478 lnet_request_val_t *request_val=NULL ;
480 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
483 if (NULL == conversation)
484 /* It's not part of any conversation - create a new one. */
485 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, proto_lnet,
486 pinfo->srcport, pinfo->destport, 0);
488 request_key.conversation = conversation->index;
489 request_key.match_bits = match_bits;
491 request_val = (struct lnet_request_val * ) g_hash_table_lookup(lnet_hash_table, &request_key);
493 new_request_key = se_alloc(sizeof(struct lnet_request_key));
494 *new_request_key = request_key;
495 request_val = se_alloc(sizeof(struct lnet_request_val));
496 request_val -> match_bits = match_bits;
497 request_val -> packet_num_parent = pinfo->fd->num ;
498 /*request_val -> filename = "test" ; */
499 g_hash_table_insert(lnet_hash_table, new_request_key, request_val);
509 /*----------------------------------------------------------- */
511 dissect_lnet_message(tvbuff_t * tvb, packet_info *pinfo, proto_tree *tree)
517 lnet_request_val_t* conversation_val ;
520 if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
521 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Lnet");
524 if (check_col(pinfo->cinfo, COL_INFO)) {
525 /* t_nid dest_nid ; */
527 /*guint32 msg_type;*/
528 /*[> col_clear(pinfo->cinfo, COL_INFO); <]*/
529 /*dest_nid = get_nid(tvb, LNET_NID_DEST_OFFSET);*/
530 /*src_nid = get_nid(tvb, LNET_NID_SRC_OFFSET);*/
532 /*[> col_add_fstr(pinfo->cinfo, COL_INFO, "%s@tcp%d > %s@tcp%d",
533 ip_to_str((guint8 *) &src_nid.addr), src_nid.interface,
534 ip_to_str((guint8 *) & dest_nid.addr), dest_nid.interface); */
536 msg_type = tvb_get_letohl(tvb, LNET_MSG_TYPE_OFFSET );
537 /* We delete the entire line and add LNET + msg_type */
538 col_add_fstr(pinfo->cinfo, COL_INFO, "LNET_%s", (msg_type < sizeof(lnet_msg_type_t)/sizeof(value_string)) ? lnet_msg_type_t[msg_type].strptr : "Unknow") ;
542 t_nid dest_nid ; /* nid value */
546 proto_item *ti = NULL; /* principal node */
547 proto_tree *lnet_tree = NULL ; /* principal tree */
548 proto_tree *lnet_nid_src_tree= NULL ; /*subtree for the nids*/
549 proto_tree *lnet_nid_dest_tree= NULL ;
550 proto_item *ti_src_nid ; /* node for the nids */
551 proto_item *ti_dest_nid ;
556 guint32 payload_length;
557 guint32 msg_filler_length;
560 ti = proto_tree_add_item(tree,proto_lnet,tvb,0,-1,FALSE); /* principal node */
561 /* ti=proto_tree_add_protocol_format(tree, proto_lnet, tvb, 0, -1, "Lnet"); */
563 lnet_tree = proto_item_add_subtree(ti,ett_lnet); /* add the subtree*/
565 /* dissect the 24first bytes (ksock_msg_t in lnet/socklnd.h */
566 offset=dissect_ksock_msg(tvb,lnet_tree,offset);
569 dest_nid = get_nid(tvb, LNET_NID_DEST_OFFSET);
570 ti_dest_nid = proto_tree_add_text(lnet_tree, tvb, offset, 8, "dest_nid = %s@tcp%d", ip_to_str((guint8 *) &dest_nid.addr), dest_nid.interface);
571 lnet_nid_dest_tree = proto_item_add_subtree(ti_dest_nid,ett_lnet_dest_nid) ;
572 offset=dissect_dest_nid(tvb,lnet_nid_dest_tree,offset);
574 /* same for src_nid */
575 src_nid = get_nid(tvb, LNET_NID_SRC_OFFSET);
576 ti_src_nid = proto_tree_add_text(lnet_tree, tvb, offset, 8, "src_nid = %s@tcp%d", ip_to_str((guint8 *) &src_nid.addr), src_nid.interface);
577 lnet_nid_src_tree = proto_item_add_subtree(ti_src_nid,ett_lnet_src_nid) ;
578 offset=dissect_src_nid(tvb,lnet_nid_src_tree,offset);
581 proto_tree_add_item(lnet_tree, hf_lnet_src_pid, tvb, offset, 4, TRUE); offset+=4;
582 proto_tree_add_item(lnet_tree, hf_lnet_dest_pid, tvb, offset, 4, TRUE); offset+=4;
584 /* message_type (32 bits) */
585 msg_type = tvb_get_letohl(tvb, offset+0);
586 /* put some nice info on lnet line */
587 proto_item_append_text(ti," %s", (msg_type < sizeof(lnet_msg_type_t)/sizeof(value_string)) ? lnet_msg_type_t[msg_type].strptr : "Unknow") ; /* rajout de l'info dans l'arbre */
588 proto_tree_add_item(lnet_tree, hf_lnet_msg_type, tvb, offset, 4, TRUE); offset+=4;
590 /* payload data (to follow) length :*/
591 payload_length = tvb_get_letohl(tvb,offset+0);
592 proto_tree_add_item(lnet_tree, hf_lnet_payload_length, tvb, offset, 4, TRUE); offset+=4;
594 /* here offset = 24+8+8+4+4+4+4 = 56 */
598 offset=dissect_lnet_ack(tvb,lnet_tree,offset,pinfo);
599 match = tvb_get_letoh64(tvb,72 );
602 offset=dissect_lnet_put(tvb,lnet_tree,offset,pinfo);
603 match = tvb_get_letoh64(tvb, 72);
606 offset=dissect_lnet_get(tvb,lnet_tree,offset,pinfo);
607 match = tvb_get_letoh64(tvb, 72);
610 offset=dissect_lnet_reply(tvb,lnet_tree,offset);
613 offset=dissect_lnet_hello(tvb,lnet_tree,offset);
620 conversation_val = get_lnet_conv(pinfo , lnet_request_hash, match );
621 /* proto_tree_add_text(tree, tvb, 0 , 0, "match = %" G_GINT64_MODIFIER "u parent = %d", conversation_val -> match_bits , conversation_val -> packet_num_parent); */
625 msg_filler_length = 72 - offset + 24 ;
626 if ( msg_filler_length > 72)
628 /* +24 : ksosck_message take 24bytes, and allready in offset */
630 proto_tree_add_item(lnet_tree, hf_lnet_msg_filler, tvb, offset, msg_filler_length, TRUE);
631 offset+=msg_filler_length;
633 if (payload_length>0)
636 /* display of payload */
637 proto_tree_add_item(lnet_tree,hf_lnet_payload, tvb, offset, payload_length, TRUE);
639 next_tvb = tvb_new_subset (tvb, offset, payload_length, payload_length);
640 if(msg_type==LNET_MSG_PUT)
641 dissector_try_port(subdissector_table, tvb_get_letohl(tvb,LNET_PTL_INDEX_OFFSET_PUT), next_tvb, pinfo, tree);
645 offset+=payload_length;
650 proto_register_lnet(void)
652 static hf_register_info hf[] = {
653 { &hf_lnet_ksm_type ,
654 { "Type of socklnd message" , "lnet.ksm_type" , FT_UINT32 , BASE_HEX , VALS(ksm_type_t) , 0x0 , "" , HFILL }} ,
655 { &hf_lnet_ksm_csum ,
656 { "Checksum" , "lnet.ksm_csum" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL }} ,
657 { &hf_lnet_ksm_zc_req_cookie ,
658 { "Ack required" , "lnet.ksm_zc_req_cookie" , FT_UINT64 , BASE_HEX , NULL , 0x0 , "" , HFILL }} ,
659 { &hf_lnet_ksm_zc_ack_cookie ,
660 { "Ack" , "lnet.ksm_zc_ack_cookie" , FT_UINT64 , BASE_HEX , NULL , 0x0 , "" , HFILL }} ,
663 { "Src nid" , "lnet.src_nid" , FT_UINT64 , BASE_HEX , NULL , 0x0 , "src nid" , HFILL }} ,
664 { &hf_lnet_src_nid_addr ,
665 { "Src nid" , "lnet.src_nid_addr" , FT_IPv4 , BASE_NONE , NULL , 0x0 , "" , HFILL }} ,
666 { &hf_lnet_src_nid_lnet_type ,
667 { "lnd network type" , "lnet.src_nid_type" , FT_UINT16 , BASE_DEC , VALS(lnetnames) , 0x0 , "" , HFILL }} ,
668 { &hf_lnet_src_nid_interface ,
669 { "lnd network interface" , "lnet.src_nid_net_interface" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }} ,
671 { &hf_lnet_dest_nid ,
672 { "Dest nid" , "lnet.dest_nid" , FT_UINT64 , BASE_HEX , NULL , 0x0 , "" , HFILL }} ,
674 { &hf_lnet_dest_nid_addr ,
675 { "Destination nid" , "lnet.dest_nid_addr" , FT_IPv4 , BASE_NONE , NULL , 0x0 , "" , HFILL }} ,
676 { &hf_lnet_dest_nid_lnet_type ,
677 { "lnd network type" , "lnet.dest_nid_type" , FT_UINT16 , BASE_DEC , VALS(lnetnames) , 0x0 , "" , HFILL }} ,
678 { &hf_lnet_dest_nid_interface ,
679 { "lnd network interface" , "lnet.dest_nid_net_interface" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }} ,
681 { &hf_lnet_dest_pid ,
682 { "Dest pid" , "lnet.dest_pid" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , "dest pid" , HFILL }} ,
684 { "Src pid" , "lnet.src_pid" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , "src nid" , HFILL }} ,
686 { &hf_lnet_msg_type ,
687 { "Message type" , "lnet.msg_type" , FT_UINT32 , BASE_DEC , VALS(lnet_msg_type_t) , 0x0 , "msg type" , HFILL }} ,
688 { &hf_lnet_payload_length ,
689 { "Payload length" , "lnet.payload_length" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL }} ,
691 { "Payload" , "lnet.payload" , FT_NONE , BASE_NONE , NULL , 0x0 , "" , HFILL }} ,
694 { "DST MD index " , "lnet.msg_dst_cookie" , FT_BYTES , BASE_NONE , NULL , 0x0 , "" , HFILL }} ,
695 { &hf_dst_wmd_interface ,
696 { "DST MD index interface" , "lnet.msg_dst_inteface_cookie" , FT_UINT64 , BASE_HEX_DEC , NULL , 0x0 , "" , HFILL }} ,
697 { &hf_dst_wmd_object ,
698 { "DST MD index object" , "lnet.msg_dst_object_cookie" , FT_UINT64 , BASE_HEX_DEC , NULL , 0x0 , "" , HFILL }} ,
700 { "Match bits" , "lnet.msg_dst_match_bits" , FT_UINT64 , BASE_HEX_DEC , NULL , 0x0 , "" , HFILL}} ,
702 { "Message length" , "lnet.msg_length" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL}} ,
707 { "hdr data" , "lnet.msg_hdr_data" , FT_UINT64 , BASE_HEX_DEC , NULL , 0x0 , "" , HFILL}} ,
709 { "ptl index" , "lnet.ptl_index" , FT_UINT32 , BASE_DEC , VALS(portal_indices) , 0x0 , "" , HFILL}} ,
711 { "offset" , "lnet.offset" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL}} ,
715 { "src offset" , "lnet.src_offset" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL}} ,
717 { "sink length" , "lnet.sink_length" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL}} ,
720 { &hf_hello_incarnation ,
721 { "hello incarnation " , "lnet.hello_incarnation" , FT_UINT64 , BASE_HEX_DEC , NULL , 0x0 , "" , HFILL}} ,
723 { "hello type" , "lnet.hello_type" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "" , HFILL}} ,
725 { &hf_lnet_msg_header ,
726 { "ptl header" , "lnet.ptl_header" , FT_NONE , BASE_NONE , NULL , 0x0 , "" , HFILL}} ,
728 { &hf_lnet_msg_filler ,
729 { "msg filler (padding)" , "lnet.ptl_filler" , FT_NONE , BASE_NONE , NULL , 0x0 , "" , HFILL}} ,
731 /* Add more fields here */
734 static gint *ett[] = {
741 module_t *lnet_module;
743 proto_lnet = proto_register_protocol("Lnet", /*name*/
744 "Lnet", /*short name*/
747 proto_register_field_array(proto_lnet, hf, array_length(hf));
748 proto_register_subtree_array(ett, array_length(ett));
750 lnet_module = prefs_register_protocol(proto_lnet, proto_reg_handoff_lnet);
752 prefs_register_uint_preference(lnet_module, "tcp.lnet_port",
753 "Lnet listener TCP Port",
754 "Set the TCP port for Lnet"
755 "(if other than the default of 988)",
756 10, &global_lnet_tcp_port);
758 subdissector_table = register_dissector_table("lnet.ptl_index", "lnet portal index", FT_UINT32 , BASE_DEC);
760 register_init_routine(&lnet_init_protocol);
765 /* The registration hand-off routine */
767 proto_reg_handoff_lnet(void)
769 static int lnet_prefs_initialized = FALSE;
770 static dissector_handle_t lnet_handle;
772 if(!lnet_prefs_initialized) {
773 lnet_handle = create_dissector_handle(dissect_lnet, proto_lnet);
774 lnet_prefs_initialized = TRUE;
777 dissector_delete("tcp.port",global_lnet_tcp_port, lnet_handle);
780 lnet_tcp_port = global_lnet_tcp_port;
782 dissector_add("tcp.port", lnet_tcp_port, lnet_handle);