From nobody Tue Jun 13 06:40:47 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 4QgJpm09Hbz4cQdg; Tue, 13 Jun 2023 06:40:48 +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 4QgJpl5Kp2z3s0l; Tue, 13 Jun 2023 06:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686638447; 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=NWtP6PIybs57DFL6vISsjBxZmjc9InxFr9pQjdRIFfA=; b=RATda4wgT0oMStcjWcKtBNs9oWBj7s3woKSFExlkIDvxriNyrnudfLA01AGShHNe0fG/NI M7nU2WZeqr5gNk1BTKEVT8+tW29TKGNYYTE7V4bsZx9x2bzfpKtPvPtopwNdIKtG3DJRgV mkUcHMRMhzUrVHFEubE49q0XFtq4FTK9c5fcr2ueI9J15lAI7QiC3aHqJZDhz5Exe7Lo1S bu7nkaU3XtidArCcmBoIB8RWvQ96c1rwrKpodB4fDmFtiEbQHdgIgWA3goSuSndsfMq9Qh 5q2dsuX1V0/8hNLnQOri3ZflTUf5/bqK1PiUf9qhAR9r3rn7eirH8wG1eHNbKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686638447; 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=NWtP6PIybs57DFL6vISsjBxZmjc9InxFr9pQjdRIFfA=; b=IRjIhhryFLmv6Naz9l/7CcO0uW4FlkpStTgSIMfTdFh6h8UqZNRlBV7npWqo+XL+n1ateC ES2NmAyeZjBcgIyEh7LcLmnYEvAViVIIyoEefAjsY9uEhRua7svUX+hdjjYMmqcPIU2VhI eJx98dJ59Sf8Kl4KKyYEWRlUQeDA+BNagTyVoDDVu5HjK2f8Envfuwhp18QsDDOZxcNisY PI6QSqm2RGLfJaOjeg1gy0fzC7iKKjfRnI8pXZJGLxqd26lrQSYdBVsh05h85D6RnExCK8 ba/paNkLe2VCY/ecX15N4nH0N9BARJIoNzTemIGgolRxq6CvoijWYxtZYj42EQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686638447; a=rsa-sha256; cv=none; b=C+oCk25NOa8K9nttTX4IszcPKD9pNigrnD0HyN3OimCNmP251c3khjOstPKeLZ4JkJb1DU 0wh/dsuv1qGpelVqr1vg4l9ly6AKpU/kqj0P0aweb9mt6jArL+ysSuWp1w9xd8QcBkjEBQ NmKla7T1jTVTp2D06NmUUWE2x1YI76qgm2m041XaHwORzhHe5zCvp4JPiVQDzcSnb4Ppa+ yjxJ5CK0elQn+rAxoODG9Td2m1fZSohCbivP7oHHn6onF8bL4oQlmYU3uOTt8lRBV+Xjje yXk8rwhc8E/AImCYwsLBATT8WvHQxqXKAXzCdh+Mct8+HQpvYTDQhOWoU2O63Q== 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 4QgJpl4Qcpz1BnV; Tue, 13 Jun 2023 06:40:47 +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 35D6el45060348; Tue, 13 Jun 2023 06:40:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35D6elgF060347; Tue, 13 Jun 2023 06:40:47 GMT (envelope-from git) Date: Tue, 13 Jun 2023 06:40:47 GMT Message-Id: <202306130640.35D6elgF060347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d77ca41f7762 - main - ifconfig(8): add the dotted format for MAC addresses. 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: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d77ca41f7762bc909a83d87ebd95735b4021652f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d77ca41f7762bc909a83d87ebd95735b4021652f commit d77ca41f7762bc909a83d87ebd95735b4021652f Author: Trond Endrestol AuthorDate: 2023-06-13 06:36:16 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-06-13 06:40:15 +0000 ifconfig(8): add the dotted format for MAC addresses. MFC after: 2 weeks PR: 261572 --- sbin/ifconfig/af_link.c | 25 +++++++++++++++++++++---- sbin/ifconfig/ifconfig.8 | 5 ++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c index 8fd5e05044e2..7b7c5259d6c9 100644 --- a/sbin/ifconfig/af_link.c +++ b/sbin/ifconfig/af_link.c @@ -62,11 +62,28 @@ print_ether(const struct ether_addr *addr, const char *prefix) { char *ether_format = ether_ntoa(addr); - if (f_ether != NULL && strcmp(f_ether, "dash") == 0) { - char *format_char; + if (f_ether != NULL) { + if (strcmp(f_ether, "dash") == 0) { + char *format_char; - while ((format_char = strchr(ether_format, ':')) != NULL) { - *format_char = '-'; + while ((format_char = strchr(ether_format, ':')) != NULL) { + *format_char = '-'; + } + } else if (strcmp(f_ether, "dotted") == 0) { + /* Indices 0 and 1 is kept as is. */ + ether_format[ 2] = ether_format[ 3]; + ether_format[ 3] = ether_format[ 4]; + ether_format[ 4] = '.'; + ether_format[ 5] = ether_format[ 6]; + ether_format[ 6] = ether_format[ 7]; + ether_format[ 7] = ether_format[ 9]; + ether_format[ 8] = ether_format[10]; + ether_format[ 9] = '.'; + ether_format[10] = ether_format[12]; + ether_format[11] = ether_format[13]; + ether_format[12] = ether_format[15]; + ether_format[13] = ether_format[16]; + ether_format[14] = '\0'; } } printf("\t%s %s\n", prefix, ether_format); diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index a7e1bb26d81a..13685eba4c39 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd May 22, 2023 +.Dd June 13, 2023 .Dt IFCONFIG 8 .Os .Sh NAME @@ -156,6 +156,9 @@ Adjust the display of link-level ethernet (MAC) addresses: Separate address segments with a colon .It Cm dash Separate address segments with a dash +.It Cm dotted +Dotted notation, for example: +.Ql 5254.0015.4a3b .It Cm default Default format, .Cm colon