
Options: --debug enable netlink debugging --version show version (3.4) Commands: help [command] Print usage for all or a specific command, e.g. "help wowlan" or "help wowlan enable". event [-t] [-r] [-f] Monitor events from the kernel. -t - print timestamp -r - print relative timstamp -f - print full frame for auth/assoc etc. phy list List all wireless devices and their capabilities. phy <phyname> info Show capabilities for the specified wireless device. dev List all network interfaces for wireless hardware. dev <devname> info Show information for this interface. dev <devname> del Remove this virtual interface dev <devname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] phy <phyname> interface add <name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] Add a new virtual interface with the given configuration. Valid interface types are: managed, ibss, monitor, mesh, wds. The flags are only used for monitor interfaces, valid flags are: none: no special flags fcsfail: show frames with FCS errors control: show control frames otherbss: show frames from other BSSes cook: use cooked mode The mesh_id is used only for mesh mode. dev <devname> ibss join <SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>] [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] [key d:0:abcde] Join the IBSS cell with the given SSID, if it doesn't exist create it on the given frequency. When fixed frequency is requested, don't join/create a cell on a different frequency. When a fixed BSSID is requested use that BSSID and do not adopt another cell's BSSID even if it has higher TSF and the same SSID. If an IBSS is created, create it with the specified basic-rates, multicast-rate and beacon-interval. dev <devname> ibss leave Leave the current IBSS cell. dev <devname> station dump List all stations known, e.g. the AP on managed interfaces dev <devname> station set <MAC address> vlan <ifindex> Set an AP VLAN for this station. dev <devname> station set <MAC address> plink_action <open|block> Set mesh peer link action for this station (peer). dev <devname> station del <MAC address> Remove the given station entry (use with caution!) dev <devname> station get <MAC address> Get information for a specific station. dev <devname> survey dump List all gathered channel survey data dev <devname> mesh leave Leave a mesh. dev <devname> mesh join <mesh ID> [mcast-rate <rate in Mbps>] [<param>=<value>]* Join a mesh with the given mesh ID with mcast-rate and mesh parameters. dev <devname> mpath dump List known mesh paths. dev <devname> mpath set <destination MAC address> next_hop <next hop MAC address> Set an existing mesh path's next hop. dev <devname> mpath new <destination MAC address> next_hop <next hop MAC address> Create a new mesh path (instead of relying on automatic discovery). dev <devname> mpath del <MAC address> Remove the mesh path to the given node. dev <devname> mpath get <MAC address> Get information on mesh path to the given node. dev <devname> scan [-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive] Scan on the given frequencies and probe for the given SSIDs (or wildcard if not given) unless passive scanning is requested. If -u is specified print unknown data in the scan results. Specified (vendor) IEs must be well-formed. dev <devname> scan trigger [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive] Trigger a scan on the given frequencies with probing for the given SSIDs (or wildcard if not given) unless passive scanning is requested. dev <devname> scan dump [-u] Dump the current scan results. If -u is specified, print unknown data in scan results. reg get Print out the kernel's current regulatory domain information. reg set <ISO/IEC 3166-1 alpha2> Notify the kernel about the current regulatory domain. dev <devname> connect [-w] <SSID> [<freq in MHz>] [<bssid>] [key 0:abcde d:1:6162636465] Join the network with the given SSID (and frequency, BSSID). With -w, wait for the connect to finish or fail. dev <devname> disconnect Disconnect from the current network. dev <devname> link Print information about the current link, if any. dev <devname> offchannel <freq> <duration> Leave operating channel and go to the given channel for a while. dev <devname> cqm rssi <threshold|off> [<hysteresis>] Set connection quality monitor RSSI threshold. phy <phyname> wowlan show Show WoWLAN status. phy <phyname> wowlan disable Disable WoWLAN. phy <phyname> wowlan enable [any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request] [4way-handshake] [rfkill-release] [patterns <pattern>*] Enable WoWLAN with the given triggers. Each pattern is given as a bytestring with '-' in places where any byte may be present, e.g. 00:11:22:-:44 will match 00:11:22:33:44 and 00:11:22:33:ff:44 etc. dev <devname> roc start <freq> <time> phy <phyname> set antenna <bitmap> | all | <tx bitmap> <rx bitmap> Set a bitmap of allowed antennas to use for TX and RX. The driver may reject antenna configurations it cannot support. dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>] Specify transmit power level and setting type. phy <phyname> set txpower <auto|fixed|limit> [<tx power in mBm>] Specify transmit power level and setting type. phy <phyname> set distance <distance> Set appropriate coverage class for given link distance in meters. Valid values: 0 - 114750 phy <phyname> set coverage <coverage class> Set coverage class (1 for every 3 usec of air propagation time). Valid values: 0 - 255. phy <phyname> set netns <pid> Put this wireless device into a different network namespace phy <phyname> set rts <rts threshold|off> Set rts threshold. phy <phyname> set frag <fragmentation threshold|off> Set fragmentation threshold. dev <devname> set channel <channel> [HT20|HT40+|HT40-] phy <phyname> set channel <channel> [HT20|HT40+|HT40-] dev <devname> set freq <freq> [HT20|HT40+|HT40-] phy <phyname> set freq <freq> [HT20|HT40+|HT40-] Set frequency/channel the hardware is using, including HT configuration. phy <phyname> set name <new name> Rename this wireless device. dev <devname> set peer <MAC address> Set interface WDS peer. dev <devname> set noack_map <map> Set the NoAck map for the TIDs. (0x0009 = BE, 0x0006 = BK, 0x0030 = VI, 0x00C0 = VO) dev <devname> set 4addr <on|off> Set interface 4addr (WDS) mode. dev <devname> set type <type> Set interface type/mode. Valid interface types are: managed, ibss, monitor, mesh, wds. dev <devname> set meshid <meshid> dev <devname> set monitor <flag>* Set monitor flags. Valid flags are: none: no special flags fcsfail: show frames with FCS errors control: show control frames otherbss: show frames from other BSSes cook: use cooked mode dev <devname> set mesh_param <param>=<value> [<param>=<value>]* Set mesh parameter (run command without any to see available ones). dev <devname> set power_save <on|off> Set power save state to on or off. dev <devname> set bitrates [legacy-<2.4|5> <legacy rate in Mbps>*] [mcs-<2.4|5> <MCS index>*] Sets up the specified rate masks. Not passing any arguments would clear the existing mask (if any). dev <devname> get mesh_param [<param>] Retrieve mesh parameter (run command without any to see available ones). dev <devname> get power_save <param> Retrieve power save state. You can omit the 'phy' or 'dev' if the identification is unique, e.g. "iw wlan0 info" or "iw phy0 info". (Don't when scripting.) Do NOT screenscrape this tool, we don't consider its output stable.
229 lines
7.1 KiB
Diff
229 lines
7.1 KiB
Diff
From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
|
|
Date: Fri, 19 Feb 2016 11:01:49 +0100
|
|
Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
|
|
|
|
This is preparation for adding support for inserting padding between the
|
|
802.11 header and LLC data
|
|
|
|
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/net/mac80211/ieee80211_i.h
|
|
+++ b/net/mac80211/ieee80211_i.h
|
|
@@ -179,6 +179,7 @@ struct ieee80211_tx_data {
|
|
struct ieee80211_tx_rate rate;
|
|
|
|
unsigned int flags;
|
|
+ unsigned int hdrlen;
|
|
};
|
|
|
|
|
|
--- a/net/mac80211/tx.c
|
|
+++ b/net/mac80211/tx.c
|
|
@@ -925,7 +925,7 @@ ieee80211_tx_h_fragment(struct ieee80211
|
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
|
struct ieee80211_hdr *hdr = (void *)skb->data;
|
|
int frag_threshold = tx->local->hw.wiphy->frag_threshold;
|
|
- int hdrlen;
|
|
+ int hdrlen = tx->hdrlen;
|
|
int fragnum;
|
|
|
|
/* no matter what happens, tx->skb moves to tx->skbs */
|
|
@@ -946,8 +946,6 @@ ieee80211_tx_h_fragment(struct ieee80211
|
|
if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
|
|
return TX_DROP;
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
-
|
|
/* internal error, why isn't DONTFRAG set? */
|
|
if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
|
|
return TX_DROP;
|
|
@@ -1178,6 +1176,8 @@ ieee80211_tx_prepare(struct ieee80211_su
|
|
|
|
hdr = (struct ieee80211_hdr *) skb->data;
|
|
|
|
+ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
+
|
|
if (likely(sta)) {
|
|
if (!IS_ERR(sta))
|
|
tx->sta = sta;
|
|
@@ -3525,6 +3525,7 @@ begin:
|
|
tx.local = local;
|
|
tx.skb = skb;
|
|
tx.sdata = vif_to_sdata(info->control.vif);
|
|
+ tx.hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
|
|
if (txq->sta)
|
|
tx.sta = container_of(txq->sta, struct sta_info, sta);
|
|
@@ -3551,7 +3552,7 @@ begin:
|
|
|
|
if (tx.key &&
|
|
(tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
|
|
- pn_offs = ieee80211_hdrlen(hdr->frame_control);
|
|
+ pn_offs = tx.hdrlen;
|
|
|
|
ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
|
|
tx.key, skb);
|
|
@@ -4008,6 +4009,7 @@ ieee80211_build_data_template(struct iee
|
|
hdr = (void *)skb->data;
|
|
tx.sta = sta_info_get(sdata, hdr->addr1);
|
|
tx.skb = skb;
|
|
+ tx.hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
|
|
if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) {
|
|
rcu_read_unlock();
|
|
--- a/net/mac80211/util.c
|
|
+++ b/net/mac80211/util.c
|
|
@@ -1390,6 +1390,7 @@ void ieee80211_send_auth(struct ieee8021
|
|
struct ieee80211_local *local = sdata->local;
|
|
struct sk_buff *skb;
|
|
struct ieee80211_mgmt *mgmt;
|
|
+ unsigned int hdrlen;
|
|
int err;
|
|
|
|
/* 24 + 6 = header + auth_algo + auth_transaction + status_code */
|
|
@@ -1413,8 +1414,10 @@ void ieee80211_send_auth(struct ieee8021
|
|
skb_put_data(skb, extra, extra_len);
|
|
|
|
if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
|
|
+ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
|
|
mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
|
|
- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
|
|
+ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
|
|
+ key_len, key_idx);
|
|
WARN_ON(err);
|
|
}
|
|
|
|
--- a/net/mac80211/wep.c
|
|
+++ b/net/mac80211/wep.c
|
|
@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
|
|
|
|
static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
|
|
struct sk_buff *skb,
|
|
+ unsigned int hdrlen,
|
|
int keylen, int keyidx)
|
|
{
|
|
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
|
- unsigned int hdrlen;
|
|
u8 *newhdr;
|
|
|
|
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
|
|
@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
|
|
if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
|
|
return NULL;
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
|
|
memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
|
|
|
|
@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
|
|
*/
|
|
int ieee80211_wep_encrypt(struct ieee80211_local *local,
|
|
struct sk_buff *skb,
|
|
+ unsigned int hdrlen,
|
|
const u8 *key, int keylen, int keyidx)
|
|
{
|
|
u8 *iv;
|
|
@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
|
|
if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
|
|
return -1;
|
|
|
|
- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
|
|
+ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
|
|
if (!iv)
|
|
return -1;
|
|
|
|
@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80
|
|
struct ieee80211_key_conf *hw_key = info->control.hw_key;
|
|
|
|
if (!hw_key) {
|
|
- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
|
|
+ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
|
|
+ tx->key->conf.key,
|
|
tx->key->conf.keylen,
|
|
tx->key->conf.keyidx))
|
|
return -1;
|
|
} else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
|
|
(hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
|
|
- if (!ieee80211_wep_add_iv(tx->local, skb,
|
|
+ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
|
|
tx->key->conf.keylen,
|
|
tx->key->conf.keyidx))
|
|
return -1;
|
|
--- a/net/mac80211/wep.h
|
|
+++ b/net/mac80211/wep.h
|
|
@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
|
|
size_t klen, u8 *data, size_t data_len);
|
|
int ieee80211_wep_encrypt(struct ieee80211_local *local,
|
|
struct sk_buff *skb,
|
|
+ unsigned int hdrlen,
|
|
const u8 *key, int keylen, int keyidx);
|
|
int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
|
|
size_t klen, u8 *data, size_t data_len);
|
|
--- a/net/mac80211/wpa.c
|
|
+++ b/net/mac80211/wpa.c
|
|
@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
|
|
skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
|
|
return TX_CONTINUE;
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
+ hdrlen = tx->hdrlen;
|
|
if (skb->len < hdrlen)
|
|
return TX_DROP;
|
|
|
|
@@ -195,7 +195,6 @@ mic_fail_no_key:
|
|
|
|
static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
|
|
{
|
|
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
|
struct ieee80211_key *key = tx->key;
|
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
|
unsigned int hdrlen;
|
|
@@ -210,7 +209,7 @@ static int tkip_encrypt_skb(struct ieee8
|
|
return 0;
|
|
}
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
+ hdrlen = tx->hdrlen;
|
|
len = skb->len - hdrlen;
|
|
|
|
if (info->control.hw_key)
|
|
@@ -428,7 +427,7 @@ static int ccmp_encrypt_skb(struct ieee8
|
|
return 0;
|
|
}
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
+ hdrlen = tx->hdrlen;
|
|
len = skb->len - hdrlen;
|
|
|
|
if (info->control.hw_key)
|
|
@@ -660,7 +659,7 @@ static int gcmp_encrypt_skb(struct ieee8
|
|
return 0;
|
|
}
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
+ hdrlen = tx->hdrlen;
|
|
len = skb->len - hdrlen;
|
|
|
|
if (info->control.hw_key)
|
|
@@ -800,7 +799,6 @@ static ieee80211_tx_result
|
|
ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
|
|
struct sk_buff *skb)
|
|
{
|
|
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
|
struct ieee80211_key *key = tx->key;
|
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
|
int hdrlen;
|
|
@@ -816,8 +814,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
|
|
pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
|
|
return TX_DROP;
|
|
|
|
- hdrlen = ieee80211_hdrlen(hdr->frame_control);
|
|
-
|
|
+ hdrlen = tx->hdrlen;
|
|
pos = skb_push(skb, iv_len);
|
|
memmove(pos, pos + iv_len, hdrlen);
|
|
|