Search Linux Wireless

Re: [PATCH v3 1/2] nl80211/cfg80211: add scan channel times to scan command

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

 



On Wed, Jun 20, 2012 at 11:29 AM, Johannes Berg
<johannes@xxxxxxxxxxxxxxxx> wrote:
> Yes, but if we let the attributes through then the driver author can
> test his code and see different timings, even though the flag isn't set,
> and then get confused. It'd be easier for the driver authors and more
> reliable if we require the flag to be set for even reading timings from
> userspace. Otherwise the driver might honour them even if the flag isn't
> set which is very odd.
>

Will add this check, so we will read scan attributes only if the
NL80211_FEATURE_SCAN_TIMES is set by the  driver.

>
>> > I pointed this out before -- this is problematic. Userspace could
>> > request a max time of 10, and then this would set the min time to 30,
>> > which means min > max which is completely stupid. We should prevent such
>> > settings.
>> >
>>
>> This check is done in nl80211_trigger_scan(), please see:
>>
>> +» » if·(request->min_ch_time·>·request->max_ch_time)
>> +» » » return·-EINVAL;
>>
>> and
>>
>> +» » if·(request->min_passive_ch_time·>·request->max_passive_ch_time)
>> +» » » return·-EINVAL;
>>
>> in this case we return EINVAL, btw this also documented:
>> + *    If one of the min times will be greater than max or set to zero,
>> + *    -EINVAL will be returned. For the software scan only the min times
>
> You're not getting it.
>
> If I set *ONLY* max_passive_ch_time = 10 via nl80211, what will happen?
>

There is no MAX times for the software scan, so the default values
will be used ,no problem here.
The hw_scan has it's own specific default values, and it should
validate that his default min_passive_channel_time is <=
max_passive_ch_time from the user request.

The other option is to enforce usermode to define always min *and*
max, something like:
if ((info->attrs[NL80211_ATTR_SCAN_MIN_CH_TIME]) &&
    (info->attrs[NL80211_ATTR_SCAN_MAX_CH_TIME])) {
             request->min_ch_time =
nla_get_u32(info->attrs[NL80211_ATTR_SCAN_MIN_CH_TIME]);
             request->max_ch_time =
nla_get_u32(info->attrs[NL80211_ATTR_SCAN_MAX_CH_TIME]);
    }

Although, not sure that enforcing is the correct way ?

-- 
Thanks,
Victor.
--
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