Commit Graph

67 Commits (b177b180bbdb30978aca75d59337246aed2ac268)

Author SHA1 Message Date
Sebastian Kemper b177b180bb mac80211: add default value for noscan
Commit b3d8b3a introduced a new test:

[ -n "$noscan" -a "$noscan" -gt 0 ] && hostapd_noscan=1

But if length of "$noscan" is zero (noscan is not set) this doesn't stop
the shell to evaluate the rest of the test.

root@hank2:~# [ -n "$noscan" -a "$noscan" -gt 0 ]
ash: out of range
root@hank2:~#

So when radios are brought up this shows in the log:

Sat Nov 23 10:51:38 2019 daemon.info procd: - init complete -
Sat Nov 23 10:52:24 2019 daemon.notice netifd: radio1 (1243): sh: out of range
Sat Nov 23 10:52:25 2019 user.notice firewall: Reloading firewall due to ifup of wan (eth0.2)
Sat Nov 23 10:52:25 2019 daemon.notice netifd: radio0 (1242): sh: out of range
Sat Nov 23 10:52:26 2019 authpriv.info dropbear[1536]: Not backgrounding

This commit sets noscan to 0 if unset and removes the gratuitous length
check, preventing the warning.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
(cherry picked from commit 28d84331f4)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Felix Fietkau 73d45c7378 mac80211: add config tweak for tx bursting when using VHT
By default, set BE tx queue TXOP limit to 2.0 in the hostapd config
Many vendor drivers are doing similar things to boost throughput.
On MT7612 under ideal conditions, it improves tx throughput from 470 Mbit/s
to about 570 Mbit/s.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 8650201f10)
5 years ago
Felix Fietkau b3d8b3ab8e mac80211: set noscan=1 if sta/adhoc/mesh interfaces are present
Fixes channel selection issues and suppresses an unnecessary extra scan

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years ago
Alexander Couzens dd3214f95d
mac80211: netifd: Use a mask when using `iw set antenna`
The keyword "all" is only supported by `iw set antenna` if
it's used as the only argument.
Convert "all" into a mask before calling `iw set antenna`.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
5 years ago
Rafał Miłecki ffa80bf5a7 mac80211: add iw command wrapper with error logging
Currently it's close to impossible to tell what part of mac80211 setup
went wrong. Errors logged into system log look like this:
radio0 (6155): command failed: No error information (-524)
radio0 (6155): command failed: Not supported (-95)
radio0 (6155): command failed: I/O error (-5)
radio0 (6155): command failed: Too many open files in system (-23)

With this commit change it's getting clear:
command failed: No error information (-524)
Failed command: iw dev wlan0 del
command failed: Not supported (-95)
Failed command: iw phy phy0 set antenna_gain 0
command failed: I/O error (-5)
Failed command: iw phy phy0 set distance 0
command failed: Too many open files in system (-23)
Failed command: iw phy phy0 interface add wlan0 type __ap

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years ago
Daniel Golle 96f4792fdb mac80211: refactor non-{sae,dfs} mesh initialization
Refactor mesh initialization into a separate function, do some cleaning
on the way to make the code more readable.
Changes:
 * Move iw mesh setup to new mac80211_setup_mesh()
 * fallback on 'ssid' parameter in case 'mesh_id' isn't set
 * move setting of freq variable to shared code as it is needed for
   both, the wpa_supplicant and the iw based setup.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Sven Eckelmann 547042398a mac80211: Re-enable encrypted 11s meshpoint
The commit 574e4377fa ("mac80211: properly setup mesh interface") uses
the variable $wpa to decide whether encrypted meshpoint is requested by the
user or not. But the variable $wpa will only be set correctly after the
function wireless_vif_parse_encryption is called.

Fixes: 574e4377fa ("mac80211: properly setup mesh interface")
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Daniel Golle 574e4377fa mac80211: properly setup mesh interface
Setup wpa_supplicant for encrypted mesh or when using DFS channels and
adjust interface setup to pass fixed frequency for mesh mode.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Daniel Golle 465d4bc538 mac80211: pass down noscan to wpa_supplicant
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Daniel Golle e633b21c14 Revert "mac80211: pass hostapd control socket to mesh-mode supplicant"
This reverts commit 1356a66f94.
The change breaks wpa_supplicant.conf generation, more work is needed
to fix mesh+AP.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Daniel Golle 1356a66f94 mac80211: pass hostapd control socket to mesh-mode supplicant
Unlike when operating in Ad-Hoc mode, we apparently need to pass the
hostapd control socket interface to wpa_supplicant when using 802.11s
mesh mode.

There also seems to still be something wrong with the logic setting
channel and (v)htmode parameters...

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Felix Fietkau 765599cb0e mac80211: remove support code for authsae
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau d91494eedf hostapd: rework frequency/ht/vht selection for ibss/mesh
- Remove obsolete patch chunks regarding fixed_freq
- Instead of patching in custom HT40+/- parameters, use the standard
config syntax as much as possible.
- Use fixed_freq for mesh
- Fix issues with disabling obss scan when using fixed_freq on mesh

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Antonio Quartulli 0da54fa642 mac80211: don't pass the hostapd ctrl iface in adhoc
Passing the ctrl iface to wpa_supplicant will automatically cause wpa_supplicant
to send "STOP_AP" messages to the hostapd. This breaks the AP interfaces.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
7 years ago
Jo-Philipp Wich 4a03347545 mac80211: gracefully handle preexisting VIF
Gracefully handle cases where the to-be-created wireless interface already
exists on the system which might commonly happen with non-multi-SSID capable
wireless drivers.

This fixes commit 8301e61365 which caused
previously ignored "Too many open files in system (-23)" errors to fail the
wireless setup procedure.

With the updated approach we'll still try recreating the vif after one
second if the first attempt to do so failed with ENFILE but we will now
consider the operation successfull if a second attempt still yields ENFILE
with the requested ifname already existing on the system.

Fixes FS#664, FS#704.

Suggested-by: Vittorio Gambaletta <openwrt@vittgam.net>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Matthias Schiffer 1a16cb9c67
mac80211, hostapd: always explicitly set beacon interval
One of the latest mac80211 updates added sanity checks, requiring the
beacon intervals of all VIFs of the same radio to match. This often broke
AP+11s setups, as these modes use different default intervals, at least in
some configurations (observed on ath9k).

Instead of relying on driver or hostapd defaults, change the scripts to
always explicitly set the beacon interval, defaulting to 100. This also
applies the beacon interval to 11s interfaces, which had been forgotten
before. VIF-specific beacon_int setting is removed from hostapd.sh.

Fixes FS#619.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
7 years ago
Vittorio Gambaletta 8301e61365 mac80211: Fix race condition leading to wifi interfaces not coming up at boot sometimes.
In the drv_mac80211_setup function, mac80211_interface_cleanup
is called to ask the kernel to delete all existing interfaces
for the phy that is being configured via netlink.

Later in the first function, mac80211_prepare_vif is called to
set up the new interfaces as required.

But sometimes, when mac80211_prepare_vif (and so the relevant
`iw phy x interface add y` command) runs, the kernel might still
be cleaning up the old interface with the same ifname. It usually
takes very few time to do that; possibly a few milliseconds of
sleep in the script after detecting this error condition could be
enough, but the busybox sh does not support sub-second sleep
intervals.

When this happens, iw obviously fails to create the new interface;
and the following message is printed in the system log, followed by
subsequent failure messages from hostapd in case this would have been
an AP interface.

Tue Mar 14 04:21:57 2017 daemon.notice netifd: radio1 (2767): command failed: Too many open files in system (-23)

This was a long-standing issue existing since at least OpenWrt Backfire,
and today I finally managed to debug and (hopefully) solve it.
It was happening very few times on most devices; but it was happening
a lot more frequently on fast platforms with multiple radios, such as
the powerpc-based dual-ath9k-radio tl-wdr4900-v1.

Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
7 years ago
Rafał Miłecki 1a14ffaf2b mac80211: start hostapd with logging wpa_printf messages to syslog
Some debugging/error messages are printed using wpa_printf and this
change allows finally reading them out of the syslog.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years ago
Alexis Green fd718c5025 mac80211: Allow HT/VHT rates when running unencrypted mesh.
Signed-off-by: Alexis Green <agreen@cococorp.com>
7 years ago
Scott Shambarger 4b8f0a2d26 mac80211: fix calculation of VHT capability values
- Fix calculation of `$vht_cap` bit field
 - Replace wrong reference to `$tx_stbc` variable with proper `$tx_stbc_2by1` one
 - Emit proper `RX-STBC-{1,12,123,1234}` tokens for the VHT capability list

See https://dev.openwrt.org/ticket/22535 for reference.

Signed-off-by: Scott Shambarger <devel@shambarger.net>
8 years ago
Felix Fietkau 95965cd813 mac80211: make the path phy lookup more robust regarding config upgrades, allow partial path matching
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48425
8 years ago
Jo-Philipp Wich 3041fbb4d2 mac80211: fix passing of VHT80 in IBSS mode
The "iw" utility expects the VHT80 to be specified as uppercase "80MHZ",
change the script to reflect that.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47814
9 years ago
Jo-Philipp Wich 713f698bd4 mac80211: fix disabling HT in IBSS mode (#21340)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47813
9 years ago
Felix Fietkau 028666e75f mac80211: Allow to select VHT80 in IBSS mode
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>

SVN-Revision: 47781
9 years ago
Felix Fietkau d293f33558 mac80211: restricted automatic channel selection
Add a new config option "channels" for mac80211 wifi devices. It's only
valid if automatic channel selection is used and restricts the channel
selection to one of the given channels.

config wifi-device
	list channels	1
	list channels	6
	list channels	11

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>

SVN-Revision: 47427
9 years ago
Felix Fietkau 08f1e1b3ac mac80211: set mcast-rate for mesh point interfaces
In order to set the multicast rate for mesh point interfaces the "mesh join"
was made explicit and moved to mac80211_setup_vif(), similar to how it is
done for IBSS interfaces.

Previously, the mesh join was made implicit in case authentication (i.e.
$key) was not used when creating the interface in mac80211_prepare_vif(),
while using authentication would create the interface first, then join
later in mac80211_setup_vif() by starting authsae.

Signed-off-by: Nils Schneider <nils@nilsschneider.net>

SVN-Revision: 47408
9 years ago
Steven Barth e07959cade package: replace ifconfig-usage with ip
Signed-off-by: Steven Barth <steven@midlink.org>

SVN-Revision: 46832
9 years ago
Felix Fietkau ecaacad14d hostapd: move ht_coex variable to mac80211.sh, guarded by 802.11n support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45917
9 years ago
Felix Fietkau fa2dfdb74b mac80211: make netifd script create AP interface directly
Before starting hostapd we create interface for it. The problem is we
try to create STA interface just to let hostapd change it to AP later.

It may fail if device doesn't support STA interfaces or if we already
hit a limit. Consider following phy (it's from BCM43602 and brcmfmac):
$ iw phy phy0 info | tail
        valid interface combinations:
                 * #{ IBSS, managed } <= 1, #{ AP } <= 4, #{ P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,
                   total <= 3, #channels <= 1

Trying to setup 2 interfaces: STA + AP results in:
radio0 (1101): command failed: Operation not supported (-95)
radio0 (1101): command failed: Operation not supported (-95)
radio0 (1101): command failed: Operation not supported (-95)
radio0 (1101): command failed: Operation not supported (-95)
radio0 (1101): Configuration file: /var/run/hostapd-phy0.conf
radio0 (1101): Could not read interface wlan0-1 flags: No such device

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45856
9 years ago
Felix Fietkau 29f8f90de4 mac80211: apply mesh parameters after starting authsae/wpa_supplicant (#16697)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45651
9 years ago
Felix Fietkau e2e2fb168b mac80211: fallback to wpa_supplicant to setup encrypted mesh
instead of failing when authsae is not installed, also try using
wpa_supplicant as the newly added -mesh variants support mesh mode
and SAE encryption.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

SVN-Revision: 45520
9 years ago
Felix Fietkau daaed6f251 netifd: fix start_disabled 'sh: bad number' in mac80211 setup (bug #19345)
Two errors "netifd: radio0: sh: bad number" have recently surfaced in system
log in trunk when wifi interfaces come up. I tracked the errors to checking
numerical values of some config options without ensuring that the option has
any value.

The errors I see have apparently been introduced by r45051 (ieee80211r in
hostapd) and r45326 (start_disabled in mac80211). My patches fix two
instances of "bad number", but there may be a third one, as the original
report in bug 19345 pre-dates r45326 and already has two "bad number" errors
for radio0.

https://dev.openwrt.org/ticket/19345

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>

SVN-Revision: 45379
9 years ago
John Crispin d564779563 mac80211: add start_disabled option
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 45326
9 years ago
John Crispin a0cc6803c8 mac80211: Revert adding SM Power Save capability to hostapd configuration
Part of rev 44173 added setting the SM Power Save capability in the hostapd.conf
file if the driver indicated that it was supported. It appears this was
incorrect, because the field in the actual HT Capabilities field in the AP
configuration is really a state indication. Just copying the state from the
capability resulted in the AP indicating that it had SMPS enabled all the time
if it supported SMPS. This effectively just disables all clients from sending
packets to the AP with more than one spatial stream, for no good reason.
So remove this part of the change.

Signed-off-by: Robert Hancock <hancockrwd@gmail.com>

SVN-Revision: 44239
9 years ago
John Crispin 04f104e74d mac80211: Add some missing 802.11n capabilities to hostapd configuration
Add some missing 802.11n capabilities to the hostapd ht_capab string when
supported by the hardware: Spatial Multiplexing Power-Save and 7935-byte AMSDUs.

Signed-off-by: Robert Hancock <hancockrwd@gmail.com>

SVN-Revision: 44173
9 years ago
Felix Fietkau 768d09be87 mac80211/hostapd: fix HT mode setup for RSN ad-hoc networks
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44100
9 years ago
Felix Fietkau b898695bdd mac80211: fix ad-hoc basic/multicast rate regression from r43782
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43853
10 years ago
Felix Fietkau ff3464eb30 mac80211: fix HT mode selection for ad-hoc
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43769
10 years ago
Felix Fietkau 4d99db168c mac80211: try to get interface addresses from wiphy sysfs 'addresses' if no mask is set
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43326
10 years ago
John Crispin 20940138ac scripts: fix wrong usage of '==' operator
[base-files] shell-scripting: fix wrong usage of '==' operator

normally the '==' is used for invoking a regex parser and is a bashism.
all of the fixes just want to compare a string. the used busybox-ash
will silently "ignore" this mistake, but make it portable/clean at least.

this patch does not change the behavior/logic of the scripts.

Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com>

SVN-Revision: 42911
10 years ago
Jo-Philipp Wich 1c0557cfa8 mac80211: support wildcard paths when matching phys
This change introduces support for wildcard patterns in "option path"
of section "wifi-device".

Objective is to allow paths like "*/usb[0-9]/*/*" in order to claim
any usb device using the same backend type, regardless of its bus
address or phy name.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 41873
10 years ago
Felix Fietkau f34cbdcf61 mac80211: Fix config variable name for dtim_period
The vif option dtim_period was accidently renamed dtim_interval in r38988
("netifd: add wireless configuration support and port mac80211 to the new
framework"). This is wrong and makes the dtim_period/dtim_interval a dead
option because the rest of the config generation code still uses dtim_period.

Reported-by: Jeppe Ledet-Pedersen <jlp@steinwurf.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>

SVN-Revision: 41557
10 years ago
Felix Fietkau 2c9c7ada6e mac80211: disable greenfield by default
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 41300
10 years ago
Felix Fietkau 867ba199f8 mac80211: fix disabling of 802.11n features
r40682 ("mac80211: clean up ht capability handling, drop the use of the
ht_capab list, use individual variables instead") removed the ht_capab list and
replaced it with optional variables to disable features for a phy. But these
variables weren't added in drv_mac80211_init_device_config and thus didn't make
any difference when modifying /etc/config/wireless.

Signed-off-by: Sven Eckelmann <sven@narfation.org>

SVN-Revision: 41180
10 years ago
John Crispin 43de2d08de mac80211: query driver for max A-MPDU length exponent
This patch enables netifd to query 802.11ac-driver for the maximum
supported A-MPDU length exponent, possibly increasing VHT throughput by
more aggressive frame aggregation.

v2: refreshed patch

Signed-off-by: Matti Laakso <malaakso at elisanet.fi>

SVN-Revision: 40938
10 years ago
Felix Fietkau 2ddcd59f16 mac80211: fix stbc configuration
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40783
10 years ago
Felix Fietkau 385b08d475 mac80211: fix ht capabilities for HT20
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40776
10 years ago
Felix Fietkau 8a75eac80b mac80211: fix VHT80 channel allocation (thx, SeG)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40770
10 years ago
Felix Fietkau 32a806cf8a mac80211: remove obsolete check for enable_ht
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40694
10 years ago
Felix Fietkau 8897093981 mac80211: add support for htmode=VHT20
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40686
10 years ago