aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2014-03-18 23:01:22 +0100
committerAnders Broman <a.broman58@gmail.com>2014-03-19 05:13:30 +0000
commit488f2a097402b1bfb941547939d13fbcbb90c6c9 (patch)
tree9d7b38d10b565d2928282517aa270ab5929cef11
parent30ba425e7e95f7b61b3a3e5ff0c46e4be9d3d8d7 (diff)
Exported PDU: add support for data length on the wire
Change-Id: Iff14ec4d0297ec85f3597b33871fb0ab5256a597 Reviewed-on: https://code.wireshark.org/review/728 Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--asn1/credssp/packet-credssp-template.c3
-rw-r--r--epan/dissectors/packet-credssp.c7
-rw-r--r--epan/dissectors/packet-diameter.c3
-rw-r--r--epan/dissectors/packet-dtls.c3
-rw-r--r--epan/dissectors/packet-dvbci.c3
-rw-r--r--epan/dissectors/packet-ipsec.c3
-rw-r--r--epan/dissectors/packet-logcat.c3
-rw-r--r--epan/dissectors/packet-reload-framing.c5
-rw-r--r--epan/dissectors/packet-sctp.c3
-rw-r--r--epan/dissectors/packet-sip.c3
-rw-r--r--epan/dissectors/packet-ssl.c3
-rw-r--r--epan/exported_pdu.h5
-rw-r--r--ui/tap_export_pdu.c5
13 files changed, 31 insertions, 18 deletions
diff --git a/asn1/credssp/packet-credssp-template.c b/asn1/credssp/packet-credssp-template.c
index abfd986275..31457f28dd 100644
--- a/asn1/credssp/packet-credssp-template.c
+++ b/asn1/credssp/packet-credssp-template.c
@@ -111,7 +111,8 @@ dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
(EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT |
EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT));
- exp_pdu_data->tvb_length = tvb_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-credssp.c b/epan/dissectors/packet-credssp.c
index 240e0c56cc..2f01b59e80 100644
--- a/epan/dissectors/packet-credssp.c
+++ b/epan/dissectors/packet-credssp.c
@@ -383,7 +383,8 @@ dissect_credssp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
(EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT |
EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT));
- exp_pdu_data->tvb_length = tvb_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
@@ -506,7 +507,7 @@ void proto_register_credssp(void) {
"OCTET_STRING", HFILL }},
/*--- End of included file: packet-credssp-hfarr.c ---*/
-#line 149 "../../asn1/credssp/packet-credssp-template.c"
+#line 150 "../../asn1/credssp/packet-credssp-template.c"
};
/* List of subtrees */
@@ -524,7 +525,7 @@ void proto_register_credssp(void) {
&ett_credssp_TSRequest,
/*--- End of included file: packet-credssp-ettarr.c ---*/
-#line 155 "../../asn1/credssp/packet-credssp-template.c"
+#line 156 "../../asn1/credssp/packet-credssp-template.c"
};
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 29f6cd61b5..1b20ee547c 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -340,7 +340,8 @@ export_diameter_pdu(packet_info *pinfo, tvbuff_t *tvb)
exp_pdu_data = load_export_pdu_tags(pinfo, "diameter", -1, tags_bit_field);
- exp_pdu_data->tvb_length = tvb_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c
index 67d53e230b..628ba19f04 100644
--- a/epan/dissectors/packet-dtls.c
+++ b/epan/dissectors/packet-dtls.c
@@ -1040,7 +1040,8 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
(EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT |
EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT));
- exp_pdu_data->tvb_length = tvb_length(next_tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(next_tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(next_tvb);
exp_pdu_data->pdu_tvb = next_tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-dvbci.c b/epan/dissectors/packet-dvbci.c
index 1a74095e21..9c1a427ac4 100644
--- a/epan/dissectors/packet-dvbci.c
+++ b/epan/dissectors/packet-dvbci.c
@@ -3417,7 +3417,8 @@ dissect_sac_msg(guint32 tag, tvbuff_t *tvb, gint offset,
exp_pdu_data = load_export_pdu_tags(
pinfo, EXPORTED_SAC_MSG_PROTO, -1, EXP_PDU_TAG_DVBCI_EVT_BIT);
- exp_pdu_data->tvb_length = tvb_length(clear_sac_msg_tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(clear_sac_msg_tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(clear_sac_msg_tvb);
exp_pdu_data->pdu_tvb = clear_sac_msg_tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
}
diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c
index a07281c398..7ff497e04e 100644
--- a/epan/dissectors/packet-ipsec.c
+++ b/epan/dissectors/packet-ipsec.c
@@ -868,7 +868,8 @@ export_ipsec_pdu(dissector_handle_t dissector_handle, packet_info *pinfo, tvbuff
(EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT |
EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT));
- exp_pdu_data->tvb_length = tvb_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-logcat.c b/epan/dissectors/packet-logcat.c
index 9e7660d778..1a0b5e2b5e 100644
--- a/epan/dissectors/packet-logcat.c
+++ b/epan/dissectors/packet-logcat.c
@@ -179,7 +179,8 @@ dissect_logcat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
exp_pdu_data_t *exp_pdu_data;
exp_pdu_data = load_export_pdu_tags(pinfo, "logcat", -1, EXP_PDU_TAG_END_OF_OPT);
- exp_pdu_data->tvb_length = tvb_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
}
diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c
index c60378bd66..000a1ed190 100644
--- a/epan/dissectors/packet-reload-framing.c
+++ b/epan/dissectors/packet-reload-framing.c
@@ -129,7 +129,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
guint8 type;
offset = 0;
- effective_length = tvb_length(tvb);
+ effective_length = tvb_captured_length(tvb);
/* First, make sure we have enough data to do the check. */
if (effective_length < MIN_HDR_LENGTH)
@@ -180,7 +180,8 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
(EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT |
EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT));
- exp_pdu_data->tvb_length = effective_length;
+ exp_pdu_data->tvb_captured_length = effective_length;
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 2653d5ff23..5c0e3e9067 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -3046,7 +3046,8 @@ export_sctp_data_chunk(packet_info *pinfo, tvbuff_t *tvb, const gchar *proto_nam
exp_pdu_data = load_export_pdu_tags(pinfo, proto_name, -1, tags_bit_field);
- exp_pdu_data->tvb_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index 09bec53be8..399a4a7f60 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -994,7 +994,8 @@ export_sip_pdu(packet_info *pinfo, tvbuff_t *tvb)
exp_pdu_data = load_export_pdu_tags(pinfo, "sip", -1, tags_bit_field);
- exp_pdu_data->tvb_length = tvb_length(tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb);
exp_pdu_data->pdu_tvb = tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c
index 0e54dfc6c1..8cb95714f5 100644
--- a/epan/dissectors/packet-ssl.c
+++ b/epan/dissectors/packet-ssl.c
@@ -1369,7 +1369,8 @@ process_ssl_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo,
(EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT |
EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT));
- exp_pdu_data->tvb_length = tvb_length(next_tvb);
+ exp_pdu_data->tvb_captured_length = tvb_captured_length(next_tvb);
+ exp_pdu_data->tvb_reported_length = tvb_reported_length(next_tvb);
exp_pdu_data->pdu_tvb = next_tvb;
tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data);
diff --git a/epan/exported_pdu.h b/epan/exported_pdu.h
index cf73c00929..9546517eb1 100644
--- a/epan/exported_pdu.h
+++ b/epan/exported_pdu.h
@@ -97,9 +97,10 @@
typedef struct _exp_pdu_data_t {
- int tlv_buffer_len;
+ guint tlv_buffer_len;
guint8 *tlv_buffer;
- int tvb_length;
+ guint tvb_captured_length;
+ guint tvb_reported_length;
tvbuff_t *pdu_tvb;
} exp_pdu_data_t;
diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c
index e93014d97e..7c35ad36d5 100644
--- a/ui/tap_export_pdu.c
+++ b/ui/tap_export_pdu.c
@@ -48,7 +48,7 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, co
int buffer_len;
guint8 *packet_buf;
- buffer_len = exp_pdu_data->tvb_length + exp_pdu_data->tlv_buffer_len;
+ buffer_len = exp_pdu_data->tvb_captured_length + exp_pdu_data->tlv_buffer_len;
packet_buf = (guint8 *)g_malloc(buffer_len);
if(exp_pdu_data->tlv_buffer_len > 0){
@@ -60,7 +60,8 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, co
}
pkthdr.ts.secs = pinfo->fd->abs_ts.secs;
pkthdr.ts.nsecs = pinfo->fd->abs_ts.nsecs;
- pkthdr.caplen = pkthdr.len = buffer_len;
+ pkthdr.caplen = buffer_len;
+ pkthdr.len = exp_pdu_data->tvb_reported_length + exp_pdu_data->tlv_buffer_len;
pkthdr.pkt_encap = exp_pdu_tap_data->pkt_encap;
pkthdr.interface_id = 0;