mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Fixed pcap summary print of 802.11 frame
802.11 Packet Type and Packet Subtype is now correctly decoded
This commit is contained in:
parent
762031424b
commit
04fab6f1ac
@ -175,10 +175,10 @@ esp_err_t pcap_print_summary(pcap_file_handle_t pcap, FILE *print_file)
|
||||
real_read = fread(packet_payload, payload_length, 1, pcap->file);
|
||||
ESP_GOTO_ON_FALSE(real_read == 1, ESP_FAIL, err, TAG, "read payload error");
|
||||
// print packet information
|
||||
// currently only print info for 802.11
|
||||
if (file_header.link_type == PCAP_LINK_TYPE_802_11) {
|
||||
fprintf(print_file, "Packet Type: %2x\n", (packet_payload[0] >> 4) & 0x03);
|
||||
fprintf(print_file, "Packet Subtype: %2x\n", packet_payload[0] & 0x0F);
|
||||
// Frame Control Field is coded as LSB first
|
||||
fprintf(print_file, "Frame Type: %2x\n", (packet_payload[0] >> 2) & 0x03);
|
||||
fprintf(print_file, "Frame Subtype: %2x\n", (packet_payload[0] >> 4) & 0x0F);
|
||||
fprintf(print_file, "Destination: ");
|
||||
for (int j = 0; j < 5; j++) {
|
||||
fprintf(print_file, "%2x ", packet_payload[4 + j]);
|
||||
|
@ -1,3 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
@ -33,8 +35,8 @@ def test_examples_simple_sniffer(env, _): # type: (Any, Any) -> None
|
||||
dut.expect(re.compile(r'Timestamp \(Microseconds\): [0-9]*'))
|
||||
dut.expect(re.compile(r'Capture Length: [0-9]*'))
|
||||
dut.expect(re.compile(r'Packet Length: [0-9]*'))
|
||||
dut.expect(re.compile(r'Packet Type: .*'))
|
||||
dut.expect(re.compile(r'Packet Subtype: .*'))
|
||||
dut.expect(re.compile(r'Frame Type: .*'))
|
||||
dut.expect(re.compile(r'Frame Subtype: .*'))
|
||||
dut.expect(re.compile(r'Destination: .*'))
|
||||
dut.expect(re.compile(r'Source: .*'))
|
||||
dut.expect('Pcap packet Number: 10')
|
||||
|
Loading…
x
Reference in New Issue
Block a user