> enable IBSS cell merging. if an IBSS beacon with the same ESSID and a TSF > higher than the local TSF (mactime) is received, we have to join its BSSID. Can you back that up with standard references? I see no such requirement in the standard text. I can see that under some circumstances this may be desirable, but maybe not. In fact, this seems to *break* standard behaviour, as per 11.1.3.1: (emphasis mine) When a STA starts a BSS, that STA shall determine the BSSID of the BSS. If the BSSType indicates an infrastructure BSS, then the STA shall start an infrastructure BSS and the BSSID shall be equal to the STA’s dot11StationID. ***The value of the BSSID shall remain unchanged***, even if the value of dot11StationID is changed after the completion of the MLME-START.request. If the BSSType indicates an IBSS, the STA shall start an IBSS, and the BSSID shall be an individual locally administered IEEE MAC address as defined in 5.2 of IEEE Std 802-1990. The remaining 46 bits of that MAC address shall be a number selected in a manner that minimizes the probability of STAs generating the same number, even when those STAs are subjected to the same initial conditions. Remember that BSSIDs, *not* SSIDs are used to identify BSSes uniquely. Of course you could argue that "merging" is simply tearing down the own and then joining the other IBSS. Comments on the code now. > --- a/net/mac80211/ieee80211_sta.c > +++ b/net/mac80211/ieee80211_sta.c > @@ -80,6 +80,9 @@ static void ieee80211_rx_bss_put(struct net_device *dev, > struct ieee80211_sta_bss *bss); > static int ieee80211_sta_find_ibss(struct net_device *dev, > struct ieee80211_if_sta *ifsta); > +static int ieee80211_sta_join_ibss(struct net_device *dev, > + struct ieee80211_if_sta *ifsta, > + struct ieee80211_sta_bss *bss); No way, order the code properly, this mess needs to be cleaned up not added to. > - if (bss->probe_resp && beacon) { > + if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS && > + bss->probe_resp && beacon) { > /* Do not allow beacon to override data from Probe Response. */ Ahem. Comment update required. > + /* check if we need to merge IBSS */ Could use a plural, but whatever. > + if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && beacon && > + !local->sta_sw_scanning && !local->sta_hw_scanning && > + mgmt->u.beacon.capab_info & WLAN_CAPABILITY_IBSS && > + memcmp(elems.ssid, sdata->u.sta.ssid, sdata->u.sta.ssid_len) == 0) { I think that needs a check "&& ssid_len" or something. Someone's bound to try making an IBSS with a hidden SSID and we really don't want that to work. > +#ifdef CONFIG_MAC80211_IBSS_DEBUG > + static unsigned long last_tsf_debug; > +#endif Let's just get rid of that, it's not usable with multiple devices. > + if (rx_status->flag & RX_FLAG_TSFT) > + mactime = rx_status->mactime; > + else { > + mactime = -1LLU; > + printk(KERN_WARNING "%s: IBSS mode needs mactime for " > + "beacons\n", dev->name); Very bad, you'll be flooded by this when others send beacons. Also, I doubt its truthfulness. > + printk(KERN_DEBUG "%s: beacon TSF higher than local TSF" > + " -> IBSS merge with BSSID %s\n", > + dev->name, print_mac(mac, mgmt->bssid)); No way. At the very least you need to ratelimit this. johannes
Attachment:
signature.asc
Description: This is a digitally signed message part