print-nfs.c (127675) | print-nfs.c (146778) |
---|---|
1/* 2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 4 unchanged lines hidden (view full) --- 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * | 1/* 2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 4 unchanged lines hidden (view full) --- 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * |
21 * $FreeBSD: head/contrib/tcpdump/print-nfs.c 127675 2004-03-31 14:57:24Z bms $ | 21 * $FreeBSD: head/contrib/tcpdump/print-nfs.c 146778 2005-05-29 19:09:28Z sam $ |
22 */ 23 24#ifndef lint 25static const char rcsid[] _U_ = | 22 */ 23 24#ifndef lint 25static const char rcsid[] _U_ = |
26 "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.99.2.2 2003/11/16 08:51:35 guy Exp $ (LBL)"; | 26 "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.106 2005/01/05 08:16:45 guy Exp $ (LBL)"; |
27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include <tcpdump-stdinc.h> 34 | 27#endif 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include <tcpdump-stdinc.h> 34 |
35#include <rpc/rpc.h> 36 | |
37#include <pcap.h> 38#include <stdio.h> 39#include <string.h> 40 41#include "interface.h" 42#include "addrtoname.h" 43#include "extract.h" 44 45#include "nfs.h" 46#include "nfsfh.h" 47 48#include "ip.h" 49#ifdef INET6 50#include "ip6.h" 51#endif | 35#include <pcap.h> 36#include <stdio.h> 37#include <string.h> 38 39#include "interface.h" 40#include "addrtoname.h" 41#include "extract.h" 42 43#include "nfs.h" 44#include "nfsfh.h" 45 46#include "ip.h" 47#ifdef INET6 48#include "ip6.h" 49#endif |
50#include "rpc_auth.h" 51#include "rpc_msg.h" |
|
52 53static void nfs_printfh(const u_int32_t *, const u_int); | 52 53static void nfs_printfh(const u_int32_t *, const u_int); |
54static void xid_map_enter(const struct rpc_msg *, const u_char *); 55static int32_t xid_map_find(const struct rpc_msg *, const u_char *, | 54static void xid_map_enter(const struct sunrpc_msg *, const u_char *); 55static int32_t xid_map_find(const struct sunrpc_msg *, const u_char *, |
56 u_int32_t *, u_int32_t *); | 56 u_int32_t *, u_int32_t *); |
57static void interp_reply(const struct rpc_msg *, u_int32_t, u_int32_t, int); | 57static void interp_reply(const struct sunrpc_msg *, u_int32_t, u_int32_t, int); |
58static const u_int32_t *parse_post_op_attr(const u_int32_t *, int); 59static void print_sattr3(const struct nfsv3_sattr *sa3, int verbose); | 58static const u_int32_t *parse_post_op_attr(const u_int32_t *, int); 59static void print_sattr3(const struct nfsv3_sattr *sa3, int verbose); |
60static int print_int64(const u_int32_t *dp, int how); | |
61static void print_nfsaddr(const u_char *, const char *, const char *); 62 63/* 64 * Mapping of old NFS Version 2 RPC numbers to generic numbers. 65 */ 66u_int32_t nfsv3_procid[NFS_NPROCS] = { 67 NFSPROC_NULL, 68 NFSPROC_GETATTR, --- 85 unchanged lines hidden (view full) --- 154 { NFDIR, "DIR" }, 155 { NFBLK, "BLK" }, 156 { NFCHR, "CHR" }, 157 { NFLNK, "LNK" }, 158 { NFFIFO, "FIFO" }, 159 { 0, NULL } 160}; 161 | 60static void print_nfsaddr(const u_char *, const char *, const char *); 61 62/* 63 * Mapping of old NFS Version 2 RPC numbers to generic numbers. 64 */ 65u_int32_t nfsv3_procid[NFS_NPROCS] = { 66 NFSPROC_NULL, 67 NFSPROC_GETATTR, --- 85 unchanged lines hidden (view full) --- 153 { NFDIR, "DIR" }, 154 { NFBLK, "BLK" }, 155 { NFCHR, "CHR" }, 156 { NFLNK, "LNK" }, 157 { NFFIFO, "FIFO" }, 158 { 0, NULL } 159}; 160 |
162/* 163 * Print out a 64-bit integer. This appears to be different on each system, 164 * try to make the best of it. The integer stored as 2 consecutive XDR 165 * encoded 32-bit integers, to which a pointer is passed. 166 * 167 * Assume that a system that has INT64_FORMAT defined, has a 64-bit 168 * integer datatype and can print it. 169 */ 170 171#define UNSIGNED 0 172#define SIGNED 1 173#define HEX 2 174 175static int print_int64(const u_int32_t *dp, int how) 176{ 177#ifdef INT64_FORMAT 178 u_int64_t res; 179 180 res = ((u_int64_t)EXTRACT_32BITS(&dp[0]) << 32) | (u_int64_t)EXTRACT_32BITS(&dp[1]); 181 switch (how) { 182 case SIGNED: 183 printf(INT64_FORMAT, res); 184 break; 185 case UNSIGNED: 186 printf(U_INT64_FORMAT, res); 187 break; 188 case HEX: 189 printf(HEX_INT64_FORMAT, res); 190 break; 191 default: 192 return (0); 193 } 194#else 195 u_int32_t high; 196 197 high = EXTRACT_32BITS(&dp[0]); 198 199 switch (how) { 200 case SIGNED: 201 case UNSIGNED: 202 case HEX: 203 if (high != 0) 204 printf("0x%x%08x", high, EXTRACT_32BITS(&dp[1])); 205 else 206 printf("0x%x", EXTRACT_32BITS(&dp[1])); 207 break; 208 default: 209 return (0); 210 } 211#endif 212 return 1; 213} 214 | |
215static void 216print_nfsaddr(const u_char *bp, const char *s, const char *d) 217{ 218 struct ip *ip; 219#ifdef INET6 220 struct ip6_hdr *ip6; 221 char srcaddr[INET6_ADDRSTRLEN], dstaddr[INET6_ADDRSTRLEN]; 222#else --- 114 unchanged lines hidden (view full) --- 337 sa3->sa_mtime.nfsv3_nsec); 338 } 339} 340 341void 342nfsreply_print(register const u_char *bp, u_int length, 343 register const u_char *bp2) 344{ | 161static void 162print_nfsaddr(const u_char *bp, const char *s, const char *d) 163{ 164 struct ip *ip; 165#ifdef INET6 166 struct ip6_hdr *ip6; 167 char srcaddr[INET6_ADDRSTRLEN], dstaddr[INET6_ADDRSTRLEN]; 168#else --- 114 unchanged lines hidden (view full) --- 283 sa3->sa_mtime.nfsv3_nsec); 284 } 285} 286 287void 288nfsreply_print(register const u_char *bp, u_int length, 289 register const u_char *bp2) 290{ |
345 register const struct rpc_msg *rp; | 291 register const struct sunrpc_msg *rp; |
346 u_int32_t proc, vers; 347 char srcid[20], dstid[20]; /*fits 32bit*/ 348 349 nfserr = 0; /* assume no error */ | 292 u_int32_t proc, vers; 293 char srcid[20], dstid[20]; /*fits 32bit*/ 294 295 nfserr = 0; /* assume no error */ |
350 rp = (const struct rpc_msg *)bp; | 296 rp = (const struct sunrpc_msg *)bp; |
351 352 if (!nflag) { 353 strlcpy(srcid, "nfs", sizeof(srcid)); 354 snprintf(dstid, sizeof(dstid), "%u", 355 EXTRACT_32BITS(&rp->rm_xid)); 356 } else { 357 snprintf(srcid, sizeof(srcid), "%u", NFS_PORT); 358 snprintf(dstid, sizeof(dstid), "%u", 359 EXTRACT_32BITS(&rp->rm_xid)); 360 } 361 print_nfsaddr(bp2, srcid, dstid); 362 (void)printf("reply %s %d", | 297 298 if (!nflag) { 299 strlcpy(srcid, "nfs", sizeof(srcid)); 300 snprintf(dstid, sizeof(dstid), "%u", 301 EXTRACT_32BITS(&rp->rm_xid)); 302 } else { 303 snprintf(srcid, sizeof(srcid), "%u", NFS_PORT); 304 snprintf(dstid, sizeof(dstid), "%u", 305 EXTRACT_32BITS(&rp->rm_xid)); 306 } 307 print_nfsaddr(bp2, srcid, dstid); 308 (void)printf("reply %s %d", |
363 EXTRACT_32BITS(&rp->rm_reply.rp_stat) == MSG_ACCEPTED? 364 "ok":"ERR", 365 length); | 309 EXTRACT_32BITS(&rp->rm_reply.rp_stat) == SUNRPC_MSG_ACCEPTED? 310 "ok":"ERR", 311 length); |
366 367 if (xid_map_find(rp, bp2, &proc, &vers) >= 0) 368 interp_reply(rp, proc, vers, length); 369} 370 371/* 372 * Return a pointer to the first file handle in the packet. 373 * If the packet was truncated, return 0. 374 */ 375static const u_int32_t * | 312 313 if (xid_map_find(rp, bp2, &proc, &vers) >= 0) 314 interp_reply(rp, proc, vers, length); 315} 316 317/* 318 * Return a pointer to the first file handle in the packet. 319 * If the packet was truncated, return 0. 320 */ 321static const u_int32_t * |
376parsereq(register const struct rpc_msg *rp, register u_int length) | 322parsereq(register const struct sunrpc_msg *rp, register u_int length) |
377{ 378 register const u_int32_t *dp; 379 register u_int len; 380 381 /* 382 * find the start of the req data (if we captured it) 383 */ 384 dp = (u_int32_t *)&rp->rm_call.cb_cred; --- 83 unchanged lines hidden (view full) --- 468 putchar(' '); 469 return (parsefn(dp)); 470} 471 472void 473nfsreq_print(register const u_char *bp, u_int length, 474 register const u_char *bp2) 475{ | 323{ 324 register const u_int32_t *dp; 325 register u_int len; 326 327 /* 328 * find the start of the req data (if we captured it) 329 */ 330 dp = (u_int32_t *)&rp->rm_call.cb_cred; --- 83 unchanged lines hidden (view full) --- 414 putchar(' '); 415 return (parsefn(dp)); 416} 417 418void 419nfsreq_print(register const u_char *bp, u_int length, 420 register const u_char *bp2) 421{ |
476 register const struct rpc_msg *rp; | 422 register const struct sunrpc_msg *rp; |
477 register const u_int32_t *dp; 478 nfs_type type; 479 int v3; 480 u_int32_t proc; 481 struct nfsv3_sattr sa3; 482 char srcid[20], dstid[20]; /*fits 32bit*/ 483 484 nfserr = 0; /* assume no error */ | 423 register const u_int32_t *dp; 424 nfs_type type; 425 int v3; 426 u_int32_t proc; 427 struct nfsv3_sattr sa3; 428 char srcid[20], dstid[20]; /*fits 32bit*/ 429 430 nfserr = 0; /* assume no error */ |
485 rp = (const struct rpc_msg *)bp; | 431 rp = (const struct sunrpc_msg *)bp; |
486 if (!nflag) { 487 snprintf(srcid, sizeof(srcid), "%u", 488 EXTRACT_32BITS(&rp->rm_xid)); 489 strlcpy(dstid, "nfs", sizeof(dstid)); 490 } else { 491 snprintf(srcid, sizeof(srcid), "%u", 492 EXTRACT_32BITS(&rp->rm_xid)); 493 snprintf(dstid, sizeof(dstid), "%u", NFS_PORT); --- 56 unchanged lines hidden (view full) --- 550 break; 551 552 case NFSPROC_READ: 553 printf(" read"); 554 if ((dp = parsereq(rp, length)) != NULL && 555 (dp = parsefh(dp, v3)) != NULL) { 556 if (v3) { 557 TCHECK(dp[2]); | 432 if (!nflag) { 433 snprintf(srcid, sizeof(srcid), "%u", 434 EXTRACT_32BITS(&rp->rm_xid)); 435 strlcpy(dstid, "nfs", sizeof(dstid)); 436 } else { 437 snprintf(srcid, sizeof(srcid), "%u", 438 EXTRACT_32BITS(&rp->rm_xid)); 439 snprintf(dstid, sizeof(dstid), "%u", NFS_PORT); --- 56 unchanged lines hidden (view full) --- 496 break; 497 498 case NFSPROC_READ: 499 printf(" read"); 500 if ((dp = parsereq(rp, length)) != NULL && 501 (dp = parsefh(dp, v3)) != NULL) { 502 if (v3) { 503 TCHECK(dp[2]); |
558 printf(" %u bytes @ ", 559 EXTRACT_32BITS(&dp[2])); 560 print_int64(dp, UNSIGNED); | 504 printf(" %u bytes @ %" PRIu64, 505 EXTRACT_32BITS(&dp[2]), 506 EXTRACT_64BITS(&dp[0])); |
561 } else { 562 TCHECK(dp[1]); 563 printf(" %u bytes @ %u", 564 EXTRACT_32BITS(&dp[1]), 565 EXTRACT_32BITS(&dp[0])); 566 } 567 return; 568 } 569 break; 570 571 case NFSPROC_WRITE: 572 printf(" write"); 573 if ((dp = parsereq(rp, length)) != NULL && 574 (dp = parsefh(dp, v3)) != NULL) { 575 if (v3) { | 507 } else { 508 TCHECK(dp[1]); 509 printf(" %u bytes @ %u", 510 EXTRACT_32BITS(&dp[1]), 511 EXTRACT_32BITS(&dp[0])); 512 } 513 return; 514 } 515 break; 516 517 case NFSPROC_WRITE: 518 printf(" write"); 519 if ((dp = parsereq(rp, length)) != NULL && 520 (dp = parsefh(dp, v3)) != NULL) { 521 if (v3) { |
576 TCHECK(dp[4]); 577 printf(" %u bytes @ ", 578 EXTRACT_32BITS(&dp[4])); 579 print_int64(dp, UNSIGNED); | 522 TCHECK(dp[2]); 523 printf(" %u (%u) bytes @ %" PRIu64, 524 EXTRACT_32BITS(&dp[4]), 525 EXTRACT_32BITS(&dp[2]), 526 EXTRACT_64BITS(&dp[0])); |
580 if (vflag) { 581 dp += 3; 582 TCHECK(dp[0]); 583 printf(" <%s>", 584 tok2str(nfsv3_writemodes, 585 NULL, EXTRACT_32BITS(dp))); 586 } 587 } else { --- 98 unchanged lines hidden (view full) --- 686 if ((dp = parsereq(rp, length)) != NULL && 687 (dp = parsefh(dp, v3)) != NULL) { 688 if (v3) { 689 TCHECK(dp[4]); 690 /* 691 * We shouldn't really try to interpret the 692 * offset cookie here. 693 */ | 527 if (vflag) { 528 dp += 3; 529 TCHECK(dp[0]); 530 printf(" <%s>", 531 tok2str(nfsv3_writemodes, 532 NULL, EXTRACT_32BITS(dp))); 533 } 534 } else { --- 98 unchanged lines hidden (view full) --- 633 if ((dp = parsereq(rp, length)) != NULL && 634 (dp = parsefh(dp, v3)) != NULL) { 635 if (v3) { 636 TCHECK(dp[4]); 637 /* 638 * We shouldn't really try to interpret the 639 * offset cookie here. 640 */ |
694 printf(" %u bytes @ ", 695 EXTRACT_32BITS(&dp[4])); 696 print_int64(dp, SIGNED); | 641 printf(" %u bytes @ %" PRId64, 642 EXTRACT_32BITS(&dp[4]), 643 EXTRACT_64BITS(&dp[0])); |
697 if (vflag) 698 printf(" verf %08x%08x", dp[2], 699 dp[3]); 700 } else { 701 TCHECK(dp[1]); 702 /* 703 * Print the offset as signed, since -1 is 704 * common, but offsets > 2^31 aren't. --- 10 unchanged lines hidden (view full) --- 715 printf(" readdirplus"); 716 if ((dp = parsereq(rp, length)) != NULL && 717 (dp = parsefh(dp, v3)) != NULL) { 718 TCHECK(dp[4]); 719 /* 720 * We don't try to interpret the offset 721 * cookie here. 722 */ | 644 if (vflag) 645 printf(" verf %08x%08x", dp[2], 646 dp[3]); 647 } else { 648 TCHECK(dp[1]); 649 /* 650 * Print the offset as signed, since -1 is 651 * common, but offsets > 2^31 aren't. --- 10 unchanged lines hidden (view full) --- 662 printf(" readdirplus"); 663 if ((dp = parsereq(rp, length)) != NULL && 664 (dp = parsefh(dp, v3)) != NULL) { 665 TCHECK(dp[4]); 666 /* 667 * We don't try to interpret the offset 668 * cookie here. 669 */ |
723 printf(" %u bytes @ ", EXTRACT_32BITS(&dp[4])); 724 print_int64(dp, SIGNED); 725 if (vflag) | 670 printf(" %u bytes @ %" PRId64, 671 EXTRACT_32BITS(&dp[4]), 672 EXTRACT_64BITS(&dp[0])); 673 if (vflag) { 674 TCHECK(dp[5]); |
726 printf(" max %u verf %08x%08x", 727 EXTRACT_32BITS(&dp[5]), dp[2], dp[3]); | 675 printf(" max %u verf %08x%08x", 676 EXTRACT_32BITS(&dp[5]), dp[2], dp[3]); |
677 } |
|
728 return; 729 } 730 break; 731 732 case NFSPROC_FSSTAT: 733 printf(" fsstat"); 734 if ((dp = parsereq(rp, length)) != NULL && 735 parsefh(dp, v3) != NULL) --- 13 unchanged lines hidden (view full) --- 749 parsefh(dp, v3) != NULL) 750 return; 751 break; 752 753 case NFSPROC_COMMIT: 754 printf(" commit"); 755 if ((dp = parsereq(rp, length)) != NULL && 756 (dp = parsefh(dp, v3)) != NULL) { | 678 return; 679 } 680 break; 681 682 case NFSPROC_FSSTAT: 683 printf(" fsstat"); 684 if ((dp = parsereq(rp, length)) != NULL && 685 parsefh(dp, v3) != NULL) --- 13 unchanged lines hidden (view full) --- 699 parsefh(dp, v3) != NULL) 700 return; 701 break; 702 703 case NFSPROC_COMMIT: 704 printf(" commit"); 705 if ((dp = parsereq(rp, length)) != NULL && 706 (dp = parsefh(dp, v3)) != NULL) { |
757 printf(" %u bytes @ ", EXTRACT_32BITS(&dp[2])); 758 print_int64(dp, UNSIGNED); | 707 TCHECK(dp[2]); 708 printf(" %u bytes @ %" PRIu64, 709 EXTRACT_32BITS(&dp[2]), 710 EXTRACT_64BITS(&dp[0])); |
759 return; 760 } 761 break; 762 763 default: 764 printf(" proc-%u", EXTRACT_32BITS(&rp->rm_call.cb_proc)); 765 return; 766 } --- 89 unchanged lines hidden (view full) --- 856#define XIDMAPSIZE 64 857 858struct xid_map_entry xid_map[XIDMAPSIZE]; 859 860int xid_map_next = 0; 861int xid_map_hint = 0; 862 863static void | 711 return; 712 } 713 break; 714 715 default: 716 printf(" proc-%u", EXTRACT_32BITS(&rp->rm_call.cb_proc)); 717 return; 718 } --- 89 unchanged lines hidden (view full) --- 808#define XIDMAPSIZE 64 809 810struct xid_map_entry xid_map[XIDMAPSIZE]; 811 812int xid_map_next = 0; 813int xid_map_hint = 0; 814 815static void |
864xid_map_enter(const struct rpc_msg *rp, const u_char *bp) | 816xid_map_enter(const struct sunrpc_msg *rp, const u_char *bp) |
865{ 866 struct ip *ip = NULL; 867#ifdef INET6 868 struct ip6_hdr *ip6 = NULL; 869#endif 870 struct xid_map_entry *xmep; 871 872 switch (IP_V((struct ip *)bp)) { --- 31 unchanged lines hidden (view full) --- 904 xmep->vers = EXTRACT_32BITS(&rp->rm_call.cb_vers); 905} 906 907/* 908 * Returns 0 and puts NFSPROC_xxx in proc return and 909 * version in vers return, or returns -1 on failure 910 */ 911static int | 817{ 818 struct ip *ip = NULL; 819#ifdef INET6 820 struct ip6_hdr *ip6 = NULL; 821#endif 822 struct xid_map_entry *xmep; 823 824 switch (IP_V((struct ip *)bp)) { --- 31 unchanged lines hidden (view full) --- 856 xmep->vers = EXTRACT_32BITS(&rp->rm_call.cb_vers); 857} 858 859/* 860 * Returns 0 and puts NFSPROC_xxx in proc return and 861 * version in vers return, or returns -1 on failure 862 */ 863static int |
912xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc, | 864xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, u_int32_t *proc, |
913 u_int32_t *vers) 914{ 915 int i; 916 struct xid_map_entry *xmep; 917 u_int32_t xid = rp->rm_xid; 918 struct ip *ip = (struct ip *)bp; 919#ifdef INET6 920 struct ip6_hdr *ip6 = (struct ip6_hdr *)bp; --- 50 unchanged lines hidden (view full) --- 971 * Routines for parsing reply packets 972 */ 973 974/* 975 * Return a pointer to the beginning of the actual results. 976 * If the packet was truncated, return 0. 977 */ 978static const u_int32_t * | 865 u_int32_t *vers) 866{ 867 int i; 868 struct xid_map_entry *xmep; 869 u_int32_t xid = rp->rm_xid; 870 struct ip *ip = (struct ip *)bp; 871#ifdef INET6 872 struct ip6_hdr *ip6 = (struct ip6_hdr *)bp; --- 50 unchanged lines hidden (view full) --- 923 * Routines for parsing reply packets 924 */ 925 926/* 927 * Return a pointer to the beginning of the actual results. 928 * If the packet was truncated, return 0. 929 */ 930static const u_int32_t * |
979parserep(register const struct rpc_msg *rp, register u_int length) | 931parserep(register const struct sunrpc_msg *rp, register u_int length) |
980{ 981 register const u_int32_t *dp; 982 u_int len; | 932{ 933 register const u_int32_t *dp; 934 u_int len; |
983 enum accept_stat astat; | 935 enum sunrpc_accept_stat astat; |
984 985 /* 986 * Portability note: 987 * Here we find the address of the ar_verf credentials. 988 * Originally, this calculation was 989 * dp = (u_int32_t *)&rp->rm_reply.rp_acpt.ar_verf 990 * On the wire, the rp_acpt field starts immediately after 991 * the (32 bit) rp_stat field. However, rp_acpt (which is a --- 17 unchanged lines hidden (view full) --- 1009 TCHECK2(dp[0], 0); 1010 1011 /* 1012 * now we can check the ar_stat field 1013 */ 1014 astat = EXTRACT_32BITS(dp); 1015 switch (astat) { 1016 | 936 937 /* 938 * Portability note: 939 * Here we find the address of the ar_verf credentials. 940 * Originally, this calculation was 941 * dp = (u_int32_t *)&rp->rm_reply.rp_acpt.ar_verf 942 * On the wire, the rp_acpt field starts immediately after 943 * the (32 bit) rp_stat field. However, rp_acpt (which is a --- 17 unchanged lines hidden (view full) --- 961 TCHECK2(dp[0], 0); 962 963 /* 964 * now we can check the ar_stat field 965 */ 966 astat = EXTRACT_32BITS(dp); 967 switch (astat) { 968 |
1017 case SUCCESS: | 969 case SUNRPC_SUCCESS: |
1018 break; 1019 | 970 break; 971 |
1020 case PROG_UNAVAIL: | 972 case SUNRPC_PROG_UNAVAIL: |
1021 printf(" PROG_UNAVAIL"); 1022 nfserr = 1; /* suppress trunc string */ 1023 return (NULL); 1024 | 973 printf(" PROG_UNAVAIL"); 974 nfserr = 1; /* suppress trunc string */ 975 return (NULL); 976 |
1025 case PROG_MISMATCH: | 977 case SUNRPC_PROG_MISMATCH: |
1026 printf(" PROG_MISMATCH"); 1027 nfserr = 1; /* suppress trunc string */ 1028 return (NULL); 1029 | 978 printf(" PROG_MISMATCH"); 979 nfserr = 1; /* suppress trunc string */ 980 return (NULL); 981 |
1030 case PROC_UNAVAIL: | 982 case SUNRPC_PROC_UNAVAIL: |
1031 printf(" PROC_UNAVAIL"); 1032 nfserr = 1; /* suppress trunc string */ 1033 return (NULL); 1034 | 983 printf(" PROC_UNAVAIL"); 984 nfserr = 1; /* suppress trunc string */ 985 return (NULL); 986 |
1035 case GARBAGE_ARGS: | 987 case SUNRPC_GARBAGE_ARGS: |
1036 printf(" GARBAGE_ARGS"); 1037 nfserr = 1; /* suppress trunc string */ 1038 return (NULL); 1039 | 988 printf(" GARBAGE_ARGS"); 989 nfserr = 1; /* suppress trunc string */ 990 return (NULL); 991 |
1040 case SYSTEM_ERR: | 992 case SUNRPC_SYSTEM_ERR: |
1041 printf(" SYSTEM_ERR"); 1042 nfserr = 1; /* suppress trunc string */ 1043 return (NULL); 1044 1045 default: 1046 printf(" ar_stat %d", astat); 1047 nfserr = 1; /* suppress trunc string */ 1048 return (NULL); --- 37 unchanged lines hidden (view full) --- 1086 printf(" %s %o ids %d/%d", 1087 tok2str(type2str, "unk-ft %d ", 1088 EXTRACT_32BITS(&fap->fa_type)), 1089 EXTRACT_32BITS(&fap->fa_mode), 1090 EXTRACT_32BITS(&fap->fa_uid), 1091 EXTRACT_32BITS(&fap->fa_gid)); 1092 if (v3) { 1093 TCHECK(fap->fa3_size); | 993 printf(" SYSTEM_ERR"); 994 nfserr = 1; /* suppress trunc string */ 995 return (NULL); 996 997 default: 998 printf(" ar_stat %d", astat); 999 nfserr = 1; /* suppress trunc string */ 1000 return (NULL); --- 37 unchanged lines hidden (view full) --- 1038 printf(" %s %o ids %d/%d", 1039 tok2str(type2str, "unk-ft %d ", 1040 EXTRACT_32BITS(&fap->fa_type)), 1041 EXTRACT_32BITS(&fap->fa_mode), 1042 EXTRACT_32BITS(&fap->fa_uid), 1043 EXTRACT_32BITS(&fap->fa_gid)); 1044 if (v3) { 1045 TCHECK(fap->fa3_size); |
1094 printf(" sz "); 1095 print_int64((u_int32_t *)&fap->fa3_size, UNSIGNED); | 1046 printf(" sz %" PRIu64, 1047 EXTRACT_64BITS((u_int32_t *)&fap->fa3_size)); |
1096 } else { 1097 TCHECK(fap->fa2_size); 1098 printf(" sz %d", EXTRACT_32BITS(&fap->fa2_size)); 1099 } 1100 } 1101 /* print lots more stuff */ 1102 if (verbose > 1) { 1103 if (v3) { 1104 TCHECK(fap->fa3_ctime); 1105 printf(" nlink %d rdev %d/%d", 1106 EXTRACT_32BITS(&fap->fa_nlink), 1107 EXTRACT_32BITS(&fap->fa3_rdev.specdata1), 1108 EXTRACT_32BITS(&fap->fa3_rdev.specdata2)); | 1048 } else { 1049 TCHECK(fap->fa2_size); 1050 printf(" sz %d", EXTRACT_32BITS(&fap->fa2_size)); 1051 } 1052 } 1053 /* print lots more stuff */ 1054 if (verbose > 1) { 1055 if (v3) { 1056 TCHECK(fap->fa3_ctime); 1057 printf(" nlink %d rdev %d/%d", 1058 EXTRACT_32BITS(&fap->fa_nlink), 1059 EXTRACT_32BITS(&fap->fa3_rdev.specdata1), 1060 EXTRACT_32BITS(&fap->fa3_rdev.specdata2)); |
1109 printf(" fsid "); 1110 print_int64((u_int32_t *)&fap->fa3_fsid, HEX); 1111 printf(" fileid "); 1112 print_int64((u_int32_t *)&fap->fa3_fileid, HEX); | 1061 printf(" fsid %" PRIx64, 1062 EXTRACT_64BITS((u_int32_t *)&fap->fa3_fsid)); 1063 printf(" fileid %" PRIx64, 1064 EXTRACT_64BITS((u_int32_t *)&fap->fa3_fileid)); |
1113 printf(" a/m/ctime %u.%06u", 1114 EXTRACT_32BITS(&fap->fa3_atime.nfsv3_sec), 1115 EXTRACT_32BITS(&fap->fa3_atime.nfsv3_nsec)); 1116 printf(" %u.%06u", 1117 EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_sec), 1118 EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_nsec)); 1119 printf(" %u.%06u", 1120 EXTRACT_32BITS(&fap->fa3_ctime.nfsv3_sec), --- 91 unchanged lines hidden (view full) --- 1212 return (0); 1213 } 1214 1215 TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS)); 1216 1217 sfsp = (const struct nfs_statfs *)dp; 1218 1219 if (v3) { | 1065 printf(" a/m/ctime %u.%06u", 1066 EXTRACT_32BITS(&fap->fa3_atime.nfsv3_sec), 1067 EXTRACT_32BITS(&fap->fa3_atime.nfsv3_nsec)); 1068 printf(" %u.%06u", 1069 EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_sec), 1070 EXTRACT_32BITS(&fap->fa3_mtime.nfsv3_nsec)); 1071 printf(" %u.%06u", 1072 EXTRACT_32BITS(&fap->fa3_ctime.nfsv3_sec), --- 91 unchanged lines hidden (view full) --- 1164 return (0); 1165 } 1166 1167 TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS)); 1168 1169 sfsp = (const struct nfs_statfs *)dp; 1170 1171 if (v3) { |
1220 printf(" tbytes "); 1221 print_int64((u_int32_t *)&sfsp->sf_tbytes, UNSIGNED); 1222 printf(" fbytes "); 1223 print_int64((u_int32_t *)&sfsp->sf_fbytes, UNSIGNED); 1224 printf(" abytes "); 1225 print_int64((u_int32_t *)&sfsp->sf_abytes, UNSIGNED); | 1172 printf(" tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64, 1173 EXTRACT_64BITS((u_int32_t *)&sfsp->sf_tbytes), 1174 EXTRACT_64BITS((u_int32_t *)&sfsp->sf_fbytes), 1175 EXTRACT_64BITS((u_int32_t *)&sfsp->sf_abytes)); |
1226 if (vflag) { | 1176 if (vflag) { |
1227 printf(" tfiles "); 1228 print_int64((u_int32_t *)&sfsp->sf_tfiles, UNSIGNED); 1229 printf(" ffiles "); 1230 print_int64((u_int32_t *)&sfsp->sf_ffiles, UNSIGNED); 1231 printf(" afiles "); 1232 print_int64((u_int32_t *)&sfsp->sf_afiles, UNSIGNED); 1233 printf(" invar %u", | 1177 printf(" tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u", 1178 EXTRACT_64BITS((u_int32_t *)&sfsp->sf_tfiles), 1179 EXTRACT_64BITS((u_int32_t *)&sfsp->sf_ffiles), 1180 EXTRACT_64BITS((u_int32_t *)&sfsp->sf_afiles), |
1234 EXTRACT_32BITS(&sfsp->sf_invarsec)); 1235 } 1236 } else { 1237 printf(" tsize %d bsize %d blocks %d bfree %d bavail %d", 1238 EXTRACT_32BITS(&sfsp->sf_tsize), 1239 EXTRACT_32BITS(&sfsp->sf_bsize), 1240 EXTRACT_32BITS(&sfsp->sf_blocks), 1241 EXTRACT_32BITS(&sfsp->sf_bfree), --- 27 unchanged lines hidden (view full) --- 1269 return (1); 1270trunc: 1271 return (0); 1272} 1273 1274static const u_int32_t * 1275parse_wcc_attr(const u_int32_t *dp) 1276{ | 1181 EXTRACT_32BITS(&sfsp->sf_invarsec)); 1182 } 1183 } else { 1184 printf(" tsize %d bsize %d blocks %d bfree %d bavail %d", 1185 EXTRACT_32BITS(&sfsp->sf_tsize), 1186 EXTRACT_32BITS(&sfsp->sf_bsize), 1187 EXTRACT_32BITS(&sfsp->sf_blocks), 1188 EXTRACT_32BITS(&sfsp->sf_bfree), --- 27 unchanged lines hidden (view full) --- 1216 return (1); 1217trunc: 1218 return (0); 1219} 1220 1221static const u_int32_t * 1222parse_wcc_attr(const u_int32_t *dp) 1223{ |
1277 printf(" sz "); 1278 print_int64(dp, UNSIGNED); | 1224 printf(" sz %" PRIu64, EXTRACT_64BITS(&dp[0])); |
1279 printf(" mtime %u.%06u ctime %u.%06u", 1280 EXTRACT_32BITS(&dp[2]), EXTRACT_32BITS(&dp[3]), 1281 EXTRACT_32BITS(&dp[4]), EXTRACT_32BITS(&dp[5])); 1282 return (dp + 6); 1283} 1284 1285/* 1286 * Pre operation attributes. Print only if vflag > 1. --- 129 unchanged lines hidden (view full) --- 1416 TCHECK(*sfp); 1417 printf(" rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u", 1418 EXTRACT_32BITS(&sfp->fs_rtmax), 1419 EXTRACT_32BITS(&sfp->fs_rtpref), 1420 EXTRACT_32BITS(&sfp->fs_wtmax), 1421 EXTRACT_32BITS(&sfp->fs_wtpref), 1422 EXTRACT_32BITS(&sfp->fs_dtpref)); 1423 if (vflag) { | 1225 printf(" mtime %u.%06u ctime %u.%06u", 1226 EXTRACT_32BITS(&dp[2]), EXTRACT_32BITS(&dp[3]), 1227 EXTRACT_32BITS(&dp[4]), EXTRACT_32BITS(&dp[5])); 1228 return (dp + 6); 1229} 1230 1231/* 1232 * Pre operation attributes. Print only if vflag > 1. --- 129 unchanged lines hidden (view full) --- 1362 TCHECK(*sfp); 1363 printf(" rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u", 1364 EXTRACT_32BITS(&sfp->fs_rtmax), 1365 EXTRACT_32BITS(&sfp->fs_rtpref), 1366 EXTRACT_32BITS(&sfp->fs_wtmax), 1367 EXTRACT_32BITS(&sfp->fs_wtpref), 1368 EXTRACT_32BITS(&sfp->fs_dtpref)); 1369 if (vflag) { |
1424 printf(" rtmult %u wtmult %u maxfsz ", | 1370 printf(" rtmult %u wtmult %u maxfsz %" PRIu64, |
1425 EXTRACT_32BITS(&sfp->fs_rtmult), | 1371 EXTRACT_32BITS(&sfp->fs_rtmult), |
1426 EXTRACT_32BITS(&sfp->fs_wtmult)); 1427 print_int64((u_int32_t *)&sfp->fs_maxfilesize, UNSIGNED); | 1372 EXTRACT_32BITS(&sfp->fs_wtmult), 1373 EXTRACT_64BITS((u_int32_t *)&sfp->fs_maxfilesize)); |
1428 printf(" delta %u.%06u ", 1429 EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_sec), 1430 EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_nsec)); 1431 } 1432 return (1); 1433trunc: 1434 return (0); 1435} --- 24 unchanged lines hidden (view full) --- 1460 EXTRACT_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "", 1461 EXTRACT_32BITS(&spp->pc_casepreserving) ? "keepcase" : ""); 1462 return (1); 1463trunc: 1464 return (0); 1465} 1466 1467static void | 1374 printf(" delta %u.%06u ", 1375 EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_sec), 1376 EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_nsec)); 1377 } 1378 return (1); 1379trunc: 1380 return (0); 1381} --- 24 unchanged lines hidden (view full) --- 1406 EXTRACT_32BITS(&spp->pc_caseinsensitive) ? "igncase" : "", 1407 EXTRACT_32BITS(&spp->pc_casepreserving) ? "keepcase" : ""); 1408 return (1); 1409trunc: 1410 return (0); 1411} 1412 1413static void |
1468interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int32_t vers, int length) | 1414interp_reply(const struct sunrpc_msg *rp, u_int32_t proc, u_int32_t vers, int length) |
1469{ 1470 register const u_int32_t *dp; 1471 register int v3; 1472 int er; 1473 1474 v3 = (vers == NFS_VER3); 1475 1476 if (!v3 && proc < NFS_NPROCS) --- 308 unchanged lines hidden --- | 1415{ 1416 register const u_int32_t *dp; 1417 register int v3; 1418 int er; 1419 1420 v3 = (vers == NFS_VER3); 1421 1422 if (!v3 && proc < NFS_NPROCS) --- 308 unchanged lines hidden --- |