From nobody Tue Oct 17 19:15: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 4S93bm2Gftz4xssr; Tue, 17 Oct 2023 19:15: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 4S93bm1gkjz3GsM; Tue, 17 Oct 2023 19:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697570148; 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=kAC2X1tAahGRL/tSnTLimZ8O39hj44OGNvPIQDLoysQ=; b=GolOcFMkazhDMiGlbe6IEfVZzcEJk+TLqMyncfeRjJlg/RZYOFjEeuswIsJ4DWvVzjTI+9 9VShYcJpaQSy7lj1Jfyg0O0QAyuGuEwRx2JuX7ljv1wMIRjy9IG5C8NhJ+Nppos0GwMbmU yly+NOpL06QaOYt0o+bVt/JU1mLdU2BIWuR+sqxAzgMND1ARBLhfrzKq9qv8Ri0Ro2Jefu j4f2noi90xdsCzd6bz39WMVrGnI4q/Wq8UQS1NwzhJvLdGz/nGJnOUKMRwgECfaqJQ8NlU CZB8Qten8hKgXAFWngCV7Q8PiJj0V+z3270T/c+nAz5Xw7w72PyC54YIqy5CsA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697570148; a=rsa-sha256; cv=none; b=dilZlxz5KNefkcjML1K594Vz6dVdgKzg/l/6hKy3OCkpGY2NIcd4iwDpknkbP5UAjZOsUd Tfttg2P74ZSzWhGd5Zmuypnuqwv45/98Jf8274VWhuZ1IaUMpSEMbwU0jSK+OWSQdYpDhv 1Sqivo8VzzHxGOyV7SIZGtVetBLudwkgDzHuGYkD08C3p+7U2EKPb3lwP15V+7l/6EDb9X c6dCuEEjmgEsEoHDKMFHEH+wU3SDnmPD74pqMaMfp+f7qzuBo1PkLZJusoUEIp1lJedCer Exg7oQNt0qSbMvgmkehGCC6KL0wJoWk5eV1swDvgSiwD8HamMF/vRGe8B5QI1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697570148; 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=kAC2X1tAahGRL/tSnTLimZ8O39hj44OGNvPIQDLoysQ=; b=E40/8O9wHPKFR3ziBP22JPtKX9dyrP5xnJE975/CKNHmozphWh5GuJs3PECwiWoQ2KsUIQ 13xJcIuar4YKbLjknRWu6WdNymC/c4CuFAmHm2idiO44ZRPofIFNQfh+by9+Gz9mLnWXkZ ol6Y675y4mDB81BBv82eh8O9XnvAa2EoEsoCXAEciQxKMz/WXwkLpZ+/znNCPqUtEMzuin zcBIj5/u1dqfbu+IeY6AMGjRtVYQjfK2oTg/p2ctdhDQbY2S+84QLh2ZBoF4bY2BUxyjrm QdW3X2xZ8KhmZKBhOgfTWzCUCD5m5jTHkR7wrb9etu59JvfuyQpJ/SQkErin4Q== 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 4S93bm0bWkzc8P; Tue, 17 Oct 2023 19:15:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39HJFl42063576; Tue, 17 Oct 2023 19:15:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39HJFlEx063573; Tue, 17 Oct 2023 19:15:47 GMT (envelope-from git) Date: Tue, 17 Oct 2023 19:15:47 GMT Message-Id: <202310171915.39HJFlEx063573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 6e281255ea35 - main - lltable: fix ddb show llentry l3_addr pretty printer 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e281255ea3574ca666e99c535a9b2734871ded8 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e281255ea3574ca666e99c535a9b2734871ded8 commit 6e281255ea3574ca666e99c535a9b2734871ded8 Author: R. Christian McDonald AuthorDate: 2023-10-17 17:03:49 +0000 Commit: Kristof Provost CommitDate: 2023-10-17 17:03:49 +0000 lltable: fix ddb show llentry l3_addr pretty printer The ddb commands for lltable do not produce useful l3_addr information. This fixes the llentry pretty printer to correctly display the l3_addr Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42253 --- sys/net/if_llatbl.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index ef4f27dbb00c..fe5273cf19c0 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -1065,18 +1065,13 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info) } #ifdef DDB -struct llentry_sa { - struct llentry base; - struct sockaddr l3_addr; -}; - static void -llatbl_lle_show(struct llentry_sa *la) +llatbl_lle_show(struct llentry *lle) { - struct llentry *lle; uint8_t octet[6]; + sa_family_t af = AF_UNSPEC; + char l3_addr_fmt[] = " l3_addr=%s (af=%d)\n"; - lle = &la->base; db_printf("lle=%p\n", lle); db_printf(" lle_next=%p\n", lle->lle_next.cle_next); db_printf(" lle_lock=%p\n", &lle->lle_lock); @@ -1097,33 +1092,37 @@ llatbl_lle_show(struct llentry_sa *la) octet[0], octet[1], octet[2], octet[3], octet[4], octet[5]); db_printf(" lle_timer=%p\n", &lle->lle_timer); - switch (la->l3_addr.sa_family) { + if (lle->lle_tbl) { + af = lle->lle_tbl->llt_af; + } + + switch (af) { #ifdef INET case AF_INET: { - struct sockaddr_in *sin; + struct sockaddr_in sin; char l3s[INET_ADDRSTRLEN]; - sin = (struct sockaddr_in *)&la->l3_addr; - inet_ntoa_r(sin->sin_addr, l3s); - db_printf(" l3_addr=%s\n", l3s); + lltable_fill_sa_entry(lle, (struct sockaddr *)&sin); + (void) inet_ntop(af, &sin.sin_addr, l3s, sizeof(l3s)); + db_printf(l3_addr_fmt, l3s, af); break; } #endif #ifdef INET6 case AF_INET6: { - struct sockaddr_in6 *sin6; + struct sockaddr_in6 sin6; char l3s[INET6_ADDRSTRLEN]; - sin6 = (struct sockaddr_in6 *)&la->l3_addr; - ip6_sprintf(l3s, &sin6->sin6_addr); - db_printf(" l3_addr=%s\n", l3s); + lltable_fill_sa_entry(lle, (struct sockaddr *)&sin6); + (void) inet_ntop(af, &sin6.sin6_addr, l3s, sizeof(l3s)); + db_printf(l3_addr_fmt, l3s, af); break; } #endif default: - db_printf(" l3_addr=N/A (af=%d)\n", la->l3_addr.sa_family); + db_printf(l3_addr_fmt, "N/A", af); break; } } @@ -1136,7 +1135,7 @@ DB_SHOW_COMMAND(llentry, db_show_llentry) return; } - llatbl_lle_show((struct llentry_sa *)addr); + llatbl_lle_show((struct llentry *)addr); } static void @@ -1150,7 +1149,7 @@ llatbl_llt_show(struct lltable *llt) for (i = 0; i < llt->llt_hsize; i++) { CK_LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { - llatbl_lle_show((struct llentry_sa *)lle); + llatbl_lle_show(lle); if (db_pager_quit) return; }