blob: 06ee95ce7220cc9bd56671c0065fb5542187a89a [file] [log] [blame]
developer617abbd2024-04-23 14:50:01 +08001From 817f2a256b166e07d7b0abcee789976b47224429 Mon Sep 17 00:00:00 2001
2From: "amlendu.mishra" <amlendu.mishra@mediatek.com>
3Date: Wed, 13 Dec 2023 18:13:01 +0530
4Subject: [PATCH 074/104] mtk: hostapd: WPS added change to configure AP PIN
5 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
18index 050ef290e..7bc19479d 100644
19--- a/hostapd/config_file.c
20+++ b/hostapd/config_file.c
21@@ -4191,6 +4191,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
22 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
31index 40edcdaa7..7f48c71f5 100644
32--- a/src/ap/ap_config.h
33+++ b/src/ap/ap_config.h
34@@ -493,6 +493,7 @@ struct hostapd_bss_config {
35 #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--
632.39.2
64