Re: [RFC 13/14] cfg80211: extend combination checking to consider channels
From: Eliad Peller <hidden>
Date: 2012-05-29 14:21:42
hi Michal, On Mon, May 28, 2012 at 2:19 PM, Michal Kazior [off-list ref] wrote:
cfg80211_can_change_interface will soon be used before .start_ap, .join_mesh, .join_ibss and .auth to verify whether a given interface combination is allowed. .connect cannot be handled since the driver scans and connects on its own. It is up to the driver then to refuse a connection (with -EBUSY for example). Change-Id: I334c78aa9189f24fcf8829b98b7703ddde120eec Signed-off-by: Michal Kazior <redacted> ---
[...]
quoted hunk ↗ jump to hunk
@@ -1007,7 +1007,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,if (rfkill_blocked(rdev->rfkill)) return notifier_from_errno(-ERFKILL); mutex_lock(&rdev->devlist_mtx); - ret = cfg80211_can_add_interface(rdev, wdev->iftype); + ret = cfg80211_can_add_interface(rdev, wdev->iftype, NULL);
you pass NULL here...
quoted hunk ↗ jump to hunk
@@ -965,9 +983,26 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) continue; + for (i = 0; i < num_max_channels; i++) { + if (!used_channels[i]) { + used_channels[i] = chan; + num_different_channels++; + break; + } + else if (used_channels[i] == chan) { + break; + } + } + + if (i == num_max_channels) { + kfree(used_channels); + return -ENOMEM; + } +
but this code will count it as a new channel. Eliad.