svn commit: r347009 - stable/11/usr.sbin/nfsdumpstate
Rick Macklem
rmacklem at FreeBSD.org
Thu May 2 01:11:51 UTC 2019
Author: rmacklem
Date: Thu May 2 01:11:49 2019
New Revision: 347009
URL: https://svnweb.freebsd.org/changeset/base/347009
Log:
MFC: r346709
Add support to nfsdumpstate for printing of INET6 addresses for locks.
r346190 added support for printing of INET6 addresses for the "-o" option
(all opens) but missed adding support for INET6 addresses for the "-l" option.
This patch adds that support.
Modified:
stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c
==============================================================================
--- stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c Thu May 2 01:02:26 2019 (r347008)
+++ stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c Thu May 2 01:11:49 2019 (r347009)
@@ -176,6 +176,7 @@ dump_lockstate(char *fname)
{
struct nfsd_dumplocklist dumplocklist;
int cnt, i;
+ char nbuf[INET6_ADDRSTRLEN];
dumplocklist.ndllck_size = DUMPSIZE;
dumplocklist.ndllck_list = (void *)lp;
@@ -183,7 +184,7 @@ dump_lockstate(char *fname)
if (nfssvc(NFSSVC_DUMPLOCKS, &dumplocklist) < 0)
errx(1, "Can't dump locks for %s\n", fname);
- printf("%-11s %-36s %-15s %s\n",
+ printf("%-11s %-36s %-45s %s\n",
"Open/Lock",
" Stateid or Lock Range",
"Clientaddr",
@@ -213,11 +214,26 @@ dump_lockstate(char *fname)
lock_flags(lp[cnt].ndlck_flags),
lp[cnt].ndlck_first,
lp[cnt].ndlck_end);
- if (lp[cnt].ndlck_addrfam == AF_INET)
- printf("%-15s ",
+ switch (lp[cnt].ndlck_addrfam) {
+#ifdef INET
+ case AF_INET:
+ printf("%-45s ",
inet_ntoa(lp[cnt].ndlck_cbaddr.sin_addr));
- else
- printf("%-15s ", " ");
+ break;
+#endif
+#ifdef INET6
+ case AF_INET6:
+ if (inet_ntop(AF_INET6, &lp[cnt].ndlck_cbaddr.sin6_addr,
+ nbuf, sizeof(nbuf)) != NULL)
+ printf("%-45s ", nbuf);
+ else
+ printf("%-45s ", " ");
+ break;
+#endif
+ default:
+ printf("%-45s ", " ");
+ break;
+ }
for (i = 0; i < lp[cnt].ndlck_owner.nclid_idlen; i++)
printf("%02x", lp[cnt].ndlck_owner.nclid_id[i]);
printf(" ");
More information about the svn-src-stable-11
mailing list