]> The Tcpdump Group git mirrors - tcpdump/commitdiff
(fs_reply_print): support parsing and printing of the errors in abort
authorassar <assar>
Fri, 7 Jan 2000 15:17:43 +0000 (15:17 +0000)
committerassar <assar>
Fri, 7 Jan 2000 15:17:43 +0000 (15:17 +0000)
packets in symbolic form.  From Love <[email protected]>

print-rx.c

index 245b7deb83ea2a0736a44ad6aba0900c36beca97..7fd9206fcd95e0670366892d542d69dbc9281d17 100644 (file)
@@ -13,7 +13,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Id: print-rx.c,v 1.5 1999-12-15 08:10:18 fenner Exp $";
+    "@(#) $Id: print-rx.c,v 1.6 2000-01-07 15:17:43 assar Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -315,6 +315,23 @@ static struct tok ubik_lock_types[] = {
 
 static char *voltype[] = { "read-write", "read-only", "backup" };
 
 
 static char *voltype[] = { "read-write", "read-only", "backup" };
 
+static struct tok afs_fs_errors[] = {
+       { 101,          "salvage volume" },
+       { 102,          "no such vnode" },
+       { 103,          "no such volume" },
+       { 104,          "volume exist" },
+       { 105,          "no service" },
+       { 106,          "volume offline" },
+       { 107,          "voline online" },
+       { 108,          "diskfull" },
+       { 109,          "diskquota exceeded" },
+       { 110,          "volume busy" },
+       { 111,          "volume moved" },
+       { 112,          "AFS IO error" },
+       { -100,         "restarting fileserver" },
+       { 0,            NULL }
+};
+
 /*
  * Cache entries we keep around so we can figure out the RX opcode
  * numbers for replies.  This allows us to make sense of RX reply packets.
 /*
  * Cache entries we keep around so we can figure out the RX opcode
  * numbers for replies.  This allows us to make sense of RX reply packets.
@@ -854,7 +871,7 @@ fs_reply_print(register const u_char *bp, int length, int32_t opcode)
         * If it was a data packet, interpret the response
         */
 
         * If it was a data packet, interpret the response
         */
 
-       if (rxh->type == RX_PACKET_TYPE_DATA)
+       if (rxh->type == RX_PACKET_TYPE_DATA) {
                switch (opcode) {
                case 131:       /* Fetch ACL */
                {
                switch (opcode) {
                case 131:       /* Fetch ACL */
                {
@@ -883,12 +900,19 @@ fs_reply_print(register const u_char *bp, int length, int32_t opcode)
                default:
                        ;
                }
                default:
                        ;
                }
-       else {
-               /*
-                * Otherwise, just print out the return code
-                */
-               printf(" errcode");
-               INTOUT();
+       } else if (rxh->type == RX_PACKET_TYPE_ABORT) {
+               int i;
+
+               /*
+                * Otherwise, just print out the return code
+                */
+               TRUNC(sizeof(int32_t)); 
+               i = (int) ntohl(*((int *) bp)); 
+               bp += sizeof(int32_t); 
+
+               printf(" error %s", tok2str(afs_fs_errors, "#%d", i));
+       } else {
+               printf(" strange fs reply of type %d", rxh->type);
        }
 
        return;
        }
 
        return;