Support WPS with no security (#21372)

* Support WPA with no security

* clean up

* add logging
pull/21393/head
sshane 4 years ago committed by GitHub
parent 6d3c587564
commit cd5c931461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      selfdrive/ui/qt/offroad/wifiManager.cc
  2. 2
      selfdrive/ui/qt/offroad/wifiManager.h

@ -12,7 +12,9 @@
* */
// https://developer.gnome.org/NetworkManager/1.26/nm-dbus-types.html#NM80211ApFlags
const int NM_802_11_AP_FLAGS_NONE = 0x00000000;
const int NM_802_11_AP_FLAGS_PRIVACY = 0x00000001;
const int NM_802_11_AP_FLAGS_WPS = 0x00000002;
// https://developer.gnome.org/NetworkManager/1.26/nm-dbus-types.html#NM80211ApSecurityFlags
const int NM_802_11_AP_SEC_PAIR_WEP40 = 0x00000001;
@ -193,11 +195,12 @@ SecurityType WifiManager::getSecurityType(const QString &path) {
// obtained by looking at flags of networks in the office as reported by an Android phone
const int supports_wpa = NM_802_11_AP_SEC_PAIR_WEP40 | NM_802_11_AP_SEC_PAIR_WEP104 | NM_802_11_AP_SEC_GROUP_WEP40 | NM_802_11_AP_SEC_GROUP_WEP104 | NM_802_11_AP_SEC_KEY_MGMT_PSK;
if (sflag == 0) {
if ((sflag == NM_802_11_AP_FLAGS_NONE) || ((sflag & NM_802_11_AP_FLAGS_WPS) && !(wpa_props & supports_wpa))) {
return SecurityType::OPEN;
} else if ((sflag & NM_802_11_AP_FLAGS_PRIVACY) && (wpa_props & supports_wpa) && !(wpa_props & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
return SecurityType::WPA;
} else {
LOGW("Unsupported network! sflag: %d, wpaflag: %d, rsnflag: %d", sflag, wpaflag, rsnflag);
return SecurityType::UNSUPPORTED;
}
}

@ -71,7 +71,7 @@ private:
uint get_wifi_device_state();
QByteArray get_property(const QString &network_path, const QString &property);
unsigned int get_ap_strength(const QString &network_path);
SecurityType getSecurityType(const QString &ssid);
SecurityType getSecurityType(const QString &path);
QDBusObjectPath pathFromSsid(const QString &ssid);
QVector<QPair<QString, QDBusObjectPath>> listConnections();

Loading…
Cancel
Save