Bug 202502 - [net80211] [patch]: check and reset (if necessary) currently selected channel before device initialization
Summary: [net80211] [patch]: check and reset (if necessary) currently selected channel...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-08-19 23:38 UTC by Andriy Voskoboinyk
Modified: 2015-08-23 01:19 UTC (History)
1 user (show)

See Also:


Attachments
Fix the issue and remove workaround from the wpi driver (1.40 KB, patch)
2015-08-19 23:38 UTC, Andriy Voskoboinyk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andriy Voskoboinyk freebsd_committer freebsd_triage 2015-08-19 23:38:57 UTC
Created attachment 160122 [details]
Fix the issue and remove workaround from the wpi driver

In case, when interface is recreated (create -> destroy -> create), some values (like ic->ic_curchan) are left unchanged and may be incompatible with new mode.

As an example:
1) ifconfig wlan0 create wlandev <dev> wlanmode ahdemo channel <some NOADHOC channel>
2) ifconfig wlan0 destroy
3) ifconfig wlan0 create wlandev <dev> wlanmode ibss ssid ssid
4) ifconfig wlan0 up

may result in incorrect ic->ic_curchan value passed into driver and may lead to crash (for example, wpi firmware throws an error here).

This patch adds a check into ieee80211_start_locked() and resets ic->ic_curchan to &ic->ic_channels[0] when the channel is incompatible with current mode.
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-08-23 01:18:48 UTC
A commit references this bug:

Author: adrian
Date: Sun Aug 23 01:17:53 UTC 2015
New revision: 287029
URL: https://svnweb.freebsd.org/changeset/base/287029

Log:
  Reset the channel to the first available channel if the interface
  is configured on a channel that isn't valid in the new operating mode.

  This isn't strictly true - it should find the first channel that is
  available for the given operating mode.

  However, I think defaulting to the first channel is fine - it's typically
  available for all modes.

  If someone would like to correctly implement this feature - try to
  find a channel that is valid for the given operating mode and error
  out if we can't find one.

  This prevents various NICs (eg wpi(4)) from throwing a firmware error.

  Tested:

  * ath(4), STA/AP mode
  * iwn(4), STA/adhoc mode

  PR:		kern/202502
  Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>

Changes:
  head/sys/net80211/ieee80211_proto.c