mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
D-Bus: Indicate whether created group is persistent or not
This adds an extra parameter in GroupStarted signal to indicate whether the created group is Persistent or not. It is similar to the [PERSISTENT] tag which comes in P2P-GROUP-STARTED over the control interface. Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
This commit is contained in:
parent
aa59370b34
commit
4fe50bbc8e
@ -1256,12 +1256,11 @@ static void peer_groups_changed(struct wpa_supplicant *wpa_s)
|
|||||||
* @wpa_s: %wpa_supplicant network interface data
|
* @wpa_s: %wpa_supplicant network interface data
|
||||||
* @ssid: SSID object
|
* @ssid: SSID object
|
||||||
* @client: this device is P2P client
|
* @client: this device is P2P client
|
||||||
* @network_id: network id of the group started, use instead of ssid->id
|
* @persistent: 0 - non persistent group, 1 - persistent group
|
||||||
* to account for persistent groups
|
|
||||||
*/
|
*/
|
||||||
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||||
const struct wpa_ssid *ssid,
|
const struct wpa_ssid *ssid,
|
||||||
int client, int network_id)
|
int client, int persistent)
|
||||||
{
|
{
|
||||||
DBusMessage *msg;
|
DBusMessage *msg;
|
||||||
DBusMessageIter iter, dict_iter;
|
DBusMessageIter iter, dict_iter;
|
||||||
@ -1300,6 +1299,7 @@ void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
|||||||
wpa_s->dbus_new_path) ||
|
wpa_s->dbus_new_path) ||
|
||||||
!wpa_dbus_dict_append_string(&dict_iter, "role",
|
!wpa_dbus_dict_append_string(&dict_iter, "role",
|
||||||
client ? "client" : "GO") ||
|
client ? "client" : "GO") ||
|
||||||
|
!wpa_dbus_dict_append_bool(&dict_iter, "persistent", persistent) ||
|
||||||
!wpa_dbus_dict_append_object_path(&dict_iter, "group_object",
|
!wpa_dbus_dict_append_object_path(&dict_iter, "group_object",
|
||||||
wpa_s->dbus_groupobj_path) ||
|
wpa_s->dbus_groupobj_path) ||
|
||||||
!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
!wpa_dbus_dict_close_write(&iter, &dict_iter)) {
|
||||||
|
@ -191,7 +191,7 @@ void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
|
|||||||
u8 go_intent);
|
u8 go_intent);
|
||||||
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||||
const struct wpa_ssid *ssid,
|
const struct wpa_ssid *ssid,
|
||||||
int client, int network_id);
|
int client, int persistent);
|
||||||
void wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
|
||||||
const char *reason);
|
const char *reason);
|
||||||
void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
|
void wpas_dbus_register_p2p_group(struct wpa_supplicant *wpa_s,
|
||||||
@ -402,7 +402,7 @@ static inline void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
|
|||||||
static inline void
|
static inline void
|
||||||
wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||||
const struct wpa_ssid *ssid,
|
const struct wpa_ssid *ssid,
|
||||||
int client, int network_id)
|
int client, int persistent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,13 +668,13 @@ void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
|
|||||||
|
|
||||||
|
|
||||||
void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
|
void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid, int network_id,
|
struct wpa_ssid *ssid, int persistent,
|
||||||
int client)
|
int client)
|
||||||
{
|
{
|
||||||
/* Notify a group has been started */
|
/* Notify a group has been started */
|
||||||
wpas_dbus_register_p2p_group(wpa_s, ssid);
|
wpas_dbus_register_p2p_group(wpa_s, ssid);
|
||||||
|
|
||||||
wpas_dbus_signal_p2p_group_started(wpa_s, ssid, client, network_id);
|
wpas_dbus_signal_p2p_group_started(wpa_s, ssid, client, persistent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
|
|||||||
u16 config_methods,
|
u16 config_methods,
|
||||||
unsigned int generated_pin);
|
unsigned int generated_pin);
|
||||||
void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
|
void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_ssid *ssid, int network_id,
|
struct wpa_ssid *ssid, int persistent,
|
||||||
int client);
|
int client);
|
||||||
void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
|
void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
|
||||||
const char *reason);
|
const char *reason);
|
||||||
|
@ -1301,7 +1301,6 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
|
|||||||
int client;
|
int client;
|
||||||
int persistent;
|
int persistent;
|
||||||
u8 go_dev_addr[ETH_ALEN];
|
u8 go_dev_addr[ETH_ALEN];
|
||||||
int network_id = -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This callback is likely called for the main interface. Update wpa_s
|
* This callback is likely called for the main interface. Update wpa_s
|
||||||
@ -1376,16 +1375,15 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (persistent)
|
if (persistent)
|
||||||
network_id = wpas_p2p_store_persistent_group(wpa_s->p2pdev,
|
wpas_p2p_store_persistent_group(wpa_s->p2pdev,
|
||||||
ssid, go_dev_addr);
|
ssid, go_dev_addr);
|
||||||
else {
|
else {
|
||||||
os_free(wpa_s->global->add_psk);
|
os_free(wpa_s->global->add_psk);
|
||||||
wpa_s->global->add_psk = NULL;
|
wpa_s->global->add_psk = NULL;
|
||||||
}
|
}
|
||||||
if (network_id < 0 && ssid)
|
|
||||||
network_id = ssid->id;
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 0);
|
wpas_notify_p2p_group_started(wpa_s, ssid, persistent, 0);
|
||||||
os_get_reltime(&wpa_s->global->p2p_go_wait_client);
|
os_get_reltime(&wpa_s->global->p2p_go_wait_client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1750,7 +1748,6 @@ static void p2p_go_configured(void *ctx, void *data)
|
|||||||
struct wpa_supplicant *wpa_s = ctx;
|
struct wpa_supplicant *wpa_s = ctx;
|
||||||
struct p2p_go_neg_results *params = data;
|
struct p2p_go_neg_results *params = data;
|
||||||
struct wpa_ssid *ssid;
|
struct wpa_ssid *ssid;
|
||||||
int network_id = -1;
|
|
||||||
|
|
||||||
wpa_s->ap_configured_cb = NULL;
|
wpa_s->ap_configured_cb = NULL;
|
||||||
wpa_s->ap_configured_cb_ctx = NULL;
|
wpa_s->ap_configured_cb_ctx = NULL;
|
||||||
@ -1797,14 +1794,14 @@ static void p2p_go_configured(void *ctx, void *data)
|
|||||||
|
|
||||||
os_get_reltime(&wpa_s->global->p2p_go_wait_client);
|
os_get_reltime(&wpa_s->global->p2p_go_wait_client);
|
||||||
if (params->persistent_group) {
|
if (params->persistent_group) {
|
||||||
network_id = wpas_p2p_store_persistent_group(
|
wpas_p2p_store_persistent_group(
|
||||||
wpa_s->p2pdev, ssid,
|
wpa_s->p2pdev, ssid,
|
||||||
wpa_s->global->p2p_dev_addr);
|
wpa_s->global->p2p_dev_addr);
|
||||||
wpas_p2p_add_psk_list(wpa_s, ssid);
|
wpas_p2p_add_psk_list(wpa_s, ssid);
|
||||||
}
|
}
|
||||||
if (network_id < 0)
|
|
||||||
network_id = ssid->id;
|
wpas_notify_p2p_group_started(wpa_s, ssid,
|
||||||
wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 0);
|
params->persistent_group, 0);
|
||||||
wpas_p2p_cross_connect_setup(wpa_s);
|
wpas_p2p_cross_connect_setup(wpa_s);
|
||||||
wpas_p2p_set_group_idle_timeout(wpa_s);
|
wpas_p2p_set_group_idle_timeout(wpa_s);
|
||||||
|
|
||||||
@ -6941,7 +6938,6 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
|
|||||||
{
|
{
|
||||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||||
u8 go_dev_addr[ETH_ALEN];
|
u8 go_dev_addr[ETH_ALEN];
|
||||||
int network_id = -1;
|
|
||||||
int persistent;
|
int persistent;
|
||||||
int freq;
|
int freq;
|
||||||
u8 ip[3 * 4];
|
u8 ip[3 * 4];
|
||||||
@ -7000,11 +6996,10 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
|
|||||||
ip_addr);
|
ip_addr);
|
||||||
|
|
||||||
if (persistent)
|
if (persistent)
|
||||||
network_id = wpas_p2p_store_persistent_group(wpa_s->p2pdev,
|
wpas_p2p_store_persistent_group(wpa_s->p2pdev,
|
||||||
ssid, go_dev_addr);
|
ssid, go_dev_addr);
|
||||||
if (network_id < 0)
|
|
||||||
network_id = ssid->id;
|
wpas_notify_p2p_group_started(wpa_s, ssid, persistent, 1);
|
||||||
wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user