developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From c384a286a5d163d324b1901b1c446df1c6dfdbe2 Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: "amlendu.mishra" <amlendu.mishra@mediatek.com> |
| 3 | Date: Wed, 13 Dec 2023 18:13:01 +0530 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 056/126] mtk: hostapd: WPS added change to configure AP PIN |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | lock timout |
| 6 | |
| 7 | added config paramter ap_pin_lockout_time to configure |
| 8 | AP PIN timeout from hosatpd.conf |
| 9 | |
| 10 | Signed-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 | |
| 17 | diff --git a/hostapd/config_file.c b/hostapd/config_file.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 18 | index fe92540c4..7ab2c6827 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 19 | --- a/hostapd/config_file.c |
| 20 | +++ b/hostapd/config_file.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 21 | @@ -4283,6 +4283,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 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); |
| 30 | diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 31 | index a8002fd1a..b66f79d31 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 32 | --- a/src/ap/ap_config.h |
| 33 | +++ b/src/ap/ap_config.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 34 | @@ -505,6 +505,7 @@ struct hostapd_bss_config { |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 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; |
| 42 | diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c |
| 43 | index 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 | -- |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 63 | 2.18.0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 64 | |