On 2019/11/06 19:17, Stefan Sperling wrote:
> This diff allows the root user to trigger a background scan with:
> 
>       ifconfig iwm0 scan
> 
> It supports two use cases which are currently not supported:
> 
> 1) It will force an attempt at finding a better AP, even if the
> current AP is above the signal level threshold which will usually
> trigger a background scan.
> 
> 2) It will update the list of cached APs. The updated list will be
> shown by subsequent invocations of 'ifconfig scan'. This allows the
> root user to view an up-to-date list of available networks without
> disassociating from the current AP. Currently, the list is updated only
> if a background scan is triggered via the signal strength threshold.
> 
> Suggested by sthen@
> 
> ok?

I'm finding this very helpful, if I'm on a low signal but working AP and
suspect that another one may be better this allows me to easily rescan
and (fairly seamlessly) move to a better one. Latency is a little higher
for a few seconds while the scan completes but packets continue flowing.

Currently the only way to trigger a scan on a bgscan interface (unless
moving to a low signal area) is ifconfig down+up which interrupts
connectivity.

The main thing I'm unsure about is whether to restrict this to root (as
this diff does) or not, there are arguments both ways - some will think
that it's also useful for an unprivileged user to be able to trigger a
search for a better AP, some will think that it's more useful to prevent
an unprivileged [possibly remote] user from being able to potentially
trigger a move to a different AP. Anyway this is an improvement and we
could remove the restriction later if wanted, so I'm OK with this as-is.


> diff 1bc5f745876be1d7923afca9b40fb6641254e697 /usr/src (staged changes)
> blob - b7b2ea6d631958b607ffdee06d272cd56320bf2e
> blob + d4c2a0ba6b1893af9652837998c759a6c0857048
> --- sys/net80211/ieee80211_ioctl.c
> +++ sys/net80211/ieee80211_ioctl.c
> @@ -906,6 +906,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
>                       na->na_nodes++;
>                       ni = RBT_NEXT(ieee80211_tree, ni);
>               }
> +             if (suser(curproc) == 0)
> +                     ieee80211_begin_bgscan(ifp);
>               break;
>       case SIOCG80211FLAGS:
>               flags = ic->ic_userflags;
> blob - b493ff0a5362fa11d7824fd8bd0ae0d57462d6c4
> blob + 501cbca0b9b8422fc9384ffbb9fb2c36b16cd2c0
> --- sys/net80211/ieee80211_var.h
> +++ sys/net80211/ieee80211_var.h
> @@ -460,6 +460,7 @@ void      ieee80211_del_ess(struct ieee80211com *, char 
> *, 
>  void ieee80211_set_ess(struct ieee80211com *, struct ieee80211_ess *,
>           struct ieee80211_node *);
>  struct ieee80211_ess *ieee80211_get_ess(struct ieee80211com *, const char *, 
> int);
> +void ieee80211_begin_bgscan(struct ifnet *);
>  
>  extern       int ieee80211_cache_size;
>  
> 

Reply via email to