aboutsummaryrefslogtreecommitdiffstats
path: root/src/wps
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-12-16 20:08:37 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-24 05:54:40 (GMT)
commit864c9afa6df17dc0f1f5e83360ea14e8a566d7e6 (patch)
tree48322597135b47d44f6b59c721b8fa4d208551d4 /src/wps
parent61e98e9cf7839e8928bc3ee3ef169dc22853da43 (diff)
downloadhostap-864c9afa6df17dc0f1f5e83360ea14e8a566d7e6.zip
hostap-864c9afa6df17dc0f1f5e83360ea14e8a566d7e6.tar.gz
hostap-864c9afa6df17dc0f1f5e83360ea14e8a566d7e6.tar.bz2
wps_registrar: Use monotonic time for PBC workaround
The PBC ignore-start workaround just needs to check whether the time is within 5 seconds, so should use monotonic time. While at it, add a few more ifdefs to clearly separate the code and variables needed. Signed-hostap: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'src/wps')
-rw-r--r--src/wps/wps_registrar.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index 5c39930..a82544a 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -183,7 +183,9 @@ struct wps_registrar {
u8 p2p_dev_addr[ETH_ALEN];
u8 pbc_ignore_uuid[WPS_UUID_LEN];
- struct os_time pbc_ignore_start;
+#ifdef WPS_WORKAROUNDS
+ struct os_reltime pbc_ignore_start;
+#endif /* WPS_WORKAROUNDS */
};
@@ -1038,7 +1040,9 @@ void wps_registrar_complete(struct wps_registrar *registrar, const u8 *uuid_e,
wps_registrar_remove_pbc_session(registrar,
uuid_e, NULL);
wps_registrar_pbc_completed(registrar);
- os_get_time(&registrar->pbc_ignore_start);
+#ifdef WPS_WORKAROUNDS
+ os_get_reltime(&registrar->pbc_ignore_start);
+#endif /* WPS_WORKAROUNDS */
os_memcpy(registrar->pbc_ignore_uuid, uuid_e, WPS_UUID_LEN);
} else {
wps_registrar_pin_completed(registrar);
@@ -1141,9 +1145,9 @@ void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
#ifdef WPS_WORKAROUNDS
if (reg->pbc_ignore_start.sec &&
os_memcmp(attr.uuid_e, reg->pbc_ignore_uuid, WPS_UUID_LEN) == 0) {
- struct os_time now, dur;
- os_get_time(&now);
- os_time_sub(&now, &reg->pbc_ignore_start, &dur);
+ struct os_reltime now, dur;
+ os_get_reltime(&now);
+ os_reltime_sub(&now, &reg->pbc_ignore_start, &dur);
if (dur.sec >= 0 && dur.sec < 5) {
wpa_printf(MSG_DEBUG, "WPS: Ignore PBC activation "
"based on Probe Request from the Enrollee "
@@ -3190,7 +3194,9 @@ static enum wps_process_res wps_process_wsc_done(struct wps_data *wps,
wps->uuid_e,
wps->p2p_dev_addr);
wps_registrar_pbc_completed(wps->wps->registrar);
- os_get_time(&wps->wps->registrar->pbc_ignore_start);
+#ifdef WPS_WORKAROUNDS
+ os_get_reltime(&wps->wps->registrar->pbc_ignore_start);
+#endif /* WPS_WORKAROUNDS */
os_memcpy(wps->wps->registrar->pbc_ignore_uuid, wps->uuid_e,
WPS_UUID_LEN);
} else {