From patchwork Thu May 9 17:35:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 242802 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]) by ozlabs.org (Postfix) with ESMTP id 126412C00F2 for ; Fri, 10 May 2013 03:36:14 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 29FB19C186; Thu, 9 May 2013 13:36:12 -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 HbYvuVe0gf3E; Thu, 9 May 2013 13:36:11 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D3DFB9C16D; Thu, 9 May 2013 13:36:06 -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 19FB09C0EB for ; Thu, 9 May 2013 13:36:05 -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 tlHKT-EOTZMn for ; Thu, 9 May 2013 13:35:59 -0400 (EDT) Received: from jmaline2.user.openhosting.com (kvm.w1.fi [128.177.28.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 577F19C0D0 for ; Thu, 9 May 2013 13:35:59 -0400 (EDT) Received: from jm (a88-112-103-136.elisa-laajakaista.fi [88.112.103.136]) (authenticated bits=0) by jmaline2.user.openhosting.com (8.13.8/8.13.8) with ESMTP id r49HSZ1f013412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 9 May 2013 13:28:36 -0400 Received: by jm (sSMTP sendmail emulation); Thu, 09 May 2013 20:35:56 +0300 Date: Thu, 9 May 2013 20:35:56 +0300 From: Jouni Malinen To: hostap@lists.shmoo.com Subject: Re: [PATCHv2 3/3] hostap: add config option for dfs channels Message-ID: <20130509173556.GB25904@w1.fi> Mail-Followup-To: hostap@lists.shmoo.com References: <1364231797-12569-1-git-send-email-siwu@hrz.tu-chemnitz.de> <1364231797-12569-4-git-send-email-siwu@hrz.tu-chemnitz.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1364231797-12569-4-git-send-email-siwu@hrz.tu-chemnitz.de> User-Agent: Mutt/1.5.21 (2010-09-15) 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: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com On Mon, Mar 25, 2013 at 06:16:37PM +0100, Simon Wunderlich wrote: > Different channels allow different transmission power, at least in ETSI > countries. Also, ETSI requires a "channel plan" for DFS operation, and > channels should be randomly choosen from these channels. > > Add a channel list configuration option for users to add channels I applied the hostapd_parse_rates() renaming part. The rest (see below) look fine, but depend on the remaining parts of patch 2/3, so I could not apply that yet. From a5f63549ff89825dd28f4ce210389b1715468d1c Mon Sep 17 00:00:00 2001 From: Simon Wunderlich Date: Thu, 9 May 2013 20:26:52 +0300 Subject: [PATCH 2/2] hostapd: Add config option for DFS channels Different channels allow different transmission power at least in ETSI countries. Also, ETSI requires a "channel plan" for DFS operation, and channels should be randomly choosen from these channels. Add a channel list configuration option for users to specify channels hostapd may pick from. Signed-hostap: Simon Wunderlich --- hostapd/config_file.c | 6 ++++++ hostapd/hostapd.conf | 7 +++++++ src/ap/ap_config.c | 1 + src/ap/ap_config.h | 1 + src/ap/hostapd.c | 20 ++++++++++++++++++++ 5 files changed, 35 insertions(+) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 231b0f9..b3ed7d1 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2307,6 +2307,12 @@ static int hostapd_config_fill(struct hostapd_config *conf, } } else if (os_strcmp(buf, "channel") == 0) { conf->channel = atoi(pos); + } else if (os_strcmp(buf, "dfs_chanlist") == 0) { + if (hostapd_parse_intlist(&conf->dfs_chanlist, pos)) { + wpa_printf(MSG_ERROR, "Line %d: invalid " + "channel list", line); + errors++; + } } else if (os_strcmp(buf, "beacon_int") == 0) { int val = atoi(pos); /* MIB defines range as 1..65535, but very small values diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index be15b86..590097d 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -123,6 +123,13 @@ hw_mode=g # channel will need to be configured separately with iwconfig. channel=1 +# Allowed DFS Channels +# This option allows hostapd to select one of the provided DFS channels when the +# current channel becomes unavailable due to radar interference. Only useful +# when ieee80211h=1 is set. +# Default: not set (any DFS channel can be used, if no radar is found) +#dfs_chanlist=100 104 108 112 116 + # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535) beacon_int=100 diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 7ab86fc..68c80e0 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -550,6 +550,7 @@ void hostapd_config_free(struct hostapd_config *conf) os_free(conf->bss); os_free(conf->supported_rates); os_free(conf->basic_rates); + os_free(conf->dfs_chanlist); os_free(conf); } diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 7c9ea90..0908312 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -475,6 +475,7 @@ struct hostapd_config { int fragm_threshold; u8 send_probe_response; u8 channel; + int *dfs_chanlist; enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */ enum { LONG_PREAMBLE = 0, diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 021fbc4..5ab9b7c 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1457,6 +1457,23 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, } +static int hostapd_is_in_dfs_chanlist(struct hostapd_data *hapd, + struct hostapd_channel_data *chan) +{ + int *chan_entry; + + if (!hapd->iface->conf->dfs_chanlist) + return 1; + + for (chan_entry = hapd->iface->conf->dfs_chanlist; *chan_entry != -1; + chan_entry++) { + if (*chan_entry == chan->chan) + return 1; + } + return 0; +} + + /* * if ret_chan == NULL: returns the number of channels with this dfs state * if ret_chan != NULL: return channel at the supplied position. @@ -1481,6 +1498,9 @@ static int hostapd_dfs_find_channel(struct hostapd_data *hapd, u32 state, ((chan->flag & HOSTAPD_CHAN_DFS_MASK) != state)) continue; + if (!hostapd_is_in_dfs_chanlist(hapd, chan)) + continue; + if (ret_chan && idx == channel_idx) { wpa_printf(MSG_DEBUG, "Selected ch. #%d", chan->chan); *ret_chan = chan;