From nobody Mon Jun 26 12:08:20 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QqRSj2brwz4k6Tc; Mon, 26 Jun 2023 12:08:21 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QqRSj125tz3hS1; Mon, 26 Jun 2023 12:08:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hi/y+7j/gCk3bGUrIedoWGMzUHBe+GseEkJ3GqoAnRg=; b=p+s1aVKaRK80r7g8FVwxnRuPIfxFX/jBozFkFsGPW02c3iKrWAJobPNrkisDTcVOEZhWcw sdWed2vGfVgLeqm7/ZeYimkj6MwF7PCvrtgoHjR8ddexDwjjyi+0IEcVLsXS21AnuoA7mz M47jGN6O7wCLAIhVYsRgI0QeEX9sqGu2teuiTVx0/sVYW0xZ8xfTf2cuhJ490csJsjscds LdFVOeVrU1StcV5DsL1HRv/BDcfC4BKjBCLbOt0KMiTnqgIIHAq66aHn0lQzZOhqWTgHMP FgdOoZi1FtXD/Dpt9bxTBoA5xaBveUjW/Q0WlSK3fcK3APfdIfxrs+Zr/UrZLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687781301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hi/y+7j/gCk3bGUrIedoWGMzUHBe+GseEkJ3GqoAnRg=; b=EdKOfXu+N98irsWCUgSVycEri4KtojW/jmquNUqCqip2kwup6xYgpvVSLalvwjlVZgGTA8 iwlU42rR+NenpXrTBMW4W5PcCVN6BfIbgdy41R/wE7h4jQWg3LoeCzUHUH7fBErJqG8shX sVTFpC845fQ6tHglzHR/c3na7Xrx5lbc1nfL5Y87UaTF4iHm50bWLTxiJQrOwSqIRtnr0k dWkqjwIudRjolCz5owG4pqlXQ9t9WDeBI/P+nzkxAt//kmXdREPDdIdD8Fi0P2uI5yJERc k74h5yeQyppKpw2vyd9WR2WsBU47MqA6aj/kP2fp9HrZ++2ZmIC1GyEb7tRKHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687781301; a=rsa-sha256; cv=none; b=MIj5/OTfOfMDfAGFcItdFkcsK2bJduldToEa9RDltOUqcxHlYBh6LMwQopd7FkjjizFIc1 0txYToaqlYSZdaUlKT9ENoXfdjnRfYC7TWxK3iM3Mzk565B2FJhaSDV1KX0dKBt5OgsXMo MOZ656q9q2U+hLw1ECsKOlWNclRhoNqJfcJE1Fl0ctMzMQlLTM1+KNm1jZkyzSWfFvHMIx a+1AD+UlrNpS2M8HXgF6qtMpNaM80PkD6ZTCmH6LQ5FwNiTo/2LncjtKWE0B/Hp/Tx1nAk 9GOY9dlZUt1QUuXbHIpPKsbG4pBPK78CtAg4JIAcZp76GAgiM0HNGfX+gs8uDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QqRSh6KQRz18Cd; Mon, 26 Jun 2023 12:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35QC8KqY082791; Mon, 26 Jun 2023 12:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35QC8KXl082790; Mon, 26 Jun 2023 12:08:20 GMT (envelope-from git) Date: Mon, 26 Jun 2023 12:08:20 GMT Message-Id: <202306261208.35QC8KXl082790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a3a5f67d3949 - stable/13 - ifconfig: ifieee80211: print bssid name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3a5f67d394999dc79be1c32a02ae659eea24963 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a3a5f67d394999dc79be1c32a02ae659eea24963 commit a3a5f67d394999dc79be1c32a02ae659eea24963 Author: Bjoern A. Zeeb AuthorDate: 2023-03-21 21:25:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-06-26 08:29:30 +0000 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. Reviewed by: adrian, cy Differential Revision: https://reviews.freebsd.org/D39192 (cherry picked from commit e091be417add7e9130653462012a9ab2f4fb5269) --- sbin/ifconfig/ifieee80211.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 @@ -3716,6 +3716,17 @@ printmimo(const struct ieee80211_mimo_info *mi) mi->ch[3].noise[0]); } +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) { @@ -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 ");