From patchwork Wed Aug 8 23:10:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eyal Shapira X-Patchwork-Id: 175970 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id BBB392C007A for ; Thu, 9 Aug 2012 09:10:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7D8789C1FF; Wed, 8 Aug 2012 19:10:42 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PZv2Pb1B0bQS; Wed, 8 Aug 2012 19:10:42 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B9E8E9C201; Wed, 8 Aug 2012 19:10:34 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2D70F9C201 for ; Wed, 8 Aug 2012 19:10:34 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YMjpoiFM7t4x for ; Wed, 8 Aug 2012 19:10:30 -0400 (EDT) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 2DC8F9C1FF for ; Wed, 8 Aug 2012 19:10:29 -0400 (EDT) Received: by wibhq12 with SMTP id hq12so35013wib.5 for ; Wed, 08 Aug 2012 16:10:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=rXUJhg28t6RClq98+Cf4VdN9850sfoY/6cWC+qdRbVM=; b=pPc5K/pJDkLR+opKqj/HGs1K/JFdv0Cf0hYaRTDq69r/f94obdl6Vgv4RKPKtV6r+U OeTkHFGfVJJezNmteT2lPoGSGGnN+o00f7d1uyroVWKf8n6Xf8MeYexCl7CicLBc7xWp ihA8Hf9EoxnFV0FtQzp79VqVqfO3P3adDShYN7+MYJ7P2nuKj6aEd5Y82Ei/QpCsLzjt mUFEVgnNdlly57UyUN+7/Yqi2LSp/+NctJ1q5QVCqtMVUDC+6+Eu46b+pg7JIj2EFkUw tDE7sPEmx2m+QkBodnlGKOgaeL0FBywUql2rfZQMu1Cm47NZjHy7W0kWTgQbzm7B+yAp iw3g== Received: by 10.216.198.10 with SMTP id u10mr10197763wen.80.1344467428691; Wed, 08 Aug 2012 16:10:28 -0700 (PDT) Received: from localhost.localdomain ([213.57.153.193]) by mx.google.com with ESMTPS id z11sm11344039wiv.10.2012.08.08.16.10.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Aug 2012 16:10:27 -0700 (PDT) From: Eyal Shapira To: Subject: [PATCH] Add p2p_go_max_inactivity config option Date: Thu, 9 Aug 2012 02:10:18 +0300 Message-Id: <1344467418-28618-1-git-send-email-eyal@wizery.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkVEw2nc+ypzvX0xwg8FELutNilE0NsxJ2Dzi72VXCe8h/4/hYITffxCyADnowRkhc1PRLL Cc: j@w1.fi X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com This enables setting a different max inactivity timeout for P2P GO. This timeout is used to detect inactive clients. In some scenarios it may be useful to have control over this and set a shorter timeout than the default 300s. For example when running STA and P2P GO interfaces concurrently, the STA interface may perform scans which may cause the GO to miss a disassoc / deauth frames from a client and keep assuming that the client is connected until the inactivity detection kicks in. 300 secs is a bit too long for such scenarios and creates a bad user experience. Signed-hostap: Eyal Shapira --- wpa_supplicant/config.c | 4 +++- wpa_supplicant/config.h | 10 ++++++++++ wpa_supplicant/config_file.c | 4 +++- wpa_supplicant/p2p_supplicant.c | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index e72ac34..de7e528 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2558,6 +2558,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, config->fast_reauth = DEFAULT_FAST_REAUTH; config->p2p_go_intent = DEFAULT_P2P_GO_INTENT; config->p2p_intra_bss = DEFAULT_P2P_INTRA_BSS; + config->p2p_go_max_inactivity = DEFAULT_P2P_GO_MAX_INACTIVITY; config->bss_max_count = DEFAULT_BSS_MAX_COUNT; config->bss_expiration_age = DEFAULT_BSS_EXPIRATION_AGE; config->bss_expiration_scan_count = DEFAULT_BSS_EXPIRATION_SCAN_COUNT; @@ -2984,7 +2985,8 @@ static const struct global_parse_data global_fields[] = { { BIN(wps_nfc_dh_pubkey), 0 }, { BIN(wps_nfc_dh_privkey), 0 }, { BIN(wps_nfc_dev_pw), 0 }, - { STR(ext_password_backend), CFG_CHANGED_EXT_PW_BACKEND } + { STR(ext_password_backend), CFG_CHANGED_EXT_PW_BACKEND }, + { INT(p2p_go_max_inactivity), 0 }, }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 080c0cd..3bbca6a 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -18,6 +18,7 @@ #define DEFAULT_FAST_REAUTH 1 #define DEFAULT_P2P_GO_INTENT 7 #define DEFAULT_P2P_INTRA_BSS 1 +#define DEFAULT_P2P_GO_MAX_INACTIVITY (5*60) #define DEFAULT_BSS_MAX_COUNT 200 #define DEFAULT_BSS_EXPIRATION_AGE 180 #define DEFAULT_BSS_EXPIRATION_SCAN_COUNT 2 @@ -723,6 +724,15 @@ struct wpa_config { * format: [:] */ char *ext_password_backend; + + /* + * p2p_go_max_inactivity - Timeout in seconds to detect STA's inactivity + * + * This timeout value is used in P2P GO mode to clean up + * inactive stations. + * By default: 300 seconds. + */ + int p2p_go_max_inactivity; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 32d416e..2b732f8 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -877,10 +877,12 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) write_global_bin(f, "wps_nfc_dh_pubkey", config->wps_nfc_dh_pubkey); write_global_bin(f, "wps_nfc_dh_privkey", config->wps_nfc_dh_privkey); write_global_bin(f, "wps_nfc_dev_pw", config->wps_nfc_dev_pw); - if (config->ext_password_backend) fprintf(f, "ext_password_backend=%s\n", config->ext_password_backend); + if (config->p2p_go_max_inactivity != DEFAULT_P2P_GO_MAX_INACTIVITY) + fprintf(f, "p2p_go_max_inactivity=%d\n", + config->p2p_go_max_inactivity); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 218ed2f..abe120f 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -807,6 +807,7 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s, ssid->proto = WPA_PROTO_RSN; ssid->pairwise_cipher = WPA_CIPHER_CCMP; ssid->passphrase = os_strdup(params->passphrase); + ssid->ap_max_inactivity = wpa_s->parent->conf->p2p_go_max_inactivity; wpa_s->ap_configured_cb = p2p_go_configured; wpa_s->ap_configured_cb_ctx = wpa_s;