From owner-svn-src-head@freebsd.org Fri Aug 7 12:24:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B90C3B976F; Fri, 7 Aug 2020 12:24:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BNPgD2xxrz4MNQ; Fri, 7 Aug 2020 12:24:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4843C178F8; Fri, 7 Aug 2020 12:24:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 077COOjf091378; Fri, 7 Aug 2020 12:24:24 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077CONJv091374; Fri, 7 Aug 2020 12:24:23 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202008071224.077CONJv091374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 7 Aug 2020 12:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364011 - in head: sbin/ifconfig share/man/man4 sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sbin/ifconfig share/man/man4 sys/net80211 X-SVN-Commit-Revision: 364011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 12:24:24 -0000 Author: bz Date: Fri Aug 7 12:24:23 2020 New Revision: 364011 URL: https://svnweb.freebsd.org/changeset/base/364011 Log: 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 Modified: head/sbin/ifconfig/ifieee80211.c head/share/man/man4/net80211.4 head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_ioctl.h Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Fri Aug 7 12:19:21 2020 (r364010) +++ head/sbin/ifconfig/ifieee80211.c Fri Aug 7 12:24:23 2020 (r364011) @@ -4779,6 +4779,23 @@ getid(int s, int ix, void *data, size_t len, int *plen 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) { @@ -5501,6 +5518,12 @@ end: LINE_CHECK("hwmpmaxhops %u", val); } } + + LINE_BREAK(); + + if (getdevicename(s, data, sizeof(data), &len) < 0) + return; + LINE_CHECK("parent interface: %s", data); LINE_BREAK(); } Modified: head/share/man/man4/net80211.4 ============================================================================== --- head/share/man/man4/net80211.4 Fri Aug 7 12:19:21 2020 (r364010) +++ head/share/man/man4/net80211.4 Fri Aug 7 12:24:23 2020 (r364011) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2009 +.Dd August 7, 2020 .Dt NET80211 4 .Os .Sh NAME @@ -393,6 +393,16 @@ Valid values are: and .Dv IEEE80211_HWMP_ROOTMODE_RANN (send broadcast Root Announcement (RANN) frames). +.It Dv IEEE80211_IOC_IC_NAME +Return the underlying hardware +.Xr device 9 +name in the buffer pointed to by +.Va i_data +and the name length including terminating NUL character in +.Va i_len . +If the buffer length is too small to hold the full name +.Er EINVAL +will be returned. .It Dv IEEE80211_IOC_INACTIVITY Return whether or not the system handles inactivity processing in .Va i_val . Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Fri Aug 7 12:19:21 2020 (r364010) +++ head/sys/net80211/ieee80211_ioctl.c Fri Aug 7 12:24:23 2020 (r364011) @@ -785,6 +785,13 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l int error = 0; switch (ireq->i_type) { + case IEEE80211_IOC_IC_NAME: + len = strlen(ic->ic_name) + 1; + if (len > ireq->i_len) + return (EINVAL); + ireq->i_len = len; + error = copyout(ic->ic_name, ireq->i_data, ireq->i_len); + break; case IEEE80211_IOC_SSID: switch (vap->iv_state) { case IEEE80211_S_INIT: Modified: head/sys/net80211/ieee80211_ioctl.h ============================================================================== --- head/sys/net80211/ieee80211_ioctl.h Fri Aug 7 12:19:21 2020 (r364010) +++ head/sys/net80211/ieee80211_ioctl.h Fri Aug 7 12:24:23 2020 (r364011) @@ -743,6 +743,9 @@ struct ieee80211req { #define IEEE80211_IOC_QUIET_OFFSET 207 /* Quiet Offset */ #define IEEE80211_IOC_QUIET_DUR 208 /* Quiet Duration */ #define IEEE80211_IOC_QUIET_COUNT 209 /* Quiet Count */ + +#define IEEE80211_IOC_IC_NAME 210 /* HW device name. */ + /* * Parameters for controlling a scan requested with * IEEE80211_IOC_SCAN_REQ.