From: Tyszkowski Jakub <jakub.tyszkowski@tieto.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCHv3 6/7] android/tester: Fix HIDHost cases sending fixed tid sdp responses
Date: Tue, 09 Sep 2014 13:53:23 +0200 [thread overview]
Message-ID: <540EEA33.2090904@tieto.com> (raw)
In-Reply-To: <CABBYNZ+OVW+detLyTHRs5EO2zQ2k=LudEDVQyqXyJ=nOrGw8OA@mail.gmail.com>
Hi Luiz
On 09/09/2014 11:10 AM, Luiz Augusto von Dentz wrote:
> Hi Jakub,
>
> On Tue, Sep 9, 2014 at 10:47 AM, Jakub Tyszkowski
> <jakub.tyszkowski@tieto.com> wrote:
>> Multiple cases were affected because of hardcoded transaction id for
>> emulated remote's SDP responses.
>>
>> This resulted in the following error in the daemon:
>> bluetoothd[13486]: sdp_process: Protocol error.
>> ---
>> android/tester-hidhost.c | 14 ++++++++++++--
>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
>> index abff837..d5741f9 100644
>> --- a/android/tester-hidhost.c
>> +++ b/android/tester-hidhost.c
>> @@ -21,6 +21,7 @@
>> #include "tester-main.h"
>>
>> #include "android/utils.h"
>> +#include "src/shared/util.h"
>>
>> #define HID_GET_REPORT_PROTOCOL 0x60
>> #define HID_GET_BOOT_PROTOCOL 0x61
>> @@ -214,15 +215,24 @@ static void hid_sdp_cid_hook_cb(const void *data, uint16_t len, void *user_data)
>> struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
>> struct emu_cid_data *cid_data = user_data;
>> struct raw_dataset *sdp_data = cid_data->user_data;
>> + const uint8_t *req_buf = data;
>> + uint8_t *sdp_buf;
>>
>> - if (!memcmp(did_req_pdu, data, len)) {
>> + if (!memcmp(did_req_pdu, req_buf, len)) {
>> bthost_send_cid(bthost, cid_data->sdp_handle, cid_data->sdp_cid,
>> did_rsp_pdu, sizeof(did_rsp_pdu));
>> return;
>> }
>>
>> + /* Get transaction ID from the request */
>> + sdp_buf = g_memdup(sdp_data->pdu, sdp_data->len);
>> + sdp_buf[1] = req_buf[1];
>> + sdp_buf[2] = req_buf[2];
>> +
>> bthost_send_cid(bthost, cid_data->sdp_handle, cid_data->sdp_cid,
>> - sdp_data->pdu, sdp_data->len);
>> + sdp_buf, sdp_data->len);
>> +
>> + g_free(sdp_buf);
>> }
>
> Do we really need this copy? Wouldn't it be enough not to mark it as
> const and just change in place? Anyway this is also broke in AVRCP, I
Yes, It looks like we could use non-const pdu array to avoid copying.
First idea was not leave any trace of previous test case but we broke it
and use non-const global variables as storage elsewhere anyway. Not sure
which way we should go to be consistent.
> have been planning to handle this but perhaps we should unify this,
> btw in case of did we should also check tid.
Agree, memcmp checks for did request with tid == 0 and responses with
tid == 0. Luckily for now its always 0 in request, but we should fix
this anyway. ;)
It looks like we need a pair of helpers, one for matching pdu and one
for sending responses to unify this 'tid' issue.
Is this something we can fix later in all testers ,by providing helpers
in tester-main or should It be part of this patch set?
Regards,
Jakub
next prev parent reply other threads:[~2014-09-09 11:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-09 7:46 [PATCHv3 0/7] android/tester: Cases for HIDHost security checks Jakub Tyszkowski
2014-09-09 7:46 ` [PATCHv3 1/7] android/tester: Allow HIDHost to use custom sdp response Jakub Tyszkowski
2014-09-09 9:02 ` Luiz Augusto von Dentz
2014-09-11 9:47 ` Szymon Janc
2014-09-09 7:46 ` [PATCHv3 2/7] android/tester: Rename and expose callback verification function Jakub Tyszkowski
2014-09-09 7:46 ` [PATCHv3 3/7] android/tester: Improve HIDHost data sending verification Jakub Tyszkowski
2014-09-09 7:47 ` [PATCHv3 4/7] android/tester: Add encryption change verification mechanism Jakub Tyszkowski
2014-09-09 7:47 ` [PATCHv3 5/7] android/tester: Add case verifying encryption on HIDHost Jakub Tyszkowski
2014-09-09 7:47 ` [PATCHv3 6/7] android/tester: Fix HIDHost cases sending fixed tid sdp responses Jakub Tyszkowski
2014-09-09 9:10 ` Luiz Augusto von Dentz
2014-09-09 11:53 ` Tyszkowski Jakub [this message]
2014-09-09 7:47 ` [PATCHv3 7/7] android/tester: Add Hidhost rejecting connection case Jakub Tyszkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=540EEA33.2090904@tieto.com \
--to=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).