[Bug 259003] "ifconfig list scan" can terminate early, before scan ends

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 08 Oct 2021 11:28:21 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259003

            Bug ID: 259003
           Summary: "ifconfig list scan" can terminate early, before scan
                    ends
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: wireless
          Assignee: wireless_at_FreeBSD.org
          Reporter: bsdpr_at_phoe.frmug.org

On hosts equipped with more than one Wi-Fi interfaces it is possible that 
"ifconfig list scan" does not wait for the actual completion of the scan and
attempt to display incomplete results.

In scan_and_wait() (located in ifieee80211.c), the reception of a
RTM_IEEE80211_SCAN message is awaited. This loop can terminate early because
the interface this message is related to is not checked.

I recommend to change

                } while (rtm->rtm_type != RTM_IEEE80211 ||
                         ifan->ifan_what != RTM_IEEE80211_SCAN);

to

                } while (rtm->rtm_type != RTM_IEEE80211 ||
                         strcmp(ifan->ifan_name, name)!=0 ||
                         ifan->ifan_what != RTM_IEEE80211_SCAN);

This bug is present from 11 (at least) to current.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Fri Oct 08 2021 - 11:28:21 UTC

Original text of this message