diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2012-08-31 21:20:51 +0300 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2012-09-09 14:04:13 -0700 |
commit | 31be0a4b946ecab910c0a9af3837dbccea5d204b (patch) | |
tree | ddae43793043af9a8820e30e21fdf3b3ac51d06b | |
parent | dee117d008719acfac082af3740349fc86629627 (diff) | |
download | external_wpa_supplicant_8-31be0a4b946ecab910c0a9af3837dbccea5d204b.zip external_wpa_supplicant_8-31be0a4b946ecab910c0a9af3837dbccea5d204b.tar.gz external_wpa_supplicant_8-31be0a4b946ecab910c0a9af3837dbccea5d204b.tar.bz2 |
P2P: Allow p2p_invite-persistent to specify channel for GO
The freq and ht40 parameters can now be used with the p2p_invite
command when reinvoking a persistent group as the GO.
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r-- | wpa_supplicant/README-P2P | 9 | ||||
-rw-r--r-- | wpa_supplicant/ctrl_iface.c | 15 | ||||
-rw-r--r-- | wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 2 | ||||
-rw-r--r-- | wpa_supplicant/p2p_supplicant.c | 14 | ||||
-rw-r--r-- | wpa_supplicant/p2p_supplicant.h | 3 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant_i.h | 1 |
6 files changed, 34 insertions, 10 deletions
diff --git a/wpa_supplicant/README-P2P b/wpa_supplicant/README-P2P index 6b81397..4abc2f2 100644 --- a/wpa_supplicant/README-P2P +++ b/wpa_supplicant/README-P2P @@ -125,7 +125,7 @@ join-a-group style PD instead of GO Negotiation style PD. p2p_connect <peer device address> <pbc|pin|PIN#> [display|keypad] [persistent|persistent=<network id>] [join|auth] - [go_intent=<0..15>] [freq=<in MHz>] [provdisc] + [go_intent=<0..15>] [freq=<in MHz>] [ht40] [provdisc] Start P2P group formation with a discovered P2P peer. This includes optional group owner negotiation, group interface setup, provisioning, @@ -166,7 +166,7 @@ used prior to starting GO Negotiation as a workaround with some deployed P2P implementations that require this to allow the user to accept the connection. -p2p_group_add [persistent|persistent=<network id>] [freq=<freq in MHz>] +p2p_group_add [persistent|persistent=<network id>] [freq=<freq in MHz>] [ht40] Set up a P2P group owner manually (i.e., without group owner negotiation with a specific peer). This is also known as autonomous @@ -346,7 +346,7 @@ Remove all local services from internal SD query processing. Invitation p2p_invite [persistent=<network id>|group=<group ifname>] [peer=address] - [go_dev_addr=address] + [go_dev_addr=address] [freq=<freq in MHz>] [ht40] Invite a peer to join a group (e.g., group=wlan1) or to reinvoke a persistent group (e.g., persistent=4). If the peer device is the GO of @@ -354,7 +354,8 @@ the persistent group, the peer parameter is not needed. Otherwise it is used to specify which device to invite. go_dev_addr parameter can be used to override the GO device address for Invitation Request should it be not known for some reason (this should not be needed in most -cases). +cases). When reinvoking a persistent group, the GO device can specify +the frequency for the group with the freq parameter. Group Operations diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 20a4086..4f0c43d 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3547,6 +3547,8 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd) int id; struct wpa_ssid *ssid; u8 peer[ETH_ALEN]; + int freq = 0; + int ht40; id = atoi(cmd); pos = os_strstr(cmd, " peer="); @@ -3563,7 +3565,18 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd) return -1; } - return wpas_p2p_invite(wpa_s, pos ? peer : NULL, ssid, NULL); + pos = os_strstr(cmd, " freq="); + if (pos) { + pos += 6; + freq = atoi(pos); + if (freq <= 0) + return -1; + } + + ht40 = os_strstr(cmd, " ht40") != NULL; + + return wpas_p2p_invite(wpa_s, pos ? peer : NULL, ssid, NULL, freq, + ht40); } diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index aee8b3a..30e0eb3 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -630,7 +630,7 @@ DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message, if (ssid == NULL || ssid->disabled != 2) goto err; - if (wpas_p2p_invite(wpa_s, peer_addr, ssid, NULL) < 0) { + if (wpas_p2p_invite(wpa_s, peer_addr, ssid, NULL, 0, 0) < 0) { reply = wpas_dbus_error_unknown_error( message, "Failed to reinvoke a persistent group"); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 94a8658..c43469e 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2374,7 +2374,9 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid) } wpas_p2p_group_add_persistent(wpa_s, ssid, - ssid->mode == WPAS_MODE_P2P_GO, 0, 0); + ssid->mode == WPAS_MODE_P2P_GO, + wpa_s->p2p_persistent_go_freq, + wpa_s->p2p_go_ht40); } @@ -4418,11 +4420,14 @@ int wpas_p2p_reject(struct wpa_supplicant *wpa_s, const u8 *addr) /* Invite to reinvoke a persistent group */ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, - struct wpa_ssid *ssid, const u8 *go_dev_addr) + struct wpa_ssid *ssid, const u8 *go_dev_addr, int freq, + int ht40) { enum p2p_invite_role role; u8 *bssid = NULL; + wpa_s->p2p_persistent_go_freq = freq; + wpa_s->p2p_go_ht40 = !!ht40; if (ssid->mode == WPAS_MODE_P2P_GO) { role = P2P_INVITE_ROLE_GO; if (peer_addr == NULL) { @@ -4456,7 +4461,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, return -1; return p2p_invite(wpa_s->global->p2p, peer_addr, role, bssid, - ssid->ssid, ssid->ssid_len, 0, go_dev_addr, 1); + ssid->ssid, ssid->ssid_len, freq, go_dev_addr, 1); } @@ -4470,6 +4475,9 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname, struct wpa_ssid *ssid; int persistent; + wpa_s->p2p_persistent_go_freq = 0; + wpa_s->p2p_go_ht40 = 0; + for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) { if (os_strcmp(wpa_s->ifname, ifname) == 0) break; diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index dfa39f2..6e4cc1d 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -112,7 +112,8 @@ int wpas_p2p_service_del_upnp(struct wpa_supplicant *wpa_s, u8 version, const char *service); int wpas_p2p_reject(struct wpa_supplicant *wpa_s, const u8 *addr); int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, - struct wpa_ssid *ssid, const u8 *go_dev_addr); + struct wpa_ssid *ssid, const u8 *go_dev_addr, int freq, + int ht40); int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname, const u8 *peer_addr, const u8 *go_dev_addr); void wpas_p2p_completed(struct wpa_supplicant *wpa_s); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 523b50d..fb8dba8 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -539,6 +539,7 @@ struct wpa_supplicant { unsigned int p2p_fallback_to_go_neg:1; unsigned int p2p_pd_before_go_neg:1; unsigned int p2p_go_ht40:1; + int p2p_persistent_go_freq; int p2p_persistent_id; int p2p_go_intent; int p2p_connect_freq; |