Search Linux Wireless

Re: [RFC 3/4] wifi: nl80211: validate RU puncturing bitmap

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

 



On Fri, 2022-12-02 at 10:35 -0800, Muna Sinada wrote:
> 
> +	[NL80211_ATTR_RU_PUNCT_SUPP_HE] = { .type = NLA_FLAG },
> +	[NL80211_ATTR_RU_PUNCT_BITMAP] = { .type = NLA_U16 },


I feel like at least in the API we should make that bigger already,
maybe U32 or even U64, at some point they're going to come up with wider
channels... should use NLA_RANGE or something to restrict it for now
though.


> +static int nl80211_parse_ru_punct_bitmap(struct cfg80211_registered_device *rdev,
> +					 struct net_device *dev,
> +					 struct genl_info *info,
> +					 struct vif_params *params)
> +{
> +	struct wireless_dev *wdev = dev->ieee80211_ptr;
> +	bool change = false;
> +
> +	if (info->attrs[NL80211_ATTR_RU_PUNCT_BITMAP]) {
> +		params->ru_punct_bitmap =
> +			 nla_get_u16(info->attrs[NL80211_ATTR_RU_PUNCT_BITMAP]);
> +
> +	if (!params->ru_punct_bitmap)
> +		return change;
> +
> +	params->ru_punct_bitmap_supp_he =
> +		nla_get_flag(info->attrs[NL80211_ATTR_RU_PUNCT_SUPP_HE]);
> +
> +	if (!rdev->wiphy.ru_punct_supp_bw &&
> +	    (params->ru_punct_bitmap || params->ru_punct_bitmap_supp_he))
> +		return -EOPNOTSUPP;
> +
> +	changed = true;

That doesn't even compile, right? :)

But you can get rid of the 'change' variable entirely.

> @@ -4175,6 +4209,12 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
>  		params.use_4addr = -1;
>  	}
>  
> +	err = nl80211_parse_ru_punct_bitmap(rdev, dev, info, &params);
> +	if (err < 0)
> +		return err;
> +	else if (err > 0)
> +		change = true;
> 

Frankly I'm not happy for this to be stuck into set_interface() like
that - can we add it to set_channel() only or something? At least there
should be too? And read it only if the channel is actually touched? This
feels very ad-hoc.

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