blob: b4630196d55311ada129f2f01e709bae5872b010 [file] [log] [blame]
From e1f26f8a80908fe46b53662db2dc87a217883751 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/69] 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 050ef290e..7bc19479d 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4191,6 +4191,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 40edcdaa7..7f48c71f5 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -493,6 +493,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 dfc5c3ecb..8a6fc42b2 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.39.2