aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2020-08-07 12:24:23 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2020-08-07 12:24:23 +0000
commit7d1d4407f569fad7d495bdb492cc088d0aed48e3 (patch)
treeb6b9e435e86f88b203602ed3ea9c15974e9f652c /sbin/ifconfig
parent43233543248c0c0ffa0e5621c31bbb1bab77fd58 (diff)
downloadsrc-7d1d4407f569fad7d495bdb492cc088d0aed48e3.tar.gz
src-7d1d4407f569fad7d495bdb492cc088d0aed48e3.zip
net80211/ifconfig: print hardware device name for wlan interfaces
Add IEEE80211_IOC_IC_NAME to query the ic_name field and in ifconfig to print the parent interface again. This functionality was lost around r287197. It helps in case of multiple wlan interfaces and multiple underlying hardware devices to keep track which wlan interface belongs to which physical device. Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Reviewed by: adrian, Idwer Vollering MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25832
Notes
Notes: svn path=/head/; revision=364011
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifieee80211.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index d63c9710d8bf..88d905698c17 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -4779,6 +4779,23 @@ getid(int s, int ix, void *data, size_t len, int *plen, int mesh)
return 0;
}
+static int
+getdevicename(int s, void *data, size_t len, int *plen)
+{
+ struct ieee80211req ireq;
+
+ (void) memset(&ireq, 0, sizeof(ireq));
+ (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
+ ireq.i_type = IEEE80211_IOC_IC_NAME;
+ ireq.i_val = -1;
+ ireq.i_data = data;
+ ireq.i_len = len;
+ if (ioctl(s, SIOCG80211, &ireq) < 0)
+ return (-1);
+ *plen = ireq.i_len;
+ return (0);
+}
+
static void
ieee80211_status(int s)
{
@@ -5503,6 +5520,12 @@ end:
}
LINE_BREAK();
+
+ if (getdevicename(s, data, sizeof(data), &len) < 0)
+ return;
+ LINE_CHECK("parent interface: %s", data);
+
+ LINE_BREAK();
}
static int