A Solution to Ad-Hoc BSSID Partitioning Problems
http://orbit-lab.org/wiki/HowTo/bssidFix
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.
Signed-Off by: Luis Rodriguez <mcgrof@winlab.rutgers.edu>
diff -Naurp madwifi-3366.orig/net80211/ieee80211_node.c madwifi-3366/net80211/ieee80211_node.c
old
|
new
|
|
53 | 53 | #include <net80211/ieee80211_var.h> |
54 | 54 | #include <net80211/if_athproto.h> |
55 | 55 | |
| 56 | static int ibss_grid = 1; |
| 57 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52)) |
| 58 | MODULE_PARM(ibss_grid, "i"); |
| 59 | #else |
| 60 | #include <linux/moduleparam.h> |
| 61 | module_param(ibss_grid, int, 0600); |
| 62 | #endif |
| 63 | MODULE_PARM_DESC(ibss_grid, "IBSS hack based on SSID for large networks"); |
| 64 | |
| 65 | |
56 | 66 | /* |
57 | 67 | * Association IDs are managed with a bit vector. |
58 | 68 | */ |
… |
… |
ieee80211_create_ibss(struct ieee80211va
|
345 | 355 | if (vap->iv_flags & IEEE80211_F_DESBSSID) { |
346 | 356 | IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid); |
347 | 357 | IEEE80211_ADDR_COPY(vap->iv_bssid, vap->iv_des_bssid); |
348 | | } else { |
349 | | ni->ni_bssid[0] |= 0x02; /* local bit for IBSS */ |
350 | | vap->iv_bssid[0] |= 0x02; |
351 | | } |
| 358 | } else { |
| 359 | /* XXX: If we're on a large network then hash the SSID |
| 360 | * instead of the MAC address to generate the BSSID. |
| 361 | * This ensures that nodes with identical SSIDs end |
| 362 | * up with identical BSSIDs, regardless of any |
| 363 | * timing bugs. We might be able to fix this for good |
| 364 | * elsewhere */ |
| 365 | if(ibss_grid) { |
| 366 | int i; |
| 367 | printk(KERN_INFO "net80211: IBSS BSSID " |
| 368 | "generation based on hash of SSID - " |
| 369 | "temporary fix for large networks\n"); |
| 370 | for(i=0; i<IEEE80211_ADDR_LEN;i++) |
| 371 | ni->ni_bssid[i] = ni->ni_essid[i % |
| 372 | ni->ni_esslen]; |
| 373 | } |
| 374 | else { |
| 375 | ni->ni_bssid[0] |= 0x02;/* local bit for IBSS */ |
| 376 | vap->iv_bssid[0] |= 0x02; |
| 377 | } |
| 378 | } |
| 379 | |
352 | 380 | } else if (vap->iv_opmode == IEEE80211_M_AHDEMO) { |
353 | 381 | if (vap->iv_flags & IEEE80211_F_DESBSSID) { |
354 | 382 | IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid); |