aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2023-03-21 21:25:28 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2023-03-23 00:15:15 +0000
commite091be417add7e9130653462012a9ab2f4fb5269 (patch)
tree0a8587f2b6b5a29a46ce078941fa2e7aacbe2070
parentb5d43972e3941d6c03d935dc423385f3c2178d68 (diff)
downloadsrc-e091be417add7e9130653462012a9ab2f4fb5269.tar.gz
src-e091be417add7e9130653462012a9ab2f4fb5269.zip
ifconfig: ifieee80211: print bssid name
In certain setups (e.g., autonomous APs) it is extremly helpful to have a way to map the BSSIDs to names for both normal status output as well as the scan list. This often allows a quicker overview than remembering (or manually looking up) BSSIDs. Call ether_ntohost() on the bssid and consult /etc/ethers and print "(name)" after the bssid for the status output and "(name)" at the end of the line after the IE list. MFC after: 10 days Reviewed by: adrian, cy Differential Revision: https://reviews.freebsd.org/D39192
-rw-r--r--sbin/ifconfig/ifieee80211.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index cb465a02b794..065a141da0f1 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -3717,6 +3717,17 @@ printmimo(const struct ieee80211_mimo_info *mi)
}
static void
+printbssidname(const struct ether_addr *n)
+{
+ char name[MAXHOSTNAMELEN + 1];
+
+ if (ether_ntohost(name, n) != 0)
+ return;
+
+ printf(" (%s)", name);
+}
+
+static void
list_scan(int s)
{
uint8_t buf[24*1024];
@@ -3767,6 +3778,7 @@ list_scan(int s)
);
printies(vp + sr->isr_ssid_len + sr->isr_meshid_len,
sr->isr_ie_len, 24);
+ printbssidname((const struct ether_addr *)sr->isr_bssid);
printf("\n");
cp += sr->isr_len, len -= sr->isr_len;
} while (len >= sizeof(struct ieee80211req_scan_result));
@@ -4904,8 +4916,10 @@ ieee80211_status(int s)
printf(" channel UNDEF");
if (get80211(s, IEEE80211_IOC_BSSID, data, IEEE80211_ADDR_LEN) >= 0 &&
- (memcmp(data, zerobssid, sizeof(zerobssid)) != 0 || verbose))
+ (memcmp(data, zerobssid, sizeof(zerobssid)) != 0 || verbose)) {
printf(" bssid %s", ether_ntoa((struct ether_addr *)data));
+ printbssidname((struct ether_addr *)data);
+ }
if (get80211len(s, IEEE80211_IOC_STATIONNAME, data, sizeof(data), &len) != -1) {
printf("\n\tstationname ");