Search Linux Wireless

[patch 6/7] mac80211: allow only one IBSS interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Consider the case of multiple virtual IBSS interfaces
trying to join the same IBSS. They wouldn't see beacons
that the other virtual interface sent of course so this
leads to problems. Disallow it.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>

---
 net/mac80211/ieee80211.c |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211.c	2007-09-26 17:21:42.667337342 +0200
+++ wireless-dev/net/mac80211/ieee80211.c	2007-09-26 17:21:51.317337342 +0200
@@ -170,8 +170,25 @@ static int ieee80211_open(struct net_dev
 	list_for_each_entry(nsdata, &local->interfaces, list) {
 		struct net_device *ndev = nsdata->dev;
 
-		if (ndev != dev && ndev != local->mdev && netif_running(ndev) &&
-		    compare_ether_addr(dev->dev_addr, ndev->dev_addr) == 0) {
+		if (ndev != dev && ndev != local->mdev &&
+		    netif_running(ndev)) {
+			/*
+			 * We really only support one IBSS interface, think
+			 * what would happen if they tried to be in the same
+			 * BSS.
+			 */
+			if (sdata->type == IEEE80211_IF_TYPE_IBSS &&
+			    nsdata->type == IEEE80211_IF_TYPE_IBSS &&
+			    netif_running(nsdata->dev))
+				return -EBUSY;
+
+			/*
+			 * The remaining checks are only done for devices
+			 * with the same MAC address.
+			 */
+			if (compare_ether_addr(dev->dev_addr, ndev->dev_addr))
+				continue;
+
 			/*
 			 * check whether it may have the same address
 			 */

-- 

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux