From patchwork Fri Jun 27 12:19:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 364948 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 ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3D98B140087 for ; Fri, 27 Jun 2014 22:28:36 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 39F4A17C0BC; Fri, 27 Jun 2014 08:28:23 -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 cma3d7PmVAjA; Fri, 27 Jun 2014 08:28:22 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2132717C0C1; Fri, 27 Jun 2014 08:27:51 -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 BA74B17C0D1 for ; Fri, 27 Jun 2014 08:27:49 -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 yNjNJDhtwNnL for ; Fri, 27 Jun 2014 08:27:44 -0400 (EDT) Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 1D59117C0BC for ; Fri, 27 Jun 2014 08:27:40 -0400 (EDT) Received: by mail-wg0-f44.google.com with SMTP id x13so5172810wgg.27 for ; Fri, 27 Jun 2014 05:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D2BpJv8JnVHbGWvtZXdSL8tj46RZS71sdDJ0A0kN6Co=; b=WMryb84ibKZQ3JxjB+2x7XBp/SKHCP2TEV1ZJkrPpwazgmUE64y45ELT0/HFO8Cd9J 5KF/YBYcw/gmmDcspPyZxKwXu4S9f0UHhu7azdb+Hsrg5++qC4j9loOXPpYAsDexJZ2a u+ISvDgLtYCCmit6nbyu/3AHxNFTipe2cXzGc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D2BpJv8JnVHbGWvtZXdSL8tj46RZS71sdDJ0A0kN6Co=; b=ZT9GMhs6zq2s8cTVk+XU6eBMlNrloTjftNOXkGXbOtWq8zNac6smT0Ger/TSasvQMO cMjNZuPQlkQzBcfUvr/OXeml+RY3r/+r9i8Ik/ftGP8WjjC/razwuXa2fbyh2iA9YyRr EFcv2EXpB02RH2UhJB0bWBmpWhU+Jju4eMlTOwlFvjhiuzgKAvLHjqHL3wdFybw8kkcJ vcw/67IRx6yS+DJggQoPqEjzGHh4qcHof8qXJPj9J7C8dTjFjlC7xEW8Oj83bWREok0Y RqGMPLFSPU0kzj6CVyyupnWlfueI8l7TXqQErnfDIxlQ70fMhktuWXGiuN+nDT6/fglm wQhA== X-Gm-Message-State: ALoCoQnlhwvP8KBFVZuvlk0ndoEScdU+E1iQuhmUc1+zunjN6bANY+m7AkoKVTcTudfhTvC0cgkGFeEUPmDqzbO3U9yAw3EZYKR1eT0nORhTpSAtHOEI5yU= X-Received: by 10.195.17.164 with SMTP id gf4mr25023816wjd.45.1403872058941; Fri, 27 Jun 2014 05:27:38 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id cz4sm77397872wib.23.2014.06.27.05.27.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jun 2014 05:27:38 -0700 (PDT) From: Michal Kazior To: j@w1.fi Subject: [PATCH v2 2/4] hostapd: Make chan_switch command per-iface not per-bss Date: Fri, 27 Jun 2014 14:19:28 +0200 Message-Id: <1403871570-6378-3-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1403871570-6378-1-git-send-email-michal.kazior@tieto.com> References: <1403695226-29139-1-git-send-email-michal.kazior@tieto.com> <1403871570-6378-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com Cc: hostap@lists.shmoo.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 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 Currently hostapd data structures aren't ready for multi-channel BSSes so make the command work now at least with single-channel multi-BSS channel switching. Signed-off-by: Michal Kazior --- hostapd/ctrl_iface.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 6265265..6924ad9 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -1252,16 +1252,26 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd) #endif /* CONFIG_TESTING_OPTIONS */ -static int hostapd_ctrl_iface_chan_switch(struct hostapd_data *hapd, char *pos) +static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, char *pos) { #ifdef NEED_AP_MLME struct csa_settings settings; - int ret = hostapd_parse_csa_settings(pos, &settings); + int i, ret; + ret = hostapd_parse_csa_settings(pos, &settings); if (ret) return ret; - return hostapd_switch_channel(hapd, &settings); + for (i = 0; i < iface->num_bss; i++) { + ret = hostapd_switch_channel(iface->bss[i], &settings); + if (ret) { + /* FIXME: What do we do if CSA fails in the middle of + * submitting multi-BSS CSA requests? */ + return ret; + } + } + + return 0; #else /* NEED_AP_MLME */ return -1; #endif /* NEED_AP_MLME */ @@ -1541,7 +1551,7 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx, reply_len = -1; #endif /* CONFIG_TESTING_OPTIONS */ } else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) { - if (hostapd_ctrl_iface_chan_switch(hapd, buf + 12)) + if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12)) reply_len = -1; } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,