mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
P2P: Use config block with disabled==2 to store persistent groups
This commit is contained in:
parent
046b26a24e
commit
4dac02455a
@ -1495,7 +1495,7 @@ static const struct parse_data ssid_fields[] = {
|
|||||||
#endif /* IEEE8021X_EAPOL */
|
#endif /* IEEE8021X_EAPOL */
|
||||||
{ INT_RANGE(mode, 0, 4) },
|
{ INT_RANGE(mode, 0, 4) },
|
||||||
{ INT_RANGE(proactive_key_caching, 0, 1) },
|
{ INT_RANGE(proactive_key_caching, 0, 1) },
|
||||||
{ INT_RANGE(disabled, 0, 1) },
|
{ INT_RANGE(disabled, 0, 2) },
|
||||||
{ STR(id_str) },
|
{ STR(id_str) },
|
||||||
#ifdef CONFIG_IEEE80211W
|
#ifdef CONFIG_IEEE80211W
|
||||||
{ INT_RANGE(ieee80211w, 0, 2) },
|
{ INT_RANGE(ieee80211w, 0, 2) },
|
||||||
|
@ -677,10 +677,12 @@ static int wpa_supplicant_ctrl_iface_list_networks(
|
|||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
ret = os_snprintf(pos, end - pos, "\t%s%s",
|
ret = os_snprintf(pos, end - pos, "\t%s%s%s",
|
||||||
ssid == wpa_s->current_ssid ?
|
ssid == wpa_s->current_ssid ?
|
||||||
"[CURRENT]" : "",
|
"[CURRENT]" : "",
|
||||||
ssid->disabled ? "[DISABLED]" : "");
|
ssid->disabled ? "[DISABLED]" : "",
|
||||||
|
ssid->disabled == 2 ? "[P2P-PERSISTENT]" :
|
||||||
|
"");
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
@ -988,6 +990,11 @@ static int wpa_supplicant_ctrl_iface_select_network(
|
|||||||
"network id=%d", id);
|
"network id=%d", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ssid->disabled == 2) {
|
||||||
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Cannot use "
|
||||||
|
"SELECT_NETWORK with persistent P2P group");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_supplicant_select_network(wpa_s, ssid);
|
wpa_supplicant_select_network(wpa_s, ssid);
|
||||||
@ -1016,6 +1023,11 @@ static int wpa_supplicant_ctrl_iface_enable_network(
|
|||||||
"network id=%d", id);
|
"network id=%d", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ssid->disabled == 2) {
|
||||||
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Cannot use "
|
||||||
|
"ENABLE_NETWORK with persistent P2P group");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wpa_supplicant_enable_network(wpa_s, ssid);
|
wpa_supplicant_enable_network(wpa_s, ssid);
|
||||||
|
|
||||||
@ -1043,6 +1055,12 @@ static int wpa_supplicant_ctrl_iface_disable_network(
|
|||||||
"network id=%d", id);
|
"network id=%d", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ssid->disabled == 2) {
|
||||||
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Cannot use "
|
||||||
|
"DISABLE_NETWORK with persistent P2P "
|
||||||
|
"group");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wpa_supplicant_disable_network(wpa_s, ssid);
|
wpa_supplicant_disable_network(wpa_s, ssid);
|
||||||
|
|
||||||
|
@ -1387,8 +1387,11 @@ void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
|
|||||||
int was_disabled;
|
int was_disabled;
|
||||||
|
|
||||||
if (ssid == NULL) {
|
if (ssid == NULL) {
|
||||||
other_ssid = wpa_s->conf->ssid;
|
for (other_ssid = wpa_s->conf->ssid; other_ssid;
|
||||||
while (other_ssid) {
|
other_ssid = other_ssid->next) {
|
||||||
|
if (other_ssid->disabled == 2)
|
||||||
|
continue; /* do not change persistent P2P group
|
||||||
|
* data */
|
||||||
if (other_ssid == wpa_s->current_ssid &&
|
if (other_ssid == wpa_s->current_ssid &&
|
||||||
other_ssid->disabled)
|
other_ssid->disabled)
|
||||||
wpa_s->reassociate = 1;
|
wpa_s->reassociate = 1;
|
||||||
@ -1400,12 +1403,10 @@ void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
|
|||||||
if (was_disabled != other_ssid->disabled)
|
if (was_disabled != other_ssid->disabled)
|
||||||
wpas_notify_network_enabled_changed(
|
wpas_notify_network_enabled_changed(
|
||||||
wpa_s, other_ssid);
|
wpa_s, other_ssid);
|
||||||
|
|
||||||
other_ssid = other_ssid->next;
|
|
||||||
}
|
}
|
||||||
if (wpa_s->reassociate)
|
if (wpa_s->reassociate)
|
||||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||||
} else if (ssid->disabled) {
|
} else if (ssid->disabled && ssid->disabled != 2) {
|
||||||
if (wpa_s->current_ssid == NULL) {
|
if (wpa_s->current_ssid == NULL) {
|
||||||
/*
|
/*
|
||||||
* Try to reassociate since there is no current
|
* Try to reassociate since there is no current
|
||||||
@ -1439,22 +1440,23 @@ void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
|
|||||||
int was_disabled;
|
int was_disabled;
|
||||||
|
|
||||||
if (ssid == NULL) {
|
if (ssid == NULL) {
|
||||||
other_ssid = wpa_s->conf->ssid;
|
for (other_ssid = wpa_s->conf->ssid; other_ssid;
|
||||||
while (other_ssid) {
|
other_ssid = other_ssid->next) {
|
||||||
was_disabled = other_ssid->disabled;
|
was_disabled = other_ssid->disabled;
|
||||||
|
if (was_disabled == 2)
|
||||||
|
continue; /* do not change persistent P2P group
|
||||||
|
* data */
|
||||||
|
|
||||||
other_ssid->disabled = 1;
|
other_ssid->disabled = 1;
|
||||||
|
|
||||||
if (was_disabled != other_ssid->disabled)
|
if (was_disabled != other_ssid->disabled)
|
||||||
wpas_notify_network_enabled_changed(
|
wpas_notify_network_enabled_changed(
|
||||||
wpa_s, other_ssid);
|
wpa_s, other_ssid);
|
||||||
|
|
||||||
other_ssid = other_ssid->next;
|
|
||||||
}
|
}
|
||||||
if (wpa_s->current_ssid)
|
if (wpa_s->current_ssid)
|
||||||
wpa_supplicant_disassociate(
|
wpa_supplicant_disassociate(
|
||||||
wpa_s, WLAN_REASON_DEAUTH_LEAVING);
|
wpa_s, WLAN_REASON_DEAUTH_LEAVING);
|
||||||
} else {
|
} else if (ssid->disabled != 2) {
|
||||||
if (ssid == wpa_s->current_ssid)
|
if (ssid == wpa_s->current_ssid)
|
||||||
wpa_supplicant_disassociate(
|
wpa_supplicant_disassociate(
|
||||||
wpa_s, WLAN_REASON_DEAUTH_LEAVING);
|
wpa_s, WLAN_REASON_DEAUTH_LEAVING);
|
||||||
@ -1488,16 +1490,16 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
|
|||||||
* Mark all other networks disabled or mark all networks enabled if no
|
* Mark all other networks disabled or mark all networks enabled if no
|
||||||
* network specified.
|
* network specified.
|
||||||
*/
|
*/
|
||||||
other_ssid = wpa_s->conf->ssid;
|
for (other_ssid = wpa_s->conf->ssid; other_ssid;
|
||||||
while (other_ssid) {
|
other_ssid = other_ssid->next) {
|
||||||
int was_disabled = other_ssid->disabled;
|
int was_disabled = other_ssid->disabled;
|
||||||
|
if (was_disabled == 2)
|
||||||
|
continue; /* do not change persistent P2P group data */
|
||||||
|
|
||||||
other_ssid->disabled = ssid ? (ssid->id != other_ssid->id) : 0;
|
other_ssid->disabled = ssid ? (ssid->id != other_ssid->id) : 0;
|
||||||
|
|
||||||
if (was_disabled != other_ssid->disabled)
|
if (was_disabled != other_ssid->disabled)
|
||||||
wpas_notify_network_enabled_changed(wpa_s, other_ssid);
|
wpas_notify_network_enabled_changed(wpa_s, other_ssid);
|
||||||
|
|
||||||
other_ssid = other_ssid->next;
|
|
||||||
}
|
}
|
||||||
wpa_s->disconnected = 0;
|
wpa_s->disconnected = 0;
|
||||||
wpa_s->reassociate = 1;
|
wpa_s->reassociate = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user