Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0551d1d9 authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Rectify the value of the direction field in PCAP records

The value was inverted, which resulted in the packets read in wireshark
to be reported as coming from the opposite direction on the link.
The impact on HCI commands and events is minimal which explains
why it was not found sooner.

Test: manual
Change-Id: I4667ab318df1ac8346fb5c3c76765451daf9bfa5
parent 815ada3a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,9 @@ void HciSniffer::AppendRecord(PacketDirection packet_direction,
  pcap::WriteRecordHeader(*output_, 4 + 1 + packet.size());

  // http://www.tcpdump.org/linktypes.html LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR
  // Note: the description given for the direction bit by tcpdump
  // is in opposition with the implementation in wireshark.
  // The values match wireshark's implementation here.
  char direction[4] = {0, 0, 0, static_cast<char>(packet_direction)};
  uint8_t idc = static_cast<uint8_t>(packet_type);
  output_->write(direction, sizeof(direction));
+2 −2
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@
namespace rootcanal {

enum class PacketDirection : uint8_t {
  CONTROLLER_TO_HOST = 0,
  HOST_TO_CONTROLLER = 1,
  HOST_TO_CONTROLLER = 0,
  CONTROLLER_TO_HOST = 1,
};

// A Hci Transport that logs all the in and out going