[PATCH] P2P: Cleanup p2p_invite argument passing for ctrl interface
nirav shah
nirav.j2.shah
Wed May 2 14:39:09 PDT 2012
The p2p_invite api requires group interface name or persistent
group id with peer address to which the invitation is to be sent.
However ctrl interface documentation and argument check function
does not mandate this. Enforcing this in the ctrl interface.
Signed-hostap: Nirav Shah <nirav.j2.shah at intel.com>
intended-for: hostap-1
---
wpa_supplicant/wpa_cli.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 18759ab..13be3d4 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -2368,20 +2368,18 @@ static int wpa_cli_cmd_p2p_invite(struct wpa_ctrl *ctrl,
char cmd[128];
int res;
- if (argc < 1) {
- printf("Invalid P2P_INVITE command: needs at least one "
- "argument\n");
+ if (argc < 2) {
+ printf("Invalid P2P_INVITE command: needs at least two "
+ "arguments\n");
return -1;
}
if (argc > 2)
res = os_snprintf(cmd, sizeof(cmd), "P2P_INVITE %s %s %s",
argv[0], argv[1], argv[2]);
- else if (argc > 1)
+ else
res = os_snprintf(cmd, sizeof(cmd), "P2P_INVITE %s %s",
argv[0], argv[1]);
- else
- res = os_snprintf(cmd, sizeof(cmd), "P2P_INVITE %s", argv[0]);
if (res < 0 || (size_t) res >= sizeof(cmd))
return -1;
cmd[sizeof(cmd) - 1] = '\0';
@@ -3067,7 +3065,8 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
"<addr> = reject connection attempts from a specific peer" },
{ "p2p_invite", wpa_cli_cmd_p2p_invite,
cli_cmd_flag_none,
- "<cmd> [peer=addr] = invite peer" },
+ "[persistent=id|group=ifname] [peer=addr] = invite specified "
+ "peer to the group" },
{ "p2p_peers", wpa_cli_cmd_p2p_peers, cli_cmd_flag_none,
"[discovered] = list known (optionally, only fully discovered) P2P "
"peers" },
--
1.7.5.4
More information about the Hostap
mailing list