wiki:HowTo/bssidFix

Version 18 (modified by mcgrof, 14 years ago) ( diff )

Documentation | !bssidFix

A Solution to Ad-Hoc BSSID Partitioning Problems

When wifi network cards are placed in ad-hoc mode (iwconfig ath0 mode 'ad-hoc') they will automatically search for networks with the same essid (iwconfig ath0 essid 'blah'). They will adopt the bssid of the first node to turn on that has the specified essid.

Unfortunately, this algorithm and/or implementation is not very good and even in relatively small networks, nodes that have the same 'essid' will end up with different a 'bssid'. Since the wifi card drivers filter incoming packets by bsssid, nodes that should be in the same ad-hoc network can't exchange packets.

The solution to this problem can be found by modifying the madwifi drivers (for Atheros wifi cards only), so that the bssid a node generates is a hash of the essid instead of its MAC address. This ensures that nodes with identical essid's end up with identical bssid's.

Although it has not been extensively tested with non-modified nodes, this modification to the madwifi drivers should be fully backwards compatible with non-modified nodes.

IBSS fix patch

Here's a patch of what needs to get done for madwifi-0.9.3.1. This has been added as part of baseline-2.2.ndz:

diff -Naur madwifi-0.9.3.1/net80211/ieee80211_node.c madwifi-0.9.3.1-ibss/net80211/ieee80211_node.c
--- madwifi-0.9.3.1/net80211/ieee80211_node.c   2007-05-23 04:43:05.000000000 -0400
+++ madwifi-0.9.3.1-ibss/net80211/ieee80211_node.c      2007-07-03 17:17:45.000000000 -0400
@@ -53,6 +53,15 @@
 #include <net80211/ieee80211_var.h>
 #include <net80211/if_athproto.h>

+static int ibss_grid = 1;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
+MODULE_PARM(ibss_grid, "i");
+#else
+#include <linux/moduleparam.h>
+module_param(ibss_grid, int, 0600);
+#endif
+MODULE_PARM_DESC(ibss_grid, "IBSS hack based on SSID for large networks");
+
 /*
  * Association id's are managed with a bit vector.
  */
@@ -301,8 +310,25 @@
                ni->ni_capinfo |= IEEE80211_CAPINFO_IBSS;       /* XXX */
                if (vap->iv_flags & IEEE80211_F_DESBSSID)
                        IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid);
-               else
-                       ni->ni_bssid[0] |= 0x02;        /* local bit for IBSS */
+               else {
+                       /* XXX: If we're on a large network then hash the SSID
+                        * instead of the MAC address to generate the BSSID.
+                        * This ensures that nodes with identical SSIDs end
+                        * up with identical BSSIDs, regardless of any 
+                        * timing bugs. We might be able to fix this for good
+                        * elsewhere */
+                       if(ibss_grid) {
+                               int i;
+                               printk(KERN_INFO "net80211: IBSS BSSID "
+                                       "generation based on hash of SSID - "
+                                       "temporary fix for large networks\n");
+                               for(i=0; i<IEEE80211_ADDR_LEN;i++)
+                                       ni->ni_bssid[i] = ni->ni_essid[i % 
+                                               ni->ni_esslen];
+                       }
+                       else
+                               ni->ni_bssid[0] |= 0x02;/* local bit for IBSS */
+               }
        } else if (vap->iv_opmode == IEEE80211_M_AHDEMO) {
                if (vap->iv_flags & IEEE80211_F_DESBSSID)
                    IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid);

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.