提交 87291c02 编写于 作者: V Vladimir Koutny 提交者: John W. Linville

mac80211: eliminate IBSS warning in rate_lowest_index()

In IBSS mode prior to join/creation of new IBSS it is possible that
a frame from unknown station is received and an ibss_add_sta() is
called. This will cause a warning in rate_lowest_index() since the
list of supported rates of our station is not initialized yet.

The fix is to add ibss stations with a rate we received that frame
at; this single-element set will be extended later based on beacon
data. Also there is no need to store stations from a foreign IBSS.
Signed-off-by: NVladimir Koutny <vlado@ksp.sk>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 c644bce9
...@@ -876,7 +876,7 @@ void ieee80211_rx_bss_list_deinit(struct net_device *dev); ...@@ -876,7 +876,7 @@ void ieee80211_rx_bss_list_deinit(struct net_device *dev);
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len); int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
struct sk_buff *skb, u8 *bssid, struct sk_buff *skb, u8 *bssid,
u8 *addr); u8 *addr, u64 supp_rates);
int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
......
...@@ -2863,7 +2863,8 @@ static void ieee80211_rx_bss_info(struct net_device *dev, ...@@ -2863,7 +2863,8 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
dev->name, print_mac(mac, mgmt->bssid)); dev->name, print_mac(mac, mgmt->bssid));
ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss); ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss);
ieee80211_ibss_add_sta(dev, NULL, ieee80211_ibss_add_sta(dev, NULL,
mgmt->bssid, mgmt->sa); mgmt->bssid, mgmt->sa,
BIT(rx_status->rate_idx));
} }
} }
...@@ -4307,12 +4308,13 @@ int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len) ...@@ -4307,12 +4308,13 @@ int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len)
struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
struct sk_buff *skb, u8 *bssid, struct sk_buff *skb, u8 *bssid,
u8 *addr) u8 *addr, u64 supp_rates)
{ {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct sta_info *sta; struct sta_info *sta;
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
int band = local->hw.conf.channel->band;
/* TODO: Could consider removing the least recently used entry and /* TODO: Could consider removing the least recently used entry and
* allow new one to be added. */ * allow new one to be added. */
...@@ -4324,6 +4326,9 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, ...@@ -4324,6 +4326,9 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
return NULL; return NULL;
} }
if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid))
return NULL;
printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n",
wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name); wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name);
...@@ -4333,8 +4338,10 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, ...@@ -4333,8 +4338,10 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev,
set_sta_flags(sta, WLAN_STA_AUTHORIZED); set_sta_flags(sta, WLAN_STA_AUTHORIZED);
sta->supp_rates[local->hw.conf.channel->band] = if (supp_rates)
sdata->u.sta.supp_rates_bits[local->hw.conf.channel->band]; sta->supp_rates[band] = supp_rates;
else
sta->supp_rates[band] = sdata->u.sta.supp_rates_bits[band];
rate_control_rate_init(sta, local); rate_control_rate_init(sta, local);
......
...@@ -1823,8 +1823,13 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, ...@@ -1823,8 +1823,13 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
if (!bssid) if (!bssid)
return 0; return 0;
if ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && if ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT &&
(rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) {
if (!rx->sta)
rx->sta = ieee80211_ibss_add_sta(sdata->dev,
rx->skb, bssid, hdr->addr2,
BIT(rx->status->rate_idx));
return 1; return 1;
}
else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
if (!(rx->flags & IEEE80211_RX_IN_SCAN)) if (!(rx->flags & IEEE80211_RX_IN_SCAN))
return 0; return 0;
...@@ -1837,7 +1842,8 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, ...@@ -1837,7 +1842,8 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
rx->flags &= ~IEEE80211_RX_RA_MATCH; rx->flags &= ~IEEE80211_RX_RA_MATCH;
} else if (!rx->sta) } else if (!rx->sta)
rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb,
bssid, hdr->addr2); bssid, hdr->addr2,
BIT(rx->status->rate_idx));
break; break;
case IEEE80211_IF_TYPE_MESH_POINT: case IEEE80211_IF_TYPE_MESH_POINT:
if (!multicast && if (!multicast &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册