From nobody Mon Mar 28 15:25:57 2022 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 2195A1A315E0; Mon, 28 Mar 2022 15:25:58 +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 4KRxNj6vYMz3QNP; Mon, 28 Mar 2022 15:25:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648481158; 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=VnDRBv8zNiE/nu0dWtiG6RcIoU0F2eg5XuzFsFwrFm4=; b=H7+zvMVTSl+8MWIjx/6CQk+K0zPtCulOQY0R6x32kLjaVtIIzjyCruWVXoAcPJY0nr8NnT Jcbk1f8q0J9exPC/X2pyaxmevUNI4HjAw4gzkywvKaVIi6EXnyZ0t6wzC9zwBt36Uy8ofk CvcfmRlGew7dzpIk0DkGb1Q1QiAnVznFKZN6YGto7FSkUnf0bHcEnY99FonQZNVM6Q4CsM PGvX9eiwNFWvrC+/E/aANdvw3nX/C2ViX8P2vkSZbleeqcS9yTMJNg0Y7tEwtQeMxvqoEz 62rBPC+WtkjVFnLtGvY7jzWUbglqOI0CfK4amnpt8r2OSQJi08yO2WghoVX9jA== 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 CD7FB3BB9; Mon, 28 Mar 2022 15:25:57 +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 22SFPvVV086840; Mon, 28 Mar 2022 15:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22SFPvP0086839; Mon, 28 Mar 2022 15:25:57 GMT (envelope-from git) Date: Mon, 28 Mar 2022 15:25:57 GMT Message-Id: <202203281525.22SFPvP0086839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 3e624dfad1c3 - releng/13.1 - netstat: fix nhop prepend printing. 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 3e624dfad1c3dbbca711da6fb79caffb8dcc4d91 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648481158; 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=VnDRBv8zNiE/nu0dWtiG6RcIoU0F2eg5XuzFsFwrFm4=; b=rONj2H0+bPtwRPxUregvw6lVdjcxF3c9dziMXepeHsdaieawGoi90Nl8NzjHtcSCP5qRKV MgNPM5DdipVE2eaBpl10ug6NKP1yJshy/w3vZe+ajh9vFhK7pfXPBScHCwI9CuIozQAbwV PENeC9VBR06vFMrYpHYc6oHs1DY+WGOhB8Dopzx+R/+Z/MrCOGPG9JQeqPrKD/Tnrw3Oam 3B5u7wi5ajv/UtV2L7MzknhL9p+mCyBLdqv3xQINSMvGPdq/3kUp50VYaY2LmfpMBhwxNS n074H4e6oG/7EMWd6yTdxDnzPh6rx3MaJ3b8xeKygweN6AtKMHL0Et5+wp5PIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648481158; a=rsa-sha256; cv=none; b=l12r/h9AIRMEHZekyyfbG29+xJuqwU087NkUQGc1Wj4B3rFc3hmB23lk3Xj4V43Gd3xYdl OzoTOm2Cq2vxdIannMyIoz7sUfbRMAV4Cfu1cno28MdmFmolkDibIHiIkY1wX6pT9HH542 yyaZAmiab41VCAiHsygPNlnymk4D0kjlxUizyVZUF+96X2O9eqpbt1yuXObJxRbbObWhBl q6nxUeMUebXn99fA4abRv7WrUrlrg0TUVF8MVUlWBH5jhm+rJCWf26n3lPXUwj+bNyx1K7 eW0Ydfq3SSUVDg4bPcVF5AWX/rneuKkS1prOXJ4TjAB89S/PlLK07Uly6lrhkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3e624dfad1c3dbbca711da6fb79caffb8dcc4d91 commit 3e624dfad1c3dbbca711da6fb79caffb8dcc4d91 Author: Alexander V. Chernikov AuthorDate: 2021-12-26 15:02:06 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-03-28 15:24:57 +0000 netstat: fix nhop prepend printing. If present, print nexthop L2 prepend data in hex. Approved by: re(gjb) MFC after: 1 week (cherry picked from commit 731bfa9f180388e4081b64afb94c357643600238) (cherry picked from commit bea3efc01cb716e8e77d61af085795eb2d0c013c) --- usr.bin/netstat/nhops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/netstat/nhops.c b/usr.bin/netstat/nhops.c index 51bed6e23c0f..8fc8db9e7b85 100644 --- a/usr.bin/netstat/nhops.c +++ b/usr.bin/netstat/nhops.c @@ -312,8 +312,10 @@ print_nhop_entry_sysctl(const char *name, struct rt_msghdr *rtm, struct nhop_ext xo_emit("{t:refcount/%*lu} ", wid_refcnt, nh->nh_refcount); if (Wflag && nh->prepend_len) { - char *prepend_hex = "AABBCCDDEE"; - xo_emit(" {:nhop-prepend/%*s}", wid_prepend, prepend_hex); + int max_bytes = MIN(nh->prepend_len, sizeof(buffer) / 2 - 1); + for (int i = 0; i < max_bytes; i++) + snprintf(&buffer[i * 2], 3, "%02X", nh->nh_prepend[i]); + xo_emit(" {:nhop-prepend/%*s}", wid_prepend, buffer); } xo_emit("\n");