aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-01-01 20:56:52 (GMT)
committerJouni Malinen <j@w1.fi>2009-01-01 20:56:52 (GMT)
commit79da74a20c0f61ded4c0fd203f054cf3783f54da (patch)
tree7026e9d131c454f430e4cb10058b0bb8cb65299e /wpa_supplicant
parent84f5b41fc1e7a74c343b42075e1708a19d44a63e (diff)
downloadhostap-06-79da74a20c0f61ded4c0fd203f054cf3783f54da.zip
hostap-06-79da74a20c0f61ded4c0fd203f054cf3783f54da.tar.gz
hostap-06-79da74a20c0f61ded4c0fd203f054cf3783f54da.tar.bz2
WPS: Generate UUID based on MAC address, if not set
Generate a SHA1 hash -based UUID from the local MAC address if the UUID was not configured. This makes it easier to prepare for WPS since there is no need to generate an UUID.
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/README-WPS3
-rw-r--r--wpa_supplicant/scan.c2
-rw-r--r--wpa_supplicant/wpa_supplicant.conf1
-rw-r--r--wpa_supplicant/wps_supplicant.c8
4 files changed, 11 insertions, 3 deletions
diff --git a/wpa_supplicant/README-WPS b/wpa_supplicant/README-WPS
index b1aa0dc..284753f 100644
--- a/wpa_supplicant/README-WPS
+++ b/wpa_supplicant/README-WPS
@@ -67,7 +67,8 @@ CONFIG_WPS=y
WPS needs the Universally Unique IDentifier (UUID; see RFC 4122) for
the device. This is configured in the runtime configuration for
-wpa_supplicant:
+wpa_supplicant (if not set, UUID will be generated based on local MAC
+address):
# example UUID for WPS
uuid=12345678-9abc-def0-1234-56789abcdef0
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index c7b2dbd..a9f86ea 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -181,7 +181,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
#ifdef CONFIG_WPS
if (wps) {
wps_ie = wps_build_probe_req_ie(wps == 2, &wpa_s->wps->dev,
- wpa_s->conf->uuid, req_type);
+ wpa_s->wps->uuid, req_type);
if (wps_ie) {
extra_ie = wpabuf_head(wps_ie);
extra_ie_len = wpabuf_len(wps_ie);
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index b92f43f..cfcea88 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -150,6 +150,7 @@ fast_reauth=1
# Wi-Fi Protected Setup (WPS) parameters
# Universally Unique IDentifier (UUID; see RFC 4122) of the device
+# If not configured, UUID will be generated based on the local MAC address.
#uuid=12345678-9abc-def0-1234-56789abcdef0
# Device Name
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index eeee496..a538338 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -21,6 +21,7 @@
#include "eap_peer/eap.h"
#include "wpa_supplicant_i.h"
#include "eloop.h"
+#include "uuid.h"
#include "wpa_ctrl.h"
#include "eap_common/eap_wsc_common.h"
#include "wps/wps.h"
@@ -442,7 +443,12 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
wps->dev.os_version = WPA_GET_BE32(wpa_s->conf->os_version);
wps->dev.rf_bands = WPS_RF_24GHZ | WPS_RF_50GHZ; /* TODO: config */
os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
- os_memcpy(wps->uuid, wpa_s->conf->uuid, 16);
+ if (is_nil_uuid(wpa_s->conf->uuid)) {
+ uuid_gen_mac_addr(wpa_s->own_addr, wps->uuid);
+ wpa_hexdump(MSG_DEBUG, "WPS: UUID based on MAC address",
+ wps->uuid, WPS_UUID_LEN);
+ } else
+ os_memcpy(wps->uuid, wpa_s->conf->uuid, WPS_UUID_LEN);
wpa_s->wps = wps;