mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 10:39:23 +01:00
knownnetworks: get matched RC on match_roaming_consortium
The HS20 module had its own getter for returning the matched roaming consortium. Since we already have the network_info op for matching we might as well return the matched RC rather than just a bool. This allows the RC to be included in (Re)Association without the need for a specific getter.
This commit is contained in:
parent
1104d69e29
commit
af46cc0ed2
@ -192,9 +192,11 @@ static bool hotspot_match_hessid(const struct network_info *info,
|
|||||||
return !memcmp(config->hessid, hessid, 6);
|
return !memcmp(config->hessid, hessid, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hotspot_match_roaming_consortium(const struct network_info *info,
|
static const uint8_t *hotspot_match_roaming_consortium(
|
||||||
|
const struct network_info *info,
|
||||||
const uint8_t *rc_ie,
|
const uint8_t *rc_ie,
|
||||||
size_t rc_len)
|
size_t rc_len,
|
||||||
|
size_t *rc_len_out)
|
||||||
{
|
{
|
||||||
const uint8_t *rc1, *rc2, *rc3;
|
const uint8_t *rc1, *rc2, *rc3;
|
||||||
size_t rc1_len, rc2_len, rc3_len;
|
size_t rc1_len, rc2_len, rc3_len;
|
||||||
@ -202,26 +204,35 @@ static bool hotspot_match_roaming_consortium(const struct network_info *info,
|
|||||||
super);
|
super);
|
||||||
|
|
||||||
if (!config->rc || !rc_ie)
|
if (!config->rc || !rc_ie)
|
||||||
return false;
|
return NULL;
|
||||||
|
|
||||||
if (ie_parse_roaming_consortium_from_data(rc_ie, rc_ie[1] + 2, NULL,
|
if (ie_parse_roaming_consortium_from_data(rc_ie, rc_ie[1] + 2, NULL,
|
||||||
&rc1, &rc1_len, &rc2, &rc2_len,
|
&rc1, &rc1_len, &rc2, &rc2_len,
|
||||||
&rc3, &rc3_len) < 0)
|
&rc3, &rc3_len) < 0)
|
||||||
return false;
|
return NULL;
|
||||||
|
|
||||||
/* rc1 is guarenteed to be set if the above returns success */
|
/* rc1 is guarenteed to be set if the above returns success */
|
||||||
if (rc1_len == config->rc_len && !memcmp(rc1, config->rc, rc1_len))
|
if (rc1_len == config->rc_len && !memcmp(rc1, config->rc, rc1_len)) {
|
||||||
return true;
|
if (rc_len_out)
|
||||||
|
*rc_len_out = rc1_len;
|
||||||
|
return rc1;
|
||||||
|
}
|
||||||
|
|
||||||
if (rc2 && rc2_len == config->rc_len &&
|
if (rc2 && rc2_len == config->rc_len &&
|
||||||
!memcmp(rc2, config->rc, rc2_len))
|
!memcmp(rc2, config->rc, rc2_len)) {
|
||||||
return true;
|
if (rc_len_out)
|
||||||
|
*rc_len_out = rc2_len;
|
||||||
|
return rc2;
|
||||||
|
}
|
||||||
|
|
||||||
if (rc3 && rc1_len == config->rc_len &&
|
if (rc3 && rc1_len == config->rc_len &&
|
||||||
!memcmp(rc3, config->rc, rc3_len))
|
!memcmp(rc3, config->rc, rc3_len)) {
|
||||||
return true;
|
if (rc_len_out)
|
||||||
|
*rc_len_out = rc3_len;
|
||||||
|
return rc3;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hotspot_match_nai_realms(const struct network_info *info,
|
static bool hotspot_match_nai_realms(const struct network_info *info,
|
||||||
|
@ -221,14 +221,17 @@ bool network_info_match_hessid(const struct network_info *info,
|
|||||||
return info->ops->match_hessid(info, hessid);
|
return info->ops->match_hessid(info, hessid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool network_info_match_roaming_consortium(const struct network_info *info,
|
const uint8_t *network_info_match_roaming_consortium(
|
||||||
|
const struct network_info *info,
|
||||||
const uint8_t *rc,
|
const uint8_t *rc,
|
||||||
size_t rc_len)
|
size_t rc_len,
|
||||||
|
size_t *rc_len_out)
|
||||||
{
|
{
|
||||||
if (!info->ops->match_roaming_consortium)
|
if (!info->ops->match_roaming_consortium)
|
||||||
return false;
|
return NULL;
|
||||||
|
|
||||||
return info->ops->match_roaming_consortium(info, rc, rc_len);
|
return info->ops->match_roaming_consortium(info, rc, rc_len,
|
||||||
|
rc_len_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool network_info_match_nai_realm(const struct network_info *info,
|
bool network_info_match_nai_realm(const struct network_info *info,
|
||||||
|
@ -41,9 +41,11 @@ struct network_info_ops {
|
|||||||
|
|
||||||
bool (*match_hessid)(const struct network_info *info,
|
bool (*match_hessid)(const struct network_info *info,
|
||||||
const uint8_t *hessid);
|
const uint8_t *hessid);
|
||||||
bool (*match_roaming_consortium)(const struct network_info *info,
|
const uint8_t *(*match_roaming_consortium)(
|
||||||
|
const struct network_info *info,
|
||||||
const uint8_t *rc_ie,
|
const uint8_t *rc_ie,
|
||||||
size_t rc_len);
|
size_t rc_len,
|
||||||
|
size_t *rc_len_out);
|
||||||
bool (*match_nai_realms)(const struct network_info *info,
|
bool (*match_nai_realms)(const struct network_info *info,
|
||||||
const char **nai_realms);
|
const char **nai_realms);
|
||||||
};
|
};
|
||||||
@ -96,9 +98,11 @@ const char *network_info_get_type(const struct network_info *info);
|
|||||||
|
|
||||||
bool network_info_match_hessid(const struct network_info *info,
|
bool network_info_match_hessid(const struct network_info *info,
|
||||||
const uint8_t *hessid);
|
const uint8_t *hessid);
|
||||||
bool network_info_match_roaming_consortium(const struct network_info *info,
|
const uint8_t *network_info_match_roaming_consortium(
|
||||||
|
const struct network_info *info,
|
||||||
const uint8_t *rc,
|
const uint8_t *rc,
|
||||||
size_t rc_len);
|
size_t rc_len,
|
||||||
|
size_t *rc_len_out);
|
||||||
bool network_info_match_nai_realm(const struct network_info *info,
|
bool network_info_match_nai_realm(const struct network_info *info,
|
||||||
const char **nai_realms);
|
const char **nai_realms);
|
||||||
|
|
||||||
|
@ -575,7 +575,8 @@ static bool hotspot_info_matches(struct network *network,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (network_info_match_roaming_consortium(info, bss->rc_ie,
|
if (network_info_match_roaming_consortium(info, bss->rc_ie,
|
||||||
bss->rc_ie[1] + 2))
|
bss->rc_ie[1] + 2,
|
||||||
|
NULL))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user