Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203050
b: refs/heads/master
c: fbd2c8d
h: refs/heads/master
v: v3
  • Loading branch information
Teemu Paasikivi authored and John W. Linville committed Jun 14, 2010
1 parent 8877f87 commit f26e63d
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b9a4b001971c89f35d55180867753a612d17458
refs/heads/master: fbd2c8dcbc69616d2e15b8a269a86b3a05d45aea
2 changes: 2 additions & 0 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ struct cfg80211_disassoc_request {
* @beacon_interval: beacon interval to use
* @privacy: this is a protected network, keys will be configured
* after joining
* @basic_rates: bitmap of basic rates to use when creating the IBSS
*/
struct cfg80211_ibss_params {
u8 *ssid;
Expand All @@ -818,6 +819,7 @@ struct cfg80211_ibss_params {
u8 *ie;
u8 ssid_len, ie_len;
u16 beacon_interval;
u32 basic_rates;
bool channel_fixed;
bool privacy;
};
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/mac80211/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
rcu_assign_pointer(ifibss->presp, skb);

sdata->vif.bss_conf.beacon_int = beacon_int;
sdata->vif.bss_conf.basic_rates = basic_rates;
bss_change = BSS_CHANGED_BEACON_INT;
bss_change |= ieee80211_reset_erp_info(sdata);
bss_change |= BSS_CHANGED_BSSID;
Expand Down Expand Up @@ -529,7 +530,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
sdata->drop_unencrypted = 0;

__ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
ifibss->channel, 3, /* first two are basic */
ifibss->channel, ifibss->basic_rates,
capability, 0);
}

Expand Down Expand Up @@ -859,6 +860,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
sdata->u.ibss.fixed_bssid = false;

sdata->u.ibss.privacy = params->privacy;
sdata->u.ibss.basic_rates = params->basic_rates;

sdata->vif.bss_conf.beacon_int = params->beacon_interval;

Expand Down
2 changes: 2 additions & 0 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ struct ieee80211_if_ibss {
unsigned long request;
unsigned long last_scan_completed;

u32 basic_rates;

bool timer_running;

bool fixed_bssid;
Expand Down
49 changes: 49 additions & 0 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3955,6 +3955,55 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
}
}

if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) {
u8 *rates =
nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
int n_rates =
nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
struct ieee80211_supported_band *sband =
wiphy->bands[ibss.channel->band];
int i, j;

if (n_rates == 0) {
err = -EINVAL;
goto out;
}

for (i = 0; i < n_rates; i++) {
int rate = (rates[i] & 0x7f) * 5;
bool found = false;

for (j = 0; j < sband->n_bitrates; j++) {
if (sband->bitrates[j].bitrate == rate) {
found = true;
ibss.basic_rates |= BIT(j);
break;
}
}
if (!found) {
err = -EINVAL;
goto out;
}
}
} else {
/*
* If no rates were explicitly configured,
* use the mandatory rate set for 11b or
* 11a for maximum compatibility.
*/
struct ieee80211_supported_band *sband =
wiphy->bands[ibss.channel->band];
int j;
u32 flag = ibss.channel->band == IEEE80211_BAND_5GHZ ?
IEEE80211_RATE_MANDATORY_A :
IEEE80211_RATE_MANDATORY_B;

for (j = 0; j < sband->n_bitrates; j++) {
if (sband->bitrates[j].flags & flag)
ibss.basic_rates |= BIT(j);
}
}

err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys);

out:
Expand Down

0 comments on commit f26e63d

Please sign in to comment.