From 51fb5081b361870b1525c2457198a5d8c99032eb Mon Sep 17 00:00:00 2001 From: Mikael Kanstrup Date: Mon, 19 Nov 2018 13:23:19 +0100 Subject: [PATCH] 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 --- extcap/androiddump.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 4a3a8870a5..fd9b8fa16f 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -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,