aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-06 12:35:11 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-06 20:35:47 +0000
commitcb1a6528f968c3cd97660217abc1a6725ff5ba92 (patch)
treeaee1d32c85897e2f769d56c454a17505cce0d4e6 /epan/dissectors
parent6db88da7f7ffd7f75bb2e06e269bd28537f10ac1 (diff)
Get rid of the pkt_encap field in struct packet_info.
pinfo->pkt_encap is jsut a copy of pinfo->phdr->pkt_encap; no need for the copy. Expand a comment while we're at it. Change-Id: I5fcfe694ecba42507f1d629d01440da0a0989501 Reviewed-on: https://code.wireshark.org/review/25643 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/file-file.c6
-rw-r--r--epan/dissectors/packet-frame.c10
-rw-r--r--epan/dissectors/packet-nettl.c2
-rw-r--r--epan/dissectors/packet-snort.c12
4 files changed, 18 insertions, 12 deletions
diff --git a/epan/dissectors/file-file.c b/epan/dissectors/file-file.c
index f926a75077..f336494f5c 100644
--- a/epan/dissectors/file-file.c
+++ b/epan/dissectors/file-file.c
@@ -121,7 +121,7 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
fh_tree = proto_item_add_subtree(ti, ett_file);
- proto_tree_add_int(fh_tree, hf_file_ftap_encap, tvb, 0, 0, pinfo->pkt_encap);
+ proto_tree_add_int(fh_tree, hf_file_ftap_encap, tvb, 0, 0, pinfo->phdr->pkt_encap);
proto_tree_add_uint(fh_tree, hf_file_record_number, tvb, 0, 0, pinfo->num);
@@ -177,12 +177,12 @@ dissect_file_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
*/
__try {
#endif
- if (!dissector_try_uint(file_encap_dissector_table, pinfo->pkt_encap,
+ if (!dissector_try_uint(file_encap_dissector_table, pinfo->phdr->pkt_encap,
tvb, pinfo, parent_tree)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
col_add_fstr(pinfo->cinfo, COL_INFO, "FTAP_ENCAP = %d",
- pinfo->pkt_encap);
+ pinfo->phdr->pkt_encap);
call_data_dissector(tvb, pinfo, parent_tree);
}
#ifdef _MSC_VER
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index bfce974f17..e9cd5a8f0e 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -245,7 +245,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
* overrides the packet record.
*/
if (pinfo->pseudo_header != NULL) {
- switch (pinfo->pkt_encap) {
+ switch (pinfo->phdr->pkt_encap) {
case WTAP_ENCAP_WFLEET_HDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
@@ -432,7 +432,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
}
if (pinfo->phdr->rec_type == REC_TYPE_PACKET)
- proto_tree_add_int(fh_tree, hf_frame_wtap_encap, tvb, 0, 0, pinfo->pkt_encap);
+ proto_tree_add_int(fh_tree, hf_frame_wtap_encap, tvb, 0, 0, pinfo->phdr->pkt_encap);
if (pinfo->presence_flags & PINFO_HAS_TS) {
proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb,
@@ -519,7 +519,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
}
/* Check for existences of MTP2 link number */
- if ((pinfo->pseudo_header != NULL ) && (pinfo->pkt_encap == WTAP_ENCAP_MTP2_WITH_PHDR)) {
+ if ((pinfo->pseudo_header != NULL ) && (pinfo->phdr->pkt_encap == WTAP_ENCAP_MTP2_WITH_PHDR)) {
proto_tree_add_uint(fh_tree, hf_link_number, tvb,
0, 0, pinfo->link_number);
}
@@ -561,12 +561,12 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
(void *)pinfo->pseudo_header);
} else {
if (!dissector_try_uint_new(wtap_encap_dissector_table,
- pinfo->pkt_encap, tvb, pinfo,
+ pinfo->phdr->pkt_encap, tvb, pinfo,
parent_tree, TRUE,
(void *)pinfo->pseudo_header)) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d",
- pinfo->pkt_encap);
+ pinfo->phdr->pkt_encap);
call_data_dissector(tvb, pinfo, parent_tree);
}
}
diff --git a/epan/dissectors/packet-nettl.c b/epan/dissectors/packet-nettl.c
index 52b4ab0362..13ef003b0f 100644
--- a/epan/dissectors/packet-nettl.c
+++ b/epan/dissectors/packet-nettl.c
@@ -227,7 +227,7 @@ dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
0, 0, pinfo->pseudo_header->nettl.uid);
}
- switch (pinfo->pkt_encap) {
+ switch (pinfo->phdr->pkt_encap) {
case WTAP_ENCAP_NETTL_ETHERNET:
call_dissector(eth_withoutfcs_handle, tvb, pinfo, tree);
break;
diff --git a/epan/dissectors/packet-snort.c b/epan/dissectors/packet-snort.c
index 616f38bd00..6da2a4b7e8 100644
--- a/epan/dissectors/packet-snort.c
+++ b/epan/dissectors/packet-snort.c
@@ -1166,11 +1166,18 @@ snort_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* Older versions of Snort don't support capture file with several encapsulations (like pcapng),
* so write in pcap format and hope we have just one encap.
- * Newer versions of Snort can read pcapng now, but still write in pcap format.
+ * Newer versions of Snort can read pcapng now, but still
+ * write in pcap format; if "newer versions of Snort" really
+ * means "Snort, when using newer versions of libpcap", then,
+ * yes, they can read pcapng, but they can't read pcapng
+ * files with more than one encapsulation type, as libpcap's
+ * API currently can't handle that, so even those "newer
+ * versions of Snort" wouldn't handle multiple encapsulation
+ * types.
*/
current_session.pdh = wtap_dump_fdopen(current_session.in,
WTAP_FILE_TYPE_SUBTYPE_PCAP,
- pinfo->pkt_encap,
+ pinfo->phdr->pkt_encap,
WTAP_MAX_PACKET_SIZE_STANDARD,
FALSE, /* compressed */
&open_err);
@@ -1193,7 +1200,6 @@ snort_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
wtp.caplen = tvb_captured_length(tvb);
wtp.len = tvb_reported_length(tvb);
- wtp.pkt_encap = pinfo->pkt_encap;
if (current_session.pdh->encap != wtp.pkt_encap) {
/* XXX, warning! convert? */
}