2016-12-22 10:36:04

by Maxime Chevallier

[permalink] [raw]
Subject: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Fix the interactive "set-security" command in btgatt-client, that would
always fail due to bad initialization of argv buffer :

[GATT client]# set-security 2
Usage: set_security <level>
level: 1-3
e.g.:
set-sec-level 2
---
tools/btgatt-client.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 40a03b1..afe00aa 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -1198,8 +1198,7 @@ static void set_security_usage(void)

static void cmd_set_security(struct client *cli, char *cmd_str)
{
- char *argvbuf[1];
- char **argv = argvbuf;
+ char *argv[2];
int argc = 0;
char *endptr = NULL;
int level;
--
2.1.4



2016-12-28 09:14:22

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Hi Maxime,

On Thu, Dec 22, 2016 at 12:36 PM, Maxime Chevallier
<[email protected]> wrote:
> Fix the interactive "set-security" command in btgatt-client, that would
> always fail due to bad initialization of argv buffer :
>
> [GATT client]# set-security 2
> Usage: set_security <level>
> level: 1-3
> e.g.:
> set-sec-level 2
> ---
> tools/btgatt-client.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
> index 40a03b1..afe00aa 100644
> --- a/tools/btgatt-client.c
> +++ b/tools/btgatt-client.c
> @@ -1198,8 +1198,7 @@ static void set_security_usage(void)
>
> static void cmd_set_security(struct client *cli, char *cmd_str)
> {
> - char *argvbuf[1];
> - char **argv = argvbuf;
> + char *argv[2];
> int argc = 0;
> char *endptr = NULL;
> int level;
> --
> 2.1.4

Applied, thanks.


--
Luiz Augusto von Dentz

2016-12-22 10:36:05

by Maxime Chevallier

[permalink] [raw]
Subject: [PATCH 2/2] tools/btgatt-client: Update set-security usage

---
tools/btgatt-client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index afe00aa..615c805 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -1190,10 +1190,10 @@ static void cmd_unregister_notify(struct client *cli, char *cmd_str)

static void set_security_usage(void)
{
- printf("Usage: set_security <level>\n"
+ printf("Usage: set-security <level>\n"
"level: 1-3\n"
"e.g.:\n"
- "\tset-sec-level 2\n");
+ "\tset-security 2\n");
}

static void cmd_set_security(struct client *cli, char *cmd_str)
--
2.1.4


2017-01-31 10:30:39

by Mallikarjun Phulari

[permalink] [raw]
Subject: Re: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Thats fine..
I am facing the problem with btgatt-server security options.
btgatt-server is not connecting to any clients even with btgatt-client when the security level of btgatt-server is set to "medium" or "high".

btagatt-server is working fine with the security level "low"


Regards
Mallikarjun Phulari

----- Original Message -----
From: "Maxime CHEVALLIER" <[email protected]>
To: "Mallikarjun Phulari" <[email protected]>
Cc: [email protected]
Sent: Tuesday, January 17, 2017 2:21:42 PM
Subject: Re: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Hi,

> Hi i am running heart-rate service using gatt-server.
> And i am using gatttool as client.
> gatt-server with default security level "low" is working fine.
> But when try different security levels "medium" and "high" with -s
> option, it is not connecting with the gatttool.
>
> What might be the problem??

The patch you linked applies to the btgatt-client tool, you seem to be
using gatttool.
When using gatttool, the option '-l' must be used to specify the
security level.

Note that gatttool will soon be marked as deprecated, you might want to
use btgatt-client instead.

> Thanks & Regards
> Mallikarjun Phulari

Regards,

Maxime

2017-01-17 08:51:42

by Maxime Chevallier

[permalink] [raw]
Subject: Re: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Hi,

> Hi i am running heart-rate service using gatt-server.
> And i am using gatttool as client.
> gatt-server with default security level "low" is working fine.
> But when try different security levels "medium" and "high" with -s
> option, it is not connecting with the gatttool.
>
> What might be the problem??

The patch you linked applies to the btgatt-client tool, you seem to be
using gatttool.
When using gatttool, the option '-l' must be used to specify the
security level.

Note that gatttool will soon be marked as deprecated, you might want to
use btgatt-client instead.

> Thanks & Regards
> Mallikarjun Phulari

Regards,

Maxime

2017-01-17 07:05:06

by Mallikarjun Phulari

[permalink] [raw]
Subject: Re: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Hi i am running heart-rate service using gatt-server.
And i am using gatttool as client.
gatt-server with default security level "low" is working fine.
But when try different security levels "medium" and "high" with -s option, it is not connecting with the gatttool.

What might be the problem??

Thanks & Regards
Mallikarjun Phulari

----- Original Message -----
From: "Maxime Chevallier" <[email protected]>
To: [email protected]
Cc: "luiz dentz" <[email protected]>, "Maxime Chevallier" <[email protected]>
Sent: Thursday, December 22, 2016 4:06:04 PM
Subject: [PATCH 1/2] tools/btgatt-client: Fix set-security interactive command

Fix the interactive "set-security" command in btgatt-client, that would
always fail due to bad initialization of argv buffer :

[GATT client]# set-security 2
Usage: set_security <level>
level: 1-3
e.g.:
set-sec-level 2
---
tools/btgatt-client.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 40a03b1..afe00aa 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -1198,8 +1198,7 @@ static void set_security_usage(void)

static void cmd_set_security(struct client *cli, char *cmd_str)
{
- char *argvbuf[1];
- char **argv = argvbuf;
+ char *argv[2];
int argc = 0;
char *endptr = NULL;
int level;
--
2.1.4