aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/main.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-12-18 00:00:21 (GMT)
committerJouni Malinen <j@w1.fi>2014-02-11 13:44:13 (GMT)
commitb0d18bc2a1bd20cb81a2fbb51126a3a7f2ab417a (patch)
treeef9d803055a73faaa0769a7e7f3151bb93e6c1bb /hostapd/main.c
parent825fb6b20bcc58d9a7445e23bde4f6c69bfd1bdc (diff)
downloadhostap-b0d18bc2a1bd20cb81a2fbb51126a3a7f2ab417a.zip
hostap-b0d18bc2a1bd20cb81a2fbb51126a3a7f2ab417a.tar.gz
hostap-b0d18bc2a1bd20cb81a2fbb51126a3a7f2ab417a.tar.bz2
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>
Diffstat (limited to 'hostapd/main.c')
-rw-r--r--hostapd/main.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/hostapd/main.c b/hostapd/main.c
index 5a1b0a9..db2a455 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -14,6 +14,7 @@
#include "utils/common.h"
#include "utils/eloop.h"
+#include "utils/uuid.h"
#include "crypto/random.h"
#include "crypto/tls.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[])
{
struct hapd_interfaces interfaces;
@@ -531,7 +553,7 @@ int main(int argc, char *argv[])
interfaces.global_ctrl_sock = -1;
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)
break;
switch (c) {
@@ -588,6 +610,10 @@ int main(int argc, char *argv[])
bss_config = tmp_bss;
bss_config[num_bss_configs++] = optarg;
break;
+#ifdef CONFIG_WPS
+ case 'u':
+ return gen_uuid(optarg);
+#endif /* CONFIG_WPS */
default:
usage();
break;