]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
wpa/hostapd: Fix 100% CPU when USB wlan NIC removed
authorCy Schubert <cy@FreeBSD.org>
Sun, 3 Apr 2022 03:54:50 +0000 (20:54 -0700)
committerCy Schubert <cy@FreeBSD.org>
Mon, 4 Apr 2022 13:11:28 +0000 (06:11 -0700)
commit6e5d01124fd4dd57899ddd9260c76dbb43543aa7
tree3b69692d199e8578663e9a3ab02950c3f80ee233
parentdb2d56ca01e8526ff077a7ecbfcaf9b3130f65b1
wpa/hostapd: Fix 100% CPU when USB wlan NIC removed

hostapd calls pcap_next(3) to read the next packet off the wlan interface.
pcap_next() returns a pointer to the packet header but does not indicate
success or failure. Unfortunately this results in an infinite loop (100%
CPU) when the wlan device disappears, i.e. when a USB wlan device is
manually removed or a USB error results in the device removal. However
pcap_next_ex(3) does return success or failure. To resolve this we use
pcap_next_ex(), forcing hostapd to exit when the error is encountered.

An error message is printed to syslog or stderr when debugging (-d flag)
is enabled. Unfortunately wpa_printf() only works when debugging is enabled.

PR: 253608
Reported by: Damjan Jovanovic <damjan.jov@gmail.com>,
bz (privately)
MFC after: 3 days
contrib/wpa/src/l2_packet/l2_packet_freebsd.c