o wl3501: implement get encode wireless extension

. Well, this is just for completeness, as with this specific
  firmware in the cards I have WEP is not implemented...
  This is the information for the cards I have (tested just one
  but I doubt the others have WEP...):
  Card Name: OEM WLAN/WPCMCIA
  Firmware Date: 02.00.06 01/07/2000 12:13:49
parent 3a19e81b
......@@ -77,7 +77,7 @@ enum wl3501_mib_attribs {
WL3501_MIB_ATTR_WEP_DEFAULT_KEYS,
WL3501_MIB_ATTR_WEP_DEFAULT_KEY_ID,
WL3501_MIB_ATTR_WEP_KEY_MAPPINGS,
WL3501_MIB_ATTR_WEP_KEY_MAPPING_LENGTH,
WL3501_MIB_ATTR_WEP_KEY_MAPPINGS_LEN,
WL3501_MIB_ATTR_EXCLUDE_UNENCRYPTED,
WL3501_MIB_ATTR_WEP_ICV_ERROR_COUNT,
WL3501_MIB_ATTR_WEP_UNDECRYPTABLE_COUNT,
......@@ -119,8 +119,8 @@ enum wl3501_mib_attribs {
WL3501_MIB_ATTR_RX_PLCP_DELAY,
WL3501_MIB_ATTR_MAC_PROCESSING_DELAY,
WL3501_MIB_ATTR_TX_RAMP_OFF_TIME,
WL3501_MIB_ATTR_PREAMBLE_LENGTH,
WL3501_MIB_ATTR_PLCP_HEADER_LENGTH,
WL3501_MIB_ATTR_PREAMBLE_LEN,
WL3501_MIB_ATTR_PLCP_HEADER_LEN,
WL3501_MIB_ATTR_MPDU_DURATION_FACTOR,
WL3501_MIB_ATTR_AIR_PROPAGATION_TIME,
WL3501_MIB_ATTR_TEMP_TYPE,
......@@ -128,7 +128,7 @@ enum wl3501_mib_attribs {
WL3501_MIB_ATTR_CW_MAX,
WL3501_MIB_ATTR_SUPPORT_DATA_RATES_TX,
WL3501_MIB_ATTR_SUPPORT_DATA_RATES_RX,
WL3501_MIB_ATTR_MPDU_MAX_LENGTH,
WL3501_MIB_ATTR_MPDU_MAX_LEN,
WL3501_MIB_ATTR_SUPPORT_TX_ANTENNAS,
WL3501_MIB_ATTR_CURRENT_TX_ANTENNA,
WL3501_MIB_ATTR_SUPPORT_RX_ANTENNAS,
......
......@@ -2104,6 +2104,44 @@ static int wl3501_get_frag_threshold(struct net_device *dev,
return rc;
}
static int wl3501_get_encode(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u8 implemented, restricted, keys[100], len_keys, tocopy;
struct wl3501_card *this = (struct wl3501_card *)dev->priv;
int rc = wl3501_get_mib_value(this,
WL3501_MIB_ATTR_PRIV_OPT_IMPLEMENTED,
&implemented, sizeof(implemented));
if (rc)
goto out;
if (!implemented) {
wrqu->encoding.flags = IW_ENCODE_DISABLED;
goto out;
}
rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_EXCLUDE_UNENCRYPTED,
&restricted, sizeof(restricted));
if (rc)
goto out;
wrqu->encoding.flags = restricted ? IW_ENCODE_RESTRICTED :
IW_ENCODE_OPEN;
rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_KEY_MAPPINGS_LEN,
&len_keys, sizeof(len_keys));
if (rc)
goto out;
rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_KEY_MAPPINGS,
keys, len_keys);
if (rc)
goto out;
tocopy = min_t(u8, len_keys, wrqu->encoding.length);
tocopy = min_t(u8, tocopy, 100);
wrqu->encoding.length = tocopy;
memset(extra, 0, tocopy);
memcpy(extra, keys, tocopy);
out:
return rc;
}
static const iw_handler wl3501_handler[] = {
[SIOCGIWNAME - SIOCIWFIRST] = wl3501_get_name,
[SIOCSIWFREQ - SIOCIWFIRST] = wl3501_set_freq,
......@@ -2125,6 +2163,7 @@ static const iw_handler wl3501_handler[] = {
[SIOCGIWRATE - SIOCIWFIRST] = wl3501_get_rate,
[SIOCGIWRTS - SIOCIWFIRST] = wl3501_get_rts_threshold,
[SIOCGIWFRAG - SIOCIWFIRST] = wl3501_get_frag_threshold,
[SIOCGIWENCODE - SIOCIWFIRST] = wl3501_get_encode,
};
static const struct iw_handler_def wl3501_handler_def = {
......
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