aboutsummaryrefslogtreecommitdiffstats
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
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>
-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
-rw-r--r--epan/packet.c1
-rw-r--r--epan/packet_info.h1
-rw-r--r--epan/wslua/wslua_dumper.c4
7 files changed, 20 insertions, 16 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? */
}
diff --git a/epan/packet.c b/epan/packet.c
index 68f41fc0d6..e167186b64 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -512,7 +512,6 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype,
edt->pi.presence_flags |= PINFO_HAS_TS;
edt->pi.abs_ts = fd->abs_ts;
}
- edt->pi.pkt_encap = phdr->pkt_encap;
edt->pi.fd = fd;
edt->pi.phdr = phdr;
edt->pi.pseudo_header = &phdr->pseudo_header;
diff --git a/epan/packet_info.h b/epan/packet_info.h
index b010f3bb5e..3799ee7d6f 100644
--- a/epan/packet_info.h
+++ b/epan/packet_info.h
@@ -60,7 +60,6 @@ typedef struct _packet_info {
guint32 num; /**< Frame number */
nstime_t abs_ts; /**< Packet absolute time stamp */
nstime_t rel_ts; /**< Relative timestamp (yes, it can be negative) */
- gint pkt_encap; /**< Per-packet encapsulation/data-link type */
frame_data *fd;
union wtap_pseudo_header *pseudo_header;
struct wtap_pkthdr *phdr; /**< Record metadata */
diff --git a/epan/wslua/wslua_dumper.c b/epan/wslua/wslua_dumper.c
index 23f7daee77..b343c81c5d 100644
--- a/epan/wslua/wslua_dumper.c
+++ b/epan/wslua/wslua_dumper.c
@@ -375,7 +375,7 @@ WSLUA_METHOD Dumper_new_for_current(lua_State* L) {
return 0;
}
- encap = lua_pinfo->pkt_encap;
+ encap = lua_pinfo->phdr->pkt_encap;
d = wtap_dump_open(filename, filetype, encap, 0, FALSE, &err);
@@ -438,7 +438,7 @@ WSLUA_METHOD Dumper_dump_current(lua_State* L) {
pkthdr.ts = lua_pinfo->abs_ts;
pkthdr.len = tvb_reported_length(tvb);
pkthdr.caplen = tvb_captured_length(tvb);
- pkthdr.pkt_encap = lua_pinfo->pkt_encap;
+ pkthdr.pkt_encap = lua_pinfo->phdr->pkt_encap;
pkthdr.pseudo_header = *lua_pinfo->pseudo_header;
if (lua_pinfo->fd->flags.has_user_comment) {