blob: b3dc7f15aca3d7fbbe40f80e18a8c43afd0b983b [file] [log] [blame]
From c384a286a5d163d324b1901b1c446df1c6dfdbe2 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 056/126] 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 fe92540c4..7ab2c6827 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4283,6 +4283,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 a8002fd1a..b66f79d31 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -505,6 +505,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.18.0