From nobody Sun Dec 26 15:06:05 2021 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 DF06D1913A88; Sun, 26 Dec 2021 15:06:05 +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 4JMPJF469jz4k0k; Sun, 26 Dec 2021 15:06:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5EA564176; Sun, 26 Dec 2021 15:06:05 +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 1BQF65oJ080955; Sun, 26 Dec 2021 15:06:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BQF65XJ080954; Sun, 26 Dec 2021 15:06:05 GMT (envelope-from git) Date: Sun, 26 Dec 2021 15:06:05 GMT Message-Id: <202112261506.1BQF65XJ080954@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: 731bfa9f1803 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 731bfa9f180388e4081b64afb94c357643600238 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640531165; 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=SpE4LzmxctmdCG+2fuaRLo2WWHaTE/BDVKp1YEc4K/8=; b=qHOZSYJre6TFaAGJzAi7qZ8ccKV28vbY7UKE79teDKYEFWW7MxK5QhZL6f8HAQWrhOc0kv Wi2AHEr/wDyaMuSkR8LaE8c+I1jnOYBtZNAvVLM3fJ+aM8NNfqcqiTza9kS+sIPl90pDLm bbQSBBmSBh6tacNRjfofmUax0O/De5hApE0ivzTYbM7NvdJAGsBXCTnsJCbj14oHpNZQ/2 QSYg1NddcqcuycRKGwL3C/3EZbOQZw2KFjjDkMbk4lDTN/iBHi0J3QwDi5nIfuucKxLm26 AUde77fMY70mK1biRRPkx3ldVNmWU8ve1u1Bs5pDvbIGjM8OGQlZ6hbOvuWStw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640531165; a=rsa-sha256; cv=none; b=K/vgsXNMKvG7Q3zzpWbEjzMtdjmmIUTuepMW3aS1wnRU9MfPVKrRe/X+DwkusUVOZRH6ux mhz4axhfIJC9T4W1ReZRBefCN7kCpasMYlLsxbE8bcY6+VuL5oInvzm3zFgILf4aCLB0E+ mVM1+H678O3fA5r3nU5h92DJZ0z6eICaULo6RAujbQ9a0woSXzZGtXkVOVtFswzp0Y8vSy M18r1cnErWhZ81mnaJLW0p6Qaf5DjYOxUs3Ym9lxCjVu9OIcnsir+d8Lay/sUWkF35OH+F 2Lef2N5sjaBdSrkEEBdPyZcsO803na/t+xmOcKOlm+D4uw69/LJ8H00Qd5JRGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=731bfa9f180388e4081b64afb94c357643600238 commit 731bfa9f180388e4081b64afb94c357643600238 Author: Alexander V. Chernikov AuthorDate: 2021-12-26 15:02:06 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-12-26 15:05:10 +0000 netstat: fix nhop prepend printing. If present, print nexthop L2 prepend data in hex. MFC after: 1 week --- 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");