Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] ipw2100: remove code for WIRELESS_EXT < 18

WIRELESS_EXT < 18 will never be true in the kernel.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Adrian Bunk and committed by
John W. Linville
8aec9383 d6a13a24

-434
-434
drivers/net/wireless/ipw2100.c
··· 5735 5735 return &priv->ieee->stats; 5736 5736 } 5737 5737 5738 - #if WIRELESS_EXT < 18 5739 - /* Support for wpa_supplicant before WE-18, deprecated. */ 5740 - 5741 - /* following definitions must match definitions in driver_ipw.c */ 5742 - 5743 - #define IPW2100_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 5744 - 5745 - #define IPW2100_CMD_SET_WPA_PARAM 1 5746 - #define IPW2100_CMD_SET_WPA_IE 2 5747 - #define IPW2100_CMD_SET_ENCRYPTION 3 5748 - #define IPW2100_CMD_MLME 4 5749 - 5750 - #define IPW2100_PARAM_WPA_ENABLED 1 5751 - #define IPW2100_PARAM_TKIP_COUNTERMEASURES 2 5752 - #define IPW2100_PARAM_DROP_UNENCRYPTED 3 5753 - #define IPW2100_PARAM_PRIVACY_INVOKED 4 5754 - #define IPW2100_PARAM_AUTH_ALGS 5 5755 - #define IPW2100_PARAM_IEEE_802_1X 6 5756 - 5757 - #define IPW2100_MLME_STA_DEAUTH 1 5758 - #define IPW2100_MLME_STA_DISASSOC 2 5759 - 5760 - #define IPW2100_CRYPT_ERR_UNKNOWN_ALG 2 5761 - #define IPW2100_CRYPT_ERR_UNKNOWN_ADDR 3 5762 - #define IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED 4 5763 - #define IPW2100_CRYPT_ERR_KEY_SET_FAILED 5 5764 - #define IPW2100_CRYPT_ERR_TX_KEY_SET_FAILED 6 5765 - #define IPW2100_CRYPT_ERR_CARD_CONF_FAILED 7 5766 - 5767 - #define IPW2100_CRYPT_ALG_NAME_LEN 16 5768 - 5769 - struct ipw2100_param { 5770 - u32 cmd; 5771 - u8 sta_addr[ETH_ALEN]; 5772 - union { 5773 - struct { 5774 - u8 name; 5775 - u32 value; 5776 - } wpa_param; 5777 - struct { 5778 - u32 len; 5779 - u8 reserved[32]; 5780 - u8 data[0]; 5781 - } wpa_ie; 5782 - struct { 5783 - u32 command; 5784 - u32 reason_code; 5785 - } mlme; 5786 - struct { 5787 - u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; 5788 - u8 set_tx; 5789 - u32 err; 5790 - u8 idx; 5791 - u8 seq[8]; /* sequence counter (set: RX, get: TX) */ 5792 - u16 key_len; 5793 - u8 key[0]; 5794 - } crypt; 5795 - 5796 - } u; 5797 - }; 5798 - 5799 - /* end of driver_ipw.c code */ 5800 - #endif /* WIRELESS_EXT < 18 */ 5801 - 5802 5738 static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) 5803 5739 { 5804 5740 /* This is called when wpa_supplicant loads and closes the driver ··· 5742 5806 priv->ieee->wpa_enabled = value; 5743 5807 return 0; 5744 5808 } 5745 - 5746 - #if WIRELESS_EXT < 18 5747 - #define IW_AUTH_ALG_OPEN_SYSTEM 0x1 5748 - #define IW_AUTH_ALG_SHARED_KEY 0x2 5749 - #endif 5750 5809 5751 5810 static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) 5752 5811 { ··· 5785 5854 ipw2100_wpa_enable(priv, 1); 5786 5855 ipw2100_set_wpa_ie(priv, &frame, 0); 5787 5856 } 5788 - 5789 - #if WIRELESS_EXT < 18 5790 - static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value) 5791 - { 5792 - struct ipw2100_priv *priv = ieee80211_priv(dev); 5793 - struct ieee80211_crypt_data *crypt; 5794 - unsigned long flags; 5795 - int ret = 0; 5796 - 5797 - switch (name) { 5798 - case IPW2100_PARAM_WPA_ENABLED: 5799 - ret = ipw2100_wpa_enable(priv, value); 5800 - break; 5801 - 5802 - case IPW2100_PARAM_TKIP_COUNTERMEASURES: 5803 - crypt = priv->ieee->crypt[priv->ieee->tx_keyidx]; 5804 - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) 5805 - break; 5806 - 5807 - flags = crypt->ops->get_flags(crypt->priv); 5808 - 5809 - if (value) 5810 - flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; 5811 - else 5812 - flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; 5813 - 5814 - crypt->ops->set_flags(flags, crypt->priv); 5815 - 5816 - break; 5817 - 5818 - case IPW2100_PARAM_DROP_UNENCRYPTED:{ 5819 - /* See IW_AUTH_DROP_UNENCRYPTED handling for details */ 5820 - struct ieee80211_security sec = { 5821 - .flags = SEC_ENABLED, 5822 - .enabled = value, 5823 - }; 5824 - priv->ieee->drop_unencrypted = value; 5825 - /* We only change SEC_LEVEL for open mode. Others 5826 - * are set by ipw_wpa_set_encryption. 5827 - */ 5828 - if (!value) { 5829 - sec.flags |= SEC_LEVEL; 5830 - sec.level = SEC_LEVEL_0; 5831 - } else { 5832 - sec.flags |= SEC_LEVEL; 5833 - sec.level = SEC_LEVEL_1; 5834 - } 5835 - if (priv->ieee->set_security) 5836 - priv->ieee->set_security(priv->ieee->dev, &sec); 5837 - break; 5838 - } 5839 - 5840 - case IPW2100_PARAM_PRIVACY_INVOKED: 5841 - priv->ieee->privacy_invoked = value; 5842 - break; 5843 - 5844 - case IPW2100_PARAM_AUTH_ALGS: 5845 - ret = ipw2100_wpa_set_auth_algs(priv, value); 5846 - break; 5847 - 5848 - case IPW2100_PARAM_IEEE_802_1X: 5849 - priv->ieee->ieee802_1x = value; 5850 - break; 5851 - 5852 - default: 5853 - printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", 5854 - dev->name, name); 5855 - ret = -EOPNOTSUPP; 5856 - } 5857 - 5858 - return ret; 5859 - } 5860 - 5861 - static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason) 5862 - { 5863 - 5864 - struct ipw2100_priv *priv = ieee80211_priv(dev); 5865 - int ret = 0; 5866 - 5867 - switch (command) { 5868 - case IPW2100_MLME_STA_DEAUTH: 5869 - // silently ignore 5870 - break; 5871 - 5872 - case IPW2100_MLME_STA_DISASSOC: 5873 - ipw2100_disassociate_bssid(priv); 5874 - break; 5875 - 5876 - default: 5877 - printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", 5878 - dev->name, command); 5879 - ret = -EOPNOTSUPP; 5880 - } 5881 - 5882 - return ret; 5883 - } 5884 - 5885 - static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, 5886 - struct ipw2100_param *param, int plen) 5887 - { 5888 - 5889 - struct ipw2100_priv *priv = ieee80211_priv(dev); 5890 - struct ieee80211_device *ieee = priv->ieee; 5891 - u8 *buf; 5892 - 5893 - if (!ieee->wpa_enabled) 5894 - return -EOPNOTSUPP; 5895 - 5896 - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || 5897 - (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) 5898 - return -EINVAL; 5899 - 5900 - if (param->u.wpa_ie.len) { 5901 - buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); 5902 - if (buf == NULL) 5903 - return -ENOMEM; 5904 - 5905 - memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); 5906 - 5907 - kfree(ieee->wpa_ie); 5908 - ieee->wpa_ie = buf; 5909 - ieee->wpa_ie_len = param->u.wpa_ie.len; 5910 - 5911 - } else { 5912 - kfree(ieee->wpa_ie); 5913 - ieee->wpa_ie = NULL; 5914 - ieee->wpa_ie_len = 0; 5915 - } 5916 - 5917 - ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); 5918 - 5919 - return 0; 5920 - } 5921 - 5922 - /* implementation borrowed from hostap driver */ 5923 - 5924 - static int ipw2100_wpa_set_encryption(struct net_device *dev, 5925 - struct ipw2100_param *param, 5926 - int param_len) 5927 - { 5928 - int ret = 0; 5929 - struct ipw2100_priv *priv = ieee80211_priv(dev); 5930 - struct ieee80211_device *ieee = priv->ieee; 5931 - struct ieee80211_crypto_ops *ops; 5932 - struct ieee80211_crypt_data **crypt; 5933 - 5934 - struct ieee80211_security sec = { 5935 - .flags = 0, 5936 - }; 5937 - 5938 - param->u.crypt.err = 0; 5939 - param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; 5940 - 5941 - if (param_len != 5942 - (int)((char *)param->u.crypt.key - (char *)param) + 5943 - param->u.crypt.key_len) { 5944 - IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, 5945 - param->u.crypt.key_len); 5946 - return -EINVAL; 5947 - } 5948 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 5949 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 5950 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 5951 - if (param->u.crypt.idx >= WEP_KEYS) 5952 - return -EINVAL; 5953 - crypt = &ieee->crypt[param->u.crypt.idx]; 5954 - } else { 5955 - return -EINVAL; 5956 - } 5957 - 5958 - sec.flags |= SEC_ENABLED | SEC_ENCRYPT; 5959 - if (strcmp(param->u.crypt.alg, "none") == 0) { 5960 - if (crypt) { 5961 - sec.enabled = 0; 5962 - sec.encrypt = 0; 5963 - sec.level = SEC_LEVEL_0; 5964 - sec.flags |= SEC_LEVEL; 5965 - ieee80211_crypt_delayed_deinit(ieee, crypt); 5966 - } 5967 - goto done; 5968 - } 5969 - sec.enabled = 1; 5970 - sec.encrypt = 1; 5971 - 5972 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 5973 - if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 5974 - request_module("ieee80211_crypt_wep"); 5975 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 5976 - } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 5977 - request_module("ieee80211_crypt_tkip"); 5978 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 5979 - } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 5980 - request_module("ieee80211_crypt_ccmp"); 5981 - ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 5982 - } 5983 - if (ops == NULL) { 5984 - IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", 5985 - dev->name, param->u.crypt.alg); 5986 - param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; 5987 - ret = -EINVAL; 5988 - goto done; 5989 - } 5990 - 5991 - if (*crypt == NULL || (*crypt)->ops != ops) { 5992 - struct ieee80211_crypt_data *new_crypt; 5993 - 5994 - ieee80211_crypt_delayed_deinit(ieee, crypt); 5995 - 5996 - new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); 5997 - if (new_crypt == NULL) { 5998 - ret = -ENOMEM; 5999 - goto done; 6000 - } 6001 - new_crypt->ops = ops; 6002 - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 6003 - new_crypt->priv = 6004 - new_crypt->ops->init(param->u.crypt.idx); 6005 - 6006 - if (new_crypt->priv == NULL) { 6007 - kfree(new_crypt); 6008 - param->u.crypt.err = 6009 - IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; 6010 - ret = -EINVAL; 6011 - goto done; 6012 - } 6013 - 6014 - *crypt = new_crypt; 6015 - } 6016 - 6017 - if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && 6018 - (*crypt)->ops->set_key(param->u.crypt.key, 6019 - param->u.crypt.key_len, param->u.crypt.seq, 6020 - (*crypt)->priv) < 0) { 6021 - IPW_DEBUG_INFO("%s: key setting failed\n", dev->name); 6022 - param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; 6023 - ret = -EINVAL; 6024 - goto done; 6025 - } 6026 - 6027 - if (param->u.crypt.set_tx) { 6028 - ieee->tx_keyidx = param->u.crypt.idx; 6029 - sec.active_key = param->u.crypt.idx; 6030 - sec.flags |= SEC_ACTIVE_KEY; 6031 - } 6032 - 6033 - if (ops->name != NULL) { 6034 - 6035 - if (strcmp(ops->name, "WEP") == 0) { 6036 - memcpy(sec.keys[param->u.crypt.idx], 6037 - param->u.crypt.key, param->u.crypt.key_len); 6038 - sec.key_sizes[param->u.crypt.idx] = 6039 - param->u.crypt.key_len; 6040 - sec.flags |= (1 << param->u.crypt.idx); 6041 - sec.flags |= SEC_LEVEL; 6042 - sec.level = SEC_LEVEL_1; 6043 - } else if (strcmp(ops->name, "TKIP") == 0) { 6044 - sec.flags |= SEC_LEVEL; 6045 - sec.level = SEC_LEVEL_2; 6046 - } else if (strcmp(ops->name, "CCMP") == 0) { 6047 - sec.flags |= SEC_LEVEL; 6048 - sec.level = SEC_LEVEL_3; 6049 - } 6050 - } 6051 - done: 6052 - if (ieee->set_security) 6053 - ieee->set_security(ieee->dev, &sec); 6054 - 6055 - /* Do not reset port if card is in Managed mode since resetting will 6056 - * generate new IEEE 802.11 authentication which may end up in looping 6057 - * with IEEE 802.1X. If your hardware requires a reset after WEP 6058 - * configuration (for example... Prism2), implement the reset_port in 6059 - * the callbacks structures used to initialize the 802.11 stack. */ 6060 - if (ieee->reset_on_keychange && 6061 - ieee->iw_mode != IW_MODE_INFRA && 6062 - ieee->reset_port && ieee->reset_port(dev)) { 6063 - IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); 6064 - param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; 6065 - return -EINVAL; 6066 - } 6067 - 6068 - return ret; 6069 - } 6070 - 6071 - static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p) 6072 - { 6073 - 6074 - struct ipw2100_param *param; 6075 - int ret = 0; 6076 - 6077 - IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); 6078 - 6079 - if (p->length < sizeof(struct ipw2100_param) || !p->pointer) 6080 - return -EINVAL; 6081 - 6082 - param = (struct ipw2100_param *)kmalloc(p->length, GFP_KERNEL); 6083 - if (param == NULL) 6084 - return -ENOMEM; 6085 - 6086 - if (copy_from_user(param, p->pointer, p->length)) { 6087 - kfree(param); 6088 - return -EFAULT; 6089 - } 6090 - 6091 - switch (param->cmd) { 6092 - 6093 - case IPW2100_CMD_SET_WPA_PARAM: 6094 - ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, 6095 - param->u.wpa_param.value); 6096 - break; 6097 - 6098 - case IPW2100_CMD_SET_WPA_IE: 6099 - ret = ipw2100_wpa_set_wpa_ie(dev, param, p->length); 6100 - break; 6101 - 6102 - case IPW2100_CMD_SET_ENCRYPTION: 6103 - ret = ipw2100_wpa_set_encryption(dev, param, p->length); 6104 - break; 6105 - 6106 - case IPW2100_CMD_MLME: 6107 - ret = ipw2100_wpa_mlme(dev, param->u.mlme.command, 6108 - param->u.mlme.reason_code); 6109 - break; 6110 - 6111 - default: 6112 - printk(KERN_ERR DRV_NAME 6113 - ": %s: Unknown WPA supplicant request: %d\n", dev->name, 6114 - param->cmd); 6115 - ret = -EOPNOTSUPP; 6116 - 6117 - } 6118 - 6119 - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) 6120 - ret = -EFAULT; 6121 - 6122 - kfree(param); 6123 - return ret; 6124 - } 6125 - 6126 - static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 6127 - { 6128 - struct iwreq *wrq = (struct iwreq *)rq; 6129 - int ret = -1; 6130 - switch (cmd) { 6131 - case IPW2100_IOCTL_WPA_SUPPLICANT: 6132 - ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); 6133 - return ret; 6134 - 6135 - default: 6136 - return -EOPNOTSUPP; 6137 - } 6138 - 6139 - return -EOPNOTSUPP; 6140 - } 6141 - #endif /* WIRELESS_EXT < 18 */ 6142 5857 6143 5858 static void ipw_ethtool_get_drvinfo(struct net_device *dev, 6144 5859 struct ethtool_drvinfo *info) ··· 5914 6337 dev->open = ipw2100_open; 5915 6338 dev->stop = ipw2100_close; 5916 6339 dev->init = ipw2100_net_init; 5917 - #if WIRELESS_EXT < 18 5918 - dev->do_ioctl = ipw2100_ioctl; 5919 - #endif 5920 6340 dev->get_stats = ipw2100_stats; 5921 6341 dev->ethtool_ops = &ipw2100_ethtool_ops; 5922 6342 dev->tx_timeout = ipw2100_tx_timeout; ··· 7429 7855 return 0; 7430 7856 } 7431 7857 7432 - #if WIRELESS_EXT > 17 7433 7858 /* 7434 7859 * WE-18 WPA support 7435 7860 */ ··· 7690 8117 } 7691 8118 return 0; 7692 8119 } 7693 - #endif /* WIRELESS_EXT > 17 */ 7694 8120 7695 8121 /* 7696 8122 * ··· 7922 8350 NULL, /* SIOCWIWTHRSPY */ 7923 8351 ipw2100_wx_set_wap, /* SIOCSIWAP */ 7924 8352 ipw2100_wx_get_wap, /* SIOCGIWAP */ 7925 - #if WIRELESS_EXT > 17 7926 8353 ipw2100_wx_set_mlme, /* SIOCSIWMLME */ 7927 - #else 7928 - NULL, /* -- hole -- */ 7929 - #endif 7930 8354 NULL, /* SIOCGIWAPLIST -- deprecated */ 7931 8355 ipw2100_wx_set_scan, /* SIOCSIWSCAN */ 7932 8356 ipw2100_wx_get_scan, /* SIOCGIWSCAN */ ··· 7946 8378 ipw2100_wx_get_encode, /* SIOCGIWENCODE */ 7947 8379 ipw2100_wx_set_power, /* SIOCSIWPOWER */ 7948 8380 ipw2100_wx_get_power, /* SIOCGIWPOWER */ 7949 - #if WIRELESS_EXT > 17 7950 8381 NULL, /* -- hole -- */ 7951 8382 NULL, /* -- hole -- */ 7952 8383 ipw2100_wx_set_genie, /* SIOCSIWGENIE */ ··· 7955 8388 ipw2100_wx_set_encodeext, /* SIOCSIWENCODEEXT */ 7956 8389 ipw2100_wx_get_encodeext, /* SIOCGIWENCODEEXT */ 7957 8390 NULL, /* SIOCSIWPMKSA */ 7958 - #endif 7959 8391 }; 7960 8392 7961 8393 #define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV