diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-08-05 16:23:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:12:42 -0400 |
commit | 5c9f41e285ad60013f0962746192769f899757be (patch) | |
tree | f834a575208c6b93e84c9ff57df65118399296fe /drivers/net/wireless/orinoco/wext.c | |
parent | bb7e43c061ad1e52a4738d5b45595ec9e1638b6a (diff) |
orinoco: use local types for auth alg and sequence length
This helps in the refactorring required to convert the driver to
cfg80211.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/wext.c')
-rw-r--r-- | drivers/net/wireless/orinoco/wext.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index b6ff3dbb7dd..33d81b4823a 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -180,7 +180,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, | |||
180 | struct orinoco_private *priv = ndev_priv(dev); | 180 | struct orinoco_private *priv = ndev_priv(dev); |
181 | int index = (erq->flags & IW_ENCODE_INDEX) - 1; | 181 | int index = (erq->flags & IW_ENCODE_INDEX) - 1; |
182 | int setindex = priv->tx_key; | 182 | int setindex = priv->tx_key; |
183 | int encode_alg = priv->encode_alg; | 183 | enum orinoco_alg encode_alg = priv->encode_alg; |
184 | int restricted = priv->wep_restrict; | 184 | int restricted = priv->wep_restrict; |
185 | u16 xlen = 0; | 185 | u16 xlen = 0; |
186 | int err = -EINPROGRESS; /* Call commit handler */ | 186 | int err = -EINPROGRESS; /* Call commit handler */ |
@@ -202,7 +202,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, | |||
202 | return -EBUSY; | 202 | return -EBUSY; |
203 | 203 | ||
204 | /* Clear any TKIP key we have */ | 204 | /* Clear any TKIP key we have */ |
205 | if ((priv->has_wpa) && (priv->encode_alg == IW_ENCODE_ALG_TKIP)) | 205 | if ((priv->has_wpa) && (priv->encode_alg == ORINOCO_ALG_TKIP)) |
206 | (void) orinoco_clear_tkip_key(priv, setindex); | 206 | (void) orinoco_clear_tkip_key(priv, setindex); |
207 | 207 | ||
208 | if (erq->length > 0) { | 208 | if (erq->length > 0) { |
@@ -212,15 +212,13 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, | |||
212 | /* Adjust key length to a supported value */ | 212 | /* Adjust key length to a supported value */ |
213 | if (erq->length > SMALL_KEY_SIZE) | 213 | if (erq->length > SMALL_KEY_SIZE) |
214 | xlen = LARGE_KEY_SIZE; | 214 | xlen = LARGE_KEY_SIZE; |
215 | else if (erq->length > 0) | 215 | else /* (erq->length > 0) */ |
216 | xlen = SMALL_KEY_SIZE; | 216 | xlen = SMALL_KEY_SIZE; |
217 | else | ||
218 | xlen = 0; | ||
219 | 217 | ||
220 | /* Switch on WEP if off */ | 218 | /* Switch on WEP if off */ |
221 | if ((encode_alg != IW_ENCODE_ALG_WEP) && (xlen > 0)) { | 219 | if (encode_alg != ORINOCO_ALG_WEP) { |
222 | setindex = index; | 220 | setindex = index; |
223 | encode_alg = IW_ENCODE_ALG_WEP; | 221 | encode_alg = ORINOCO_ALG_WEP; |
224 | } | 222 | } |
225 | } else { | 223 | } else { |
226 | /* Important note : if the user do "iwconfig eth0 enc off", | 224 | /* Important note : if the user do "iwconfig eth0 enc off", |
@@ -242,7 +240,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, | |||
242 | } | 240 | } |
243 | 241 | ||
244 | if (erq->flags & IW_ENCODE_DISABLED) | 242 | if (erq->flags & IW_ENCODE_DISABLED) |
245 | encode_alg = IW_ENCODE_ALG_NONE; | 243 | encode_alg = ORINOCO_ALG_NONE; |
246 | if (erq->flags & IW_ENCODE_OPEN) | 244 | if (erq->flags & IW_ENCODE_OPEN) |
247 | restricted = 0; | 245 | restricted = 0; |
248 | if (erq->flags & IW_ENCODE_RESTRICTED) | 246 | if (erq->flags & IW_ENCODE_RESTRICTED) |
@@ -825,7 +823,7 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev, | |||
825 | /* Set the requested key first */ | 823 | /* Set the requested key first */ |
826 | switch (alg) { | 824 | switch (alg) { |
827 | case IW_ENCODE_ALG_NONE: | 825 | case IW_ENCODE_ALG_NONE: |
828 | priv->encode_alg = alg; | 826 | priv->encode_alg = ORINOCO_ALG_NONE; |
829 | priv->keys[idx].len = 0; | 827 | priv->keys[idx].len = 0; |
830 | break; | 828 | break; |
831 | 829 | ||
@@ -837,7 +835,7 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev, | |||
837 | else | 835 | else |
838 | goto out; | 836 | goto out; |
839 | 837 | ||
840 | priv->encode_alg = alg; | 838 | priv->encode_alg = ORINOCO_ALG_WEP; |
841 | priv->keys[idx].len = cpu_to_le16(key_len); | 839 | priv->keys[idx].len = cpu_to_le16(key_len); |
842 | 840 | ||
843 | key_len = min(ext->key_len, key_len); | 841 | key_len = min(ext->key_len, key_len); |
@@ -854,7 +852,7 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev, | |||
854 | (ext->key_len > sizeof(priv->tkip_key[0]))) | 852 | (ext->key_len > sizeof(priv->tkip_key[0]))) |
855 | goto out; | 853 | goto out; |
856 | 854 | ||
857 | priv->encode_alg = alg; | 855 | priv->encode_alg = ORINOCO_ALG_TKIP; |
858 | memset(&priv->tkip_key[idx], 0, | 856 | memset(&priv->tkip_key[idx], 0, |
859 | sizeof(priv->tkip_key[idx])); | 857 | sizeof(priv->tkip_key[idx])); |
860 | memcpy(&priv->tkip_key[idx], ext->key, ext->key_len); | 858 | memcpy(&priv->tkip_key[idx], ext->key, ext->key_len); |
@@ -914,19 +912,21 @@ static int orinoco_ioctl_get_encodeext(struct net_device *dev, | |||
914 | encoding->flags = idx + 1; | 912 | encoding->flags = idx + 1; |
915 | memset(ext, 0, sizeof(*ext)); | 913 | memset(ext, 0, sizeof(*ext)); |
916 | 914 | ||
917 | ext->alg = priv->encode_alg; | ||
918 | switch (priv->encode_alg) { | 915 | switch (priv->encode_alg) { |
919 | case IW_ENCODE_ALG_NONE: | 916 | case ORINOCO_ALG_NONE: |
917 | ext->alg = IW_ENCODE_ALG_NONE; | ||
920 | ext->key_len = 0; | 918 | ext->key_len = 0; |
921 | encoding->flags |= IW_ENCODE_DISABLED; | 919 | encoding->flags |= IW_ENCODE_DISABLED; |
922 | break; | 920 | break; |
923 | case IW_ENCODE_ALG_WEP: | 921 | case ORINOCO_ALG_WEP: |
922 | ext->alg = IW_ENCODE_ALG_WEP; | ||
924 | ext->key_len = min_t(u16, le16_to_cpu(priv->keys[idx].len), | 923 | ext->key_len = min_t(u16, le16_to_cpu(priv->keys[idx].len), |
925 | max_key_len); | 924 | max_key_len); |
926 | memcpy(ext->key, priv->keys[idx].data, ext->key_len); | 925 | memcpy(ext->key, priv->keys[idx].data, ext->key_len); |
927 | encoding->flags |= IW_ENCODE_ENABLED; | 926 | encoding->flags |= IW_ENCODE_ENABLED; |
928 | break; | 927 | break; |
929 | case IW_ENCODE_ALG_TKIP: | 928 | case ORINOCO_ALG_TKIP: |
929 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
930 | ext->key_len = min_t(u16, sizeof(struct orinoco_tkip_key), | 930 | ext->key_len = min_t(u16, sizeof(struct orinoco_tkip_key), |
931 | max_key_len); | 931 | max_key_len); |
932 | memcpy(ext->key, &priv->tkip_key[idx], ext->key_len); | 932 | memcpy(ext->key, &priv->tkip_key[idx], ext->key_len); |