Commit 5886d0db authored by Ivo van Doorn's avatar Ivo van Doorn Committed by David S. Miller

[PATCH] rt2x00: Don't use changed_flags inside configure_packet_filter

We shouldn't use changed_flags when configuring the packet filter,
we work directly with the total_flags which is safe enough since
we already check if something has changed after we applied our
packet filtering flag rules.
Also make sure that when the packet filter is scheduled, the
rt2x00dev->interface.filter is cleared to make sure the drivers
will update the packet filter instead of failing at the check:
*total_flags == rt2x00dev->interface.filter
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 483272f5
...@@ -1497,8 +1497,8 @@ static void rt2400pci_configure_filter(struct ieee80211_hw *hw, ...@@ -1497,8 +1497,8 @@ static void rt2400pci_configure_filter(struct ieee80211_hw *hw,
* - Some filters are set based on interface type. * - Some filters are set based on interface type.
*/ */
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (changed_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
changed_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP)) if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS; *total_flags |= FIF_PROMISC_IN_BSS;
......
...@@ -1830,8 +1830,8 @@ static void rt2500pci_configure_filter(struct ieee80211_hw *hw, ...@@ -1830,8 +1830,8 @@ static void rt2500pci_configure_filter(struct ieee80211_hw *hw,
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (changed_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
changed_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP)) if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS; *total_flags |= FIF_PROMISC_IN_BSS;
......
...@@ -1602,8 +1602,8 @@ static void rt2500usb_configure_filter(struct ieee80211_hw *hw, ...@@ -1602,8 +1602,8 @@ static void rt2500usb_configure_filter(struct ieee80211_hw *hw,
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (changed_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
changed_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP)) if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS; *total_flags |= FIF_PROMISC_IN_BSS;
......
...@@ -410,8 +410,6 @@ struct rt2x00lib_ops { ...@@ -410,8 +410,6 @@ struct rt2x00lib_ops {
*/ */
void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac); void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac);
void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid); void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid);
void (*config_packet_filter) (struct rt2x00_dev *rt2x00dev,
const unsigned int filter);
void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type); void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type);
void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags, void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags,
struct ieee80211_conf *conf); struct ieee80211_conf *conf);
......
...@@ -276,11 +276,18 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work) ...@@ -276,11 +276,18 @@ static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
{ {
struct rt2x00_dev *rt2x00dev = struct rt2x00_dev *rt2x00dev =
container_of(work, struct rt2x00_dev, filter_work); container_of(work, struct rt2x00_dev, filter_work);
unsigned int filter = rt2x00dev->interface.filter;
/*
* Since we had stored the filter inside interface.filter,
* we should now clear that field. Otherwise the driver will
* assume nothing has changed (*total_flags will be compared
* to interface.filter to determine if any action is required).
*/
rt2x00dev->interface.filter = 0;
rt2x00dev->ops->hw->configure_filter(rt2x00dev->hw, rt2x00dev->ops->hw->configure_filter(rt2x00dev->hw,
rt2x00dev->interface.filter, filter, &filter, 0, NULL);
&rt2x00dev->interface.filter,
0, NULL);
} }
/* /*
......
...@@ -2389,8 +2389,8 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw, ...@@ -2389,8 +2389,8 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw,
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (changed_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
changed_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP)) if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS; *total_flags |= FIF_PROMISC_IN_BSS;
......
...@@ -1856,8 +1856,8 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw, ...@@ -1856,8 +1856,8 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw,
*/ */
if (mc_count) if (mc_count)
*total_flags |= FIF_ALLMULTI; *total_flags |= FIF_ALLMULTI;
if (changed_flags & FIF_OTHER_BSS || if (*total_flags & FIF_OTHER_BSS ||
changed_flags & FIF_PROMISC_IN_BSS) *total_flags & FIF_PROMISC_IN_BSS)
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
if (is_interface_type(intf, IEEE80211_IF_TYPE_AP)) if (is_interface_type(intf, IEEE80211_IF_TYPE_AP))
*total_flags |= FIF_PROMISC_IN_BSS; *total_flags |= FIF_PROMISC_IN_BSS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment