linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Michael Wu <flamingice@sourmilk.net>,
	John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [patch 6/7] mac80211: allow only one IBSS interface
Date: Wed, 26 Sep 2007 17:53:19 +0200	[thread overview]
Message-ID: <20070926155435.685374000@sipsolutions.net> (raw)
In-Reply-To: 20070926155313.955049000@sipsolutions.net

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@sipsolutions.net>

---
 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
 			 */

-- 


  parent reply	other threads:[~2007-09-26 15:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26 15:53 [patch 0/7] more mac80211 cleanups and fixes Johannes Berg
2007-09-26 15:53 ` [patch 1/7] mac80211: move sta_process rx handler later Johannes Berg
2007-09-26 15:53 ` [patch 2/7] mac80211: consolidate decryption more Johannes Berg
2007-09-26 15:53 ` [patch 3/7] mac80211: use RX_FLAG_DECRYPTED for sw decrypted as well Johannes Berg
2007-09-26 15:53 ` [patch 4/7] mac80211: remove ALG_NONE Johannes Berg
2007-09-27  1:03   ` Zhu Yi
2007-09-26 15:53 ` [patch 5/7] mac80211: improve radiotap injection Johannes Berg
2007-09-26 15:53 ` Johannes Berg [this message]
2007-09-26 15:53 ` [patch 7/7] mac80211: make userspace-mlme a per-interface setting Johannes Berg
  -- strict thread matches above, loose matches on Subject: below --
2007-09-27  8:08 [patch 6/7] mac80211: allow only one IBSS interface Joerg Pommnitz
2007-09-27  8:50 ` Johannes Berg
2007-09-27 11:44 Joerg Pommnitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070926155435.685374000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=flamingice@sourmilk.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).