diff mbox series

[BlueZ,v2,01/12] monitor: Fix Create BIG PDU

Message ID 20220305012229.853784-2-luiz.dentz@gmail.com
State New
Headers show
Series emulator: Initial Broacast Receiver | expand

Commit Message

Luiz Augusto von Dentz March 5, 2022, 1:22 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The PDU of Create BIG is actually fixed size as the num_bis is
related to the number of indexes to be connected and not the BIS
parameters.
---
 emulator/btdev.c | 2 +-
 monitor/bt.h     | 2 +-
 monitor/packet.c | 9 ++-------
 3 files changed, 4 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 378674010..9189e8082 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -5692,10 +5692,10 @@  static int cmd_create_big_complete(struct btdev *dev, const void *data,
 							uint8_t len)
 {
 	const struct bt_hci_cmd_le_create_big *cmd = data;
+	const struct bt_hci_bis *bis = &cmd->bis;
 	int i;
 
 	for (i = 0; i < cmd->num_bis; i++) {
-		const struct bt_hci_bis *bis = &cmd->bis[i];
 		struct btdev_conn *conn;
 		struct {
 			struct bt_hci_evt_le_big_complete evt;
diff --git a/monitor/bt.h b/monitor/bt.h
index 66ed3ef5a..51b1833dc 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -2758,7 +2758,7 @@  struct bt_hci_cmd_le_create_big {
 	uint8_t  handle;
 	uint8_t  adv_handle;
 	uint8_t  num_bis;
-	struct bt_hci_bis bis[0];
+	struct bt_hci_bis bis;
 } __attribute__ ((packed));
 
 #define BT_HCI_CMD_LE_CREATE_BIG_TEST		0x2069
diff --git a/monitor/packet.c b/monitor/packet.c
index ec779a9d5..a17c632a7 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -8200,10 +8200,8 @@  static void le_reject_cis_req_cmd(const void *data, uint8_t size)
 	print_reason(cmd->reason);
 }
 
-static void print_bis(const void *data, int i)
+static void print_bis(const struct bt_hci_bis *bis)
 {
-	const struct bt_hci_bis *bis = data;
-
 	print_usec_interval("SDU Interval", bis->sdu_interval);
 	print_field("Maximum SDU size: %u", le16_to_cpu(bis->sdu));
 	print_field("Maximum Latency: %u ms (0x%4.4x)",
@@ -8223,10 +8221,7 @@  static void le_create_big_cmd(const void *data, uint8_t size)
 	print_field("Handle: 0x%2.2x", cmd->handle);
 	print_field("Advertising Handle: 0x%2.2x", cmd->adv_handle);
 	print_field("Number of BIS: %u", cmd->num_bis);
-
-	size -= sizeof(*cmd);
-
-	print_list(cmd->bis, size, cmd->num_bis, sizeof(*cmd->bis), print_bis);
+	print_bis(&cmd->bis);
 }
 
 static void print_bis_test(const void *data, int i)