From patchwork Mon Feb 19 15:49:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitrii Lebed X-Patchwork-Id: 875192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mj+Uexik"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="Pcjzc8NA"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=quantenna.com header.i=@quantenna.com header.b="xusnSI40"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zlT952TKlz9ryd for ; Tue, 20 Feb 2018 03:04:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+va8gQQ1wNit1w+byNlvU1ruGvn6+URyLHy4lDfD6sU=; b=mj+UexikX3DTrq lYg+ZlT9Gwt7bnjXQJ4sbt5nR4Ov5gAMottPxj450LE7aVFQxz37PsjqT7K8xRQXUtqm6TtsS9rDk zny+3OHDZ4pexogGDQ1o3fZJlsiMwwTzv1Y0iKDLMl+0u9dZiDvh3V+M++Q10zUEqqtT0n28ScGU+ rZk0unI1ILb6li6EjWrJctQBHVK3R4e4yoY3l50ZTU8o0ExCUwYmMvvDQrAmCSHIuEwR/bjm3FZDp 4/FhjBnpdnY6pMeUBaZjIw2lD4fOkgFq4Aj74aKcGyim2l22GJZD9iKuyW7BfoOdhfBrgCbjUsILj dy5fCwEEhq8Qa+vZGVNg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ennvi-0003ax-JT; Mon, 19 Feb 2018 16:04:38 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ennvg-0003C7-Oe for hostap@bombadil.infradead.org; Mon, 19 Feb 2018 16:04:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=H/K5pk53A7aSkKnBSNvDTryftxghh3PBoX82kI0SM7Y=; b=Pcjzc8NAS4u/8JeYz/eHQ9ByQC xWZZOkqWvvDhFZxr+5JFOpQ/ceuwgRY1jMjH4IxpnTJdOAko0KyRWK2XPC+WL5pj8Qm6gUu+jJyB0 MmyhmFnR4D/pzWut2QOMP5NLTFUySQtrnesOVuGc/uvhe9hAAUybGgT3oBv5o/ILTdTAIHaAfSAl7 tgEQzTBkOiwLzTQP+CbrZmrjhILotz829as+MBhzk7TsmeQ6V5YYzIEVwoF+GH5NrkG72tVLt1Z2L wa4D/67Wa7v6pyaRqQcpwQ+JB/7FGc54C6VEQADWXwrUUlzFCbBciOqybaau0pC5Vgh3XmidkNfvp NlNS8WKg==; Received: from mail-cys01nam02on0046.outbound.protection.outlook.com ([104.47.37.46] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ennhp-0006gg-3F for hostap@lists.infradead.org; Mon, 19 Feb 2018 15:50:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=H/K5pk53A7aSkKnBSNvDTryftxghh3PBoX82kI0SM7Y=; b=xusnSI40ZrVQnr4lBoOV0u1tjWtQK3bxOOuiq7Yq4b3DCY7d1jY8np9Ox6qgTRmR23WKJtnYxf8LwnFU6mTYZNUjzR7wBIIwUsys2ZAtuFdLj4QBmgtsdIfCvNjVa1RESxeyhU8g7MC34GyLcHJr+vhs3k6UDM3elgH6R+CGnkI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=dlebed@quantenna.com; Received: from dlebed-laptop.quantenna.com (195.182.157.78) by SN1PR05MB1934.namprd05.prod.outlook.com (2a01:111:e400:523b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.527.6; Mon, 19 Feb 2018 15:50:00 +0000 From: Dmitrii Lebed To: hostap@lists.infradead.org Subject: [PATCH v2] DFS: restart CAC in case of CAC is aborted Date: Mon, 19 Feb 2018 18:49:30 +0300 Message-Id: <20180219154930.7011-1-dlebed@quantenna.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <800a151e-1e7d-2057-255b-5d56f3c32882@quantenna.com> References: <800a151e-1e7d-2057-255b-5d56f3c32882@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:209:14::16) To SN1PR05MB1934.namprd05.prod.outlook.com (2a01:111:e400:523b::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a46d4441-c236-42c9-21ae-08d577b06fbe X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SN1PR05MB1934; X-Microsoft-Exchange-Diagnostics: 1; SN1PR05MB1934; 3:rgm4kn7rWX0Xzf2S8gsl08LqvJ3jrxK38lPT5wzD978A52ZIoUAEv9FFbP4VdMV+OoAW2bzqJtDAcBG9z1HMhA1GiUf7VzKyUvBRR7+xCwx34WpNtJ4ce/+DH7fatoToEeGGTbn8oTZW7bBt05wqV2ykb/TUJvh1w7kwQO5OAaaOm+qP+qeh69H5YAxjXJlpZp4047sZTNpl26aVmfOW89wQhV7mBZbpAygYYrKPiz93s1jVWvoSBenR/0exUyKx; 25:J/bGgVSLonrZFW3Nqwv84JY4PuUS0SO8p3UVP+864+39dE7q/1l9xJ/N0q2iPZF+fagLjAIYxLqCcvXcaoJZOUsqI8r+05Xh92dccc303qLpiLY5ibrRIhJQy/M9HFscMimAAPc2na4Bcv6RgKVqxXIIBvZfpdL+warQTONCV7H4nlm7pz723bepmZaZcwZ8+YX1X9r3rljfvu7tCUNTvIMtHlgfq+99uZZTN7bgottJMB0/bwF4mQLxCbl0Pey2Nsp+VgLjSfNcRt5XJGK8gdren0f0R/hsGP4cBWzpxtJosh7YHElDuOASwIdGNThZ86m/i8xnOFMj2qWY2eAGlA==; 31:PlBOuFSBwQivMzpVqMNrEW4L6kzAKLXzeeYxfC9Awidq9lqV5jMwkHoN0bZU7XCa9j7D8Zl+zfT1T4Idjz2epaCkyDEXQvARpI8SbUulwo1NWWTs1RKKHxSVFfVsMb6MSV5haiKGr3qGacsLwpWcWq4VOpP2uRhoimKW7EvuUV6/t5xWZ4UVl/jXQlf68bE6+eAhVunm63gGoKsy9YEnQjGcVlIDSP7z7Uvi0zz46uQ= X-MS-TrafficTypeDiagnostic: SN1PR05MB1934: X-Microsoft-Exchange-Diagnostics: 1; SN1PR05MB1934; 20:eSgke9wQ9zPJleresooqAcUlbMUQjLOckxiXzaOts0A6uGjZDXm4lNAWA2Wo4oQbyKCiFhp9nuuj8aY6HspLLPzFPtcWE/FBaTMDWY5tsWrYE0rjCiehl7mGEviNwsbvHPs3AyGNsSBAhEVDG+g5bULwfH6CTyEb9UoUm4iRus/udNf2qTWiDb2Lm9F8roBPX8TBrcAeCd7s4xUcUB9b5usndVjGmWtvATuMDkvIZje1kFzYW9LVaotEBogIEo4+xUSmUhFc+t9loyeHCD5j4ToZd+IKpKEGdxkd9xD2uQg+ACFAyJOnZld3rUmjfFt+VrOemmkDhQTotzujnWVhSQvtQ5noZXUiwobp/X4jI7YrpeuewRT0a0qrp510OdlL35n8OaYRmGZ7ArnOjPxf7+BgYh7YLR4iAvkjpV+Tmjalz90nTIreXDfejC5RSwIHW+hUmrFZW+7r0I+imNWLJc270liOqQbpDbAb8DZyPzlyj3x8NPEzORE2BzXC2BbL; 4:qXLvxE9FCIV7RGNo2KSgwOgzo1v61D9cPz/qbDnvIkOBXmtpVyRD5zjleBcPbxmq27ZEo++1K6Wjh++jy1uGGJuUVdg5McmWIKK7FzMlUNihi5yy0ySFtl84NVwFExQPOOYZCPSg3tLpnCR7I6SrqAqcHAN+DbTinA/MnwDy8R7isBKZuIBCWq8bzM7l5XmPEF1GGeqfxiJmEz0rOgVoeJv0XfKS4ZWovHE/0vJ5Yad9mOz1oyOgU4rFnhKg3WHuf5BpLoE9b7wfXjLPX/1OiA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(944501161)(3002001)(93006095)(93001095)(10201501046)(6041288)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:SN1PR05MB1934; BCL:0; PCL:0; RULEID:; SRVR:SN1PR05MB1934; X-Forefront-PRVS: 0588B2BD96 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(39380400002)(396003)(39830400003)(199004)(189003)(26005)(186003)(6666003)(2950100002)(6916009)(66066001)(316002)(68736007)(47776003)(97736004)(50466002)(48376002)(36756003)(25786009)(105586002)(53416004)(59450400001)(106356001)(2351001)(86362001)(53936002)(386003)(2361001)(4326008)(575784001)(107886003)(2906002)(3846002)(16526019)(6116002)(1076002)(5890100001)(5660300001)(54906003)(8936002)(7696005)(69596002)(52116002)(6486002)(50226002)(51416003)(81166006)(478600001)(8746002)(81156014)(305945005)(76176011)(8676002)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR05MB1934; H:dlebed-laptop.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR05MB1934; 23:0XLC5Hpb1rqsdwkvQU82/6HghNInRPLMQW6ZQgFaG?= K+weggWbTy0uZvg/EfJnj6043wvXH6C5stqdVdFF/rlvrlGkLjHYCY1diW8qragqzvtzHw86I1f+FcrWTkMFYVtjkWrQYdvWNkck+JHm68Im1IT68RSfsSl2nGHljZcas/5YzfjwYKaxtSdCxrgemgPKAmM/6NtyYJ6+H47tXVwkDUAcH1eWLmKWmwMXz/vnU5CbT2qayzVZPxF5mhRUy0uA43UNXN9CIAiGoIKFE7BE5hU/eteXu5w1OfX4tUEyaSIRrbf3jCCkDaoY/a33WRTJM5GbltM+kJw5Ghbu+WHQel1OtM29IN/Q4y6m0IjumrwPvXM9Ya4vWEOR+9jXGfqv8jyuqI/KvjY4XVh9iaBDD65+mjvCOsPlIB/mRhADEHZ1XJin7/uYxXfxDop63JENvR0hmX3SVItX3rh/quQgbBj3xUFPLNAEV/HqT3NorxpdWJy3CiniCo2SAKFiUTFuI0sUJlc0PUXOifO3YX82qXf3oXWEc3b8qhzvSxYWb1wLPzKkdgLgUF0MG5Kl6Ljy0B3Nm4Ig2Q1CIS3avItGgW7o0DIf5KVj2ArVNRoynLBnw02ddDUUs8ETLr25Y8inirt313+BdKAsR42RqyUOYA5SAJOLcn9n0j9oNrl8WCNaRs6OJEHI6HwkKAp89dN2TFkEIn8kiV341s+cakoM/GPiY9eGqbcags+pp/GhCmrm/6MJ4oqWrQXcX4OQQTY6h5NuKURaXyXv8kfSEjnquDuUqUl0KdoJC85cK8psSRDG4Kvdebn5/WjDbhXblR8R9qm1Gpd9XwXwA66+wCXzlSQhKi1JHGbo8Z5C9KRdTAYzhKW8kWMrpth0YjfwRvwXePDvAnAWxxmAep0kvc0mUCcojh5EK4GOxOAdPKhmvOOfwoQOFjqsexYVT7Uh0cKgew1vCcBgEBh+VCKNzdYHYImqXuxgV2c3Jl8+3qNR1WPFWXYw6gDhwgbJhajAmhQf37UkJs35C9EC8N5tT2bzkGzSesfi1WnT9TpYH/tyuDSPHl1xNY7s1x4t/3rW9wGWJB9Ie7utcHKtl6UVVKpDRhdDRYeUgD+u3xtqM2viH+03vbOeS3A+4lbc7qcX/cuXHyIu4Ypo0P8aP4bct1iIxQGZ5myaX2NU8rAE2JW5S9rbPDKEYdGg6NDbIc27a61AbpP1HpwuZYVw84YeHfddRmD2G2y5D6mgYVYTu3cHG3oi1tqYtPlxmvGrIKK7QOXBvu+awOgy+2p/09LQJh+0w== X-Microsoft-Exchange-Diagnostics: 1; SN1PR05MB1934; 6:kqY8zyI62RDPjtx6PuXP/f043onooF+PdC3Mxc2nVlEMA/H321MWl2lW7ALMwXtvrvKGxWcY+w9nx1GFrY0gxck1JKs9gcL9V1e/UWEnz/UAUEoRC2xVaaXcYmMmhSH5njmzvIjnPbeHARx7DcR2fEtW2BaIcDBGWRfn+2muXBfugoIm8tJ/AHkfy0oz3Q5okzTneZNagzCK3hkZ7Jp1EUwstFacpl+F+ETQDtt/HeAWAJTgzBdDd/exah1uUfFKx001cgcpME8v1DBuJl8pRa0O8ikcPHWTUx/RlC77/nlyVQ6dDcF/OrEozExqAKCYHMdLeipRRh5eGXvO8hmbnJdaZxI42DdGkw6JCYgaJQo=; 5:cJyvQ+MJOx7XSrJRfiXEVEAUHPNRkzkO9CH9tzglMyIm3BMNyTNKSeivnvrbajxSYbpbUAmuAyKM1JG/btZ445cDtm7ZSBnT3Wor38xqs6kIKdYKnnvCgfT+oKiQUnjK6loGs2qSA8vO76tFkhMFZO6NpVsCqgDZMKqeMDecy5w=; 24:YhC62c21zavycKHuIB5hOroDOyuijvQwacXlVbWUWQzbKVQmNk9bwfaJeKanHrQCKfKpfBbRXa7DmBU7ASsM91Me6Us5KzakbYqFmh5DiXU=; 7:2qMTI1mCR2E4WOo3ObWjMK80qn8qp6vcNpRUEJuvIHQLxF7byfL1yKkNWqWHpsHO8WaAx3/wflmxrk8r8Awl2yTnMacRCEaYFZGBPdxHL682gDw9kxGoYOJVKhC8CFbd9mbRmwTRz8RCTyv7NMkEIUJq/JI7pPbuu+vmslmOcqi1NVffaDYaYKnJO81bYv8Y7eDhmhGAumXw3cKtnrJz+Om6AT53UwOoRyGYLHkCqLurrByPyfm4TE0rUcoDm2Xn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2018 15:50:00.2817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a46d4441-c236-42c9-21ae-08d577b06fbe X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR05MB1934 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180219_155017_282487_2538EE6A X-CRM114-Status: GOOD ( 15.02 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-2.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [104.47.37.46 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [104.47.37.46 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Lebed , Igor Mitsyanko , Sergey Matyukevich , Sergey Maksimenko Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Dmitry Lebed If CAC is aborted, hostapd will continue wait for CAC completion and will stuck in this state forever. Adding CAC restart action on CAC aborted event, considering "CAC aborted" state as recoverable. CAC aborted can be generated in some complex configs, e.g. in repeater config, when wpa_supplicant is doing something on another virtual interface that can lead to generation of "CAC aborted" event. Signed-off-by: Dmitrii Lebed --- V1->V2 changes: 1. Move CAC restart to eloop with 1 sec delay 2. Added CAC start error handling in CAC restart handler 3. Added DFS offload handling for CAC abort src/ap/dfs.c | 97 ++++++++++++++++++++++++++++++++++++-------------- src/ap/dfs.h | 2 +- src/ap/drv_callbacks.c | 6 ++-- 3 files changed, 74 insertions(+), 31 deletions(-) -- 2.16.1 This email, including its contents and any attachment(s), may contain confidential information of Quantenna Communications, Inc. and is solely for the intended recipient(s). If you may have received this in error, please contact the sender and permanently delete this email, its contents and any attachment(s). diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 5a0d7814b..f1476eee0 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -10,6 +10,7 @@ #include "utils/includes.h" #include "utils/common.h" +#include "utils/eloop.h" #include "common/ieee802_11_defs.h" #include "common/hw_features_common.h" #include "common/wpa_ctrl.h" @@ -636,6 +637,34 @@ static unsigned int dfs_get_cac_time(struct hostapd_iface *iface, return cac_time_ms; } +static int dfs_start_cac(struct hostapd_iface *iface) +{ + int res; + + wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START + "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds", + iface->freq, + iface->conf->channel, iface->conf->secondary_channel, + iface->conf->vht_oper_chwidth, + iface->conf->vht_oper_centr_freq_seg0_idx, + iface->conf->vht_oper_centr_freq_seg1_idx, + iface->dfs_cac_ms / 1000); + + res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode, + iface->freq, + iface->conf->channel, + iface->conf->ieee80211n, + iface->conf->ieee80211ac, + iface->conf->secondary_channel, + iface->conf->vht_oper_chwidth, + iface->conf->vht_oper_centr_freq_seg0_idx, + iface->conf->vht_oper_centr_freq_seg1_idx); + + if (res) + wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res); + + return res; +} /* * Main DFS handler @@ -719,31 +748,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface) /* Finally start CAC */ hostapd_set_state(iface, HAPD_IFACE_DFS); wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq); - wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START - "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds", - iface->freq, - iface->conf->channel, iface->conf->secondary_channel, - iface->conf->vht_oper_chwidth, - iface->conf->vht_oper_centr_freq_seg0_idx, - iface->conf->vht_oper_centr_freq_seg1_idx, - iface->dfs_cac_ms / 1000); - res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode, - iface->freq, - iface->conf->channel, - iface->conf->ieee80211n, - iface->conf->ieee80211ac, - iface->conf->secondary_channel, - iface->conf->vht_oper_chwidth, - iface->conf->vht_oper_centr_freq_seg0_idx, - iface->conf->vht_oper_centr_freq_seg1_idx); - - if (res) { - wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res); - return -1; - } - - return 0; + return dfs_start_cac(iface); } @@ -763,18 +769,43 @@ static int hostapd_config_dfs_chan_available(struct hostapd_iface *iface) return dfs_check_chans_available(iface, start_chan_idx, n_chans); } +static void hostapd_dfs_cac_restart(void *eloop_data, void *user_ctx) +{ + struct hostapd_iface *iface = eloop_data; + int res; + + if (iface->state != HAPD_IFACE_DFS || !iface->cac_started) { + wpa_printf(MSG_WARNING, "CAC restart in wrong state=%d; started=%d", + iface->state, iface->cac_started); + return; + } + + wpa_printf(MSG_DEBUG, "DFS restart CAC on %d MHz", iface->freq); + res = dfs_start_cac(iface); + + if (res) + hostapd_setup_interface_complete(iface, res); +} int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, int ht_enabled, int chan_offset, int chan_width, int cf1, int cf2) { + int res = 0; + int dfs_offload = !!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD); + wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED "success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + if (!iface->cac_started) { + wpa_printf(MSG_ERROR, "CAC complete received in wrong state"); + return 1; + } + if (success) { /* Complete iface/ap configuration */ - if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) { + if (dfs_offload) { /* Complete AP configuration for the first bring up. */ if (iface->state != HAPD_IFACE_ENABLED) hostapd_setup_interface_complete(iface, 0); @@ -800,9 +831,21 @@ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, iface->cac_started = 0; } } + } else { + if (dfs_offload) { + if (iface->state == HAPD_IFACE_ENABLED) + iface->cac_started = 0; + } else if (iface->state == HAPD_IFACE_DFS) { + /* Schedule CAC restart in 1 second */ + eloop_register_timeout(1, 0, hostapd_dfs_cac_restart, + iface, NULL); + } else { + wpa_printf(MSG_ERROR, "CAC aborted received in wrong state=%d offload=%d", + iface->state, dfs_offload); + } } - return 0; + return res; } @@ -1074,7 +1117,7 @@ int hostapd_is_dfs_required(struct hostapd_iface *iface) } -int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq, +int hostapd_dfs_cac_started(struct hostapd_iface *iface, int freq, int ht_enabled, int chan_offset, int chan_width, int cf1, int cf2) { diff --git a/src/ap/dfs.h b/src/ap/dfs.h index f0fa6f688..2d1532815 100644 --- a/src/ap/dfs.h +++ b/src/ap/dfs.h @@ -25,7 +25,7 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq, int ht_enabled, int chan_offset, int chan_width, int cf1, int cf2); int hostapd_is_dfs_required(struct hostapd_iface *iface); -int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq, +int hostapd_dfs_cac_started(struct hostapd_iface *iface, int freq, int ht_enabled, int chan_offset, int chan_width, int cf1, int cf2); int hostapd_handle_dfs_offload(struct hostapd_iface *iface); diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index e4a458107..58e967704 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -1398,9 +1398,9 @@ static void hostapd_event_dfs_cac_started(struct hostapd_data *hapd, struct dfs_event *radar) { wpa_printf(MSG_DEBUG, "DFS offload CAC started on %d MHz", radar->freq); - hostapd_dfs_start_cac(hapd->iface, radar->freq, radar->ht_enabled, - radar->chan_offset, radar->chan_width, - radar->cf1, radar->cf2); + hostapd_dfs_cac_started(hapd->iface, radar->freq, radar->ht_enabled, + radar->chan_offset, radar->chan_width, + radar->cf1, radar->cf2); } #endif /* NEED_AP_MLME */