Search Linux Wireless

Re: [RFT] mac80211: clean up set_key callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 08 December 2008 18:23:55 Johannes Berg wrote:
> --- everything.orig/drivers/net/wireless/b43/main.c	2008-12-08 17:42:05.000000000 +0100
> +++ everything/drivers/net/wireless/b43/main.c	2008-12-08 17:49:40.000000000 +0100
> @@ -3508,8 +3508,8 @@ static void b43_op_bss_info_changed(stru
>  }
>  
>  static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
> -			   const u8 *local_addr, const u8 *addr,
> -			   struct ieee80211_key_conf *key)
> +			  struct ieee80211_vif *vif, struct ieee80211_sta *sta,
> +			  struct ieee80211_key_conf *key)
>  {
>  	struct b43_wl *wl = hw_to_b43_wl(hw);
>  	struct b43_wldev *dev;
> @@ -3567,17 +3567,13 @@ static int b43_op_set_key(struct ieee802
>  			goto out_unlock;
>  		}
>  
> -		if (is_broadcast_ether_addr(addr)) {
> +		if (!sta) {
>  			/* addr is FF:FF:FF:FF:FF:FF for default keys */

Please also remove this comment.

>  			err = b43_key_write(dev, index, algorithm,
>  					    key->key, key->keylen, NULL, key);
>  		} else {
> -			/*
> -			 * either pairwise key or address is 00:00:00:00:00:00
> -			 * for transmit-only keys
> -			 */
> -			err = b43_key_write(dev, -1, algorithm,
> -					    key->key, key->keylen, addr, key);
> +			err = b43_key_write(dev, -1, algorithm, key->key,
> +					    key->keylen, sta->addr, key);
>  		}
>  		if (err)
>  			goto out_unlock;
> @@ -3604,10 +3600,12 @@ out_unlock:
>  	spin_unlock_irqrestore(&wl->irq_lock, flags);
>  	mutex_unlock(&wl->mutex);
>  	if (!err) {
> +		static const u8 bcast_addr[ETH_ALEN] =
> +			{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
>  		b43dbg(wl, "%s hardware based encryption for keyidx: %d, "
>  		       "mac: %s\n",
>  		       cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
> -		       print_mac(mac, addr));
> +		       print_mac(mac, sta ? sta->addr : bcast_addr));

Will throw "unused variable bcast_addr" for !DEBUG.
Use something like
		sta ? print_mac(mac, sta->addr) : "group/tx-only");

-- 
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux