Commit 4ae6ee2d authored by David Kilroy's avatar David Kilroy Committed by John W. Linville

orinoco: Don't use boolean parameter to record encoding type

For WPA support we need to encode NONE, WEP and TKIP in the encoding
parameter. In anticipation of this we need to change the usage away from
the current boolean usage.
Signed-off-by: default avatarDavid Kilroy <kilroyd@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 01632fa4
...@@ -2100,8 +2100,9 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv) ...@@ -2100,8 +2100,9 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
int err = 0; int err = 0;
int master_wep_flag; int master_wep_flag;
int auth_flag; int auth_flag;
int enc_flag;
if (priv->wep_on) if (priv->encode_alg == IW_ENCODE_ALG_WEP)
__orinoco_hw_setup_wepkeys(priv); __orinoco_hw_setup_wepkeys(priv);
if (priv->wep_restrict) if (priv->wep_restrict)
...@@ -2109,9 +2110,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv) ...@@ -2109,9 +2110,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
else else
auth_flag = HERMES_AUTH_OPEN; auth_flag = HERMES_AUTH_OPEN;
if (priv->encode_alg == IW_ENCODE_ALG_WEP)
enc_flag = 1;
else
enc_flag = 0;
switch (priv->firmware_type) { switch (priv->firmware_type) {
case FIRMWARE_TYPE_AGERE: /* Agere style WEP */ case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
if (priv->wep_on) { if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
/* Enable the shared-key authentication. */ /* Enable the shared-key authentication. */
err = hermes_write_wordrec(hw, USER_BAP, err = hermes_write_wordrec(hw, USER_BAP,
HERMES_RID_CNFAUTHENTICATION_AGERE, HERMES_RID_CNFAUTHENTICATION_AGERE,
...@@ -2119,14 +2125,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv) ...@@ -2119,14 +2125,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
} }
err = hermes_write_wordrec(hw, USER_BAP, err = hermes_write_wordrec(hw, USER_BAP,
HERMES_RID_CNFWEPENABLED_AGERE, HERMES_RID_CNFWEPENABLED_AGERE,
priv->wep_on); enc_flag);
if (err) if (err)
return err; return err;
break; break;
case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */ case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */
case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */ case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */
if (priv->wep_on) { if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
if (priv->wep_restrict || if (priv->wep_restrict ||
(priv->firmware_type == FIRMWARE_TYPE_SYMBOL)) (priv->firmware_type == FIRMWARE_TYPE_SYMBOL))
master_wep_flag = HERMES_WEP_PRIVACY_INVOKED | master_wep_flag = HERMES_WEP_PRIVACY_INVOKED |
...@@ -3008,7 +3014,7 @@ static int orinoco_init(struct net_device *dev) ...@@ -3008,7 +3014,7 @@ static int orinoco_init(struct net_device *dev)
priv->channel = 0; /* use firmware default */ priv->channel = 0; /* use firmware default */
priv->promiscuous = 0; priv->promiscuous = 0;
priv->wep_on = 0; priv->encode_alg = IW_ENCODE_ALG_NONE;
priv->tx_key = 0; priv->tx_key = 0;
/* Make the hardware available, as long as it hasn't been /* Make the hardware available, as long as it hasn't been
...@@ -3497,7 +3503,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, ...@@ -3497,7 +3503,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
struct orinoco_private *priv = netdev_priv(dev); struct orinoco_private *priv = netdev_priv(dev);
int index = (erq->flags & IW_ENCODE_INDEX) - 1; int index = (erq->flags & IW_ENCODE_INDEX) - 1;
int setindex = priv->tx_key; int setindex = priv->tx_key;
int enable = priv->wep_on; int encode_alg = priv->encode_alg;
int restricted = priv->wep_restrict; int restricted = priv->wep_restrict;
u16 xlen = 0; u16 xlen = 0;
int err = -EINPROGRESS; /* Call commit handler */ int err = -EINPROGRESS; /* Call commit handler */
...@@ -3531,9 +3537,9 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, ...@@ -3531,9 +3537,9 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
xlen = 0; xlen = 0;
/* Switch on WEP if off */ /* Switch on WEP if off */
if ((!enable) && (xlen > 0)) { if ((encode_alg != IW_ENCODE_ALG_WEP) && (xlen > 0)) {
setindex = index; setindex = index;
enable = 1; encode_alg = IW_ENCODE_ALG_WEP;
} }
} else { } else {
/* Important note : if the user do "iwconfig eth0 enc off", /* Important note : if the user do "iwconfig eth0 enc off",
...@@ -3555,7 +3561,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, ...@@ -3555,7 +3561,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
} }
if (erq->flags & IW_ENCODE_DISABLED) if (erq->flags & IW_ENCODE_DISABLED)
enable = 0; encode_alg = IW_ENCODE_ALG_NONE;
if (erq->flags & IW_ENCODE_OPEN) if (erq->flags & IW_ENCODE_OPEN)
restricted = 0; restricted = 0;
if (erq->flags & IW_ENCODE_RESTRICTED) if (erq->flags & IW_ENCODE_RESTRICTED)
...@@ -3570,14 +3576,15 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev, ...@@ -3570,14 +3576,15 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
priv->tx_key = setindex; priv->tx_key = setindex;
/* Try fast key change if connected and only keys are changed */ /* Try fast key change if connected and only keys are changed */
if (priv->wep_on && enable && (priv->wep_restrict == restricted) && if ((priv->encode_alg == encode_alg) &&
(priv->wep_restrict == restricted) &&
netif_carrier_ok(dev)) { netif_carrier_ok(dev)) {
err = __orinoco_hw_setup_wepkeys(priv); err = __orinoco_hw_setup_wepkeys(priv);
/* No need to commit if successful */ /* No need to commit if successful */
goto out; goto out;
} }
priv->wep_on = enable; priv->encode_alg = encode_alg;
priv->wep_restrict = restricted; priv->wep_restrict = restricted;
out: out:
...@@ -3606,7 +3613,7 @@ static int orinoco_ioctl_getiwencode(struct net_device *dev, ...@@ -3606,7 +3613,7 @@ static int orinoco_ioctl_getiwencode(struct net_device *dev,
index = priv->tx_key; index = priv->tx_key;
erq->flags = 0; erq->flags = 0;
if (! priv->wep_on) if (!priv->encode_alg)
erq->flags |= IW_ENCODE_DISABLED; erq->flags |= IW_ENCODE_DISABLED;
erq->flags |= index + 1; erq->flags |= index + 1;
......
...@@ -100,7 +100,7 @@ struct orinoco_private { ...@@ -100,7 +100,7 @@ struct orinoco_private {
/* Configuration paramaters */ /* Configuration paramaters */
u32 iw_mode; u32 iw_mode;
int prefer_port3; int prefer_port3;
u16 wep_on, wep_restrict, tx_key; u16 encode_alg, wep_restrict, tx_key;
struct orinoco_key keys[ORINOCO_MAX_KEYS]; struct orinoco_key keys[ORINOCO_MAX_KEYS];
int bitratemode; int bitratemode;
char nick[IW_ESSID_MAX_SIZE+1]; char nick[IW_ESSID_MAX_SIZE+1];
......
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