Search Linux Wireless

Re: [PATCH 01/11] wifi: cfg80211: add option for vif allowed radios

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

 



> + * @NL80211_ATTR_VIF_RADIO_MASK: Bitmask of allowed radios (u32).
> + *	A value of 0 means all radios.

The handling of 0 seems inconsistent, you don't always initialize it, so
0 could be reported to userspace (for interfaces created other than
through nl80211), but setting it to 0 results in non-zero "full" bitmap.

Probably just need to always initialize it in cfg80211_init_wdev()?

Though not quite sure how that meshes with the nl80211 creation.

> +static int nl80211_parse_vif_radio_mask(struct genl_info *info,
> +					u32 *radio_mask)
> +{
> +	struct cfg80211_registered_device *rdev = info->user_ptr[0];
> +	struct nlattr *attr = info->attrs[NL80211_ATTR_VIF_RADIO_MASK];
> +	u32 mask, allowed;
> +
> +	if (!attr)
> +		return 0;

Might be nicer to also initialize *radio_mask here

> +	err = nl80211_parse_vif_radio_mask(info, &radio_mask);
> +	if (err < 0)
> +		return err;
> +	if (radio_mask && netif_running(dev))
> +		return -EBUSY;

and use the return value (==1) to distinguish this, rather than the
value you initialized radio_mask to (which is then not needed)?

Not sure, I can see benefits of this approach too I guess, just got
confused about it - and especially due to the zero issue pointed out
above.

johannes





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux