Add bssid fix from #1281
[librecmc/librecmc.git] / package / madwifi / patches / 112-fixed_ibss_bssid.patch
1 This patch fixes a bug in net80211/ieee80211_wireless.c preventing 
2 the user from setting a certain BSSID by 
3 "iwconfig athX ap XX:XX:XX:XX:XX:XX". 
4 It furthermore prevents merging to another IBSS in ad-hoc mode 
5 if a BSSID was set previously by the above command.
6 It was tested with the snapshot madwifi-ng-r1696-20060730.
7
8 Signed-off-by: Joerg Albert <jal2@gmx.de>
9
10 diff -ru madwifi-ng-r1696-20060730/ath/if_ath.c madwifi-ng-r1696-20060730.work/ath/if_ath.c
11 --- madwifi-ng-r1696-20060730/ath/if_ath.c      2006-07-08 08:47:19.000000000 +0200
12 +++ madwifi-ng-r1696-20060730.work/ath/if_ath.c 2006-08-03 20:38:12.000000000 +0200
13 @@ -5316,7 +5316,10 @@
14                          * ath_newstate as the state machine will go from
15                          * RUN -> RUN when this happens.
16                          */
17 -                       if (le64_to_cpu(ni->ni_tstamp.tsf) >= tsf) {
18 +                       /* jal: added: don't merge if we have a desired
19 +                          BSSID */
20 +                       if (!(vap->iv_flags & IEEE80211_F_DESBSSID) &&
21 +                               le64_to_cpu(ni->ni_tstamp.tsf) >= tsf) {
22                                 DPRINTF(sc, ATH_DEBUG_STATE,
23                                         "ibss merge, rstamp %u tsf %llu "
24                                         "tstamp %llu\n", rstamp, (long long) tsf,
25 diff -ru madwifi-ng-r1696-20060730/net80211/ieee80211_wireless.c madwifi-ng-r1696-20060730.work/net80211/ieee80211_wireless.c
26 --- madwifi-ng-r1696-20060730/net80211/ieee80211_wireless.c     2006-07-29 03:31:11.000000000 +0200
27 +++ madwifi-ng-r1696-20060730.work/net80211/ieee80211_wireless.c        2006-08-03 21:23:30.000000000 +0200
28 @@ -539,7 +539,7 @@
29          *
30          * anything else specifies a particular AP.
31          */
32 -       if (IEEE80211_ADDR_EQ(vap->iv_des_bssid, zero_bssid)) 
33 +       if (IEEE80211_ADDR_EQ(&ap_addr->sa_data, zero_bssid)) 
34                 vap->iv_flags &= ~IEEE80211_F_DESBSSID;
35         else {
36                 IEEE80211_ADDR_COPY(vap->iv_des_bssid, &ap_addr->sa_data);