diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-06-23 21:41:31 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-06-23 21:41:31 +0000 |
commit | 53ef7adb09e85e0a785aef306986cfd841a1d78f (patch) | |
tree | 0a3415640b7f0595c347d632d927c3b68c48b33a /sbin/ifconfig | |
parent | 50ce312adac770b79263b008d576e5ba017dc074 (diff) |
allow ifconfig to print the signal quality of the current ap. if the
driver reports a RSSI Max value, print the signal quality as a
percentage instead of the arbitrary "dB" value, this also applies to
the output of ifconfig -M (scan/node list).
ok damien@ jsg@
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 376c11b3546..33f6919c838 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.167 2006/06/15 16:19:59 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.168 2006/06/23 21:41:30 reyk Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -1484,6 +1484,7 @@ ieee80211_status(void) struct ieee80211chanreq channel; struct ieee80211_bssid bssid; struct ieee80211_txpower txpower; + struct ieee80211_nodereq nr; u_int8_t zero_bssid[IEEE80211_ADDR_LEN]; u_int8_t keybuf[IEEE80211_WEP_NKID][16]; struct ether_addr ea; @@ -1541,6 +1542,16 @@ ieee80211_status(void) memcpy(&ea.ether_addr_octet, bssid.i_bssid, sizeof(ea.ether_addr_octet)); printf("bssid %s ", ether_ntoa(&ea)); + + bzero(&nr, sizeof(nr)); + bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr)); + strlcpy(nr.nr_ifname, name, sizeof(nr.nr_ifname)); + if (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi) { + if (nr.nr_max_rssi) + printf("%u%% ", IEEE80211_NODEREQ_RSSI(&nr)); + else + printf("%udB ", nr.nr_rssi); + } } if (inwkey == 0 && nwkey.i_wepon > 0) { @@ -1687,7 +1698,10 @@ ieee80211_printnode(struct ieee80211_nodereq *nr) printf("lladdr %s ", ether_ntoa((struct ether_addr*)nr->nr_macaddr)); - printf("%udB ", nr->nr_rssi); + if (nr->nr_max_rssi) + printf("%u%% ", IEEE80211_NODEREQ_RSSI(nr)); + else + printf("%udB ", nr->nr_rssi); if (nr->nr_pwrsave) printf("powersave "); |