2011-08-09 16:34:04 +00:00
|
|
|
/* packet-hdfs.c
|
|
|
|
* HDFS Protocol and dissectors
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 by Isilon Systems.
|
|
|
|
*
|
|
|
|
* Author: Allison Obourn <aobourn@isilon.com>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1999 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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2011-08-09 16:34:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/prefs.h>
|
2014-12-20 21:23:59 +00:00
|
|
|
#include "packet-tcp.h"
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_hdfs(void);
|
|
|
|
void proto_reg_handoff_hdfs(void);
|
|
|
|
|
2011-11-27 15:30:29 +00:00
|
|
|
#if 0
|
2011-08-09 16:34:04 +00:00
|
|
|
#define NAMENODE_PORT 8020
|
2011-11-27 15:30:29 +00:00
|
|
|
#endif
|
|
|
|
|
2011-08-09 16:34:04 +00:00
|
|
|
#define REQUEST_STR "hrpc"
|
|
|
|
|
|
|
|
#define SEND_DEC 1936027236
|
|
|
|
#define SEND_OFFSET 13
|
|
|
|
#define HEAR_DEC 1214603634
|
|
|
|
#define HEAR_OFFSET 9
|
|
|
|
#define TBEA_DEC 1952605537
|
|
|
|
#define TBEA_OFFSET 5
|
|
|
|
#define T_DEC 116
|
|
|
|
#define T_OFFSET 1
|
|
|
|
|
|
|
|
#define FIRST_READ_FRAGMENT_LEN 15
|
|
|
|
#define SECOND_READ_FRAGMENT_LEN 29
|
|
|
|
|
|
|
|
|
2013-10-23 06:29:11 +00:00
|
|
|
#if 0
|
2011-08-09 16:34:04 +00:00
|
|
|
static const int START = 0;
|
|
|
|
static const int AUTHENTICATION = 1;
|
|
|
|
static const int DATA = 2;
|
2013-10-23 06:29:11 +00:00
|
|
|
#endif
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
static guint tcp_port = 0;
|
|
|
|
|
|
|
|
static int proto_hdfs = -1;
|
|
|
|
static int hf_hdfs_pdu_type = -1;
|
|
|
|
static int hf_hdfs_flags = -1;
|
|
|
|
static int hf_hdfs_sequenceno = -1;
|
|
|
|
static int hf_hdfs_packetno = -1;
|
|
|
|
static int hf_hdfs_authlen = -1;
|
|
|
|
static int hf_hdfs_success = -1;
|
|
|
|
static int hf_hdfs_auth = -1;
|
|
|
|
static int hf_hdfs_len = -1;
|
|
|
|
static int hf_hdfs_strcall = -1;
|
|
|
|
static int hf_hdfs_params = -1;
|
|
|
|
static int hf_hdfs_paramtype = -1;
|
|
|
|
static int hf_hdfs_paramval = -1;
|
|
|
|
static int hf_hdfs_paramvalnum = -1;
|
2013-01-31 17:55:31 +00:00
|
|
|
/* static int hf_hdfs_rest = -1; */
|
2011-09-02 05:56:34 +00:00
|
|
|
static int hf_hdfs_fileperm = -1;
|
|
|
|
static int hf_hdfs_blockloc = -1;
|
|
|
|
static int hf_hdfs_endblockloc = -1;
|
2011-09-21 18:55:03 +00:00
|
|
|
static int hf_hdfs_blockgen = -1;
|
2011-09-02 05:56:34 +00:00
|
|
|
static int hf_hdfs_prover = -1;
|
|
|
|
static int hf_hdfs_objname = -1;
|
|
|
|
static int hf_hdfs_filename = -1;
|
|
|
|
static int hf_hdfs_blockcount = -1;
|
|
|
|
static int hf_hdfs_ownername = -1;
|
|
|
|
static int hf_hdfs_groupname = -1;
|
|
|
|
static int hf_hdfs_namelenone = -1;
|
|
|
|
static int hf_hdfs_namelentwo = -1;
|
|
|
|
static int hf_hdfs_accesstime = -1;
|
|
|
|
static int hf_hdfs_modtime = -1;
|
|
|
|
static int hf_hdfs_blockrep = -1;
|
|
|
|
static int hf_hdfs_isdir = -1;
|
|
|
|
static int hf_hdfs_blocksize = -1;
|
|
|
|
static int hf_hdfs_filelen = -1;
|
|
|
|
static int hf_hdfs_construct = -1;
|
|
|
|
static int hf_hdfs_hostname = -1;
|
|
|
|
static int hf_hdfs_rackloc = -1;
|
|
|
|
static int hf_hdfs_adminstate = -1;
|
|
|
|
static int hf_hdfs_activecon = -1;
|
|
|
|
static int hf_hdfs_lastupdate = -1;
|
|
|
|
static int hf_hdfs_remaining = -1;
|
|
|
|
static int hf_hdfs_dfsused = -1;
|
|
|
|
static int hf_hdfs_capacity = -1;
|
|
|
|
static int hf_hdfs_ipcport = -1;
|
|
|
|
static int hf_hdfs_infoport = -1;
|
|
|
|
static int hf_hdfs_storageid = -1;
|
|
|
|
static int hf_hdfs_datanodeid = -1;
|
|
|
|
static int hf_hdfs_locations = -1;
|
|
|
|
static int hf_hdfs_offset = -1;
|
|
|
|
static int hf_hdfs_corrupt = -1;
|
|
|
|
static int hf_hdfs_identifier = -1;
|
|
|
|
static int hf_hdfs_password = -1;
|
|
|
|
static int hf_hdfs_kind = -1;
|
|
|
|
static int hf_hdfs_service = -1;
|
|
|
|
|
2011-08-09 16:34:04 +00:00
|
|
|
static gint ett_hdfs = -1;
|
|
|
|
|
2013-08-05 18:09:43 +00:00
|
|
|
static dissector_handle_t hdfs_handle;
|
|
|
|
|
2011-08-09 16:34:04 +00:00
|
|
|
/* Parses the parameters of a function.
|
|
|
|
Parses the type length which is always in 2 bytes.
|
|
|
|
Next the type which is the previously found length.
|
|
|
|
If this type is variable length it then reads the length of the data
|
|
|
|
from 2 bytes and then the data.
|
|
|
|
Otherwise reads just the data. */
|
|
|
|
static void
|
2011-09-02 05:56:34 +00:00
|
|
|
dissect_params (tvbuff_t *tvb, proto_tree *hdfs_tree, guint offset, int params) {
|
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
guint length;
|
|
|
|
int i = 0;
|
|
|
|
const guint8* type_name;
|
|
|
|
for (i = 0; i < params; i++) {
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* get length that we just dissected */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* 2 bytes = parameter type length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* length bytes = parameter type */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_paramtype, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
if (offset >= length && (!tvb_memeql(tvb, offset - length, "long", length) || !tvb_memeql(tvb, offset - length, "int", length) ||
|
|
|
|
!tvb_memeql(tvb, offset - length, "short", length) || !tvb_memeql(tvb, offset - length, "char", length) ||
|
|
|
|
!tvb_memeql(tvb, offset - length, "byte", length) || !tvb_memeql(tvb, offset - length, "float", length)
|
|
|
|
|| !tvb_memeql(tvb, offset - length, "double", length) || !tvb_memeql(tvb, offset - length, "boolean", length))) {
|
2011-09-02 05:56:34 +00:00
|
|
|
|
|
|
|
if (!tvb_memeql(tvb, offset - length, "boolean", length)) {
|
|
|
|
length = 1;
|
|
|
|
} else if (!tvb_memeql(tvb, offset - length, "short", length)) {
|
|
|
|
length = 2;
|
|
|
|
} else {
|
2011-09-21 18:55:03 +00:00
|
|
|
length = sizeof(type_name);
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_paramvalnum, tvb, offset, length, ENC_BIG_ENDIAN);
|
|
|
|
offset += length;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* get length */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
|
|
|
|
|
|
|
/* 2 bytes = parameter value length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_paramval, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
|
|
|
|
|
|
|
if (!tvb_memeql(tvb, offset - length, "org.apache.hadoop.fs.permission.FsPermission", length)) {
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_fileperm, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Dissects a data packet of the form:
|
2011-09-21 18:55:03 +00:00
|
|
|
method name length : 2B
|
|
|
|
method name : above value
|
|
|
|
number of parameters : 4B
|
2011-09-02 05:56:34 +00:00
|
|
|
-- list of parameters the length of above --
|
2011-09-21 18:55:03 +00:00
|
|
|
parameter type length : 2B
|
|
|
|
parameter type : above value
|
2011-09-02 05:56:34 +00:00
|
|
|
-- if the type is variable size --
|
2011-09-21 18:55:03 +00:00
|
|
|
parameter value length : 2B
|
|
|
|
parameter value : above value
|
2011-09-02 05:56:34 +00:00
|
|
|
-- otherwise --
|
2011-09-21 18:55:03 +00:00
|
|
|
parameter value : length of the type */
|
2011-09-02 05:56:34 +00:00
|
|
|
static void
|
|
|
|
dissect_data (tvbuff_t *tvb, proto_tree *hdfs_tree, guint offset) {
|
2011-09-21 18:55:03 +00:00
|
|
|
int params = 0;
|
|
|
|
guint length = 0;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* get length */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* method name length = 2 B */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* length bytes = method name */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_strcall, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* we only want to parse the packet if it is not a heartbeat (random looking numbers are the decimal
|
|
|
|
representation of sendHeartbeat */
|
|
|
|
if (!(tvb_get_ntohl(tvb, offset - SEND_OFFSET) == SEND_DEC && tvb_get_ntohl(tvb, offset - HEAR_OFFSET) == HEAR_DEC &&
|
|
|
|
tvb_get_ntohl(tvb, offset - TBEA_OFFSET) == TBEA_DEC && tvb_get_guint8(tvb, offset - T_OFFSET) == T_DEC)) {
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* get number of params */
|
|
|
|
params = tvb_get_ntohl(tvb, offset);
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* 4 bytes = # of parameters */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_params, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* go through all params and dissect their type length, type, value length and value */
|
|
|
|
dissect_params (tvb, hdfs_tree, offset, params);
|
|
|
|
}
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
response to a get protocol version message
|
|
|
|
contains a type length, type name and the value
|
|
|
|
*/
|
2012-05-08 17:42:36 +00:00
|
|
|
static int
|
2011-09-02 05:56:34 +00:00
|
|
|
dissect_resp_long (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
|
2011-08-09 16:34:04 +00:00
|
|
|
/* get length that we just dissected */
|
2011-09-02 05:56:34 +00:00
|
|
|
int length = tvb_get_ntohs(tvb, offset);
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
/* 2 bytes = parameter type length */
|
2011-09-02 05:56:34 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2011-08-09 16:34:04 +00:00
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* length bytes = parameter type */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_paramtype, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-08-09 16:34:04 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* the value */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_prover, tvb, offset, 8, ENC_BIG_ENDIAN);
|
2012-05-08 17:42:36 +00:00
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
return offset;
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/*
|
|
|
|
Response to a file status message
|
|
|
|
*/
|
2012-05-08 17:42:36 +00:00
|
|
|
static int
|
2011-09-02 05:56:34 +00:00
|
|
|
dissect_resp_filestatus (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
int length;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* file status */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_fileperm, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += 2;
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* get length */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* 2 bytes = file name length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* file name */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_filename, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
|
|
|
|
/* 8 file size / end location */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_endblockloc, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* is directory */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_isdir, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* block replication factor */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_blockrep, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* block size */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_blocksize, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* modified time */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_modtime, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
/* access time */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_accesstime, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
/* 2 of file permissions */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_fileperm, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* get length */
|
|
|
|
length = tvb_get_guint8 (tvb, offset);
|
|
|
|
|
|
|
|
/* owner name length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* owner name */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_ownername, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* get length */
|
|
|
|
length = tvb_get_guint8 (tvb, offset);
|
|
|
|
|
|
|
|
/* group name length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* group name */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_groupname, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2012-05-08 17:42:36 +00:00
|
|
|
|
|
|
|
return offset;
|
2011-08-09 16:34:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/*
|
|
|
|
Response to the get block info message
|
|
|
|
parses the sent back information about each blcok
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
dissect_block_info (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
int length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* identifier length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* identifier */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_identifier, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* password length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* password */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_password, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* kind length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* kind */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_kind, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* service length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* service */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_service, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* corrupt */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_corrupt, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* offset */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_offset, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* block info section */
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* block location */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_blockloc, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
/* block size */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_blocksize, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* gen id 8 */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_blockgen, tvb, offset, 8, ENC_BIG_ENDIAN);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += 8;
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* locations */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_locations, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* address section */
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* get length */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* length of addr */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* datanode id */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_datanodeid, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* length of addr */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* storageid */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_storageid, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* info port */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_infoport, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* default name node port */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_ipcport, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* capacity */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_capacity, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* dfs used */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_dfsused, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* remaining */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_remaining, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* last update */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_lastupdate, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* num active connections */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_activecon, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2011-08-09 16:34:04 +00:00
|
|
|
offset += 4;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* location rack length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* location rack */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_rackloc, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* hostname length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* hostname */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_hostname, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
length = tvb_get_guint8(tvb, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* admin state length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* admin state */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_adminstate, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-02 05:56:34 +00:00
|
|
|
offset += length;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
return offset;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
|
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/*
|
|
|
|
dissects the response from get block info.
|
2011-09-02 05:56:34 +00:00
|
|
|
*/
|
2011-08-09 16:34:04 +00:00
|
|
|
static void
|
2011-09-02 05:56:34 +00:00
|
|
|
dissect_resp_locatedblocks (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* file length = 8 */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_filelen, tvb, offset, 8, ENC_BIG_ENDIAN);
|
|
|
|
offset += 8;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* under construction = 1 */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_construct, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* number of blocks */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_blockcount, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* dissect info for each block */
|
|
|
|
while (tvb_reported_length(tvb) - offset > 0) {
|
|
|
|
offset = dissect_block_info (tvb, hdfs_tree, offset);
|
2011-08-09 16:34:04 +00:00
|
|
|
}
|
2011-09-02 05:56:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-09 17:46:28 +00:00
|
|
|
static int
|
|
|
|
dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2011-09-02 05:56:34 +00:00
|
|
|
{
|
2011-09-21 18:55:03 +00:00
|
|
|
guint offset = 0;
|
|
|
|
int success = 0;
|
|
|
|
guint length = 0;
|
|
|
|
|
|
|
|
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HDFS");
|
|
|
|
/* Clear out stuff in the info column */
|
|
|
|
col_clear(pinfo->cinfo,COL_INFO);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
|
2014-06-27 02:51:11 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *hdfs_tree;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_hdfs, tvb, 0, -1, ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
hdfs_tree = proto_item_add_subtree(ti, ett_hdfs);
|
|
|
|
|
|
|
|
/* Response */
|
2011-11-27 15:30:29 +00:00
|
|
|
if (pinfo->srcport == tcp_port) {
|
2011-09-21 18:55:03 +00:00
|
|
|
/* 4 bytes = sequence number */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_packetno, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* 4 bytes = status -> 0000 = success, 0001 = error, ffff = fatal */
|
|
|
|
success = tvb_get_ntohl(tvb, offset);
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_success, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (success != 0) {
|
2013-11-09 17:46:28 +00:00
|
|
|
return offset;
|
2011-09-21 18:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!tvb_memeql(tvb, offset + 2, "long", 4)) {
|
|
|
|
dissect_resp_long (tvb, hdfs_tree, offset);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* name length = 2 B */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* length bytes = method name */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_objname, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
|
|
|
/* get length that we just dissected */
|
2011-09-21 18:55:03 +00:00
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
|
|
|
|
|
|
|
/* 2 bytes = objects length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* length bytes = object name */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_objname, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
|
|
|
|
|
|
|
/* responses about block location info */
|
|
|
|
if (!tvb_memeql(tvb, offset - length, "org.apache.hadoop.hdfs.protocol.LocatedBlocks", length)) {
|
2011-09-02 05:56:34 +00:00
|
|
|
dissect_resp_locatedblocks (tvb, hdfs_tree, offset);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
/* responses about file statuses */
|
2011-09-02 05:56:34 +00:00
|
|
|
} else if (!tvb_memeql(tvb, offset - length, "org.apache.hadoop.hdfs.protocol.HdfsFileStatus", length)) {
|
2011-09-21 18:55:03 +00:00
|
|
|
dissect_resp_filestatus (tvb, hdfs_tree, offset);
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
} else {
|
2011-09-21 18:55:03 +00:00
|
|
|
/* get length */
|
|
|
|
length = tvb_get_ntohs(tvb, offset);
|
2011-09-02 05:56:34 +00:00
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* 2 bytes = parameter value length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2011-09-02 05:56:34 +00:00
|
|
|
|
|
|
|
/* the value of the parameter */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_paramval, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2012-05-08 17:42:36 +00:00
|
|
|
/*offset += length;*/
|
2011-09-21 18:55:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Request to namenode */
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* check the packet length */
|
|
|
|
guint auth = tvb_get_ntohl(tvb, offset);
|
|
|
|
|
|
|
|
/* first setup packet starts with "hrpc" */
|
|
|
|
if (!tvb_memeql(tvb, offset, REQUEST_STR, sizeof(REQUEST_STR) - 1)) {
|
|
|
|
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_sequenceno, tvb, offset, sizeof(REQUEST_STR) - 1, ENC_ASCII|ENC_NA);
|
2012-12-26 05:57:06 +00:00
|
|
|
offset += (int)sizeof(REQUEST_STR) - 1;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2012-05-08 17:42:36 +00:00
|
|
|
/*offset += 1;*/
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
/* second authentication packet */
|
|
|
|
if (auth + 4 != tvb_reported_length(tvb)) {
|
|
|
|
|
|
|
|
/* authentication length (read out of first 4 bytes) */
|
|
|
|
length = tvb_get_ntohl(tvb, offset);
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_authlen, tvb, offset, 4, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* authentication (length the number we just got) */
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_auth, tvb, offset, length, ENC_ASCII|ENC_NA);
|
2011-09-21 18:55:03 +00:00
|
|
|
offset += length;
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
2011-09-21 18:55:03 +00:00
|
|
|
|
|
|
|
/* data packets */
|
|
|
|
|
|
|
|
/* 4 bytes = length */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_len, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* 4 bytes = sequence number */
|
|
|
|
proto_tree_add_item(hdfs_tree, hf_hdfs_packetno, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* dissect packet data */
|
|
|
|
dissect_data (tvb, hdfs_tree, offset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-23 18:24:48 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2011-08-09 16:34:04 +00:00
|
|
|
}
|
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
/* determine PDU length of protocol */
|
2015-01-25 19:30:13 +00:00
|
|
|
static guint get_hdfs_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
|
|
|
|
int offset _U_, void *data _U_)
|
2011-09-02 05:56:34 +00:00
|
|
|
{
|
|
|
|
int len = tvb_reported_length(tvb);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
if (tvb_reported_length(tvb) == 1448 || tvb_reported_length(tvb) == 1321) {
|
2011-09-21 18:55:03 +00:00
|
|
|
len = 150 * tvb_get_ntohs(tvb, 113) + 115 ;
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
return len;
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
|
|
|
|
2013-11-09 17:46:28 +00:00
|
|
|
static int
|
|
|
|
dissect_hdfs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
2011-09-02 05:56:34 +00:00
|
|
|
{
|
|
|
|
int frame_header_len = 0;
|
|
|
|
gboolean need_reassemble = FALSE;
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
frame_header_len = tvb_reported_length(tvb);
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2011-09-02 05:56:34 +00:00
|
|
|
if (frame_header_len == 1448 || frame_header_len == 1321) {
|
|
|
|
need_reassemble = TRUE;
|
|
|
|
}
|
2011-09-21 18:55:03 +00:00
|
|
|
|
2013-11-09 17:46:28 +00:00
|
|
|
tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfs_message_len, dissect_hdfs_message, data);
|
2015-06-23 18:24:48 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2011-09-02 05:56:34 +00:00
|
|
|
}
|
2011-08-09 16:34:04 +00:00
|
|
|
|
2016-10-07 20:25:01 +00:00
|
|
|
static void
|
|
|
|
apply_hdfs_prefs(void)
|
|
|
|
{
|
|
|
|
/* HDFS uses the port preference to determine request/response */
|
2016-11-18 02:45:28 +00:00
|
|
|
tcp_port = prefs_get_uint_value("hdfs", "tcp.port");;
|
2016-10-07 20:25:01 +00:00
|
|
|
}
|
|
|
|
|
2011-08-09 16:34:04 +00:00
|
|
|
/* registers the protcol with the given names */
|
|
|
|
void
|
|
|
|
proto_register_hdfs(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
|
2011-09-21 18:55:03 +00:00
|
|
|
/* list of all options for dissecting the protocol */
|
|
|
|
|
|
|
|
/*************************************************
|
|
|
|
First packet
|
|
|
|
**************************************************/
|
|
|
|
{ &hf_hdfs_sequenceno,
|
|
|
|
{ "HDFS protocol type", "hdfs.type",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_pdu_type,
|
|
|
|
{ "HDFS protocol version", "hdfs.version",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_flags,
|
2012-01-19 21:57:24 +00:00
|
|
|
{ "HDFS authentication type", "hdfs.auth_type",
|
2011-09-21 18:55:03 +00:00
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
/***********************************************
|
|
|
|
Authentication packet
|
|
|
|
***********************************************/
|
|
|
|
{ &hf_hdfs_authlen,
|
|
|
|
{ "HDFS authentication length", "hdfs.authlen",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_auth,
|
|
|
|
{ "HDFS authorization bits", "hdfs.auth",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
/**********************************************
|
|
|
|
Response
|
|
|
|
**********************************************/
|
|
|
|
{ &hf_hdfs_packetno,
|
|
|
|
{ "HDFS packet number", "hdfs.seqno",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_success,
|
|
|
|
{ "HDFS success", "hdfs.success",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_strcall,
|
|
|
|
{ "HDFS method name", "hdfs.strcall",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2013-01-31 17:55:31 +00:00
|
|
|
#if 0
|
2011-09-21 18:55:03 +00:00
|
|
|
{ &hf_hdfs_rest,
|
|
|
|
{ "HDFS value", "hdfs.rest",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2013-01-31 17:55:31 +00:00
|
|
|
#endif
|
2011-09-21 18:55:03 +00:00
|
|
|
{ &hf_hdfs_blockloc,
|
|
|
|
{ "HDFS block location", "hdfs.blockloc",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_blocksize,
|
|
|
|
{ "HDFS block size", "hdfs.blocksize",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_endblockloc,
|
|
|
|
{ "HDFS file size", "hdfs.endblockloc",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_blockgen,
|
|
|
|
{ "HDFS block gen", "hdfs.blockgen",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_prover,
|
|
|
|
{ "HDFS protocol version", "hdfs.prover",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_objname,
|
|
|
|
{ "HDFS object name", "hdfs.objname",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_filename,
|
|
|
|
{ "HDFS file name", "hdfs.filename",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_blockcount,
|
|
|
|
{ "HDFS block count", "hdfs.blockcount",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_ownername,
|
|
|
|
{ "HDFS owner name", "hdfs.ownername",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_groupname,
|
|
|
|
{ "HDFS group name", "hdfs.groupname",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_accesstime,
|
|
|
|
{ "HDFS access time", "hdfs.accesstime",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_modtime,
|
|
|
|
{ "HDFS modified time", "hdfs.modtime",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_blockrep,
|
|
|
|
{ "HDFS block replication factor", "hdfs.blockrep",
|
|
|
|
FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_isdir,
|
|
|
|
{ "HDFS is directory", "hdfs.isdir",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_filelen,
|
|
|
|
{ "HDFS file length", "hdfs.filelen",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_construct,
|
|
|
|
{ "HDFS under construction", "hdfs.construct",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_rackloc,
|
|
|
|
{ "HDFS rack location", "hdfs.rackloc",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_adminstate,
|
|
|
|
{ "HDFS admin state", "hdfs.adminstate",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_hostname,
|
|
|
|
{ "HDFS hostname", "hdfs.hostname",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{ &hf_hdfs_namelenone,
|
|
|
|
{ "HDFS name length", "hdfs.namelenone",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_namelentwo,
|
|
|
|
{ "HDFS name length", "hdfs.namelentwo",
|
|
|
|
FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************
|
|
|
|
file info response
|
|
|
|
***************************************/
|
|
|
|
{ &hf_hdfs_activecon,
|
|
|
|
{ "HDFS active connections", "hdfs.activecon",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_lastupdate,
|
|
|
|
{ "HDFS lastupdate", "hdfs.lastupdate",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_remaining,
|
|
|
|
{ "HDFS remaining", "hdfs.remaining",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_dfsused,
|
|
|
|
{ "HDFS dfs used", "hdfs.dfsused",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_capacity,
|
|
|
|
{ "HDFS capacity", "hdfs.capacity",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_ipcport,
|
|
|
|
{ "HDFS ipcport", "hdfs.ipcport",
|
|
|
|
FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_infoport,
|
|
|
|
{ "HDFS info port", "hdfs.infoport",
|
|
|
|
FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_storageid,
|
|
|
|
{ "HDFS storage id", "hdfs.storageid",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_datanodeid,
|
|
|
|
{ "HDFS datanodeid", "hdfs.datanodeid",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_locations,
|
|
|
|
{ "HDFS locations", "hdfs.locations",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_hdfs_identifier,
|
|
|
|
{ "HDFS locations", "hdfs.identifier",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_password,
|
|
|
|
{ "HDFS password", "hdfs.password",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_kind,
|
|
|
|
{ "HDFS kind", "hdfs.kind",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_service,
|
|
|
|
{ "HDFS locations", "hdfs.service",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_corrupt,
|
|
|
|
{ "HDFS corrupt", "hdfs.corrupt",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_offset,
|
|
|
|
{ "HDFS offset", "hdfs.offset",
|
|
|
|
FT_UINT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************
|
|
|
|
Data request
|
|
|
|
***********************************************/
|
|
|
|
{ &hf_hdfs_len,
|
|
|
|
{ "HDFS length", "hdfs.len",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
/* packet number, same as in response
|
|
|
|
method name length, same as in response
|
|
|
|
string call, same as in response */
|
|
|
|
{ &hf_hdfs_params,
|
|
|
|
{ "HDFS number of parameters", "hdfs.params",
|
|
|
|
FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_paramtype,
|
|
|
|
{ "HDFS parameter type", "hdfs.paramtype",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_paramval,
|
|
|
|
{ "HDFS parameter value", "hdfs.paramval",
|
|
|
|
FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
/* param value that is displayed as a number not a string */
|
|
|
|
{ &hf_hdfs_paramvalnum,
|
|
|
|
{ "HDFS parameter value", "hdfs.paramvalnum",
|
|
|
|
FT_INT64, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_hdfs_fileperm,
|
|
|
|
{ "HDFS File permission", "hdfs.fileperm",
|
|
|
|
FT_INT16, BASE_DEC,
|
|
|
|
NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_hdfs
|
|
|
|
};
|
|
|
|
|
2016-10-07 20:25:01 +00:00
|
|
|
proto_hdfs = proto_register_protocol ("HDFS Protocol", "HDFS", "hdfs");
|
2011-08-09 16:34:04 +00:00
|
|
|
|
|
|
|
proto_register_field_array(proto_hdfs, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2016-10-07 20:25:01 +00:00
|
|
|
prefs_register_protocol(proto_hdfs, apply_hdfs_prefs);
|
2015-12-09 04:04:01 +00:00
|
|
|
hdfs_handle = register_dissector("hdfs", dissect_hdfs, proto_hdfs);
|
2011-08-09 16:34:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* registers handoff */
|
|
|
|
void
|
|
|
|
proto_reg_handoff_hdfs(void)
|
|
|
|
{
|
2016-10-07 20:25:01 +00:00
|
|
|
dissector_add_for_decode_as_with_preference("tcp.port", hdfs_handle);
|
2011-08-09 16:34:04 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
2011-09-21 18:55:03 +00:00
|
|
|
* c-basic-offset: 4
|
2011-08-09 16:34:04 +00:00
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
2011-09-21 18:55:03 +00:00
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
2011-08-09 16:34:04 +00:00
|
|
|
*/
|