Use the wpa_supplicant to join open networks if it is running.
We need to make sure that the wpa_supplicant knows about our intention even when joining an open network, as it otherwise might interfere. Since leaving a network is not synchronous and the wpa_supplicant is already running in that case anyway, this seems easier and more reliable. If the wpa_supplicant is not already running we still join ourselves.
This commit is contained in:
@@ -1113,9 +1113,16 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We always try to join via the wpa_supplicant. Even if we could join
|
||||||
|
// ourselves, we need to make sure that the wpa_supplicant knows about
|
||||||
|
// our intention, as otherwise it would interfere with it.
|
||||||
|
|
||||||
|
BMessenger wpaSupplicant(kWPASupplicantSignature);
|
||||||
|
if (!wpaSupplicant.IsValid()) {
|
||||||
|
// The wpa_supplicant isn't running yet, we may join ourselves.
|
||||||
if (!askForConfig
|
if (!askForConfig
|
||||||
&& network.authentication_mode == B_NETWORK_AUTHENTICATION_NONE) {
|
&& network.authentication_mode == B_NETWORK_AUTHENTICATION_NONE) {
|
||||||
// we join the network ourselves
|
// We can join this network ourselves.
|
||||||
status_t status = set_80211(deviceName, IEEE80211_IOC_SSID,
|
status_t status = set_80211(deviceName, IEEE80211_IOC_SSID,
|
||||||
network.name, strlen(network.name));
|
network.name, strlen(network.name));
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
@@ -1123,14 +1130,9 @@ NetServer::_JoinNetwork(const BMessage& message, const char* name)
|
|||||||
strerror(status));
|
strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join via wpa_supplicant
|
// We need the supplicant, try to launch it.
|
||||||
|
|
||||||
BMessenger wpaSupplicant(kWPASupplicantSignature);
|
|
||||||
if (!wpaSupplicant.IsValid()) {
|
|
||||||
status_t status = be_roster->Launch(kWPASupplicantSignature);
|
status_t status = be_roster->Launch(kWPASupplicantSignature);
|
||||||
if (status != B_OK && status != B_ALREADY_RUNNING)
|
if (status != B_OK && status != B_ALREADY_RUNNING)
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user