nl80211: recognize SAE encrypted mesh
Also report open Ad-Hoc and Mesh network encryption as "none" and not as "unknown". Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
313e82709b
commit
2a95086db2
1 changed files with 28 additions and 2 deletions
|
@ -870,7 +870,9 @@ static int __nl80211_wpactl_query(const char *ifname, ...)
|
||||||
if (nl80211_get_mode(ifname, &mode))
|
if (nl80211_get_mode(ifname, &mode))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (mode != IWINFO_OPMODE_CLIENT && mode != IWINFO_OPMODE_ADHOC)
|
if (mode != IWINFO_OPMODE_CLIENT &&
|
||||||
|
mode != IWINFO_OPMODE_ADHOC &&
|
||||||
|
mode != IWINFO_OPMODE_MESHPOINT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sock = nl80211_wpactl_connect(ifname, &local);
|
sock = nl80211_wpactl_connect(ifname, &local);
|
||||||
|
@ -1593,9 +1595,11 @@ static void parse_wpa_ciphers(const char *str, uint8_t *ciphers)
|
||||||
static int nl80211_get_encryption(const char *ifname, char *buf)
|
static int nl80211_get_encryption(const char *ifname, char *buf)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
int opmode;
|
||||||
uint8_t wpa_version = 0;
|
uint8_t wpa_version = 0;
|
||||||
char wpa[2], wpa_key_mgmt[64], wpa_pairwise[16], wpa_groupwise[16];
|
char wpa[2], wpa_key_mgmt[64], wpa_pairwise[16], wpa_groupwise[16];
|
||||||
char auth_algs[2], wep_key0[27], wep_key1[27], wep_key2[27], wep_key3[27];
|
char auth_algs[2], wep_key0[27], wep_key1[27], wep_key2[27], wep_key3[27];
|
||||||
|
char mode[16];
|
||||||
|
|
||||||
struct iwinfo_crypto_entry *c = (struct iwinfo_crypto_entry *)buf;
|
struct iwinfo_crypto_entry *c = (struct iwinfo_crypto_entry *)buf;
|
||||||
|
|
||||||
|
@ -1603,7 +1607,8 @@ static int nl80211_get_encryption(const char *ifname, char *buf)
|
||||||
if (nl80211_wpactl_query(ifname,
|
if (nl80211_wpactl_query(ifname,
|
||||||
"pairwise_cipher", wpa_pairwise, sizeof(wpa_pairwise),
|
"pairwise_cipher", wpa_pairwise, sizeof(wpa_pairwise),
|
||||||
"group_cipher", wpa_groupwise, sizeof(wpa_groupwise),
|
"group_cipher", wpa_groupwise, sizeof(wpa_groupwise),
|
||||||
"key_mgmt", wpa_key_mgmt, sizeof(wpa_key_mgmt)))
|
"key_mgmt", wpa_key_mgmt, sizeof(wpa_key_mgmt),
|
||||||
|
"mode", mode, sizeof(mode)))
|
||||||
{
|
{
|
||||||
/* WEP or Open */
|
/* WEP or Open */
|
||||||
if (!strcmp(wpa_key_mgmt, "NONE"))
|
if (!strcmp(wpa_key_mgmt, "NONE"))
|
||||||
|
@ -1622,6 +1627,16 @@ static int nl80211_get_encryption(const char *ifname, char *buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MESH with SAE */
|
||||||
|
else if (!strcmp(mode, "mesh") && !strcmp(wpa_key_mgmt, "UNKNOWN"))
|
||||||
|
{
|
||||||
|
c->enabled = 1;
|
||||||
|
c->wpa_version = 4;
|
||||||
|
c->auth_suites = IWINFO_KMGMT_SAE;
|
||||||
|
c->pair_ciphers = IWINFO_CIPHER_CCMP;
|
||||||
|
c->group_ciphers = IWINFO_CIPHER_CCMP;
|
||||||
|
}
|
||||||
|
|
||||||
/* WPA */
|
/* WPA */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1709,6 +1724,17 @@ static int nl80211_get_encryption(const char *ifname, char *buf)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ad-Hoc or Mesh interfaces without wpa_supplicant are open */
|
||||||
|
else if (!nl80211_get_mode(ifname, &opmode) &&
|
||||||
|
(opmode == IWINFO_OPMODE_ADHOC ||
|
||||||
|
opmode == IWINFO_OPMODE_MESHPOINT))
|
||||||
|
{
|
||||||
|
c->enabled = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue