Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size
@ 2014-01-22  8:25 Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 2/9] android/ipc-tester: Add cases for HIDHOST " Jakub Tyszkowski
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

Add cases testing message size verification for SOCK opcodes.
---
 android/ipc-tester.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index ed0dd10..088c324 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -864,5 +864,23 @@ int main(int argc, char *argv[])
 			sizeof(struct hal_cmd_le_test_mode), -1,
 			HAL_SERVICE_ID_BLUETOOTH);
 
+	/* check for valid data size for SOCK */
+	test_datasize_valid("SOCK Listen+", HAL_SERVICE_ID_SOCK,
+			HAL_OP_SOCK_LISTEN,
+			sizeof(struct hal_cmd_sock_listen), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
+	test_datasize_valid("SOCK Listen-", HAL_SERVICE_ID_SOCK,
+			HAL_OP_SOCK_LISTEN,
+			sizeof(struct hal_cmd_sock_listen), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
+	test_datasize_valid("SOCK Connect+", HAL_SERVICE_ID_SOCK,
+			HAL_OP_SOCK_CONNECT,
+			sizeof(struct hal_cmd_sock_connect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
+	test_datasize_valid("SOCK Connect-", HAL_SERVICE_ID_SOCK,
+			HAL_OP_SOCK_CONNECT,
+			sizeof(struct hal_cmd_sock_connect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
+
 	return tester_run();
 }
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/9] android/ipc-tester: Add cases for HIDHOST msg size
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 3/9] android/ipc-tester: Add case for HIDHOST Set Info Jakub Tyszkowski
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

Add cases testing message size verification for HIDHOST opcodes.
---
 android/ipc-tester.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 088c324..2871587 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -882,5 +882,79 @@ int main(int argc, char *argv[])
 			sizeof(struct hal_cmd_sock_connect), -1,
 			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
 
+	/* check for valid data size for HID Host */
+	test_datasize_valid("HIDHOST Connect+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_CONNECT,
+			sizeof(struct hal_cmd_hidhost_connect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Connect-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_CONNECT,
+			sizeof(struct hal_cmd_hidhost_connect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Disconnect+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_DISCONNECT,
+			sizeof(struct hal_cmd_hidhost_disconnect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Disconnect-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_DISCONNECT,
+			sizeof(struct hal_cmd_hidhost_disconnect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Virt. Unplug+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_VIRTUAL_UNPLUG,
+			sizeof(struct hal_cmd_hidhost_virtual_unplug), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Virt. Unplug-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_VIRTUAL_UNPLUG,
+			sizeof(struct hal_cmd_hidhost_virtual_unplug), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Set Info+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SET_INFO,
+			sizeof(struct hal_cmd_hidhost_set_info), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Set Info-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SET_INFO,
+			sizeof(struct hal_cmd_hidhost_set_info), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Get Protocol+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_GET_PROTOCOL,
+			sizeof(struct hal_cmd_hidhost_get_protocol), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Get Protocol-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_GET_PROTOCOL,
+			sizeof(struct hal_cmd_hidhost_get_protocol), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Set Protocol+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SET_PROTOCOL,
+			sizeof(struct hal_cmd_hidhost_set_protocol), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Set Protocol-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SET_PROTOCOL,
+			sizeof(struct hal_cmd_hidhost_set_protocol), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Get Report+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_GET_REPORT,
+			sizeof(struct hal_cmd_hidhost_get_report), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Get Report-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_GET_REPORT,
+			sizeof(struct hal_cmd_hidhost_get_report), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Set Report+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SET_REPORT,
+			sizeof(struct hal_cmd_hidhost_set_report), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Set Report-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SET_REPORT,
+			sizeof(struct hal_cmd_hidhost_set_report), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Send Data+", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SEND_DATA,
+			sizeof(struct hal_cmd_hidhost_send_data), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_datasize_valid("HIDHOST Send Data-", HAL_SERVICE_ID_HIDHOST,
+			HAL_OP_HIDHOST_SEND_DATA,
+			sizeof(struct hal_cmd_hidhost_send_data), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+
 	return tester_run();
 }
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/9] android/ipc-tester: Add case for HIDHOST Set Info
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 2/9] android/ipc-tester: Add cases for HIDHOST " Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 4/9] android/ipc-tester: Add case for HIDHOST Set Report Jakub Tyszkowski
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds test for verifying data length inside
hal_cmd_hidhost_set_info struct.
---
 android/ipc-tester.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 2871587..641bc5b 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -650,6 +650,41 @@ struct hal_hdr enable_bt_service_hdr = {
 	.len = 0,
 };
 
+struct hidhost_set_info_data {
+	struct hal_hdr hdr;
+	struct hal_cmd_hidhost_set_info info;
+
+	/* data placeholder for hal_cmd_hidhost_set_info.descr[0] field */
+	uint8_t buf[BLUEZ_HAL_MTU - sizeof(struct hal_hdr) -
+				sizeof(struct hal_cmd_hidhost_set_info)];
+} __attribute__((packed));
+
+#define set_info_data "some descriptor"
+
+static struct hidhost_set_info_data hidhost_set_info_data_overs = {
+	.hdr.service_id = HAL_SERVICE_ID_HIDHOST,
+	.hdr.opcode = HAL_OP_HIDHOST_SET_INFO,
+	.hdr.len = sizeof(struct hal_cmd_hidhost_set_info) +
+							sizeof(set_info_data),
+
+	/* declare wrong descriptor length */
+	.info.descr_len = sizeof(set_info_data) + 1,
+	/* init .info.descr[0] */
+	.buf = set_info_data,
+};
+
+static struct hidhost_set_info_data hidhost_set_info_data_unders = {
+	.hdr.service_id = HAL_SERVICE_ID_HIDHOST,
+	.hdr.opcode = HAL_OP_HIDHOST_SET_INFO,
+	.hdr.len = sizeof(struct hal_cmd_hidhost_set_info) +
+							sizeof(set_info_data),
+
+	/* declare wrong descriptor length */
+	.info.descr_len = sizeof(set_info_data) - 1,
+	/* init .info.descr[0] */
+	.buf = set_info_data,
+};
+
 int main(int argc, char *argv[])
 {
 	snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
@@ -915,6 +950,20 @@ int main(int argc, char *argv[])
 			HAL_OP_HIDHOST_SET_INFO,
 			sizeof(struct hal_cmd_hidhost_set_info), -1,
 			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_generic("Data size HIDHOST Set Info Vardata+",
+			ipc_send_tc, setup, teardown,
+			&hidhost_set_info_data_overs,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_hidhost_set_info) +
+				sizeof(set_info_data)),
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_generic("Data size HIDHOST Set Info Vardata-",
+			ipc_send_tc, setup, teardown,
+			&hidhost_set_info_data_unders,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_hidhost_set_info) +
+				sizeof(set_info_data)),
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
 	test_datasize_valid("HIDHOST Get Protocol+", HAL_SERVICE_ID_HIDHOST,
 			HAL_OP_HIDHOST_GET_PROTOCOL,
 			sizeof(struct hal_cmd_hidhost_get_protocol), 1,
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/9] android/ipc-tester: Add case for HIDHOST Set Report
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 2/9] android/ipc-tester: Add cases for HIDHOST " Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 3/9] android/ipc-tester: Add case for HIDHOST Set Info Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 5/9] android/ipc-tester: Add case for HIDHOST Send Data Jakub Tyszkowski
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds test for verifying data length inside
hal_cmd_hidhost_set_report struct.
---
 android/ipc-tester.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 641bc5b..ca4d9b9 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -685,6 +685,41 @@ static struct hidhost_set_info_data hidhost_set_info_data_unders = {
 	.buf = set_info_data,
 };
 
+struct hidhost_set_report_data {
+	struct hal_hdr hdr;
+	struct hal_cmd_hidhost_set_report report;
+
+	/* data placeholder for hal_cmd_hidhost_set_report.data[0] field */
+	uint8_t buf[BLUEZ_HAL_MTU - sizeof(struct hal_hdr) -
+				sizeof(struct hal_cmd_hidhost_set_report)];
+} __attribute__((packed));
+
+#define set_rep_data "1234567890"
+
+static struct hidhost_set_report_data hidhost_set_report_data_overs = {
+	.hdr.service_id = HAL_SERVICE_ID_HIDHOST,
+	.hdr.opcode = HAL_OP_HIDHOST_SET_REPORT,
+	.hdr.len = sizeof(struct hal_cmd_hidhost_set_report) +
+							sizeof(set_rep_data),
+
+	/* declare wrong descriptor length */
+	.report.len = sizeof(set_rep_data) + 1,
+	/* init report.data[0] */
+	.buf = set_rep_data,
+};
+
+static struct hidhost_set_report_data hidhost_set_report_data_unders = {
+	.hdr.service_id = HAL_SERVICE_ID_HIDHOST,
+	.hdr.opcode = HAL_OP_HIDHOST_SET_REPORT,
+	.hdr.len = sizeof(struct hal_cmd_hidhost_set_report) +
+							sizeof(set_rep_data),
+
+	/* declare wrong descriptor length */
+	.report.len = sizeof(set_rep_data) - 1,
+	/* init report.data[0] */
+	.buf = set_rep_data,
+};
+
 int main(int argc, char *argv[])
 {
 	snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
@@ -996,6 +1031,20 @@ int main(int argc, char *argv[])
 			HAL_OP_HIDHOST_SET_REPORT,
 			sizeof(struct hal_cmd_hidhost_set_report), -1,
 			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_generic("Data size HIDHOST Set Report Vardata+",
+			ipc_send_tc, setup, teardown,
+			&hidhost_set_report_data_overs,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_hidhost_set_report) +
+				sizeof(set_rep_data)),
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_generic("Data size HIDHOST Set Report Vardata-",
+			ipc_send_tc, setup, teardown,
+			&hidhost_set_report_data_unders,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_hidhost_set_report) +
+				sizeof(set_rep_data)),
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
 	test_datasize_valid("HIDHOST Send Data+", HAL_SERVICE_ID_HIDHOST,
 			HAL_OP_HIDHOST_SEND_DATA,
 			sizeof(struct hal_cmd_hidhost_send_data), 1,
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/9] android/ipc-tester: Add case for HIDHOST Send Data
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
                   ` (2 preceding siblings ...)
  2014-01-22  8:25 ` [PATCH 4/9] android/ipc-tester: Add case for HIDHOST Set Report Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 6/9] android/ipc-tester: Add cases for PAN msg size Jakub Tyszkowski
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

This adds test for verifying data length inside
hal_cmd_hidhost_send_data struct.
---
 android/ipc-tester.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index ca4d9b9..b161049 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -720,6 +720,41 @@ static struct hidhost_set_report_data hidhost_set_report_data_unders = {
 	.buf = set_rep_data,
 };
 
+struct hidhost_send_data_data {
+	struct hal_hdr hdr;
+	struct hal_cmd_hidhost_send_data hiddata;
+
+	/* data placeholder for hal_cmd_hidhost_send_data.data[0] field */
+	uint8_t buf[BLUEZ_HAL_MTU - sizeof(struct hal_hdr) -
+				sizeof(struct hal_cmd_hidhost_send_data)];
+} __attribute__((packed));
+
+#define send_data_data "1234567890"
+
+static struct hidhost_send_data_data hidhost_send_data_overs = {
+	.hdr.service_id = HAL_SERVICE_ID_HIDHOST,
+	.hdr.opcode = HAL_OP_HIDHOST_SEND_DATA,
+	.hdr.len = sizeof(struct hal_cmd_hidhost_send_data) +
+							sizeof(send_data_data),
+
+	/* declare wrong descriptor length */
+	.hiddata.len = sizeof(send_data_data) + 1,
+	/* init .hiddata.data[0] */
+	.buf = send_data_data,
+};
+
+static struct hidhost_send_data_data hidhost_send_data_unders = {
+	.hdr.service_id = HAL_SERVICE_ID_HIDHOST,
+	.hdr.opcode = HAL_OP_HIDHOST_SEND_DATA,
+	.hdr.len = sizeof(struct hal_cmd_hidhost_send_data) +
+							sizeof(send_data_data),
+
+	/* declare wrong descriptor length */
+	.hiddata.len = sizeof(send_data_data) - 1,
+	/* init .hiddata.data[0] */
+	.buf = send_data_data,
+};
+
 int main(int argc, char *argv[])
 {
 	snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
@@ -1053,6 +1088,20 @@ int main(int argc, char *argv[])
 			HAL_OP_HIDHOST_SEND_DATA,
 			sizeof(struct hal_cmd_hidhost_send_data), -1,
 			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_generic("Data size HIDHOST Send Vardata+",
+			ipc_send_tc, setup, teardown,
+			&hidhost_send_data_overs,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_hidhost_send_data) +
+				sizeof(send_data_data)),
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
+	test_generic("Data size HIDHOST Send Vardata-",
+			ipc_send_tc, setup, teardown,
+			&hidhost_send_data_unders,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_hidhost_send_data) +
+				sizeof(send_data_data)),
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
 
 	return tester_run();
 }
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/9] android/ipc-tester: Add cases for PAN msg size
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
                   ` (3 preceding siblings ...)
  2014-01-22  8:25 ` [PATCH 5/9] android/ipc-tester: Add case for HIDHOST Send Data Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 7/9] android/ipc-tester: Add cases for A2DP " Jakub Tyszkowski
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

Add cases testing message size verification for PAN opcodes.
---
 android/ipc-tester.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index b161049..11239e7 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -1103,5 +1103,35 @@ int main(int argc, char *argv[])
 				sizeof(send_data_data)),
 			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_HIDHOST);
 
+	/* check for valid data size for PAN */
+	test_datasize_valid("PAN Enable+", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_ENABLE,
+			sizeof(struct hal_cmd_pan_enable), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+	test_datasize_valid("PAN Enable-", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_ENABLE,
+			sizeof(struct hal_cmd_pan_enable), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+	test_datasize_valid("PAN Get Role+", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_GET_ROLE,
+			0, 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+	test_datasize_valid("PAN Connect+", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_CONNECT,
+			sizeof(struct hal_cmd_pan_connect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+	test_datasize_valid("PAN Connect-", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_CONNECT,
+			sizeof(struct hal_cmd_pan_connect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+	test_datasize_valid("PAN Disconnect+", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_DISCONNECT,
+			sizeof(struct hal_cmd_pan_disconnect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+	test_datasize_valid("PAN Disconnect-", HAL_SERVICE_ID_PAN,
+			HAL_OP_PAN_DISCONNECT,
+			sizeof(struct hal_cmd_pan_disconnect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
+
 	return tester_run();
 }
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/9] android/ipc-tester: Add cases for A2DP msg size
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
                   ` (4 preceding siblings ...)
  2014-01-22  8:25 ` [PATCH 6/9] android/ipc-tester: Add cases for PAN msg size Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 8/9] android/ipc-tester: Add case for BT Set adapter prop Jakub Tyszkowski
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

Add cases testing message size veification for A2DP opcodes.
---
 android/ipc-tester.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 11239e7..c621167 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -1133,5 +1133,23 @@ int main(int argc, char *argv[])
 			sizeof(struct hal_cmd_pan_disconnect), -1,
 			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_PAN);
 
+	/* check for valid data size for A2DP */
+	test_datasize_valid("A2DP Connect+", HAL_SERVICE_ID_A2DP,
+			HAL_OP_A2DP_CONNECT,
+			sizeof(struct hal_cmd_a2dp_connect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);
+	test_datasize_valid("A2DP Connect-", HAL_SERVICE_ID_A2DP,
+			HAL_OP_A2DP_CONNECT,
+			sizeof(struct hal_cmd_a2dp_connect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);
+	test_datasize_valid("A2DP Disconnect+", HAL_SERVICE_ID_A2DP,
+			HAL_OP_A2DP_DISCONNECT,
+			sizeof(struct hal_cmd_a2dp_disconnect), 1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);
+	test_datasize_valid("A2DP Disconnect-", HAL_SERVICE_ID_A2DP,
+			HAL_OP_A2DP_DISCONNECT,
+			sizeof(struct hal_cmd_a2dp_disconnect), -1,
+			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_A2DP);
+
 	return tester_run();
 }
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 8/9] android/ipc-tester: Add case for BT Set adapter prop
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
                   ` (5 preceding siblings ...)
  2014-01-22  8:25 ` [PATCH 7/9] android/ipc-tester: Add cases for A2DP " Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-22  8:25 ` [PATCH 9/9] android/ipc-tester: Add case for BT Set remote prop Jakub Tyszkowski
  2014-01-23 23:25 ` [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Szymon Janc
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds test for verifying data length inside
hal_cmd_set_adapter_prop struct.
---
 android/ipc-tester.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index c621167..e44afb3 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -650,6 +650,43 @@ struct hal_hdr enable_bt_service_hdr = {
 	.len = 0,
 };
 
+struct bt_set_adapter_prop_data {
+	struct hal_hdr hdr;
+	struct hal_cmd_set_adapter_prop prop;
+
+	/* data placeholder for hal_cmd_set_adapter_prop.val[0] */
+	uint8_t buf[BLUEZ_HAL_MTU - sizeof(struct hal_hdr) -
+				sizeof(struct hal_cmd_set_adapter_prop)];
+} __attribute__((packed));
+
+#define set_name "new name"
+
+static struct bt_set_adapter_prop_data bt_set_adapter_prop_data_overs = {
+	.hdr.service_id = HAL_SERVICE_ID_BLUETOOTH,
+	.hdr.opcode = HAL_OP_SET_ADAPTER_PROP,
+	.hdr.len = sizeof(struct hal_cmd_set_adapter_prop) +
+						sizeof(set_name),
+
+	.prop.type = HAL_PROP_ADAPTER_NAME,
+	/* declare wrong descriptor length */
+	.prop.len = sizeof(set_name) + 1,
+	/* init prop.val[0] */
+	.buf = set_name,
+};
+
+static struct bt_set_adapter_prop_data bt_set_adapter_prop_data_unders = {
+	.hdr.service_id = HAL_SERVICE_ID_BLUETOOTH,
+	.hdr.opcode = HAL_OP_SET_ADAPTER_PROP,
+	.hdr.len = sizeof(struct hal_cmd_set_adapter_prop) +
+						sizeof(set_name),
+
+	.prop.type = HAL_PROP_ADAPTER_NAME,
+	/* declare wrong descriptor length */
+	.prop.len = sizeof(set_name) - 1,
+	/* init prop.val[0] */
+	.buf = set_name,
+};
+
 struct hidhost_set_info_data {
 	struct hal_hdr hdr;
 	struct hal_cmd_hidhost_set_info info;
@@ -856,6 +893,20 @@ int main(int argc, char *argv[])
 			HAL_OP_SET_ADAPTER_PROP,
 			sizeof(struct hal_cmd_set_adapter_prop), -1,
 			HAL_SERVICE_ID_BLUETOOTH);
+	test_generic("Data size BT Set Adapter Prop Vardata+",
+			ipc_send_tc, setup, teardown,
+			&bt_set_adapter_prop_data_overs,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_set_adapter_prop) +
+				sizeof(set_name)),
+			HAL_SERVICE_ID_BLUETOOTH);
+	test_generic("Data size BT Set Adapter Prop Vardata+",
+			ipc_send_tc, setup, teardown,
+			&bt_set_adapter_prop_data_unders,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_set_adapter_prop) +
+				sizeof(set_name)),
+			HAL_SERVICE_ID_BLUETOOTH);
 	test_datasize_valid("BT Get Remote Props+", HAL_SERVICE_ID_BLUETOOTH,
 			HAL_OP_GET_REMOTE_DEVICE_PROPS,
 			sizeof(struct hal_cmd_get_remote_device_props), 1,
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 9/9] android/ipc-tester: Add case for BT Set remote prop
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
                   ` (6 preceding siblings ...)
  2014-01-22  8:25 ` [PATCH 8/9] android/ipc-tester: Add case for BT Set adapter prop Jakub Tyszkowski
@ 2014-01-22  8:25 ` Jakub Tyszkowski
  2014-01-23 23:25 ` [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Szymon Janc
  8 siblings, 0 replies; 10+ messages in thread
From: Jakub Tyszkowski @ 2014-01-22  8:25 UTC (permalink / raw)
  To: linux-bluetooth

This patch adds test for verifying data length inside
hal_cmd_set_remote_device_prop struct.
---
 android/ipc-tester.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index e44afb3..e1aeb2e 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -687,6 +687,41 @@ static struct bt_set_adapter_prop_data bt_set_adapter_prop_data_unders = {
 	.buf = set_name,
 };
 
+struct bt_set_remote_prop_data {
+	struct hal_hdr hdr;
+	struct hal_cmd_set_remote_device_prop prop;
+
+	/* data placeholder for hal_cmd_set_remote_device_prop.val[0] */
+	uint8_t buf[BLUEZ_HAL_MTU - sizeof(struct hal_hdr) -
+				sizeof(struct hal_cmd_set_remote_device_prop)];
+} __attribute__((packed));
+
+static struct bt_set_remote_prop_data bt_set_remote_prop_data_overs = {
+	.hdr.service_id = HAL_SERVICE_ID_BLUETOOTH,
+	.hdr.opcode = HAL_OP_SET_REMOTE_DEVICE_PROP,
+	.hdr.len = sizeof(struct hal_cmd_set_remote_device_prop) +
+						sizeof(set_name),
+
+	.prop.bdaddr = {},
+	.prop.type = HAL_PROP_DEVICE_NAME,
+	/* declare wrong descriptor length */
+	.prop.len = sizeof(set_name) + 1,
+	.buf = set_name,
+};
+
+static struct bt_set_remote_prop_data bt_set_remote_prop_data_unders = {
+	.hdr.service_id = HAL_SERVICE_ID_BLUETOOTH,
+	.hdr.opcode = HAL_OP_SET_REMOTE_DEVICE_PROP,
+	.hdr.len = sizeof(struct hal_cmd_set_remote_device_prop) +
+						sizeof(set_name),
+
+	.prop.bdaddr = {},
+	.prop.type = HAL_PROP_DEVICE_NAME,
+	/* declare wrong descriptor length */
+	.prop.len = sizeof(set_name) - 1,
+	.buf = set_name,
+};
+
 struct hidhost_set_info_data {
 	struct hal_hdr hdr;
 	struct hal_cmd_hidhost_set_info info;
@@ -931,6 +966,20 @@ int main(int argc, char *argv[])
 			HAL_OP_SET_REMOTE_DEVICE_PROP,
 			sizeof(struct hal_cmd_set_remote_device_prop), -1,
 			HAL_SERVICE_ID_BLUETOOTH);
+	test_generic("Data size BT Set Remote Prop Vardata+",
+			ipc_send_tc, setup, teardown,
+			&bt_set_remote_prop_data_overs,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_set_remote_device_prop) +
+				sizeof(set_name)),
+			HAL_SERVICE_ID_BLUETOOTH);
+	test_generic("Data size BT Set Remote Prop Vardata-",
+			ipc_send_tc, setup, teardown,
+			&bt_set_remote_prop_data_unders,
+			(sizeof(struct hal_hdr) +
+				sizeof(struct hal_cmd_set_remote_device_prop) +
+				sizeof(set_name)),
+			HAL_SERVICE_ID_BLUETOOTH);
 	test_datasize_valid("BT Get Remote SV Rec+", HAL_SERVICE_ID_BLUETOOTH,
 			HAL_OP_GET_REMOTE_SERVICE_REC,
 			sizeof(struct hal_cmd_get_remote_service_rec), 1,
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size
  2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
                   ` (7 preceding siblings ...)
  2014-01-22  8:25 ` [PATCH 9/9] android/ipc-tester: Add case for BT Set remote prop Jakub Tyszkowski
@ 2014-01-23 23:25 ` Szymon Janc
  8 siblings, 0 replies; 10+ messages in thread
From: Szymon Janc @ 2014-01-23 23:25 UTC (permalink / raw)
  To: Jakub Tyszkowski; +Cc: linux-bluetooth

Hi Jakub,

On Wednesday 22 January 2014 09:25:16 Jakub Tyszkowski wrote:
> Add cases testing message size verification for SOCK opcodes.
> ---
>  android/ipc-tester.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/android/ipc-tester.c b/android/ipc-tester.c
> index ed0dd10..088c324 100644
> --- a/android/ipc-tester.c
> +++ b/android/ipc-tester.c
> @@ -864,5 +864,23 @@ int main(int argc, char *argv[])
>  			sizeof(struct hal_cmd_le_test_mode), -1,
>  			HAL_SERVICE_ID_BLUETOOTH);
> 
> +	/* check for valid data size for SOCK */
> +	test_datasize_valid("SOCK Listen+", HAL_SERVICE_ID_SOCK,
> +			HAL_OP_SOCK_LISTEN,
> +			sizeof(struct hal_cmd_sock_listen), 1,
> +			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
> +	test_datasize_valid("SOCK Listen-", HAL_SERVICE_ID_SOCK,
> +			HAL_OP_SOCK_LISTEN,
> +			sizeof(struct hal_cmd_sock_listen), -1,
> +			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
> +	test_datasize_valid("SOCK Connect+", HAL_SERVICE_ID_SOCK,
> +			HAL_OP_SOCK_CONNECT,
> +			sizeof(struct hal_cmd_sock_connect), 1,
> +			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
> +	test_datasize_valid("SOCK Connect-", HAL_SERVICE_ID_SOCK,
> +			HAL_OP_SOCK_CONNECT,
> +			sizeof(struct hal_cmd_sock_connect), -1,
> +			HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
> +
>  	return tester_run();
>  }

All patches in this set have been applied, thanks.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-01-23 23:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22  8:25 [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 2/9] android/ipc-tester: Add cases for HIDHOST " Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 3/9] android/ipc-tester: Add case for HIDHOST Set Info Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 4/9] android/ipc-tester: Add case for HIDHOST Set Report Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 5/9] android/ipc-tester: Add case for HIDHOST Send Data Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 6/9] android/ipc-tester: Add cases for PAN msg size Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 7/9] android/ipc-tester: Add cases for A2DP " Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 8/9] android/ipc-tester: Add case for BT Set adapter prop Jakub Tyszkowski
2014-01-22  8:25 ` [PATCH 9/9] android/ipc-tester: Add case for BT Set remote prop Jakub Tyszkowski
2014-01-23 23:25 ` [PATCH 1/9] android/ipc-tester: Add cases for SOCK msg size Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox