blob: b3dc7f15aca3d7fbbe40f80e18a8c43afd0b983b [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From c384a286a5d163d324b1901b1c446df1c6dfdbe2 Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: "amlendu.mishra" <amlendu.mishra@mediatek.com>
3Date: Wed, 13 Dec 2023 18:13:01 +0530
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 056/126] mtk: hostapd: WPS added change to configure AP PIN
developer66e89bc2024-04-23 14:50:01 +08005 lock timout
6
7added config paramter ap_pin_lockout_time to configure
8AP PIN timeout from hosatpd.conf
9
10Signed-off-by: amlendu.mishra <amlendu.mishra@mediatek.com>
11---
12 hostapd/config_file.c | 2 ++
13 src/ap/ap_config.h | 1 +
14 src/ap/wps_hostapd.c | 9 ++++++---
15 3 files changed, 9 insertions(+), 3 deletions(-)
16
17diff --git a/hostapd/config_file.c b/hostapd/config_file.c
developer05f3b2b2024-08-19 19:17:34 +080018index fe92540c4..7ab2c6827 100644
developer66e89bc2024-04-23 14:50:01 +080019--- a/hostapd/config_file.c
20+++ b/hostapd/config_file.c
developer05f3b2b2024-08-19 19:17:34 +080021@@ -4283,6 +4283,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
developer66e89bc2024-04-23 14:50:01 +080022 bss->wps_independent = atoi(pos);
23 } else if (os_strcmp(buf, "ap_setup_locked") == 0) {
24 bss->ap_setup_locked = atoi(pos);
25+ } else if (os_strcmp(buf, "ap_pin_lockout_time") == 0) {
26+ bss->ap_pin_lockout_time = atoi(pos);
27 } else if (os_strcmp(buf, "uuid") == 0) {
28 if (uuid_str2bin(pos, bss->uuid)) {
29 wpa_printf(MSG_ERROR, "Line %d: invalid UUID", line);
30diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
developer05f3b2b2024-08-19 19:17:34 +080031index a8002fd1a..b66f79d31 100644
developer66e89bc2024-04-23 14:50:01 +080032--- a/src/ap/ap_config.h
33+++ b/src/ap/ap_config.h
developer05f3b2b2024-08-19 19:17:34 +080034@@ -505,6 +505,7 @@ struct hostapd_bss_config {
developer66e89bc2024-04-23 14:50:01 +080035 #ifdef CONFIG_WPS
36 int wps_independent;
37 int ap_setup_locked;
38+ unsigned int ap_pin_lockout_time;
39 u8 uuid[16];
40 char *wps_pin_requests;
41 char *device_name;
42diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
43index dfc5c3ecb..8a6fc42b2 100644
44--- a/src/ap/wps_hostapd.c
45+++ b/src/ap/wps_hostapd.c
46@@ -768,9 +768,12 @@ static int wps_pwd_auth_fail(struct hostapd_data *hapd, void *ctx)
47 eloop_cancel_timeout(hostapd_wps_reenable_ap_pin, hapd, NULL);
48 wpa_printf(MSG_DEBUG, "WPS: AP PIN disabled indefinitely");
49 } else if (!hapd->conf->ap_setup_locked) {
50- if (hapd->ap_pin_lockout_time == 0)
51- hapd->ap_pin_lockout_time = 60;
52- else if (hapd->ap_pin_lockout_time < 365 * 24 * 60 * 60 &&
53+ if (hapd->ap_pin_lockout_time == 0) {
54+ if (hapd->conf->ap_pin_lockout_time)
55+ hapd->ap_pin_lockout_time = hapd->conf->ap_pin_lockout_time;
56+ else
57+ hapd->ap_pin_lockout_time = 60;
58+ } else if (hapd->ap_pin_lockout_time < 365 * 24 * 60 * 60 &&
59 (hapd->ap_pin_failures % 3) == 0)
60 hapd->ap_pin_lockout_time *= 2;
61
62--
developer05f3b2b2024-08-19 19:17:34 +0800632.18.0
developer66e89bc2024-04-23 14:50:01 +080064