1
0
Fork 0

wifi: fixed disconnected wifi status on openbsd

This commit is contained in:
Tobias Tschinkowitz 2018-05-31 13:53:49 +02:00 committed by Aaron Marcher
parent b0401b13bb
commit 8c8091f4f1

View file

@ -109,6 +109,7 @@
{ {
struct ieee80211_bssid bssid; struct ieee80211_bssid bssid;
int sockfd; int sockfd;
uint8_t zero_bssid[IEEE80211_ADDR_LEN];
memset(&bssid, 0, sizeof(bssid)); memset(&bssid, 0, sizeof(bssid));
memset(nr, 0, sizeof(struct ieee80211_nodereq)); memset(nr, 0, sizeof(struct ieee80211_nodereq));
@ -122,6 +123,12 @@
close(sockfd); close(sockfd);
return 0; return 0;
} }
memset(&zero_bssid, 0, sizeof(zero_bssid));
if (memcmp(bssid.i_bssid, zero_bssid,
IEEE80211_ADDR_LEN) == 0) {
close(sockfd);
return 0;
}
strlcpy(nr->nr_ifname, iface, sizeof(nr->nr_ifname)); strlcpy(nr->nr_ifname, iface, sizeof(nr->nr_ifname));
memcpy(&nr->nr_macaddr, bssid.i_bssid, sizeof(nr->nr_macaddr)); memcpy(&nr->nr_macaddr, bssid.i_bssid, sizeof(nr->nr_macaddr));
if ((ioctl(sockfd, SIOCG80211NODE, nr)) < 0 && nr->nr_rssi) { if ((ioctl(sockfd, SIOCG80211NODE, nr)) < 0 && nr->nr_rssi) {