d80211: Fix overflow when creating AVS header
Subsystems (2)
PATCH 1/5 d80211: Fix overflow when creating AVS header
In reply to a message not in the archiveFix overflow when converting timespec to microseconds. Without this patch you can get an overflow during the multiplication which can result in a negative number. hostime is define here:
4.4 hosttime
The hosttime field is set to the current value of the host maintained clock variable when the frame is received.
(from http://www.locustworld.com/tracker/getfile/prism2drivers/doc/capturefrm.txt)
it is a u64.
net/d80211/ieee80211.c +1 -1
@@ -2573,7 +2573,7 @@ ieee80211_rx_mgmt(struct net_device *devstruct ieee80211_rate *rate;jiffies_to_timespec (status->hosttime, &ts); - fi->hosttime =cpu_to_be64 (ts.tv_sec *1000000 + + fi->hosttime =cpu_to_be64 ((u64 ) ts.tv_sec *1000000 + ts.tv_nsec /1000 ); fi->mactime =cpu_to_be64 (status->mactime);switch (status->phymode) {
--
PATCH 2/5 d80211: remove unused xr structure members, interface, etc.
In reply to a message not in the archiveFrom: Elliot Schwartz <[email protected]>
This is all unused.
include/net/d80211.h +0 -9
@@ -82,7 +82,6 @@ struct ieee80211_hw_modes {struct ieee80211_channel *channels;int num_rates;struct ieee80211_rate *rates; -int xr_end;/* only used with Atheros XR */ };struct ieee80211_tx_queue_params {
@@ -166,8 +165,6 @@ struct ieee80211_tx_control {* transmission */ unsigned int fast_frame:1; - unsigned int atheros_xr:1; /* only used with Atheros XR */ - unsigned int power_level:8; /* per-packet transmit power level, in dBm*/ unsigned int antenna_sel:4; /* 0 = default/diversity,
@@ -193,7 +190,6 @@ struct ieee80211_tx_control {#define RX_FLAG_MMIC_ERROR 0x1#define RX_FLAG_DECRYPTED 0x2 -#define RX_FLAG_XR_DOUBLE_CHIRP 0x4/* Receive status. The low-level driver should provide this information * (the subset supported by hardware) to the 802.11 code with each received
@@ -276,8 +272,6 @@ struct ieee80211_conf {int atheros_super_ag_turbo_g;int atheros_super_ag_turbo_prime; -int atheros_xr; -/* Following five fields are used for IEEE 802.11H */ unsigned int radar_detect;unsigned int spect_mgmt;
@@ -679,9 +673,6 @@ struct ieee80211_hw {* needed only for IBSS mode and the result of this function is used to * determine whether to reply to Probe Requests. */ int (*tx_last_beacon)(struct net_device *dev); - -/* Optional handler for XR-in-use notification. */ -int (*atheros_xr_in_use)(struct net_device *dev,int in_use); };/* Allocate a new hardware device. This must be called once for each
include/net/d80211_mgmt.h +0 -4
@@ -220,8 +220,4 @@ enum ieee80211_eid {WLAN_EID_QOS_PARAMETER =222 }; - - -#define ATHEROS_INFO_USEXR BIT(3) -#endif /* D802_11_MGMT_H */
include/net/d80211_shared.h +1 -3
@@ -21,8 +21,7 @@ enum {MODE_ATHEROS_TURBOG =4 /* Atheros Turbo mode (2x.11g at 2.4 GHz) */ ,MODE_ATHEROS_PRIME =5 /* Atheros Dynamic Turbo mode */ ,MODE_ATHEROS_PRIMEG =6 /* Atheros Dynamic Turbo mode G */ , -MODE_ATHEROS_XR =7 /* Atheros XR mode */ , - NUM_IEEE80211_MODES = 8 + NUM_IEEE80211_MODES = 7 };#define IEEE80211_CHAN_W_SCAN 0x00000001
@@ -40,7 +39,6 @@ enum {#define IEEE80211_RATE_CCK 0x00000040#define IEEE80211_RATE_TURBO 0x00000080#define IEEE80211_RATE_MANDATORY 0x00000100 -#define IEEE80211_RATE_XR 0x00000200#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)#define IEEE80211_RATE_MODULATION (f) \
net/d80211/hostapd_ioctl.h +0 -1
@@ -186,7 +186,6 @@ struct prism2_hostapd_param {* IEEE80211_ATHEROS_SUPER_AG */ u8 atheros_super_ag; -u8 atheros_xr_mode;u8 wds_flags;#define IEEE80211_STA_DYNAMIC_ENC BIT(0)u8 enc_flags;
net/d80211/ieee80211_sysfs_sta.c +2 -3
@@ -77,7 +77,7 @@ STA_ATTR(wep_weak_iv_count, wep_weak_iv_static ssize_t show_sta_flags (const struct sta_info *sta,char *buf) { - return sprintf(buf, "%s%s%s%s%s%s%s%s%s%s", + return sprintf(buf, "%s%s%s%s%s%s%s%s%s", sta->flags & WLAN_STA_AUTH ? "AUTH\n" : "", sta->flags & WLAN_STA_ASSOC ? "ASSOC\n" : "", sta->flags & WLAN_STA_PS ? "PS\n" : "",
@@ -87,8 +87,7 @@ static ssize_t show_sta_flags(const stru sta->flags &WLAN_STA_SHORT_PREAMBLE ?"SHORT PREAMBLE\n" :"" , sta->flags &WLAN_STA_WME ?"WME\n" :"" , - sta->flags &WLAN_STA_WDS ?"WDS\n" :"" , - sta->flags & WLAN_STA_XR ? "XR\n" : ""); + sta->flags & WLAN_STA_WDS ? "WDS\n" : ""); }__STA_ATTR (flags);
net/d80211/sta_info.h +0 -1
@@ -26,7 +26,6 @@*/ #define WLAN_STA_SHORT_PREAMBLE BIT(7)#define WLAN_STA_WME BIT(9) -#define WLAN_STA_XR BIT(26)#define WLAN_STA_WDS BIT(27)
--
PATCH 3/5 d80211: remove rate limit code
In reply to a message not in the archiveFrom: Elliot Schwartz <[email protected]>
Remove unused and more or less pointless rate limiting code. This would have just dropped multicast frames arbitrarily when the limit is reached which is quite useless and does not really belong to 802.11 code.
net/d80211/hostapd_ioctl.h +2 -2
@@ -58,8 +58,8 @@ enum {PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES =1001 ,PRISM2_PARAM_DROP_UNENCRYPTED =1002 ,PRISM2_PARAM_PREAMBLE =1003 , -PRISM2_PARAM_RATE_LIMIT =1004 , -PRISM2_PARAM_RATE_LIMIT_BURST =1005 , +PRISM2_PARAM_RATE_LIMIT =1004 ,/* no longer used */ +PRISM2_PARAM_RATE_LIMIT_BURST =1005 ,/* no longer used */ PRISM2_PARAM_SHORT_SLOT_TIME =1006 ,PRISM2_PARAM_TEST_MODE =1007 , PRISM2_PARAM_NEXT_MODE = 1008,
net/d80211/ieee80211.c +0 -38
@@ -843,38 +843,6 @@ ieee80211_tx_h_misc(struct ieee80211_txr } -static void ieee80211_rate_limit (unsigned long data) -{ -struct ieee80211_local *local = (struct ieee80211_local *) data; - -if (local->rate_limit) { - local->rate_limit_bucket += local->rate_limit; -if (local->rate_limit_bucket > local->rate_limit_burst) - local->rate_limit_bucket = local->rate_limit_burst; - local->rate_limit_timer.expires = jiffies +HZ ; -add_timer (&local->rate_limit_timer); - } -} - - -static ieee80211_txrx_result -ieee80211_tx_h_rate_limit (struct ieee80211_txrx_data *tx) -{ - -if (likely (!tx->local->rate_limit || tx->u.tx.unicast)) -return TXRX_CONTINUE ; - -/* rate limit */ -if (tx->local->rate_limit_bucket) { - tx->local->rate_limit_bucket--; -return TXRX_CONTINUE ; - } - -I802_DEBUG_INC (tx->local->tx_handlers_drop_rate_limit); -return TXRX_DROP ; -} - -static ieee80211_txrx_result ieee80211_tx_h_check_assoc (struct ieee80211_txrx_data *tx) {
@@ -4206,7 +4174,6 @@ static ieee80211_rx_handler ieee80211_rxstatic ieee80211_tx_handler ieee80211_tx_handlers[] = { - ieee80211_tx_h_rate_limit, ieee80211_tx_h_check_assoc, ieee80211_tx_h_ps_buf, ieee80211_tx_h_select_key,
@@ -4369,9 +4336,6 @@ struct net_device *ieee80211_alloc_hw(siinit_timer (&local->scan.timer);/* clear it out */ spin_lock_init (&local->generic_lock); -init_timer (&local->rate_limit_timer); - local->rate_limit_timer.function = ieee80211_rate_limit; - local->rate_limit_timer.data = (unsigned long ) local;init_timer (&local->stat_timer); local->stat_timer.function = ieee80211_stat_refresh; local->stat_timer.data = (unsigned long ) local;
@@ -4582,8 +4546,6 @@ void ieee80211_unregister_hw(struct net_ }rtnl_unlock (); -if (local->rate_limit) -del_timer_sync (&local->rate_limit_timer);if (local->stat_time)del_timer_sync (&local->stat_timer);if (local->scan_work.data) {
net/d80211/ieee80211_i.h +0 -5
@@ -470,10 +470,6 @@ struct ieee80211_local {u32 stat_time;struct timer_list stat_timer; -struct timer_list rate_limit_timer; -u32 rate_limit; -u32 rate_limit_burst; -u32 rate_limit_bucket;struct proc_dir_entry *proc, *proc_sta, *proc_iface;struct work_struct sta_proc_add;
@@ -493,7 +489,6 @@ struct ieee80211_local {unsigned int tx_handlers_drop_unencrypted;unsigned int tx_handlers_drop_fragment;unsigned int tx_handlers_drop_wep; -unsigned int tx_handlers_drop_rate_limit;unsigned int tx_handlers_drop_not_assoc;unsigned int tx_handlers_drop_unauth_port;unsigned int rx_handlers_drop;
net/d80211/ieee80211_ioctl.c +0 -27
@@ -2405,25 +2405,6 @@ static int ieee80211_ioctl_prism2_param( local->short_preamble = value;break ; -case PRISM2_PARAM_RATE_LIMIT_BURST : - local->rate_limit_burst = value; - local->rate_limit_bucket = value; -break ; - -case PRISM2_PARAM_RATE_LIMIT : -/* number of packets (tokens) allowed per second */ -if (!local->rate_limit && value) { -if (!local->rate_limit_burst) local->rate_limit_burst = - value; - local->rate_limit_bucket = local->rate_limit_burst; - local->rate_limit_timer.expires = jiffies +HZ ; -add_timer (&local->rate_limit_timer); - }else if (local->rate_limit && !value) { -del_timer_sync (&local->rate_limit_timer); - } - local->rate_limit = value; -break ; -case PRISM2_PARAM_STAT_TIME :if (!local->stat_time && value) { local->stat_timer.expires = jiffies +HZ * value /100 ;
@@ -2656,14 +2637,6 @@ static int ieee80211_ioctl_get_prism2_pa *param = local->short_preamble;break ; -case PRISM2_PARAM_RATE_LIMIT_BURST : - *param = local->rate_limit_burst; -break ; - -case PRISM2_PARAM_RATE_LIMIT : - *param = local->rate_limit; -break ; -case PRISM2_PARAM_STAT_TIME : *param = local->stat_time;break ;
net/d80211/ieee80211_sysfs.c +0 -2
@@ -241,7 +241,6 @@ IEEE80211_LOCAL_ATTR(tx_handlers_queued,IEEE80211_LOCAL_ATTR (tx_handlers_drop_unencrypted, tx_handlers_drop_unencrypted,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_fragment, tx_handlers_drop_fragment,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_wep, tx_handlers_drop_wep,"%u" ); -IEEE80211_LOCAL_ATTR (tx_handlers_drop_rate_limit, tx_handlers_drop_rate_limit,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_not_assoc, tx_handlers_drop_not_assoc,"%u" );IEEE80211_LOCAL_ATTR (tx_handlers_drop_unauth_port, tx_handlers_drop_unauth_port,"%u" );IEEE80211_LOCAL_ATTR (rx_handlers_drop, rx_handlers_drop,"%u" );
@@ -352,7 +351,6 @@ static struct attribute *ieee80211_stats &class_device_attr_tx_handlers_drop_unencrypted.attr, &class_device_attr_tx_handlers_drop_fragment.attr, &class_device_attr_tx_handlers_drop_wep.attr, - &class_device_attr_tx_handlers_drop_rate_limit.attr, &class_device_attr_tx_handlers_drop_not_assoc.attr, &class_device_attr_tx_handlers_drop_unauth_port.attr, &class_device_attr_rx_handlers_drop.attr,
--
PATCH 4/5 d80211: retain PS frames for at least STA listen interval
In reply to a message not in the archiveFrom: Jouni Malinen <[email protected]>
Start using 2 * listen_int * beacon_int as a timeout for PS buffered unicast frames if that is longer than 10 seconds. Previously, we used fixed 10 second limit regardless of the listen interval.
This fixes power saving for STAs that request very long listen interval (over 10 seconds).
This was reported by UNH IOL 802.11 AP Base MAC Test Suite v2.4 Test #1.3.2 Part e.
While we are at it, remove the station from the TIM when the PS buffer is empty.
net/d80211/hostapd_ioctl.h +1 -0
@@ -189,6 +189,7 @@ struct prism2_hostapd_param {u8 wds_flags;#define IEEE80211_STA_DYNAMIC_ENC BIT(0)u8 enc_flags; +u16 listen_interval; } add_sta;struct {u32 inactive_msec;
net/d80211/ieee80211_ioctl.c +1 -0
@@ -296,6 +296,7 @@ static int ieee80211_ioctl_add_sta(struc sta->aid = param->u.add_sta.aid;if (sta->aid >IEEE80211_MAX_AID ) sta->aid =0 ; + sta->listen_interval = param->u.add_sta.listen_interval; rates =0 ;for (i =0 ; i <sizeof (param->u.add_sta.supp_rates); i++) {
net/d80211/sta_info.c +16 -8
@@ -269,18 +269,24 @@ void sta_info_free(struct sta_info *sta, } -static inline int sta_info_buffer_expired (struct sk_buff *skb) +static inline int sta_info_buffer_expired (struct ieee80211_local *local, +struct sta_info *sta, +struct sk_buff *skb) {struct ieee80211_tx_packet_data *pkt_data; +int timeout; +if (!skb)return 0 ; -/* TODO: this could be improved by passing STA listen interval into -* the kernel driver and expiring frames after 2 x listen_interval x -* beacon interval */ - pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; -return time_after (jiffies, pkt_data->jiffies +STA_TX_BUFFER_EXPIRE ); + +/* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ + timeout = (sta->listen_interval * local->conf.beacon_int *32 / +15625 ) *HZ ; +if (timeout <STA_TX_BUFFER_EXPIRE ) + timeout =STA_TX_BUFFER_EXPIRE ; +return time_after (jiffies, pkt_data->jiffies + timeout); }
@@ -296,9 +302,11 @@ static void sta_info_cleanup_expire_bufffor (;;) {spin_lock_irqsave (&sta->ps_tx_buf.lock, flags); skb =skb_peek (&sta->ps_tx_buf); -if (sta_info_buffer_expired (skb)) +if (sta_info_buffer_expired (local, sta, skb)) { skb =__skb_dequeue (&sta->ps_tx_buf); -else +if (skb_queue_empty (&sta->ps_tx_buf)) + sta->flags &= ~WLAN_STA_TIM ; + }else skb =NULL ;spin_unlock_irqrestore (&sta->ps_tx_buf.lock, flags);
net/d80211/sta_info.h +4 -1
@@ -107,6 +107,8 @@ struct sta_info {#endif /* CONFIG_D80211_DEBUG_COUNTERS */ int vlan_id; + +u16 listen_interval; };
@@ -120,7 +122,8 @@ struct sta_info {/* Maximum number of frames to buffer per power saving station */ #define STA_MAX_TX_BUFFER 128 -/* Buffered frame expiry time */ +/* Minimum buffered frame expiry time. If STA uses listen interval that is +* smaller than this value, the minimum value here is used instead. */ #define STA_TX_BUFFER_EXPIRE (10 * HZ)/* How often station data is cleaned up (e.g., expiration of buffered frames)
--
PATCH 5/5 d80211: allow wireless vlan interface to have same MAC an AP interface
In reply to a message not in the archiveWireless vlan interfaces need to have the same mac address as AP interfaces. The STA must not see the change when it is bound to a specific vlan, so the address of the vlan interface must be the same as the address of the AP interface the station associated with.
net/d80211/ieee80211.c +6 -1
@@ -2092,7 +2092,12 @@ static inline int identical_mac_addr_all type2 == IEEE80211_IF_TYPE_WDS) || (type1 ==IEEE80211_IF_TYPE_WDS && (type2 ==IEEE80211_IF_TYPE_WDS || - type2 == IEEE80211_IF_TYPE_AP))); + type2 ==IEEE80211_IF_TYPE_AP )) || + (type1 ==IEEE80211_IF_TYPE_AP && + type2 ==IEEE80211_IF_TYPE_VLAN ) || + (type1 ==IEEE80211_IF_TYPE_VLAN && + (type2 ==IEEE80211_IF_TYPE_AP || + type2 == IEEE80211_IF_TYPE_VLAN))); }static int ieee80211_master_open (struct net_device *dev)
--
Re: [patch 5/5] d80211: allow wireless vlan interface to have same MAC an AP interface
All patches have been applied to my tree, thanks!
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Re: [patch 5/5] d80211: allow wireless vlan interface to have same MAC an AP interface
In reply to David KimdonQuoted 4 lines · David Kimdon
Wireless vlan interfaces need to have the same mac address as AP interfaces. The STA must not see the change when it is bound to a specific vlan, so the address of the vlan interface must be the same as the address of the AP interface the station associated with.
Hm. Now I finally understand the vlan interface type. Neat. How do you bind stas to one vlan interface? Is it possible to do on the fly after EAP or similar?
Anyway. Wouldn't it make more sense to not even allow setting a MAC address different from all AP interfaces, i.e. require that the VLAN interface have the same MAC as one of the AP interfaces that exist?
And then there probably should be a check that prohibits binding a sta to a vlan interface that has a different MAC than the AP interface it is/was on... or something.
johannes
Re: [patch 5/5] d80211: allow wireless vlan interface to have sameMAC an AP interface
Quoted 3 lines · Johannes Berg
Hm. Now I finally understand the vlan interface type. Neat. How do you bind stas to one vlan interface? Is it possible to do on the fly after EAP or similar?
Yes, I just merged in support for this (dynamic VLANs) into hostapd. RADIUS Access-Accept is used select VLAN is being used and the STA is bound at that point to another virtual interface, if needed.
Quoted 3 lines
Anyway. Wouldn't it make more sense to not even allow setting a MAC address different from all AP interfaces, i.e. require that the VLAN interface have the same MAC as one of the AP interfaces that exist?
That would be fine, too, but maybe not necessary.
Quoted 3 lines
And then there probably should be a check that prohibits binding a sta to a vlan interface that has a different MAC than the AP interface it is/was on... or something.
Well, that would probably be correct for most (all?) cases, but then again, I would probably not bother with this level of validation in kernel. Whatever is taking care of binding the STA in user space (e.g., hostapd) can do the validation.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
Re: [patch 5/5] d80211: allow wireless vlan interface to have sameMAC an AP interface
Quoted 3 lines · Jouni Malinen
Yes, I just merged in support for this (dynamic VLANs) into hostapd. RADIUS Access-Accept is used select VLAN is being used and the STA is bound at that point to another virtual interface, if needed.
Cool.
Quoted 4 lines
Well, that would probably be correct for most (all?) cases, but then again, I would probably not bother with this level of validation in kernel. Whatever is taking care of binding the STA in user space (e.g., hostapd) can do the validation.
Yeah, I guess it's always possible to mess with STAs from the hostapd since, well, it's the AP :)
[but this also means that I understood the point, so thanks for your reply :) ]
johannes
Re: [patch 5/5] d80211: allow wireless vlan interface to have sameMAC an AP interface
In reply to Jouni MalinenQuoted 3 lines · Jouni Malinen
Yes, I just merged in support for this (dynamic VLANs) into hostapd. RADIUS Access-Accept is used select VLAN is being used and the STA is bound at that point to another virtual interface, if needed.
Different question. How do broadcasts to a vlan interface work? Are they rewritten to unicasts to all vlan stations? You obviously can't get perfect separation anyway since it all travels over the shared medium and stations can always sniff the packets, but ...
johannes
Re: [patch 5/5] d80211: allow wireless vlan interface to havesameMAC an AP interface
Quoted 8 lines · Johannes Berg
Quoted 3 lines · Jouni Malinen
Yes, I just merged in support for this (dynamic VLANs) into hostapd. RADIUS Access-Accept is used select VLAN is being used and the STA is bound at that point to another virtual interface, if needed.
Different question. How do broadcasts to a vlan interface work? Are they rewritten to unicasts to all vlan stations?
no, still broadcasts, but in a typical deployment some for of encryption is used. Each vlan has a unique broadcast key so stations on one vlan cannot decrypt packets from another vlan.
-David
Re: [patch 5/5] d80211: allow wireless vlan interface to havesameMAC an AP interface
Quoted 3 lines · David Kimdon
no, still broadcasts, but in a typical deployment some for of encryption is used. Each vlan has a unique broadcast key so stations on one vlan cannot decrypt packets from another vlan.
Oh ok, that makes sense. Thanks.
johannes