mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 13:59:24 +01:00
hotspot: Simplify path generation
This commit is contained in:
parent
912fae6b2d
commit
0577662c5b
@ -132,8 +132,7 @@ static void hotspot_network_free(struct network_info *info)
|
|||||||
|
|
||||||
static const char *hotspot_network_get_path(const struct network_info *info)
|
static const char *hotspot_network_get_path(const struct network_info *info)
|
||||||
{
|
{
|
||||||
uint8_t digest[8];
|
char *digest;
|
||||||
unsigned int pos = 0, i;
|
|
||||||
struct l_checksum *sha;
|
struct l_checksum *sha;
|
||||||
char **realms;
|
char **realms;
|
||||||
struct hs20_config *config = l_container_of(info, struct hs20_config,
|
struct hs20_config *config = l_container_of(info, struct hs20_config,
|
||||||
@ -159,21 +158,10 @@ static const char *hotspot_network_get_path(const struct network_info *info)
|
|||||||
if (!util_mem_is_zero(config->hessid, 6))
|
if (!util_mem_is_zero(config->hessid, 6))
|
||||||
l_checksum_update(sha, config->hessid, 6);
|
l_checksum_update(sha, config->hessid, 6);
|
||||||
|
|
||||||
l_checksum_get_digest(sha, digest, 8);
|
digest = l_checksum_get_string(sha);
|
||||||
|
|
||||||
/* Path is of the form "/<16 hex characters>_hotspot" (26 bytes) */
|
|
||||||
config->object_path = l_malloc(26);
|
|
||||||
|
|
||||||
config->object_path[pos++] = '/';
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
|
||||||
pos += snprintf(config->object_path + pos, 26, "%02x",
|
|
||||||
digest[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(config->object_path + pos, 26 - pos, "_hotspot");
|
|
||||||
|
|
||||||
l_checksum_free(sha);
|
l_checksum_free(sha);
|
||||||
|
config->object_path = l_strdup_printf("/%.8s_hotspot", digest);
|
||||||
|
l_free(digest);
|
||||||
|
|
||||||
return config->object_path;
|
return config->object_path;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user