wiki:HowTo/bssidFix

Version 15 (modified by cmdavies, 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.

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.