mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-21 03:23:04 -05:00
WPS: Make UUID-from-MAC Address easily available
"hostapd -u<MAC Address>" can now be used to display the UUID that will be generated based on a MAC Address (i.e., when hostapd configuration does not set a specific UUID). Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
825fb6b20b
commit
b0d18bc2a1
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "utils/common.h"
|
#include "utils/common.h"
|
||||||
#include "utils/eloop.h"
|
#include "utils/eloop.h"
|
||||||
|
#include "utils/uuid.h"
|
||||||
#include "crypto/random.h"
|
#include "crypto/random.h"
|
||||||
#include "crypto/tls.h"
|
#include "crypto/tls.h"
|
||||||
#include "common/version.h"
|
#include "common/version.h"
|
||||||
@ -501,6 +502,27 @@ static int hostapd_get_ctrl_iface_group(struct hapd_interfaces *interfaces,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_WPS
|
||||||
|
static int gen_uuid(const char *txt_addr)
|
||||||
|
{
|
||||||
|
u8 addr[ETH_ALEN];
|
||||||
|
u8 uuid[UUID_LEN];
|
||||||
|
char buf[100];
|
||||||
|
|
||||||
|
if (hwaddr_aton(txt_addr, addr) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
uuid_gen_mac_addr(addr, uuid);
|
||||||
|
if (uuid_bin2str(uuid, buf, sizeof(buf)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
printf("%s\n", buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct hapd_interfaces interfaces;
|
struct hapd_interfaces interfaces;
|
||||||
@ -531,7 +553,7 @@ int main(int argc, char *argv[])
|
|||||||
interfaces.global_ctrl_sock = -1;
|
interfaces.global_ctrl_sock = -1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = getopt(argc, argv, "b:Bde:f:hKP:Ttvg:G:");
|
c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -588,6 +610,10 @@ int main(int argc, char *argv[])
|
|||||||
bss_config = tmp_bss;
|
bss_config = tmp_bss;
|
||||||
bss_config[num_bss_configs++] = optarg;
|
bss_config[num_bss_configs++] = optarg;
|
||||||
break;
|
break;
|
||||||
|
#ifdef CONFIG_WPS
|
||||||
|
case 'u':
|
||||||
|
return gen_uuid(optarg);
|
||||||
|
#endif /* CONFIG_WPS */
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user