summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-11-04 17:21:22 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-11-04 17:21:22 +0100
commitdc4eb576b6eba6bce9bc7b82e20ae69878de09a1 (patch)
treee6c01c2aa0b3762fee92c0400d732733ee52f361
parent9d573589449e7e92f8e576be03de75d5b438c1a8 (diff)
downloadbluez-dc4eb576b6eba6bce9bc7b82e20ae69878de09a1.tar.gz
monitor: Fix handling of buffer for high speed data frames
-rw-r--r--monitor/control.c6
-rw-r--r--monitor/hcidump.c2
-rw-r--r--monitor/packet.c6
3 files changed, 9 insertions, 5 deletions
diff --git a/monitor/control.c b/monitor/control.c
index 95582a4c4..ae1a7ae56 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -45,10 +45,12 @@
#include "btsnoop.h"
#include "control.h"
+#define MAX_PACKET_SIZE (1486 + 4)
+
struct control_data {
uint16_t channel;
int fd;
- unsigned char buf[HCI_MAX_FRAME_SIZE];
+ unsigned char buf[MAX_PACKET_SIZE];
uint16_t offset;
};
@@ -772,7 +774,7 @@ void control_server(const char *path)
void control_reader(const char *path)
{
- unsigned char buf[HCI_MAX_FRAME_SIZE];
+ unsigned char buf[MAX_PACKET_SIZE];
uint16_t index, opcode, pktlen;
struct timeval tv;
diff --git a/monitor/hcidump.c b/monitor/hcidump.c
index 4eb0a4939..e69bcb14d 100644
--- a/monitor/hcidump.c
+++ b/monitor/hcidump.c
@@ -108,7 +108,7 @@ static int open_hci_dev(uint16_t index)
static void device_callback(int fd, uint32_t events, void *user_data)
{
struct hcidump_data *data = user_data;
- unsigned char buf[HCI_MAX_FRAME_SIZE];
+ unsigned char buf[HCI_MAX_FRAME_SIZE * 2];
unsigned char control[64];
struct msghdr msg;
struct iovec iov;
diff --git a/monitor/packet.c b/monitor/packet.c
index d90dc24a6..a080ff748 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -3833,7 +3833,8 @@ void packet_hci_acldata(struct timeval *tv, uint16_t index, bool in,
handle_str, extra_str);
if (size != dlen) {
- print_field("invalid packet size");
+ print_field("invalid packet size (%d != %d)", size, dlen);
+ packet_hexdump(data, size);
return;
}
@@ -3883,7 +3884,8 @@ void packet_hci_scodata(struct timeval *tv, uint16_t index, bool in,
handle_str, extra_str);
if (size != hdr->dlen) {
- print_field("invalid packet size");
+ print_field("invalid packet size (%d != %d)", size, hdr->dlen);
+ packet_hexdump(data, size);
return;
}