Version 17 (modified by 18 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.
What to Change
These instructions are designed to be applied to the baseline.ndz as of Aug 25,2006.
- ssh to one of the nodes
joeuser@console.sb1:~$ ssh root@node1-2
- open /usr/src/madwifi/trunk/net80211/ieee80211_node.c in your favourite text editor
- goto line 427, you'll see some code that looks like this:
if (ic->ic_flags & IEEE80211_F_DESBSSID) IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_des_bssid); else ni->ni_bssid[0] |= 0x02; /* local bit for IBSS */
- Right after those lines, add these lines:
int len = 0; while (ic->ic_des_essid[len] != 0) len++; int i; for (i=0;i<IEEE80211_ADDR_LEN;i++) { ni->ni_bssid[i] = ic->ic_des_essid[i % len]; }
- Save the file
- Move to the madwifi directory and compile the changes
root@node1-2:~$ cd /usr/src/madwifi/trunk root@node1-2:~$ make
- Copy the modified madwifi drivers to where the kernel expects them
root@node1-2:~$ cp /usr/src/madwifi/trunk/net80211/*.ko /lib/modules/2.6.12/net
- Turn on and off the modified driver so the changes are activated
root@node1-2:~$ modprobe -r ath_pci root@node1-2:~$ modprobe ath_pci
- Done!
You will probably want to save the image of this modified node in order to save running these steps all the time.
Save the image of the node:
joeuser@console.sb1:~$ saveNode 1,2
These instructions should be fairly similar for future version of madwifi. Look for where a node picks what bssid it wants to use (usually in create_ibss or similar), and then find that function where the node determines that it's in adhoc mode.
Changes required in madwifi-0.9.2 driver
In case you're using a more recent madwifi driver, the following might help. Assuming you've unpacked madwifi-0.9.2.tar.gz in your home directory, the file is:
~/madwifi-0.9.2/net80211/ieee80211_node.c
The change is roughly on line 305; before:
if (vap->iv_opmode == IEEE80211_M_IBSS) { vap->iv_flags |= IEEE80211_F_SIBSS; 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 */ }
After:
if (vap->iv_opmode == IEEE80211_M_IBSS) { int i; vap->iv_flags |= IEEE80211_F_SIBSS; 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 */ for(i=0; i<IEEE80211_ADDR_LEN;i++){ ni->ni_bssid[i] = ni->ni_essid[i % ni->ni_esslen]; } }
then simply make and copy the new modules as above.
Attachments (1)
-
patch-01-ibss-fix.diff
(2.9 KB
) - added by 17 years ago.
IBSS fix for large networks
Download all attachments as: .zip