forked from osmocom/wireshark
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>
This commit is contained in:
parent
6db88da7f7
commit
cb1a6528f9
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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? */
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue