Date: Sat, 27 Apr 2019 01:50:10 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r346772 - stable/12/usr.sbin/nfsdumpstate Message-ID: <201904270150.x3R1oATR082879@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Sat Apr 27 01:50:09 2019 New Revision: 346772 URL: https://svnweb.freebsd.org/changeset/base/346772 Log: MFC: r346190 Fix nfsdumpstate(8) so that it can print out INET6 callback addresses. The patch adds support for printing of INET6 callback addresses. It also adds the #ifdef INET, INET6 as requested by bz@. Modified: stable/12/usr.sbin/nfsdumpstate/Makefile stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/nfsdumpstate/Makefile ============================================================================== --- stable/12/usr.sbin/nfsdumpstate/Makefile Sat Apr 27 00:53:41 2019 (r346771) +++ stable/12/usr.sbin/nfsdumpstate/Makefile Sat Apr 27 01:50:09 2019 (r346772) @@ -1,6 +1,15 @@ # $FreeBSD$ +.include <src.opts.mk> + PROG= nfsdumpstate MAN= nfsdumpstate.8 + +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DINET6 +.endif .include <bsd.prog.mk> Modified: stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c ============================================================================== --- stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c Sat Apr 27 00:53:41 2019 (r346771) +++ stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c Sat Apr 27 01:50:09 2019 (r346772) @@ -121,13 +121,14 @@ dump_openstate(void) { struct nfsd_dumplist dumplist; int cnt, i; + char nbuf[INET6_ADDRSTRLEN]; dumplist.ndl_size = DUMPSIZE; dumplist.ndl_list = (void *)dp; if (nfssvc(NFSSVC_DUMPCLIENTS, &dumplist) < 0) errx(1, "Can't perform dump clients syscall"); - printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-15s %s\n", + printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-45s %s\n", "Flags", "OpenOwner", "Open", "LockOwner", "Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID"); /* @@ -143,9 +144,23 @@ dump_openstate(void) dp[cnt].ndcl_nlocks, dp[cnt].ndcl_ndelegs, dp[cnt].ndcl_nolddelegs); - if (dp[cnt].ndcl_addrfam == AF_INET) - printf("%-15s ", + switch (dp[cnt].ndcl_addrfam) { +#ifdef INET + case AF_INET: + printf("%-45s ", inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr)); + break; +#endif +#ifdef INET6 + case AF_INET6: + if (inet_ntop(AF_INET6, &dp[cnt].ndcl_cbaddr.sin6_addr, + nbuf, sizeof(nbuf)) != NULL) + printf("%-45s ", nbuf); + else + printf("%-45s ", " "); + break; +#endif + } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); printf("\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904270150.x3R1oATR082879>