Changes between Version 17 and Version 18 of HowTo/bssidFix


Ignore:
Timestamp:
Jul 3, 2007, 10:25:04 PM (14 years ago)
Author:
mcgrof
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • HowTo/bssidFix

    v17 v18  
    1212Although 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.
    1313
    14 == What to Change ==
     14== IBSS fix patch ==
    1515
    16 These instructions are designed to be applied to the baseline.ndz as of Aug 25,2006.
    17 
    18  * ssh to one of the nodes
    19 {{{
    20 joeuser@console.sb1:~$ ssh root@node1-2
    21 }}}
    22  * open /usr/src/madwifi/trunk/net80211/ieee80211_node.c in your favourite text editor
    23  * goto line 427, you'll see some code that looks like this:
    24 {{{
    25         if (ic->ic_flags & IEEE80211_F_DESBSSID)
    26             IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_des_bssid);
    27         else
    28             ni->ni_bssid[0] |= 0x02;        /* local bit for IBSS */
    29 }}}
    30  * Right after those lines, add these lines:
    31 {{{
    32         int len = 0;
    33         while (ic->ic_des_essid[len] != 0) len++;
    34         int i;
    35         for (i=0;i<IEEE80211_ADDR_LEN;i++) {
    36             ni->ni_bssid[i] = ic->ic_des_essid[i % len];
    37         }
    38 }}}
    39  * Save the file
    40  * Move to the madwifi directory and compile the changes
    41 {{{
    42 root@node1-2:~$ cd /usr/src/madwifi/trunk
    43 root@node1-2:~$ make
    44 }}}
    45  * Copy the modified madwifi drivers to where the kernel expects them
    46 {{{
    47 root@node1-2:~$ cp /usr/src/madwifi/trunk/net80211/*.ko /lib/modules/2.6.12/net
    48 }}}
    49  * Turn on and off the modified driver so the changes are activated
    50 {{{
    51 root@node1-2:~$ modprobe -r ath_pci
    52 root@node1-2:~$ modprobe ath_pci
    53 }}}
    54  * Done!
    55 
    56 You will probably want to save the image of this modified node in order to save running these steps all the time.
    57 
    58 Save the image of the node:
    59 {{{
    60 joeuser@console.sb1:~$ saveNode 1,2
    61 }}}
    62 
    63 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.
    64 
    65 
    66 == Changes required in madwifi-0.9.2 driver ==
    67 
    68 In case you're using a more recent madwifi driver, the following might help.
    69 Assuming you've unpacked madwifi-0.9.2.tar.gz in your home directory, the file is:
    70 {{{
    71 ~/madwifi-0.9.2/net80211/ieee80211_node.c
    72 }}}
    73 The change is roughly on line 305; before:
     16Here's a patch of what needs to get done for madwifi-0.9.3.1. This has been added as part of [wiki:Documentation/SupportedImages/baseline-2.2.ndz baseline-2.2.ndz]:
    7417
    7518{{{
    76    if (vap->iv_opmode == IEEE80211_M_IBSS) {
    77                 vap->iv_flags |= IEEE80211_F_SIBSS;
     19diff -Naur madwifi-0.9.3.1/net80211/ieee80211_node.c madwifi-0.9.3.1-ibss/net80211/ieee80211_node.c
     20--- madwifi-0.9.3.1/net80211/ieee80211_node.c   2007-05-23 04:43:05.000000000 -0400
     21+++ madwifi-0.9.3.1-ibss/net80211/ieee80211_node.c      2007-07-03 17:17:45.000000000 -0400
     22@@ -53,6 +53,15 @@
     23 #include <net80211/ieee80211_var.h>
     24 #include <net80211/if_athproto.h>
     25
     26+static int ibss_grid = 1;
     27+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
     28+MODULE_PARM(ibss_grid, "i");
     29+#else
     30+#include <linux/moduleparam.h>
     31+module_param(ibss_grid, int, 0600);
     32+#endif
     33+MODULE_PARM_DESC(ibss_grid, "IBSS hack based on SSID for large networks");
     34+
     35 /*
     36  * Association id's are managed with a bit vector.
     37  */
     38@@ -301,8 +310,25 @@
    7839                ni->ni_capinfo |= IEEE80211_CAPINFO_IBSS;       /* XXX */
    7940                if (vap->iv_flags & IEEE80211_F_DESBSSID)
    8041                        IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid);
    81                 else
    82                         ni->ni_bssid[0] |= 0x02;        /* local bit for IBSS */
    83         }
     42-               else
     43-                       ni->ni_bssid[0] |= 0x02;        /* local bit for IBSS */
     44+               else {
     45+                       /* XXX: If we're on a large network then hash the SSID
     46+                        * instead of the MAC address to generate the BSSID.
     47+                        * This ensures that nodes with identical SSIDs end
     48+                        * up with identical BSSIDs, regardless of any
     49+                        * timing bugs. We might be able to fix this for good
     50+                        * elsewhere */
     51+                       if(ibss_grid) {
     52+                               int i;
     53+                               printk(KERN_INFO "net80211: IBSS BSSID "
     54+                                       "generation based on hash of SSID - "
     55+                                       "temporary fix for large networks\n");
     56+                               for(i=0; i<IEEE80211_ADDR_LEN;i++)
     57+                                       ni->ni_bssid[i] = ni->ni_essid[i %
     58+                                               ni->ni_esslen];
     59+                       }
     60+                       else
     61+                               ni->ni_bssid[0] |= 0x02;/* local bit for IBSS */
     62+               }
     63        } else if (vap->iv_opmode == IEEE80211_M_AHDEMO) {
     64                if (vap->iv_flags & IEEE80211_F_DESBSSID)
     65                    IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid);
    8466}}}
    85 
    86 After:
    87 
    88 {{{
    89     if (vap->iv_opmode == IEEE80211_M_IBSS) {
    90                 int i;
    91                 vap->iv_flags |= IEEE80211_F_SIBSS;
    92                 ni->ni_capinfo |= IEEE80211_CAPINFO_IBSS;       /* XXX */
    93                 if (vap->iv_flags & IEEE80211_F_DESBSSID)
    94                         IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_des_bssid);
    95                 else
    96                         ni->ni_bssid[0] |= 0x02;        /* local bit for IBSS */
    97                 for(i=0; i<IEEE80211_ADDR_LEN;i++){
    98                     ni->ni_bssid[i] = ni->ni_essid[i % ni->ni_esslen];
    99                 }
    100         }
    101 }}}
    102 
    103 then simply make and copy the new modules as above.
    104