androiddump: Add packets with same encap type as used when open wtap

Already when selecting the extcap interface to use the encap type is
known. For some reason when adding packets the type is explicitly
checked for certain values and if not known type is set to
WTAP_ENCAP_WIRESHARK_UPPER_PDU.

This conversion break tcpdump function for all but ETHERNET interface
type. For example NLMON and 802.11 radiotap interfaces does not work.

This problem has probably been there since quite a while back but was not
seen (in the sense that current capture looked OK). Though when:

"3aec5e1 Catch attempts to write multiple encapsulation types if unsupported."

got applied the encap type mismatch is now detected and packet capture stops.
As encap type is known already when selecting the interface to use, fix
this by simply reusing the initial value when dumping the packets.

Change-Id: Ica9824e715c47b285c985ea48cbae0e10e18d542
Reviewed-on: https://code.wireshark.org/review/30715
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Mikael Kanstrup 2018-11-19 13:23:19 +01:00 committed by Anders Broman
parent 57c3ebb396
commit 51fb5081b3
1 changed files with 1 additions and 7 deletions

View File

@ -508,14 +508,8 @@ static gboolean extcap_dumper_dump(struct extcap_dumper extcap_dumper,
rec.rec_header.packet_header.caplen -= (guint32)sizeof(own_pcap_bluetooth_h4_header);
buffer += sizeof(own_pcap_bluetooth_h4_header);
rec.rec_header.packet_header.pkt_encap = WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR;
}
else if (extcap_dumper.encap == EXTCAP_ENCAP_ETHERNET) {
rec.rec_header.packet_header.pkt_encap = WTAP_ENCAP_ETHERNET;
}
else {
rec.rec_header.packet_header.pkt_encap = WTAP_ENCAP_WIRESHARK_UPPER_PDU;
}
rec.rec_header.packet_header.pkt_encap = extcap_dumper.encap;
if (!wtap_dump(extcap_dumper.dumper.wtap, &rec, (const guint8 *) buffer, &err, &err_info)) {
cfile_write_failure_message("androiddump", NULL, fifo, err, err_info,