Search Linux Wireless

Re: [PATCH] mac80211: filter multicast data packets on AP_VLAN interfaces w/o sta

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2015-03-17 at 20:30 +0100, Michael Braun wrote:
> Currently, multicast data packets are dropped on AP interfaces if
> there are no authorized stations connected. This avoids superflous

typo: superfluous

> data packets to be transmitted on air.
> 
> But when using AP_VLAN, this does not happen, as the current check does
> not apply to AP_VLAN interfaces. Though, there can easily be more AP_VLAN
> interfaces on an AP resulting in more multicast data frames. This is
> especially true since hostapd does not remove no-longer-used AP_VLAN
> interfaces and bridges.
> 
> In order to filter on AP_VLAN interfaces, a per AP_VLAN interface
> counter is required (in constrast to the counter on the AP interface

typo: contrast

> +		if (sta->sta_state == IEEE80211_STA_AUTHORIZED &&
> +		    sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
> +		    !sta->sdata->u.vlan.sta &&
> +		    sta->sdata != vlansdata)
> +			atomic_dec(&sta->sdata->u.vlan.num_mcast_sta);
> +
> +		if (sta->sta_state == IEEE80211_STA_AUTHORIZED &&
> +		    vlansdata->vif.type == NL80211_IFTYPE_AP_VLAN &&

Hmm. Can this ever be false?

> +++ b/net/mac80211/sta_info.c
> @@ -143,6 +143,17 @@ static void __cleanup_single_sta(struct sta_info *sta)
>  		ieee80211_purge_tx_queue(&local->hw, &tid_tx->pending);
>  		kfree(tid_tx);
>  	}
> +
> +	if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
> +		if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
> +		    (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
> +		     !sta->sdata->u.vlan.sta))
> +			atomic_dec(&sta->sdata->bss->num_mcast_sta);
> +		if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
> +		     !sta->sdata->u.vlan.sta)
> +			atomic_dec(&sta->sdata->u.vlan.num_mcast_sta);
> +		clear_sta_flag(sta, WLAN_STA_AUTHORIZED);
> +	}
>  }

The new clear_sta_flag() here seems rather wrong to me?

> @@ -1694,6 +1705,9 @@ int sta_info_move_state(struct sta_info *sta,
>  			    (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
>  			     !sta->sdata->u.vlan.sta))
>  				atomic_dec(&sta->sdata->bss->num_mcast_sta);
> +			if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
> +			     !sta->sdata->u.vlan.sta)
> +				atomic_dec(&sta->sdata->u.vlan.num_mcast_sta);
>  			clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);

> @@ -1703,6 +1717,9 @@ int sta_info_move_state(struct sta_info *sta,
>  			    (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
>  			     !sta->sdata->u.vlan.sta))
>  				atomic_inc(&sta->sdata->bss->num_mcast_sta);
> +			if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
> +			     !sta->sdata->u.vlan.sta)
> +				atomic_inc(&sta->sdata->u.vlan.num_mcast_sta);

It seems to me that perhaps we should split this into two new
subfunctions or so to be able to refactor this code? After all, you have
exactly the same conditions here ...

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux