Search Linux Wireless

Re: [PATCH] mac80211: add key flag for management keys

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

 



On Friday 07 September 2012 19:26:34 Johannes Berg wrote:
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 03fe6d1..b45f410 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -170,6 +170,38 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
>  		}
>  	}
>  
> +	switch (sdata->vif.type) {
> +	case NL80211_IFTYPE_STATION:
> +		if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED)
> +			key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
> +		break;
> +	case NL80211_IFTYPE_AP:
> +	case NL80211_IFTYPE_AP_VLAN:
> +		/* Keys without a station are used for TX only */
> +		if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP))
> +			key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
> +		break;
> +	case NL80211_IFTYPE_ADHOC:
> +		/* no MFP (yet) */
> +		break;
> +	case NL80211_IFTYPE_MESH_POINT:
> +#ifdef CONFIG_MAC80211_MESH
> +		if (sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE)
> +			key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
> +		break;
> +#endif
> +	case NL80211_IFTYPE_WDS:
> +	case NL80211_IFTYPE_MONITOR:
> +	case NL80211_IFTYPE_P2P_DEVICE:
> +	case NL80211_IFTYPE_UNSPECIFIED:
> +	case NUM_NL80211_IFTYPES:
> +	case NL80211_IFTYPE_P2P_CLIENT:
> +	case NL80211_IFTYPE_P2P_GO:
> +		/* shouldn't happen */
> +		WARN_ON(1);
> +		break;
> +	}
> +
Is there a reason not to use default: ? 

	...
#ifdef CONFIG_MAC80211_MESH
	case NL80211_IFTYPE_MESH_POINT:
		if (sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE)
			key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
	break;
#endif
	default:
		/* shouldn't happen */
		WARN_ON(1);
		break;
}

Regards,
	Chr
--
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 Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux