blob: fab77063912e41ba012ecded4b710407b6ddb50e [file] [log] [blame]
From 44d5b6d691a45b71d2e8896f3302b4b946ae4d33 Mon Sep 17 00:00:00 2001
From: "amlendu.mishra" <amlendu.mishra@mediatek.com>
Date: Wed, 13 Dec 2023 18:13:01 +0530
Subject: [PATCH 54/54] mtk: hostapd: WPS added change to configure AP PIN lock
timout
added config paramter ap_pin_lockout_time to configure
AP PIN timeout from hosatpd.conf
Signed-off-by: amlendu.mishra <amlendu.mishra@mediatek.com>
---
hostapd/config_file.c | 2 ++
src/ap/ap_config.h | 1 +
src/ap/wps_hostapd.c | 9 ++++++---
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 721685baf..9dd86e037 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3709,6 +3709,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
bss->wps_independent = atoi(pos);
} else if (os_strcmp(buf, "ap_setup_locked") == 0) {
bss->ap_setup_locked = atoi(pos);
+ } else if (os_strcmp(buf, "ap_pin_lockout_time") == 0) {
+ bss->ap_pin_lockout_time = atoi(pos);
} else if (os_strcmp(buf, "uuid") == 0) {
if (uuid_str2bin(pos, bss->uuid)) {
wpa_printf(MSG_ERROR, "Line %d: invalid UUID", line);
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 3e0505594..c03fa11b6 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -491,6 +491,7 @@ struct hostapd_bss_config {
#ifdef CONFIG_WPS
int wps_independent;
int ap_setup_locked;
+ unsigned int ap_pin_lockout_time;
u8 uuid[16];
char *wps_pin_requests;
char *device_name;
diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 0c351af5f..ea2608917 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -768,9 +768,12 @@ static int wps_pwd_auth_fail(struct hostapd_data *hapd, void *ctx)
eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
wpa_printf(MSG_DEBUG, "WPS: AP PIN disabled indefinitely");
} else if (!hapd->conf->ap_setup_locked) {
- if (hapd->ap_pin_lockout_time == 0)
- hapd->ap_pin_lockout_time = 60;
- else if (hapd->ap_pin_lockout_time < 365 * 24 * 60 * 60 &&
+ if (hapd->ap_pin_lockout_time == 0) {
+ if (hapd->conf->ap_pin_lockout_time)
+ hapd->ap_pin_lockout_time = hapd->conf->ap_pin_lockout_time;
+ else
+ hapd->ap_pin_lockout_time = 60;
+ } else if (hapd->ap_pin_lockout_time < 365 * 24 * 60 * 60 &&
(hapd->ap_pin_failures % 3) == 0)
hapd->ap_pin_lockout_time *= 2;
--
2.18.0