Always count packets per encapsulation.

Currently, for pcapng files, if all of the IDBs we've seen *so far* are
the same, we report it as the file's encapsulation type; however, we may
see IDBs of a different type in the future, so don't check for
per-packet encapsulation before counting packets of the encapsulation
type.

Change-Id: I617ddcf2963aa16e7ba58855b3e5bf326ab7dc32
Reviewed-on: https://code.wireshark.org/review/15808
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-06-10 00:40:18 -07:00
parent 1438d28768
commit e53a1adf49
1 changed files with 5 additions and 8 deletions

View File

@ -1158,14 +1158,11 @@ process_cap_file(wtap *wth, const char *filename)
snaplen_max_inferred = phdr->caplen;
}
/* Per-packet encapsulation */
if (wtap_file_encap(wth) == WTAP_ENCAP_PER_PACKET) {
if ((phdr->pkt_encap > 0) && (phdr->pkt_encap < WTAP_NUM_ENCAP_TYPES)) {
cf_info.encap_counts[phdr->pkt_encap] += 1;
} else {
fprintf(stderr, "capinfos: Unknown per-packet encapsulation %d in frame %u of file \"%s\"\n",
phdr->pkt_encap, packet, filename);
}
if ((phdr->pkt_encap > 0) && (phdr->pkt_encap < WTAP_NUM_ENCAP_TYPES)) {
cf_info.encap_counts[phdr->pkt_encap] += 1;
} else {
fprintf(stderr, "capinfos: Unknown packet encapsulation %d in frame %u of file \"%s\"\n",
phdr->pkt_encap, packet, filename);
}
/* Packet interface_id info */