Commit 0a6d61ec authored by YAMANE Toshiaki's avatar YAMANE Toshiaki Committed by Greg Kroah-Hartman

staging/rtl8187se: Fix spacing coding style in ieee80211/ieee80211_wx.c

The following errors and warnings fixed.
- ERROR: code indent should use tabs where possible
- WARNING: please, no spaces at the start of a line
- WARNING: please, no space before tabs
Signed-off-by: default avatarYAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 82692d20
...@@ -41,9 +41,9 @@ static const char *ieee80211_modes[] = { ...@@ -41,9 +41,9 @@ static const char *ieee80211_modes[] = {
#define MAX_CUSTOM_LEN 64 #define MAX_CUSTOM_LEN 64
static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee,
char *start, char *stop, char *start, char *stop,
struct ieee80211_network *network, struct ieee80211_network *network,
struct iw_request_info *info) struct iw_request_info *info)
{ {
char custom[MAX_CUSTOM_LEN]; char custom[MAX_CUSTOM_LEN];
char *p; char *p;
...@@ -78,9 +78,9 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, ...@@ -78,9 +78,9 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee,
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]);
start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN);
/* Add mode */ /* Add mode */
iwe.cmd = SIOCGIWMODE; iwe.cmd = SIOCGIWMODE;
if (network->capability & if (network->capability &
(WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) {
if (network->capability & WLAN_CAPABILITY_BSS) if (network->capability & WLAN_CAPABILITY_BSS)
iwe.u.mode = IW_MODE_MASTER; iwe.u.mode = IW_MODE_MASTER;
...@@ -90,7 +90,7 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, ...@@ -90,7 +90,7 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee,
start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN);
} }
/* Add frequency/channel */ /* Add frequency/channel */
iwe.cmd = SIOCGIWFREQ; iwe.cmd = SIOCGIWFREQ;
/* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); /* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode);
iwe.u.freq.e = 3; */ iwe.u.freq.e = 3; */
...@@ -168,23 +168,23 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee, ...@@ -168,23 +168,23 @@ static inline char *rtl818x_translate_scan(struct ieee80211_device *ieee,
if (iwe.u.data.length) if (iwe.u.data.length)
start = iwe_stream_add_point(info, start, stop, &iwe, custom); start = iwe_stream_add_point(info, start, stop, &iwe, custom);
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
if (network->wpa_ie_len) { if (network->wpa_ie_len) {
// printk("wpa_ie_len:%d\n", network->wpa_ie_len); // printk("wpa_ie_len:%d\n", network->wpa_ie_len);
char buf[MAX_WPA_IE_LEN]; char buf[MAX_WPA_IE_LEN];
memcpy(buf, network->wpa_ie, network->wpa_ie_len); memcpy(buf, network->wpa_ie, network->wpa_ie_len);
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = network->wpa_ie_len; iwe.u.data.length = network->wpa_ie_len;
start = iwe_stream_add_point(info, start, stop, &iwe, buf); start = iwe_stream_add_point(info, start, stop, &iwe, buf);
} }
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
if (network->rsn_ie_len) { if (network->rsn_ie_len) {
// printk("=====>rsn_ie_len:\n", network->rsn_ie_len); // printk("=====>rsn_ie_len:\n", network->rsn_ie_len);
char buf[MAX_WPA_IE_LEN]; char buf[MAX_WPA_IE_LEN];
memcpy(buf, network->rsn_ie, network->rsn_ie_len); memcpy(buf, network->rsn_ie, network->rsn_ie_len);
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = network->rsn_ie_len; iwe.u.data.length = network->rsn_ie_len;
start = iwe_stream_add_point(info, start, stop, &iwe, buf); start = iwe_stream_add_point(info, start, stop, &iwe, buf);
} }
...@@ -359,7 +359,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, ...@@ -359,7 +359,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
key, escape_essid(sec.keys[key], len), key, escape_essid(sec.keys[key], len),
erq->length, len); erq->length, len);
sec.key_sizes[key] = len; sec.key_sizes[key] = len;
(*crypt)->ops->set_key(sec.keys[key], len, NULL, (*crypt)->ops->set_key(sec.keys[key], len, NULL,
(*crypt)->priv); (*crypt)->priv);
sec.flags |= (1 << key); sec.flags |= (1 << key);
/* This ensures a key will be activated if no key is /* This ensures a key will be activated if no key is
...@@ -472,218 +472,218 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee, ...@@ -472,218 +472,218 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
} }
int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct net_device *dev = ieee->dev; struct net_device *dev = ieee->dev;
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
int i, idx, ret = 0; int i, idx, ret = 0;
int group_key = 0; int group_key = 0;
const char *alg; const char *alg;
struct ieee80211_crypto_ops *ops; struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt; struct ieee80211_crypt_data **crypt;
struct ieee80211_security sec = { struct ieee80211_security sec = {
.flags = 0, .flags = 0,
}; };
//printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg); //printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg);
idx = encoding->flags & IW_ENCODE_INDEX; idx = encoding->flags & IW_ENCODE_INDEX;
if (idx) { if (idx) {
if (idx < 1 || idx > WEP_KEYS) if (idx < 1 || idx > WEP_KEYS)
return -EINVAL; return -EINVAL;
idx--; idx--;
} else } else
idx = ieee->tx_keyidx; idx = ieee->tx_keyidx;
if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
crypt = &ieee->crypt[idx]; crypt = &ieee->crypt[idx];
group_key = 1; group_key = 1;
} else { } else {
/* some Cisco APs use idx>0 for unicast in dynamic WEP */ /* some Cisco APs use idx>0 for unicast in dynamic WEP */
//printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg); //printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg);
if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
return -EINVAL; return -EINVAL;
if (ieee->iw_mode == IW_MODE_INFRA) if (ieee->iw_mode == IW_MODE_INFRA)
crypt = &ieee->crypt[idx]; crypt = &ieee->crypt[idx];
else else
return -EINVAL; return -EINVAL;
} }
sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT;
if ((encoding->flags & IW_ENCODE_DISABLED) || if ((encoding->flags & IW_ENCODE_DISABLED) ||
ext->alg == IW_ENCODE_ALG_NONE) { ext->alg == IW_ENCODE_ALG_NONE) {
if (*crypt) if (*crypt)
ieee80211_crypt_delayed_deinit(ieee, crypt); ieee80211_crypt_delayed_deinit(ieee, crypt);
for (i = 0; i < WEP_KEYS; i++) for (i = 0; i < WEP_KEYS; i++)
if (ieee->crypt[i] != NULL) if (ieee->crypt[i] != NULL)
break; break;
if (i == WEP_KEYS) { if (i == WEP_KEYS) {
sec.enabled = 0; sec.enabled = 0;
// sec.encrypt = 0; // sec.encrypt = 0;
sec.level = SEC_LEVEL_0; sec.level = SEC_LEVEL_0;
sec.flags |= SEC_LEVEL; sec.flags |= SEC_LEVEL;
} }
//printk("disabled: flag:%x\n", encoding->flags); //printk("disabled: flag:%x\n", encoding->flags);
goto done; goto done;
} }
sec.enabled = 1; sec.enabled = 1;
// sec.encrypt = 1; // sec.encrypt = 1;
switch (ext->alg) { switch (ext->alg) {
case IW_ENCODE_ALG_WEP: case IW_ENCODE_ALG_WEP:
alg = "WEP"; alg = "WEP";
break; break;
case IW_ENCODE_ALG_TKIP: case IW_ENCODE_ALG_TKIP:
alg = "TKIP"; alg = "TKIP";
break; break;
case IW_ENCODE_ALG_CCMP: case IW_ENCODE_ALG_CCMP:
alg = "CCMP"; alg = "CCMP";
break; break;
default: default:
IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
dev->name, ext->alg); dev->name, ext->alg);
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
// printk("8-09-08-9=====>%s, alg name:%s\n",__func__, alg); // printk("8-09-08-9=====>%s, alg name:%s\n",__func__, alg);
ops = ieee80211_get_crypto_ops(alg); ops = ieee80211_get_crypto_ops(alg);
if (ops == NULL) if (ops == NULL)
ops = ieee80211_get_crypto_ops(alg); ops = ieee80211_get_crypto_ops(alg);
if (ops == NULL) { if (ops == NULL) {
IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
dev->name, ext->alg); dev->name, ext->alg);
printk("========>unknown crypto alg %d\n", ext->alg); printk("========>unknown crypto alg %d\n", ext->alg);
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
if (*crypt == NULL || (*crypt)->ops != ops) { if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt; struct ieee80211_crypt_data *new_crypt;
ieee80211_crypt_delayed_deinit(ieee, crypt); ieee80211_crypt_delayed_deinit(ieee, crypt);
new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
if (new_crypt == NULL) { if (new_crypt == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
new_crypt->ops = ops; new_crypt->ops = ops;
if (new_crypt->ops) if (new_crypt->ops)
new_crypt->priv = new_crypt->ops->init(idx); new_crypt->priv = new_crypt->ops->init(idx);
if (new_crypt->priv == NULL) { if (new_crypt->priv == NULL) {
kfree(new_crypt); kfree(new_crypt);
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
*crypt = new_crypt; *crypt = new_crypt;
} }
if (ext->key_len > 0 && (*crypt)->ops->set_key && if (ext->key_len > 0 && (*crypt)->ops->set_key &&
(*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
(*crypt)->priv) < 0) { (*crypt)->priv) < 0) {
IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name);
printk("key setting failed\n"); printk("key setting failed\n");
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
#if 1 #if 1
//skip_host_crypt: //skip_host_crypt:
//printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags);
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
ieee->tx_keyidx = idx; ieee->tx_keyidx = idx;
sec.active_key = idx; sec.active_key = idx;
sec.flags |= SEC_ACTIVE_KEY; sec.flags |= SEC_ACTIVE_KEY;
} }
if (ext->alg != IW_ENCODE_ALG_NONE) { if (ext->alg != IW_ENCODE_ALG_NONE) {
memcpy(sec.keys[idx], ext->key, ext->key_len); memcpy(sec.keys[idx], ext->key, ext->key_len);
sec.key_sizes[idx] = ext->key_len; sec.key_sizes[idx] = ext->key_len;
sec.flags |= (1 << idx); sec.flags |= (1 << idx);
if (ext->alg == IW_ENCODE_ALG_WEP) { if (ext->alg == IW_ENCODE_ALG_WEP) {
// sec.encode_alg[idx] = SEC_ALG_WEP; // sec.encode_alg[idx] = SEC_ALG_WEP;
sec.flags |= SEC_LEVEL; sec.flags |= SEC_LEVEL;
sec.level = SEC_LEVEL_1; sec.level = SEC_LEVEL_1;
} else if (ext->alg == IW_ENCODE_ALG_TKIP) { } else if (ext->alg == IW_ENCODE_ALG_TKIP) {
// sec.encode_alg[idx] = SEC_ALG_TKIP; // sec.encode_alg[idx] = SEC_ALG_TKIP;
sec.flags |= SEC_LEVEL; sec.flags |= SEC_LEVEL;
sec.level = SEC_LEVEL_2; sec.level = SEC_LEVEL_2;
} else if (ext->alg == IW_ENCODE_ALG_CCMP) { } else if (ext->alg == IW_ENCODE_ALG_CCMP) {
// sec.encode_alg[idx] = SEC_ALG_CCMP; // sec.encode_alg[idx] = SEC_ALG_CCMP;
sec.flags |= SEC_LEVEL; sec.flags |= SEC_LEVEL;
sec.level = SEC_LEVEL_3; sec.level = SEC_LEVEL_3;
} }
/* Don't set sec level for group keys. */ /* Don't set sec level for group keys. */
if (group_key) if (group_key)
sec.flags &= ~SEC_LEVEL; sec.flags &= ~SEC_LEVEL;
} }
#endif #endif
done: done:
if (ieee->set_security) if (ieee->set_security)
ieee->set_security(ieee->dev, &sec); ieee->set_security(ieee->dev, &sec);
if (ieee->reset_on_keychange && if (ieee->reset_on_keychange &&
ieee->iw_mode != IW_MODE_INFRA && ieee->iw_mode != IW_MODE_INFRA &&
ieee->reset_port && ieee->reset_port(dev)) { ieee->reset_port && ieee->reset_port(dev)) {
IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);
return -EINVAL; return -EINVAL;
} }
return ret; return ret;
} }
int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct iw_mlme *mlme = (struct iw_mlme *) extra; struct iw_mlme *mlme = (struct iw_mlme *) extra;
// printk("\ndkgadfslkdjgalskdf===============>%s(), cmd:%x\n", __func__, mlme->cmd); // printk("\ndkgadfslkdjgalskdf===============>%s(), cmd:%x\n", __func__, mlme->cmd);
#if 1 #if 1
switch (mlme->cmd) { switch (mlme->cmd) {
case IW_MLME_DEAUTH: case IW_MLME_DEAUTH:
case IW_MLME_DISASSOC: case IW_MLME_DISASSOC:
// printk("disassoc now\n"); // printk("disassoc now\n");
ieee80211_disassociate(ieee); ieee80211_disassociate(ieee);
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
#endif #endif
return 0; return 0;
} }
int ieee80211_wx_set_auth(struct ieee80211_device *ieee, int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_param *data, char *extra) struct iw_param *data, char *extra)
{ {
/* /*
struct ieee80211_security sec = { struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE, .flags = SEC_AUTH_MODE,
} }
*/ */
//printk("set auth:flag:%x, data value:%x\n", data->flags, data->value); //printk("set auth:flag:%x, data value:%x\n", data->flags, data->value);
switch (data->flags & IW_AUTH_INDEX) { switch (data->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION: case IW_AUTH_WPA_VERSION:
/*need to support wpa2 here*/ /*need to support wpa2 here*/
//printk("wpa version:%x\n", data->value); //printk("wpa version:%x\n", data->value);
break; break;
case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_PAIRWISE:
case IW_AUTH_CIPHER_GROUP: case IW_AUTH_CIPHER_GROUP:
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
/* /*
* * Host AP driver does not use these parameters and allows * * Host AP driver does not use these parameters and allows
* * wpa_supplicant to control them internally. * * wpa_supplicant to control them internally.
* */ * */
break; break;
case IW_AUTH_TKIP_COUNTERMEASURES: case IW_AUTH_TKIP_COUNTERMEASURES:
ieee->tkip_countermeasures = data->value; ieee->tkip_countermeasures = data->value;
break; break;
case IW_AUTH_DROP_UNENCRYPTED: case IW_AUTH_DROP_UNENCRYPTED:
ieee->drop_unencrypted = data->value; ieee->drop_unencrypted = data->value;
break; break;
case IW_AUTH_80211_AUTH_ALG: case IW_AUTH_80211_AUTH_ALG:
...@@ -699,13 +699,13 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, ...@@ -699,13 +699,13 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
#endif #endif
case IW_AUTH_RX_UNENCRYPTED_EAPOL: case IW_AUTH_RX_UNENCRYPTED_EAPOL:
ieee->ieee802_1x = data->value; ieee->ieee802_1x = data->value;
break; break;
case IW_AUTH_PRIVACY_INVOKED: case IW_AUTH_PRIVACY_INVOKED:
ieee->privacy_invoked = data->value; ieee->privacy_invoked = data->value;
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return 0; return 0;
} }
......
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