aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-02 00:36:30 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-02 00:36:30 +0000
commitf8f1f483713edc82c51656580e67f5d21ba2adef (patch)
tree724e691cfbd818a3c191335e83121d0a3ad897f8 /epan/dissectors
parentb6484432aaa2eb6787cc54cc4a7b489ae70e57aa (diff)
Pass struct tcpinfo into all TCP subdissectors instead of through pinfo->private_data.
svn path=/trunk/; revision=53036
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-http.c18
-rw-r--r--epan/dissectors/packet-iwarp-mpa.c6
-rw-r--r--epan/dissectors/packet-ldss.c40
-rw-r--r--epan/dissectors/packet-msproxy.c5
-rw-r--r--epan/dissectors/packet-nbns.c64
-rw-r--r--epan/dissectors/packet-ndmp.c10
-rw-r--r--epan/dissectors/packet-rpc.c39
-rw-r--r--epan/dissectors/packet-rtmpt.c14
-rw-r--r--epan/dissectors/packet-socks.c10
-rw-r--r--epan/dissectors/packet-tcp.c40
-rw-r--r--epan/dissectors/packet-tcp.h4
-rw-r--r--epan/dissectors/rpc_defrag.h2
12 files changed, 127 insertions, 125 deletions
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 822c98c8eb..fd7537a124 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -1916,7 +1916,7 @@ chunked_encoding_dissector(tvbuff_t **tvb_ptr, packet_info *pinfo,
/* Call a subdissector to handle HTTP CONNECT's traffic */
static void
http_payload_subdissector(tvbuff_t *tvb, proto_tree *tree,
- packet_info *pinfo, http_conv_t *conv_data)
+ packet_info *pinfo, http_conv_t *conv_data, void* data)
{
guint32 *ptr = NULL;
guint32 uri_port, saved_port, srcport, destport;
@@ -1982,7 +1982,7 @@ http_payload_subdissector(tvbuff_t *tvb, proto_tree *tree,
saved_port = *ptr;
*ptr = uri_port;
decode_tcp_ports(tvb, 0, pinfo, tree,
- pinfo->srcport, pinfo->destport, NULL);
+ pinfo->srcport, pinfo->destport, NULL, data);
*ptr = saved_port;
}
}
@@ -2677,8 +2677,8 @@ check_auth_kerberos(proto_item *hdr_item, tvbuff_t *tvb, packet_info *pinfo,
return FALSE;
}
-static void
-dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
http_conv_t *conv_data;
int offset = 0;
@@ -2696,7 +2696,7 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
conv_data->request_uri) {
if(conv_data->startframe == 0 && !pinfo->fd->flags.visited)
conv_data->startframe = pinfo->fd->num;
- http_payload_subdissector(tvb, tree, pinfo, conv_data);
+ http_payload_subdissector(tvb, tree, pinfo, conv_data, data);
} else {
while (tvb_reported_length_remaining(tvb, offset) > 0) {
if (conv_data->upgrade == UPGRADE_WEBSOCKET && pinfo->fd->num >= conv_data->startframe) {
@@ -2722,10 +2722,12 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_fence(pinfo->cinfo, COL_INFO);
}
}
+
+ return tvb_length(tvb);
}
static gboolean
-dissect_http_heur_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_http_heur_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
gint offset = 0, next_offset, linelen;
conversation_t *conversation;
@@ -2746,7 +2748,7 @@ dissect_http_heur_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
if((tvb_strncaseeql(tvb, linelen-8, "HTTP/1.1", 8) == 0)||(tvb_strncaseeql(tvb, 0, "HTTP/1.1", 8) == 0)){
conversation = find_or_create_conversation(pinfo);
conversation_set_dissector(conversation,http_handle);
- dissect_http(tvb, pinfo, tree);
+ dissect_http(tvb, pinfo, tree, data);
return TRUE;
}
@@ -3026,7 +3028,7 @@ proto_register_http(void)
expert_http = expert_register_protocol(proto_http);
expert_register_field_array(expert_http, ei, array_length(ei));
- http_handle = register_dissector("http", dissect_http, proto_http);
+ http_handle = new_register_dissector("http", dissect_http, proto_http);
http_module = prefs_register_protocol(proto_http, reinit_http);
prefs_register_bool_preference(http_module, "desegment_headers",
diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c
index dd22971f21..71cf53c1bb 100644
--- a/epan/dissectors/packet-iwarp-mpa.c
+++ b/epan/dissectors/packet-iwarp-mpa.c
@@ -780,20 +780,18 @@ dissect_mpa_fpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* Main dissection routine.
*/
static gboolean
-dissect_iwarp_mpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_iwarp_mpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
tvbuff_t *next_tvb = NULL;
conversation_t *conversation = NULL;
mpa_state_t *state = NULL;
- struct tcpinfo *tcpinfo = NULL;
+ struct tcpinfo *tcpinfo = (struct tcpinfo *)data;
guint8 endpoint = 3;
guint16 ulpdu_length = 0;
/* FPDU */
if (tvb_length(tvb) >= MPA_SMALLEST_FPDU_LEN && is_mpa_fpdu(pinfo)) {
- tcpinfo = (struct tcpinfo *)pinfo->private_data;
-
conversation = find_conversation(pinfo->fd->num, &pinfo->src,
&pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c
index 3a3225e751..b45fc8f032 100644
--- a/epan/dissectors/packet-ldss.c
+++ b/epan/dissectors/packet-ldss.c
@@ -206,7 +206,8 @@ static int ett_ldss_broadcast = -1;
static int ett_ldss_transfer = -1;
static int ett_ldss_transfer_req = -1;
-static dissector_handle_t ldss_handle;
+static dissector_handle_t ldss_udp_handle;
+static dissector_handle_t ldss_tcp_handle;
/* Global variables associated with the preferences for ldss */
static guint global_udp_port_ldss = UDP_PORT_LDSS;
@@ -230,7 +231,7 @@ prepare_ldss_transfer_conv(ldss_broadcast_t *broadcast)
transfer_conv = conversation_new (broadcast->num, &broadcast->broadcaster->addr, &broadcast->broadcaster->addr,
PT_TCP, broadcast->broadcaster->port, broadcast->broadcaster->port, NO_ADDR2|NO_PORT2);
conversation_add_proto_data(transfer_conv, proto_ldss, transfer_info);
- conversation_set_dissector(transfer_conv, ldss_handle);
+ conversation_set_dissector(transfer_conv, ldss_tcp_handle);
}
/* Broadcasts are searches, offers or promises.
@@ -454,22 +455,23 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* file the implementation sends searches for is on a different TCP port
* on the searcher's machine. */
static int
-dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
conversation_t *transfer_conv;
ldss_transfer_info_t *transfer_info;
- struct tcpinfo *transfer_tcpinfo;
+ struct tcpinfo *transfer_tcpinfo = (struct tcpinfo *)data;
proto_tree *ti, *line_tree = NULL, *ldss_tree = NULL;
nstime_t broadcast_response_time;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDSS");
+
/* Look for the transfer conversation; this was created during
* earlier broadcast dissection (see prepate_ldss_transfer_conv) */
transfer_conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst,
PT_TCP, pinfo->srcport, pinfo->destport, 0);
transfer_info = (ldss_transfer_info_t *)conversation_get_proto_data(transfer_conv, proto_ldss);
- transfer_tcpinfo = (struct tcpinfo *)pinfo->private_data;
/* For a pull, the first packet in the TCP connection is the file request.
* First packet is identified by relative seq/ack numbers of 1.
@@ -800,23 +802,16 @@ is_broadcast(address* addr)
}
static int
-dissect_ldss (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_ldss (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- if (is_broadcast(&pinfo->dl_dst) &&
- pinfo->ipproto == IP_PROTO_UDP) {
+ if (is_broadcast(&pinfo->dl_dst)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDSS");
return dissect_ldss_broadcast(tvb, pinfo, tree);
}
- else if (pinfo->ipproto == IP_PROTO_TCP) {
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDSS");
- return dissect_ldss_transfer(tvb, pinfo, tree);
- }
- else {
- /* Definitely not LDSS */
- return 0;
- }
+ /* Definitely not LDSS */
+ return 0;
}
/* Initialize the highest num seen each time a
@@ -979,13 +974,11 @@ proto_register_ldss (void) {
module_t *ldss_module;
- proto_ldss = proto_register_protocol( "Local Download Sharing Service",
- "LDSS", "ldss");
+ proto_ldss = proto_register_protocol("Local Download Sharing Service", "LDSS", "ldss");
proto_register_field_array(proto_ldss, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- ldss_module = prefs_register_protocol( proto_ldss,
- proto_reg_handoff_ldss);
+ ldss_module = prefs_register_protocol( proto_ldss, proto_reg_handoff_ldss);
prefs_register_uint_preference( ldss_module, "udp_port",
"LDSS UDP Port",
"The UDP port on which "
@@ -1005,12 +998,13 @@ proto_reg_handoff_ldss (void)
static gboolean ldss_initialized = FALSE;
if (!ldss_initialized) {
- ldss_handle = new_create_dissector_handle(dissect_ldss, proto_ldss);
+ ldss_udp_handle = new_create_dissector_handle(dissect_ldss, proto_ldss);
+ ldss_tcp_handle = new_create_dissector_handle(dissect_ldss_transfer, proto_ldss);
ldss_initialized = TRUE;
}
else {
- dissector_delete_uint("udp.port", saved_udp_port_ldss, ldss_handle);
+ dissector_delete_uint("udp.port", saved_udp_port_ldss, ldss_udp_handle);
}
- dissector_add_uint("udp.port", global_udp_port_ldss, ldss_handle);
+ dissector_add_uint("udp.port", global_udp_port_ldss, ldss_udp_handle);
saved_udp_port_ldss = global_udp_port_ldss;
}
diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c
index a2a2133d14..61d34b179d 100644
--- a/epan/dissectors/packet-msproxy.c
+++ b/epan/dissectors/packet-msproxy.c
@@ -243,7 +243,7 @@ static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo,
if ( redirect_info->proto == PT_TCP)
decode_tcp_ports( tvb, 0, pinfo, tree, pinfo->srcport,
- pinfo->destport, NULL);
+ pinfo->destport, NULL, NULL);
else
decode_udp_ports( tvb, 0, pinfo, tree, pinfo->srcport,
pinfo->destport, -1);
@@ -1271,8 +1271,7 @@ proto_register_msproxy( void){
expert_module_t* expert_msproxy;
- proto_msproxy = proto_register_protocol( "MS Proxy Protocol",
- "MS Proxy", "msproxy");
+ proto_msproxy = proto_register_protocol( "MS Proxy Protocol", "MS Proxy", "msproxy");
proto_register_field_array(proto_msproxy, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-nbns.c b/epan/dissectors/packet-nbns.c
index 266793b74c..b3438f5743 100644
--- a/epan/dissectors/packet-nbns.c
+++ b/epan/dissectors/packet-nbns.c
@@ -1620,10 +1620,30 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo,
return length + 4;
}
-static void
-dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_continuation_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- struct tcpinfo *tcpinfo = (struct tcpinfo *)pinfo->private_data;
+ proto_tree *nbss_tree;
+ proto_item *ti;
+
+ /*
+ * It looks like a continuation.
+ */
+ col_set_str(pinfo->cinfo, COL_INFO, "NBSS Continuation Message");
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_nbss, tvb, 0, -1, ENC_NA);
+ nbss_tree = proto_item_add_subtree(ti, ett_nbss);
+ proto_tree_add_text(nbss_tree, tvb, 0, -1, "Continuation data");
+ }
+
+ return tvb_length(tvb);
+}
+
+static int
+dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ struct tcpinfo *tcpinfo = (struct tcpinfo *)data;
int offset = 0;
int max_data;
guint8 msg_type;
@@ -1631,8 +1651,6 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 length;
int len;
gboolean is_cifs;
- proto_tree *nbss_tree;
- proto_item *ti;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBSS");
col_clear(pinfo->cinfo, COL_INFO);
@@ -1679,7 +1697,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* attempt to reassemble the data, if the first byte
* is a valid message type.
*/
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
}
/*
@@ -1721,7 +1739,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* A bogus flag was set; assume it's a continuation.
*/
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
}
switch (msg_type) {
@@ -1735,7 +1753,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* protocols have them.)
*/
if (length == 0)
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
break;
@@ -1759,7 +1777,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* bytes of data.
*/
if (length < 2 || length > 256)
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
break;
case POSITIVE_SESSION_RESPONSE:
@@ -1767,7 +1785,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* This has no data, so the length must be zero.
*/
if (length != 0)
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
break;
case NEGATIVE_SESSION_RESPONSE:
@@ -1775,7 +1793,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* This has 1 byte of data.
*/
if (length != 1)
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
break;
case RETARGET_SESSION_RESPONSE:
@@ -1783,7 +1801,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* This has 6 bytes of data.
*/
if (length != 6)
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
break;
case SESSION_KEEP_ALIVE:
@@ -1791,14 +1809,14 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* This has no data, so the length must be zero.
*/
if (length != 0)
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
break;
default:
/*
* Unknown message type; assume it's a continuation.
*/
- goto continuation;
+ return dissect_continuation_packet(tvb, pinfo, tree);
}
}
@@ -1819,24 +1837,12 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
pinfo->desegment_offset = offset;
pinfo->desegment_len = -len;
- return;
+ return tvb_length(tvb);
}
offset += len;
}
- return;
-
-continuation:
- /*
- * It looks like a continuation.
- */
- col_set_str(pinfo->cinfo, COL_INFO, "NBSS Continuation Message");
-
- if (tree) {
- ti = proto_tree_add_item(tree, proto_nbss, tvb, 0, -1, ENC_NA);
- nbss_tree = proto_item_add_subtree(ti, ett_nbss);
- proto_tree_add_text(nbss_tree, tvb, 0, -1, "Continuation data");
- }
+ return tvb_length(tvb);
}
void
@@ -2043,7 +2049,7 @@ proto_reg_handoff_nbt(void)
nbdgm_handle = create_dissector_handle(dissect_nbdgm, proto_nbdgm);
dissector_add_uint("udp.port", UDP_PORT_NBDGM, nbdgm_handle);
- nbss_handle = create_dissector_handle(dissect_nbss, proto_nbss);
+ nbss_handle = new_create_dissector_handle(dissect_nbss, proto_nbss);
dissector_add_uint("tcp.port", TCP_PORT_NBSS, nbss_handle);
dissector_add_uint("tcp.port", TCP_PORT_CIFS, nbss_handle);
}
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c
index d0bf54509f..f79b33d615 100644
--- a/epan/dissectors/packet-ndmp.c
+++ b/epan/dissectors/packet-ndmp.c
@@ -3164,7 +3164,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
DISSECTOR_ASSERT((pinfo != NULL) && (pinfo->private_data != NULL));
- tcpinfo = (struct tcpinfo *)pinfo->private_data;
+ tcpinfo = (struct tcpinfo *)p_get_proto_data(pinfo->fd, proto_ndmp, 0);
seq = tcpinfo->seq;
len = (ndmp_rm & RPC_RM_FRAGLEN) + 4;
@@ -3508,12 +3508,18 @@ dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* as the protocol dissector for this conversation.
*/
static int
-dissect_ndmp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_ndmp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (tvb_length(tvb) < 28)
return 0;
if (!check_if_ndmp(tvb, pinfo))
return 0;
+
+ /* XXX - tcp_dissect_pdus() doesn't have a way to pass dissector data, so store
+ the tcpinfo structure from the TCP dissector as proto_data to be retrieved
+ in dissect_ndmp_message() */
+ p_add_proto_data(pinfo->fd, proto_ndmp, 0, data);
+
tcp_dissect_pdus(tvb, pinfo, tree, ndmp_desegment, 28,
get_ndmp_pdu_len, dissect_ndmp_message);
return tvb_length(tvb);
diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c
index fd23103670..1c160c9232 100644
--- a/epan/dissectors/packet-rpc.c
+++ b/epan/dissectors/packet-rpc.c
@@ -299,7 +299,6 @@ GHashTable *rpc_progs = NULL;
GHashTable *rpc_procs = NULL;
static void dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_rpc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/***********************************/
/* Hash array with procedure names */
@@ -3084,9 +3083,8 @@ call_message_dissector(tvbuff_t *tvb, tvbuff_t *rec_tvb, packet_info *pinfo,
int
dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, rec_dissector_t dissector, gboolean is_heur,
- int proto, int ett, gboolean defragment, gboolean first_pdu)
+ int proto, int ett, gboolean defragment, gboolean first_pdu, struct tcpinfo *tcpinfo)
{
- struct tcpinfo *tcpinfo;
guint32 seq;
guint32 rpc_rm;
volatile guint32 len;
@@ -3100,14 +3098,10 @@ dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
fragment_head *ipfd_head;
tvbuff_t *rec_tvb;
- if (pinfo == NULL || pinfo->private_data == NULL) {
+ if (pinfo == NULL || tcpinfo == NULL) {
return 0;
}
- tcpinfo = (struct tcpinfo *)pinfo->private_data;
- if (tcpinfo == NULL) {
- return 0;
- }
seq = tcpinfo->seq + offset;
/*
@@ -3596,13 +3590,12 @@ static int
find_and_dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, rec_dissector_t dissector,
gboolean is_heur,
- int proto, int ett, gboolean defragment)
+ int proto, int ett, gboolean defragment, struct tcpinfo* tcpinfo)
{
int offReply;
int len;
-
offReply = find_rpc_over_tcp_reply_start(tvb, offset);
if (offReply < 0) {
/* could search for request, but not needed (or testable) thus far */
@@ -3613,7 +3606,7 @@ find_and_dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
pinfo, tree,
dissector, is_heur, proto, ett,
defragment,
- TRUE /* force first-pdu state */);
+ TRUE /* force first-pdu state */, tcpinfo);
/* misses are reported as-is */
if (len == 0)
@@ -3657,7 +3650,7 @@ typedef enum {
static rpc_tcp_return_t
dissect_rpc_tcp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- gboolean is_heur)
+ gboolean is_heur, struct tcpinfo* tcpinfo)
{
int offset = 0;
gboolean saw_rpc = FALSE;
@@ -3670,7 +3663,7 @@ dissect_rpc_tcp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
len = dissect_rpc_fragment(tvb, offset, pinfo, tree,
dissect_rpc_message, is_heur, proto_rpc, ett_rpc,
- rpc_defragment, first_pdu);
+ rpc_defragment, first_pdu, tcpinfo);
if ((len == 0) && first_pdu && rpc_find_fragment_start) {
/*
@@ -3679,7 +3672,7 @@ dissect_rpc_tcp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
len = find_and_dissect_rpc_fragment(tvb, offset, pinfo, tree,
dissect_rpc_message, is_heur, proto_rpc, ett_rpc,
- rpc_defragment);
+ rpc_defragment, tcpinfo);
}
first_pdu = FALSE;
@@ -3726,9 +3719,11 @@ dissect_rpc_tcp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static gboolean
-dissect_rpc_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_rpc_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
- switch (dissect_rpc_tcp_common(tvb, pinfo, tree, TRUE)) {
+ struct tcpinfo* tcpinfo = (struct tcpinfo *)data;
+
+ switch (dissect_rpc_tcp_common(tvb, pinfo, tree, TRUE, tcpinfo)) {
case IS_RPC:
return TRUE;
@@ -3743,11 +3738,15 @@ dissect_rpc_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
}
}
-static void
-dissect_rpc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_rpc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- if (dissect_rpc_tcp_common(tvb, pinfo, tree, FALSE) == IS_NOT_RPC)
+ struct tcpinfo* tcpinfo = (struct tcpinfo *)data;
+
+ if (dissect_rpc_tcp_common(tvb, pinfo, tree, FALSE, tcpinfo) == IS_NOT_RPC)
dissect_rpc_continuation(tvb, pinfo, tree);
+
+ return tvb_length(tvb);
}
/* Discard any state we've saved. */
@@ -4050,7 +4049,7 @@ proto_register_rpc(void)
&rpc_find_fragment_start);
register_dissector("rpc", dissect_rpc, proto_rpc);
- register_dissector("rpc-tcp", dissect_rpc_tcp, proto_rpc);
+ new_register_dissector("rpc-tcp", dissect_rpc_tcp, proto_rpc);
rpc_tap = register_tap("rpc");
/*
diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c
index 9603fd90ad..13c8bf98fd 100644
--- a/epan/dissectors/packet-rtmpt.c
+++ b/epan/dissectors/packet-rtmpt.c
@@ -2241,13 +2241,13 @@ rtmpt_init_rconv(conversation_t *conv)
return rconv;
}
-static void
-dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
conversation_t *conv;
rtmpt_conv_t *rconv;
int cdir;
- struct tcpinfo *tcpinfo;
+ struct tcpinfo *tcpinfo = (struct tcpinfo*)data;
conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
if (!conv) {
@@ -2264,8 +2264,8 @@ dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
conv->key_ptr->port1==pinfo->srcport &&
conv->key_ptr->port2==pinfo->destport) ? 0 : 1;
- tcpinfo = (struct tcpinfo *)pinfo->private_data;
dissect_rtmpt_common(tvb, pinfo, tree, rconv, cdir, tcpinfo->seq, tcpinfo->lastackseq);
+ return tvb_length(tvb);
}
static void
@@ -2386,7 +2386,7 @@ dissect_rtmpt_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
#if 0
static gboolean
-dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
conversation_t * conversation;
if (tvb_length(tvb) >= 12)
@@ -2394,7 +2394,7 @@ dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* To avoid a too high rate of false positive, this heuristics only matches the protocol
from the first server response packet and not from the client request packets before.
Therefore it is necessary to a "Decode as" to properly decode the first packets */
- struct tcpinfo *tcpinfo = pinfo->private_data;
+ struct tcpinfo *tcpinfo = (struct tcpinfo *)data;
if (tcpinfo->lastackseq == RTMPT_HANDSHAKE_OFFSET_2
&& tcpinfo->seq == RTMPT_HANDSHAKE_OFFSET_1
&& tvb_get_guint8(tvb, 0) == RTMPT_MAGIC)
@@ -2690,7 +2690,7 @@ proto_reg_handoff_rtmpt(void)
dissector_handle_t amf_handle;
/* heur_dissector_add("tcp", dissect_rtmpt_heur, proto_rtmpt); */
- rtmpt_tcp_handle = create_dissector_handle(dissect_rtmpt_tcp, proto_rtmpt);
+ rtmpt_tcp_handle = new_create_dissector_handle(dissect_rtmpt_tcp, proto_rtmpt);
/* dissector_add_handle("tcp.port", rtmpt_tcp_handle); */
dissector_add_uint("tcp.port", RTMP_PORT, rtmpt_tcp_handle);
diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c
index 268e2827b6..78a9176df9 100644
--- a/epan/dissectors/packet-socks.c
+++ b/epan/dissectors/packet-socks.c
@@ -929,7 +929,7 @@ static void clear_in_socks_dissector_flag(void *s)
static void call_next_dissector(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, proto_tree *socks_tree,
- socks_hash_entry_t *hash_info, sock_state_t* state_info)
+ socks_hash_entry_t *hash_info, sock_state_t* state_info, struct tcpinfo *tcpinfo)
{
/* Display the results for PING and TRACERT extensions or */
@@ -940,7 +940,6 @@ static void call_next_dissector(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* the payload, and restore the pinfo port after that is done. */
guint32 *ptr;
- struct tcpinfo *tcpinfo = (struct tcpinfo *)pinfo->private_data;
guint16 save_can_desegment;
struct tcp_analysis *tcpd=NULL;
@@ -971,7 +970,7 @@ static void call_next_dissector(tvbuff_t *tvb, int offset, packet_info *pinfo,
pinfo->can_desegment = pinfo->saved_can_desegment;
dissect_tcp_payload(tvb, pinfo, offset, tcpinfo->seq,
tcpinfo->nxtseq, pinfo->srcport, pinfo->destport,
- tree, socks_tree, tcpd);
+ tree, socks_tree, tcpd, tcpinfo);
pinfo->can_desegment = save_can_desegment;
CLEANUP_CALL_AND_POP;
@@ -983,7 +982,7 @@ static void call_next_dissector(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
-dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
+dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
int offset = 0;
proto_tree *socks_tree = NULL;
@@ -992,6 +991,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
conversation_t *conversation;
sock_state_t* state_info;
guint8 version;
+ struct tcpinfo *tcpinfo = (struct tcpinfo*)data;
state_info = (sock_state_t *)p_get_proto_data(pinfo->fd, proto_socks, 0);
if (state_info == NULL) {
@@ -1139,7 +1139,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
/* call next dissector if ready */
if ( pinfo->fd->num > hash_info->start_done_frame){
call_next_dissector(tvb, offset, pinfo, tree, socks_tree,
- hash_info, state_info);
+ hash_info, state_info, tcpinfo);
}
return tvb_reported_length(tvb);
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index f09a2af617..0b0e09b709 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -480,7 +480,7 @@ static void
process_tcp_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo,
proto_tree *tree, proto_tree *tcp_tree, int src_port, int dst_port,
guint32 seq, guint32 nxtseq, gboolean is_tcp_segment,
- struct tcp_analysis *tcpd);
+ struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo);
struct tcp_analysis *
@@ -1616,9 +1616,8 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
guint32 seq, guint32 nxtseq,
guint32 sport, guint32 dport,
proto_tree *tree, proto_tree *tcp_tree,
- struct tcp_analysis *tcpd)
+ struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo)
{
- struct tcpinfo *tcpinfo = (struct tcpinfo *)pinfo->private_data;
fragment_head *ipfd_head;
int last_fragment_len;
gboolean must_desegment;
@@ -1749,7 +1748,7 @@ again:
tcpinfo->seq = seq;
process_tcp_payload(tvb, offset, pinfo, tree, tcp_tree,
- sport, dport, 0, 0, FALSE, tcpd);
+ sport, dport, 0, 0, FALSE, tcpd, tcpinfo);
called_dissector = TRUE;
/* Did the subdissector ask us to desegment some more data
@@ -1813,7 +1812,7 @@ again:
/* call subdissector */
process_tcp_payload(next_tvb, 0, pinfo, tree, tcp_tree, sport,
- dport, 0, 0, FALSE, tcpd);
+ dport, 0, 0, FALSE, tcpd, tcpinfo);
called_dissector = TRUE;
/*
@@ -3776,7 +3775,7 @@ static gboolean try_heuristic_first = FALSE;
gboolean
decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, int src_port, int dst_port,
- struct tcp_analysis *tcpd)
+ struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo)
{
tvbuff_t *next_tvb;
int low_port, high_port;
@@ -3808,7 +3807,7 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* for the conversation if available */
if (try_conversation_dissector(&pinfo->src, &pinfo->dst, PT_TCP,
- src_port, dst_port, next_tvb, pinfo, tree, NULL)) {
+ src_port, dst_port, next_tvb, pinfo, tree, tcpinfo)) {
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
return TRUE;
}
@@ -3817,7 +3816,7 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* do lookup with the heuristic subdissector table */
save_desegment_offset = pinfo->desegment_offset;
save_desegment_len = pinfo->desegment_len;
- if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, NULL)) {
+ if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, tcpinfo)) {
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
return TRUE;
}
@@ -3850,7 +3849,7 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
number of 0 to disable the port. */
if (tcpd && tcpd->server_port != 0 &&
- dissector_try_uint(subdissector_table, tcpd->server_port, next_tvb, pinfo, tree)) {
+ dissector_try_uint_new(subdissector_table, tcpd->server_port, next_tvb, pinfo, tree, FALSE, tcpinfo)) {
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
return TRUE;
}
@@ -3864,12 +3863,12 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
if (low_port != 0 &&
- dissector_try_uint(subdissector_table, low_port, next_tvb, pinfo, tree)) {
+ dissector_try_uint_new(subdissector_table, low_port, next_tvb, pinfo, tree, FALSE, tcpinfo)) {
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
return TRUE;
}
if (high_port != 0 &&
- dissector_try_uint(subdissector_table, high_port, next_tvb, pinfo, tree)) {
+ dissector_try_uint_new(subdissector_table, high_port, next_tvb, pinfo, tree, FALSE, tcpinfo)) {
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
return TRUE;
}
@@ -3878,7 +3877,7 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* do lookup with the heuristic subdissector table */
save_desegment_offset = pinfo->desegment_offset;
save_desegment_len = pinfo->desegment_len;
- if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, NULL)) {
+ if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, tcpinfo)) {
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
return TRUE;
}
@@ -3904,7 +3903,7 @@ static void
process_tcp_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo,
proto_tree *tree, proto_tree *tcp_tree, int src_port, int dst_port,
guint32 seq, guint32 nxtseq, gboolean is_tcp_segment,
- struct tcp_analysis *tcpd)
+ struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo)
{
pinfo->want_pdu_tracking=0;
@@ -3924,7 +3923,7 @@ process_tcp_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo,
*/
if( (offset!=-1) &&
decode_tcp_ports(tvb, offset, pinfo, tree, src_port,
- dst_port, tcpd) ) {
+ dst_port, tcpd, tcpinfo) ) {
/*
* We succeeded in handing off to a subdissector.
*
@@ -3983,7 +3982,7 @@ void
dissect_tcp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, guint32 seq,
guint32 nxtseq, guint32 sport, guint32 dport,
proto_tree *tree, proto_tree *tcp_tree,
- struct tcp_analysis *tcpd)
+ struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo)
{
gboolean save_fragmented;
@@ -3991,7 +3990,7 @@ dissect_tcp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, guint32 seq,
if (pinfo->can_desegment) {
/* Yes. */
desegment_tcp(tvb, pinfo, offset, seq, nxtseq, sport, dport, tree,
- tcp_tree, tcpd);
+ tcp_tree, tcpd, tcpinfo);
} else {
/* No - just call the subdissector.
Mark this as fragmented, so if somebody throws an exception,
@@ -3999,7 +3998,7 @@ dissect_tcp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, guint32 seq,
save_fragmented = pinfo->fragmented;
pinfo->fragmented = TRUE;
process_tcp_payload(tvb, offset, pinfo, tree, tcp_tree, sport, dport,
- seq, nxtseq, TRUE, tcpd);
+ seq, nxtseq, TRUE, tcpd, tcpinfo);
pinfo->fragmented = save_fragmented;
}
}
@@ -4397,8 +4396,6 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Assume we'll pass un-reassembled data to subdissectors. */
tcpinfo.is_reassembled = FALSE;
- pinfo->private_data = &tcpinfo;
-
/*
* Assume, initially, that we can't desegment.
*/
@@ -4707,7 +4704,8 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
pinfo->can_desegment = 0;
- process_tcp_payload(next_tvb, 0, pinfo, tree, tcp_tree, tcph->th_sport, tcph->th_dport, tcph->th_seq, nxtseq, FALSE, tcpd);
+ process_tcp_payload(next_tvb, 0, pinfo, tree, tcp_tree, tcph->th_sport, tcph->th_dport, tcph->th_seq,
+ nxtseq, FALSE, tcpd, &tcpinfo);
return;
}
@@ -4777,7 +4775,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_format_text(tvb, offset, length_remaining));
} else {
dissect_tcp_payload(tvb, pinfo, offset, tcph->th_seq, nxtseq,
- tcph->th_sport, tcph->th_dport, tree, tcp_tree, tcpd);
+ tcph->th_sport, tcph->th_dport, tree, tcp_tree, tcpd, &tcpinfo);
}
}
}
diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h
index eb1c8f0a47..b1a5fc807e 100644
--- a/epan/dissectors/packet-tcp.h
+++ b/epan/dissectors/packet-tcp.h
@@ -272,12 +272,12 @@ extern void dissect_tcp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset,
guint32 seq, guint32 nxtseq, guint32 sport,
guint32 dport, proto_tree *tree,
proto_tree *tcp_tree,
- struct tcp_analysis *tcpd);
+ struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo);
extern struct tcp_analysis *get_tcp_conversation_data(conversation_t *conv,
packet_info *pinfo);
-extern gboolean decode_tcp_ports(tvbuff_t *, int, packet_info *, proto_tree *, int, int, struct tcp_analysis *);
+extern gboolean decode_tcp_ports(tvbuff_t *, int, packet_info *, proto_tree *, int, int, struct tcp_analysis *, struct tcpinfo *);
/** Associate process information with a given flow
*
diff --git a/epan/dissectors/rpc_defrag.h b/epan/dissectors/rpc_defrag.h
index 3bf5c434cd..0cec855ec7 100644
--- a/epan/dissectors/rpc_defrag.h
+++ b/epan/dissectors/rpc_defrag.h
@@ -40,6 +40,6 @@ extern void show_rpc_fraginfo(tvbuff_t *tvb, tvbuff_t *frag_tvb,
proto_tree *tree, guint32 rpc_rm, fragment_head *ipfd_head, packet_info *pinfo);
extern int dissect_rpc_fragment(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, rec_dissector_t dissector, gboolean is_heur,
- int proto, int ett, gboolean defragment, gboolean first_pdu);
+ int proto, int ett, gboolean defragment, gboolean first_pdu, struct tcpinfo *tcpinfo);
#endif /* __RPC_DEFRAG_H__ */