]> The Tcpdump Group git mirrors - tcpdump/blob - print-rx.c
Clean up some warnings.
[tcpdump] / print-rx.c
1 /*
2 * This code unmangles RX packets. RX is the mutant form of RPC that AFS
3 * uses to communicate between clients and servers.
4 *
5 * In this code, I mainly concern myself with decoding the AFS calls, not
6 * with the guts of RX, per se.
7 *
8 * Bah. If I never look at rx_packet.h again, it will be too soon.
9 *
10 * Ken Hornstein <kenh@cmf.nrl.navy.mil>
11 *
12 */
13
14 #ifndef lint
15 static const char rcsid[] =
16 "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.9 2000-02-09 16:00:50 kenh Exp $";
17 #endif
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include <stdio.h>
24 #include <string.h>
25 #include <sys/param.h>
26 #include <sys/time.h>
27 #include <sys/types.h>
28 #include <sys/socket.h>
29 #include <netinet/in.h>
30 #include <netinet/in_systm.h>
31 #include <netinet/ip.h>
32 #include <arpa/inet.h>
33
34 #include "interface.h"
35 #include "addrtoname.h"
36 #include "extract.h"
37
38 #undef NOERROR /* Solaris sucks */
39 #include <arpa/nameser.h>
40
41 #include "rx.h"
42
43 static struct tok rx_types[] = {
44 { RX_PACKET_TYPE_DATA, "data" },
45 { RX_PACKET_TYPE_ACK, "ack" },
46 { RX_PACKET_TYPE_BUSY, "busy" },
47 { RX_PACKET_TYPE_ABORT, "abort" },
48 { RX_PACKET_TYPE_ACKALL, "ackall" },
49 { RX_PACKET_TYPE_CHALLENGE, "challenge" },
50 { RX_PACKET_TYPE_RESPONSE, "response" },
51 { RX_PACKET_TYPE_DEBUG, "debug" },
52 { RX_PACKET_TYPE_PARAMS, "params" },
53 { RX_PACKET_TYPE_VERSION, "version" },
54 { 0, NULL },
55 };
56
57 static struct tok rx_flags[] = {
58 { RX_CLIENT_INITIATED, "client-init" },
59 { RX_REQUEST_ACK, "req-ack" },
60 { RX_LAST_PACKET, "last-pckt" },
61 { RX_MORE_PACKETS, "more-pckts" },
62 { RX_FREE_PACKET, "free-pckt" }
63 };
64
65 static struct tok fs_req[] = {
66 { 130, "fetch-data" },
67 { 131, "fetch-acl" },
68 { 132, "fetch-status" },
69 { 133, "store-data" },
70 { 134, "store-acl" },
71 { 135, "store-status" },
72 { 136, "remove-file" },
73 { 137, "create-file" },
74 { 138, "rename" },
75 { 139, "symlink" },
76 { 140, "link" },
77 { 141, "makedir" },
78 { 142, "rmdir" },
79 { 143, "oldsetlock" },
80 { 144, "oldextlock" },
81 { 145, "oldrellock" },
82 { 146, "get-stats" },
83 { 147, "give-cbs" },
84 { 148, "get-vlinfo" },
85 { 149, "get-vlstats" },
86 { 150, "set-vlstats" },
87 { 151, "get-rootvl" },
88 { 152, "check-token" },
89 { 153, "get-time" },
90 { 154, "nget-vlinfo" },
91 { 155, "bulk-stat" },
92 { 156, "setlock" },
93 { 157, "extlock" },
94 { 158, "rellock" },
95 { 159, "xstat-ver" },
96 { 160, "get-xstat" },
97 { 161, "dfs-lookup" },
98 { 162, "dfs-flushcps" },
99 { 163, "dfs-symlink" },
100 { 0, NULL },
101 };
102
103 static struct tok cb_req[] = {
104 { 204, "callback" },
105 { 205, "initcb" },
106 { 206, "probe" },
107 { 207, "getlock" },
108 { 208, "getce" },
109 { 209, "xstatver" },
110 { 210, "getxstat" },
111 { 211, "initcb2" },
112 { 212, "whoareyou" },
113 { 213, "initcb3" },
114 { 214, "probeuuid" },
115 { 0, NULL },
116 };
117
118 static struct tok pt_req[] = {
119 { 500, "new-user" },
120 { 501, "where-is-it" },
121 { 502, "dump-entry" },
122 { 503, "add-to-group" },
123 { 504, "name-to-id" },
124 { 505, "id-to-name" },
125 { 506, "delete" },
126 { 507, "remove-from-group" },
127 { 508, "get-cps" },
128 { 509, "new-entry" },
129 { 510, "list-max" },
130 { 511, "set-max" },
131 { 512, "list-entry" },
132 { 513, "change-entry" },
133 { 514, "list-elements" },
134 { 515, "same-mbr-of" },
135 { 516, "set-fld-sentry" },
136 { 517, "list-owned" },
137 { 518, "get-cps2" },
138 { 519, "get-host-cps" },
139 { 520, "update-entry" },
140 { 0, NULL },
141 };
142
143 static struct tok vldb_req[] = {
144 { 501, "create-entry" },
145 { 502, "delete-entry" },
146 { 503, "get-entry-by-id" },
147 { 504, "get-entry-by-name" },
148 { 505, "get-new-volume-id" },
149 { 506, "replace-entry" },
150 { 507, "update-entry" },
151 { 508, "setlock" },
152 { 509, "releaselock" },
153 { 510, "list-entry" },
154 { 511, "list-attrib" },
155 { 512, "linked-list" },
156 { 513, "get-stats" },
157 { 514, "probe" },
158 { 515, "get-addrs" },
159 { 516, "change-addr" },
160 { 517, "create-entry-n" },
161 { 518, "get-entry-by-id-n" },
162 { 519, "get-entry-by-name-n" },
163 { 520, "replace-entry-n" },
164 { 521, "list-entry-n" },
165 { 522, "list-attrib-n" },
166 { 523, "linked-list-n" },
167 { 524, "update-entry-by-name" },
168 { 525, "create-entry-u" },
169 { 526, "get-entry-by-id-u" },
170 { 527, "get-entry-by-name-u" },
171 { 528, "replace-entry-u" },
172 { 529, "list-entry-u" },
173 { 530, "list-attrib-u" },
174 { 531, "linked-list-u" },
175 { 532, "regaddr" },
176 { 533, "get-addrs-u" },
177 { 0, NULL },
178 };
179
180 static struct tok kauth_req[] = {
181 { 1, "auth-old" },
182 { 21, "authenticate" },
183 { 22, "authenticate-v2" },
184 { 2, "change-pw" },
185 { 3, "get-ticket-old" },
186 { 23, "get-ticket" },
187 { 4, "set-pw" },
188 { 5, "set-fields" },
189 { 6, "create-user" },
190 { 7, "delete-user" },
191 { 8, "get-entry" },
192 { 9, "list-entry" },
193 { 10, "get-stats" },
194 { 11, "debug" },
195 { 12, "get-pw" },
196 { 13, "get-random-key" },
197 { 14, "unlock" },
198 { 15, "lock-status" },
199 { 0, NULL },
200 };
201
202 static struct tok vol_req[] = {
203 { 100, "create-volume" },
204 { 101, "delete-volume" },
205 { 102, "restore" },
206 { 103, "forward" },
207 { 104, "end-trans" },
208 { 105, "clone" },
209 { 106, "set-flags" },
210 { 107, "get-flags" },
211 { 108, "trans-create" },
212 { 109, "dump" },
213 { 110, "get-nth-volume" },
214 { 111, "set-forwarding" },
215 { 112, "get-name" },
216 { 113, "get-status" },
217 { 114, "sig-restore" },
218 { 115, "list-partitions" },
219 { 116, "list-volumes" },
220 { 117, "set-id-types" },
221 { 118, "monitor" },
222 { 119, "partition-info" },
223 { 120, "reclone" },
224 { 121, "list-one-volume" },
225 { 122, "nuke" },
226 { 123, "set-date" },
227 { 124, "x-list-volumes" },
228 { 125, "x-list-one-volume" },
229 { 126, "set-info" },
230 { 127, "x-list-partitions" },
231 { 128, "forward-multiple" },
232 { 0, NULL },
233 };
234
235 static struct tok bos_req[] = {
236 { 80, "create-bnode" },
237 { 81, "delete-bnode" },
238 { 82, "set-status" },
239 { 83, "get-status" },
240 { 84, "enumerate-instance" },
241 { 85, "get-instance-info" },
242 { 86, "get-instance-parm" },
243 { 87, "add-superuser" },
244 { 88, "delete-superuser" },
245 { 89, "list-superusers" },
246 { 90, "list-keys" },
247 { 91, "add-key" },
248 { 92, "delete-key" },
249 { 93, "set-cell-name" },
250 { 94, "get-cell-name" },
251 { 95, "get-cell-host" },
252 { 96, "add-cell-host" },
253 { 97, "delete-cell-host" },
254 { 98, "set-t-status" },
255 { 99, "shutdown-all" },
256 { 100, "restart-all" },
257 { 101, "startup-all" },
258 { 102, "set-noauth-flag" },
259 { 103, "re-bozo" },
260 { 104, "restart" },
261 { 105, "start-bozo-install" },
262 { 106, "uninstall" },
263 { 107, "get-dates" },
264 { 108, "exec" },
265 { 109, "prune" },
266 { 110, "set-restart-time" },
267 { 111, "get-restart-time" },
268 { 112, "start-bozo-log" },
269 { 113, "wait-all" },
270 { 114, "get-instance-strings" },
271 { 0, NULL },
272 };
273
274 static struct tok ubik_req[] = {
275 { 10000, "vote-beacon" },
276 { 10001, "vote-debug-old" },
277 { 10002, "vote-sdebug-old" },
278 { 10003, "vote-getsyncsite" },
279 { 10004, "vote-debug" },
280 { 10005, "vote-sdebug" },
281 { 20000, "disk-begin" },
282 { 20001, "disk-commit" },
283 { 20002, "disk-lock" },
284 { 20003, "disk-write" },
285 { 20004, "disk-getversion" },
286 { 20005, "disk-getfile" },
287 { 20006, "disk-sendfile" },
288 { 20007, "disk-abort" },
289 { 20008, "disk-releaselocks" },
290 { 20009, "disk-truncate" },
291 { 20010, "disk-probe" },
292 { 20011, "disk-writev" },
293 { 20012, "disk-interfaceaddr" },
294 { 20013, "disk-setversion" },
295 { 0, NULL },
296 };
297
298 #define VOTE_LOW 10000
299 #define VOTE_HIGH 10005
300 #define DISK_LOW 20000
301 #define DISK_HIGH 20013
302
303 static struct tok cb_types[] = {
304 { 1, "exclusive" },
305 { 2, "shared" },
306 { 3, "dropped" },
307 { 0, NULL },
308 };
309
310 static struct tok ubik_lock_types[] = {
311 { 1, "read" },
312 { 2, "write" },
313 { 3, "wait" },
314 { 0, NULL },
315 };
316
317 static char *voltype[] = { "read-write", "read-only", "backup" };
318
319 static struct tok afs_fs_errors[] = {
320 { 101, "salvage volume" },
321 { 102, "no such vnode" },
322 { 103, "no such volume" },
323 { 104, "volume exist" },
324 { 105, "no service" },
325 { 106, "volume offline" },
326 { 107, "voline online" },
327 { 108, "diskfull" },
328 { 109, "diskquota exceeded" },
329 { 110, "volume busy" },
330 { 111, "volume moved" },
331 { 112, "AFS IO error" },
332 { -100, "restarting fileserver" },
333 { 0, NULL }
334 };
335
336 /*
337 * Reasons for acknowledging a packet
338 */
339
340 static struct tok rx_ack_reasons[] = {
341 { 1, "ack requested" },
342 { 2, "duplicate packet" },
343 { 3, "out of sequence" },
344 { 4, "exceeds window" },
345 { 5, "no buffer space" },
346 { 6, "ping" },
347 { 7, "ping response" },
348 { 8, "delay" },
349 { 0, NULL },
350 };
351
352 /*
353 * Cache entries we keep around so we can figure out the RX opcode
354 * numbers for replies. This allows us to make sense of RX reply packets.
355 */
356
357 struct rx_cache_entry {
358 u_int32_t callnum; /* Call number (net order) */
359 struct in_addr client; /* client IP address (net order) */
360 struct in_addr server; /* server IP address (net order) */
361 int dport; /* server port (host order) */
362 u_short serviceId; /* Service identifier (net order) */
363 u_int32_t opcode; /* RX opcode (host order) */
364 };
365
366 #define RX_CACHE_SIZE 64
367
368 static struct rx_cache_entry rx_cache[RX_CACHE_SIZE];
369
370 static int rx_cache_next = 0;
371 static int rx_cache_hint = 0;
372 static void rx_cache_insert(const u_char *, const struct ip *, int, int);
373 static int rx_cache_find(const struct rx_header *, const struct ip *,
374 int, int32_t *);
375
376 static void fs_print(const u_char *, int);
377 static void fs_reply_print(const u_char *, int, int32_t);
378 static void acl_print(u_char *, u_char *);
379 static void cb_print(const u_char *, int);
380 static void cb_reply_print(const u_char *, int, int32_t);
381 static void prot_print(const u_char *, int);
382 static void prot_reply_print(const u_char *, int, int32_t);
383 static void vldb_print(const u_char *, int);
384 static void vldb_reply_print(const u_char *, int, int32_t);
385 static void kauth_print(const u_char *, int);
386 static void kauth_reply_print(const u_char *, int, int32_t);
387 static void vol_print(const u_char *, int);
388 static void vol_reply_print(const u_char *, int, int32_t);
389 static void bos_print(const u_char *, int);
390 static void bos_reply_print(const u_char *, int, int32_t);
391 static void ubik_print(const u_char *, int);
392 static void ubik_reply_print(const u_char *, int, int32_t);
393
394 static void rx_ack_print(const u_char *, int);
395
396 static int is_ubik(u_int32_t);
397
398 /*
399 * Handle the rx-level packet. See if we know what port it's going to so
400 * we can peek at the afs call inside
401 */
402
403 void
404 rx_print(register const u_char *bp, int length, int sport, int dport,
405 u_char *bp2)
406 {
407 register struct rx_header *rxh;
408 int i;
409 int32_t opcode;
410
411 if (snapend - bp < sizeof (struct rx_header)) {
412 printf(" [|rx] (%d)", length);
413 return;
414 }
415
416 rxh = (struct rx_header *) bp;
417
418 printf(" rx %s", tok2str(rx_types, "type %d", rxh->type));
419
420 if (vflag > 1) {
421 int firstflag = 0;
422 printf(" cid %08x call# %d seq %d ser %d",
423 (int) EXTRACT_32BITS(&rxh->cid),
424 (int) EXTRACT_32BITS(&rxh->callNumber),
425 (int) EXTRACT_32BITS(&rxh->seq),
426 (int) EXTRACT_32BITS(&rxh->serial));
427 if (vflag > 2)
428 printf(" secindex %d serviceid %hu",
429 (int) rxh->securityIndex,
430 EXTRACT_16BITS(&rxh->serviceId));
431 for (i = 0; i < NUM_RX_FLAGS; i++) {
432 if (rxh->flags & rx_flags[i].v) {
433 if (!firstflag) {
434 firstflag = 1;
435 printf(" ");
436 } else {
437 printf(",");
438 }
439 printf("<%s>", rx_flags[i].s);
440 }
441 }
442 }
443
444 /*
445 * Try to handle AFS calls that we know about. Check the destination
446 * port and make sure it's a data packet. Also, make sure the
447 * seq number is 1 (because otherwise it's a continuation packet,
448 * and we can't interpret that). Also, seems that reply packets
449 * do not have the client-init flag set, so we check for that
450 * as well.
451 */
452
453 if (rxh->type == RX_PACKET_TYPE_DATA &&
454 EXTRACT_32BITS(&rxh->seq) == 1 &&
455 rxh->flags & RX_CLIENT_INITIATED) {
456
457 /*
458 * Insert this call into the call cache table, so we
459 * have a chance to print out replies
460 */
461
462 rx_cache_insert(bp, (const struct ip *) bp2, dport, length);
463
464 switch (dport) {
465 case FS_RX_PORT: /* AFS file service */
466 fs_print(bp, length);
467 break;
468 case CB_RX_PORT: /* AFS callback service */
469 cb_print(bp, length);
470 break;
471 case PROT_RX_PORT: /* AFS protection service */
472 prot_print(bp, length);
473 break;
474 case VLDB_RX_PORT: /* AFS VLDB service */
475 vldb_print(bp, length);
476 break;
477 case KAUTH_RX_PORT: /* AFS Kerberos auth service */
478 kauth_print(bp, length);
479 break;
480 case VOL_RX_PORT: /* AFS Volume service */
481 vol_print(bp, length);
482 break;
483 case BOS_RX_PORT: /* AFS BOS service */
484 bos_print(bp, length);
485 break;
486 default:
487 ;
488 }
489
490 /*
491 * If it's a reply (client-init is _not_ set, but seq is one)
492 * then look it up in the cache. If we find it, call the reply
493 * printing functions Note that we handle abort packets here,
494 * because printing out the return code can be useful at times.
495 */
496
497 } else if (((rxh->type == RX_PACKET_TYPE_DATA &&
498 EXTRACT_32BITS(&rxh->seq) == 1) ||
499 rxh->type == RX_PACKET_TYPE_ABORT) &&
500 (rxh->flags & RX_CLIENT_INITIATED) == 0 &&
501 rx_cache_find(rxh, (const struct ip *) bp2,
502 sport, &opcode)) {
503
504 switch (sport) {
505 case FS_RX_PORT: /* AFS file service */
506 fs_reply_print(bp, length, opcode);
507 break;
508 case CB_RX_PORT: /* AFS callback service */
509 cb_reply_print(bp, length, opcode);
510 break;
511 case PROT_RX_PORT: /* AFS PT service */
512 prot_reply_print(bp, length, opcode);
513 break;
514 case VLDB_RX_PORT: /* AFS VLDB service */
515 vldb_reply_print(bp, length, opcode);
516 break;
517 case KAUTH_RX_PORT: /* AFS Kerberos auth service */
518 kauth_reply_print(bp, length, opcode);
519 break;
520 case VOL_RX_PORT: /* AFS Volume service */
521 vol_reply_print(bp, length, opcode);
522 break;
523 case BOS_RX_PORT: /* AFS BOS service */
524 bos_reply_print(bp, length, opcode);
525 break;
526 default:
527 ;
528 }
529
530 /*
531 * If it's an RX ack packet, then use the appropriate ack decoding
532 * function (there isn't any service-specific information in the
533 * ack packet, so we can use one for all AFS services)
534 */
535
536 } else if (rxh->type == RX_PACKET_TYPE_ACK)
537 rx_ack_print(bp, length);
538
539
540 printf(" (%d)", length);
541 }
542
543 /*
544 * Insert an entry into the cache. Taken from print-nfs.c
545 */
546
547 static void
548 rx_cache_insert(const u_char *bp, const struct ip *ip, int dport,
549 int length)
550 {
551 struct rx_cache_entry *rxent;
552 const struct rx_header *rxh = (const struct rx_header *) bp;
553
554 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t))
555 return;
556
557 rxent = &rx_cache[rx_cache_next];
558
559 if (++rx_cache_next >= RX_CACHE_SIZE)
560 rx_cache_next = 0;
561
562 rxent->callnum = rxh->callNumber;
563 rxent->client = ip->ip_src;
564 rxent->server = ip->ip_dst;
565 rxent->dport = dport;
566 rxent->serviceId = rxh->serviceId;
567 rxent->opcode = EXTRACT_32BITS(bp + sizeof(struct rx_header));
568 }
569
570 /*
571 * Lookup an entry in the cache. Also taken from print-nfs.c
572 *
573 * Note that because this is a reply, we're looking at the _source_
574 * port.
575 */
576
577 static int
578 rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
579 int32_t *opcode)
580 {
581 int i;
582 struct rx_cache_entry *rxent;
583 u_int32_t clip = ip->ip_dst.s_addr;
584 u_int32_t sip = ip->ip_src.s_addr;
585
586 /* Start the search where we last left off */
587
588 i = rx_cache_hint;
589 do {
590 rxent = &rx_cache[i];
591 if (rxent->callnum == rxh->callNumber &&
592 rxent->client.s_addr == clip &&
593 rxent->server.s_addr == sip &&
594 rxent->serviceId == rxh->serviceId &&
595 rxent->dport == sport) {
596
597 /* We got a match! */
598
599 rx_cache_hint = i;
600 *opcode = rxent->opcode;
601 return(1);
602 }
603 if (++i > RX_CACHE_SIZE)
604 i = 0;
605 } while (i != rx_cache_hint);
606
607 /* Our search failed */
608 return(0);
609 }
610
611 /*
612 * These extrememly grody macros handle the printing of various AFS stuff.
613 */
614
615 #define TRUNC(n) if (snapend - bp + 1 <= n) goto trunc;
616 #define FIDOUT() { unsigned long n1, n2, n3; \
617 TRUNC(sizeof(int32_t) * 3); \
618 n1 = EXTRACT_32BITS(bp); \
619 bp += sizeof(int32_t); \
620 n2 = EXTRACT_32BITS(bp); \
621 bp += sizeof(int32_t); \
622 n3 = EXTRACT_32BITS(bp); \
623 bp += sizeof(int32_t); \
624 printf(" fid %d/%d/%d", (int) n1, (int) n2, (int) n3); \
625 }
626
627 #define STROUT(MAX) { int i; \
628 TRUNC(sizeof(int32_t)); \
629 i = (int) EXTRACT_32BITS(bp); \
630 bp += sizeof(int32_t); \
631 TRUNC(i); \
632 strncpy(s, (char *) bp, min(MAX, i)); \
633 s[i] = '\0'; \
634 printf(" \"%s\"", s); \
635 bp += ((i + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t); \
636 }
637
638 #define INTOUT() { int i; \
639 TRUNC(sizeof(int32_t)); \
640 i = (int) EXTRACT_32BITS(bp); \
641 bp += sizeof(int32_t); \
642 printf(" %d", i); \
643 }
644
645 #define UINTOUT() { unsigned long i; \
646 TRUNC(sizeof(int32_t)); \
647 i = EXTRACT_32BITS(bp); \
648 bp += sizeof(int32_t); \
649 printf(" %lu", i); \
650 }
651
652 #define DATEOUT() { time_t t; struct tm *tm; char str[256]; \
653 TRUNC(sizeof(int32_t)); \
654 t = (time_t) EXTRACT_32BITS(bp); \
655 bp += sizeof(int32_t); \
656 tm = localtime(&t); \
657 strftime(str, 256, "%Y/%m/%d %T", tm); \
658 printf(" %s", str); \
659 }
660
661 #define STOREATTROUT() { unsigned long mask, i; \
662 TRUNC((sizeof(int32_t)*6)); \
663 mask = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
664 if (mask) printf (" StoreStatus"); \
665 if (mask & 1) { printf(" date"); DATEOUT(); } \
666 else bp += sizeof(int32_t); \
667 i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
668 if (mask & 2) printf(" owner %lu", i); \
669 i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
670 if (mask & 4) printf(" group %lu", i); \
671 i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
672 if (mask & 8) printf(" mode %lo", i & 07777); \
673 i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
674 if (mask & 16) printf(" segsize %lu", i); \
675 /* undocumented in 3.3 docu */ \
676 if (mask & 1024) printf(" fsync"); \
677 }
678
679 #define UBIK_VERSIONOUT() {int32_t epoch; int32_t counter; \
680 TRUNC(sizeof(int32_t) * 2); \
681 epoch = EXTRACT_32BITS(bp); \
682 bp += sizeof(int32_t); \
683 counter = EXTRACT_32BITS(bp); \
684 bp += sizeof(int32_t); \
685 printf(" %d.%d", epoch, counter); \
686 }
687
688 #define AFSUUIDOUT() {u_int32_t temp; int i; \
689 TRUNC(11*sizeof(u_int32_t)); \
690 temp = EXTRACT_32BITS(bp); \
691 bp += sizeof(u_int32_t); \
692 printf(" %08x", temp); \
693 temp = EXTRACT_32BITS(bp); \
694 bp += sizeof(u_int32_t); \
695 printf("%04x", temp); \
696 temp = EXTRACT_32BITS(bp); \
697 bp += sizeof(u_int32_t); \
698 printf("%04x", temp); \
699 for (i = 0; i < 8; i++) { \
700 temp = EXTRACT_32BITS(bp); \
701 bp += sizeof(u_int32_t); \
702 printf("%02x", (unsigned char) temp); \
703 } \
704 }
705
706 /*
707 * This is the sickest one of all
708 */
709
710 #define VECOUT(MAX) { char *sp; \
711 int k; \
712 TRUNC(MAX * sizeof(int32_t)); \
713 sp = s; \
714 for (k = 0; k < MAX; k++) { \
715 *sp++ = (char) EXTRACT_32BITS(bp); \
716 bp += sizeof(int32_t); \
717 } \
718 s[MAX] = '\0'; \
719 printf(" \"%s\"", s); \
720 }
721
722 /*
723 * Handle calls to the AFS file service (fs)
724 */
725
726 void
727 fs_print(register const u_char *bp, int length)
728 {
729 int fs_op;
730 unsigned long i;
731 char s[AFSNAMEMAX];
732
733 if (length <= sizeof(struct rx_header))
734 return;
735
736 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
737 goto trunc;
738 }
739
740 /*
741 * Print out the afs call we're invoking. The table used here was
742 * gleaned from fsint/afsint.xg
743 */
744
745 fs_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
746
747 printf(" fs call %s", tok2str(fs_req, "op#%d", fs_op));
748
749 /*
750 * Print out arguments to some of the AFS calls. This stuff is
751 * all from afsint.xg
752 */
753
754 bp += sizeof(struct rx_header) + 4;
755
756 /*
757 * Sigh. This is gross. Ritchie forgive me.
758 */
759
760 switch (fs_op) {
761 case 130: /* Fetch data */
762 FIDOUT();
763 printf(" offset");
764 UINTOUT();
765 printf(" length");
766 UINTOUT();
767 break;
768 case 131: /* Fetch ACL */
769 case 132: /* Fetch Status */
770 case 143: /* Old set lock */
771 case 144: /* Old extend lock */
772 case 145: /* Old release lock */
773 case 156: /* Set lock */
774 case 157: /* Extend lock */
775 case 158: /* Release lock */
776 FIDOUT();
777 break;
778 case 135: /* Store status */
779 FIDOUT();
780 STOREATTROUT();
781 break;
782 case 133: /* Store data */
783 FIDOUT();
784 STOREATTROUT();
785 printf(" offset");
786 UINTOUT();
787 printf(" length");
788 UINTOUT();
789 printf(" flen");
790 UINTOUT();
791 break;
792 case 134: /* Store ACL */
793 {
794 char a[AFSOPAQUEMAX];
795 FIDOUT();
796 TRUNC(4);
797 i = EXTRACT_32BITS(bp);
798 bp += sizeof(int32_t);
799 TRUNC(i);
800 strncpy(a, (char *) bp, min(AFSOPAQUEMAX, i));
801 a[i] = '\0';
802 acl_print((u_char *) a, (u_char *) a + i);
803 break;
804 }
805 case 137: /* Create file */
806 case 141: /* MakeDir */
807 FIDOUT();
808 STROUT(AFSNAMEMAX);
809 STOREATTROUT();
810 break;
811 case 136: /* Remove file */
812 case 142: /* Remove directory */
813 FIDOUT();
814 STROUT(AFSNAMEMAX);
815 break;
816 case 138: /* Rename file */
817 printf(" old");
818 FIDOUT();
819 STROUT(AFSNAMEMAX);
820 printf(" new");
821 FIDOUT();
822 STROUT(AFSNAMEMAX);
823 break;
824 case 139: /* Symlink */
825 FIDOUT();
826 STROUT(AFSNAMEMAX);
827 printf(" link to");
828 STROUT(AFSNAMEMAX);
829 break;
830 case 140: /* Link */
831 FIDOUT();
832 STROUT(AFSNAMEMAX);
833 printf(" link to");
834 FIDOUT();
835 break;
836 case 148: /* Get volume info */
837 STROUT(AFSNAMEMAX);
838 break;
839 case 149: /* Get volume stats */
840 case 150: /* Set volume stats */
841 printf(" volid");
842 UINTOUT();
843 break;
844 case 154: /* New get volume info */
845 printf(" volname");
846 STROUT(AFSNAMEMAX);
847 break;
848 case 155: /* Bulk stat */
849 {
850 unsigned long j;
851 TRUNC(4);
852 j = EXTRACT_32BITS(bp);
853 bp += sizeof(int32_t);
854
855 for (i = 0; i < j; i++) {
856 FIDOUT();
857 if (i != j - 1)
858 printf(",");
859 }
860 if (j == 0)
861 printf(" <none!>");
862 }
863 default:
864 ;
865 }
866
867 return;
868
869 trunc:
870 printf(" [|fs]");
871 }
872
873 /*
874 * Handle replies to the AFS file service
875 */
876
877 static void
878 fs_reply_print(register const u_char *bp, int length, int32_t opcode)
879 {
880 unsigned long i;
881 char s[AFSNAMEMAX];
882 struct rx_header *rxh;
883
884 if (length <= sizeof(struct rx_header))
885 return;
886
887 rxh = (struct rx_header *) bp;
888
889 /*
890 * Print out the afs call we're invoking. The table used here was
891 * gleaned from fsint/afsint.xg
892 */
893
894 printf(" fs reply %s", tok2str(fs_req, "op#%d", opcode));
895
896 bp += sizeof(struct rx_header);
897
898 /*
899 * If it was a data packet, interpret the response
900 */
901
902 if (rxh->type == RX_PACKET_TYPE_DATA) {
903 switch (opcode) {
904 case 131: /* Fetch ACL */
905 {
906 char a[AFSOPAQUEMAX];
907 TRUNC(4);
908 i = EXTRACT_32BITS(bp);
909 bp += sizeof(int32_t);
910 TRUNC(i);
911 strncpy(a, (char *) bp, min(AFSOPAQUEMAX, i));
912 a[i] = '\0';
913 acl_print((u_char *) a, (u_char *) a + i);
914 break;
915 }
916 case 137: /* Create file */
917 case 141: /* MakeDir */
918 printf(" new");
919 FIDOUT();
920 break;
921 case 151: /* Get root volume */
922 printf(" root volume");
923 STROUT(AFSNAMEMAX);
924 break;
925 case 153: /* Get time */
926 DATEOUT();
927 break;
928 default:
929 ;
930 }
931 } else if (rxh->type == RX_PACKET_TYPE_ABORT) {
932 int i;
933
934 /*
935 * Otherwise, just print out the return code
936 */
937 TRUNC(sizeof(int32_t));
938 i = (int) EXTRACT_32BITS(bp);
939 bp += sizeof(int32_t);
940
941 printf(" error %s", tok2str(afs_fs_errors, "#%d", i));
942 } else {
943 printf(" strange fs reply of type %d", rxh->type);
944 }
945
946 return;
947
948 trunc:
949 printf(" [|fs]");
950 }
951
952 /*
953 * Print out an AFS ACL string. An AFS ACL is a string that has the
954 * following format:
955 *
956 * <positive> <negative>
957 * <uid1> <aclbits1>
958 * ....
959 *
960 * "positive" and "negative" are integers which contain the number of
961 * positive and negative ACL's in the string. The uid/aclbits pair are
962 * ASCII strings containing the UID/PTS record and and a ascii number
963 * representing a logical OR of all the ACL permission bits
964 */
965
966 static void
967 acl_print(u_char *s, u_char *end)
968 {
969 int pos, neg, acl;
970 int n, i;
971 char user[128];
972
973 if (sscanf((char *) s, "%d %d\n%n", &pos, &neg, &n) != 2)
974 return;
975
976 s += n;
977
978 if (s > end)
979 return;
980
981 /*
982 * This wacky order preserves the order used by the "fs" command
983 */
984
985 #define ACLOUT(acl) \
986 if (acl & PRSFS_READ) \
987 printf("r"); \
988 if (acl & PRSFS_LOOKUP) \
989 printf("l"); \
990 if (acl & PRSFS_INSERT) \
991 printf("i"); \
992 if (acl & PRSFS_DELETE) \
993 printf("d"); \
994 if (acl & PRSFS_WRITE) \
995 printf("w"); \
996 if (acl & PRSFS_LOCK) \
997 printf("k"); \
998 if (acl & PRSFS_ADMINISTER) \
999 printf("a");
1000
1001 for (i = 0; i < pos; i++) {
1002 if (sscanf((char *) s, "%s %d\n%n", user, &acl, &n) != 2)
1003 return;
1004 s += n;
1005 printf(" +{%s ", user);
1006 ACLOUT(acl);
1007 printf("}");
1008 if (s > end)
1009 return;
1010 }
1011
1012 for (i = 0; i < neg; i++) {
1013 if (sscanf((char *) s, "%s %d\n%n", user, &acl, &n) != 2)
1014 return;
1015 s += n;
1016 printf(" -{%s ", user);
1017 ACLOUT(acl);
1018 printf("}");
1019 if (s > end)
1020 return;
1021 }
1022 }
1023
1024 #undef ACLOUT
1025
1026 /*
1027 * Handle calls to the AFS callback service
1028 */
1029
1030 static void
1031 cb_print(register const u_char *bp, int length)
1032 {
1033 int cb_op;
1034 unsigned long i;
1035
1036 if (length <= sizeof(struct rx_header))
1037 return;
1038
1039 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
1040 goto trunc;
1041 }
1042
1043 /*
1044 * Print out the afs call we're invoking. The table used here was
1045 * gleaned from fsint/afscbint.xg
1046 */
1047
1048 cb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
1049
1050 printf(" cb call %s", tok2str(cb_req, "op#%d", cb_op));
1051
1052 bp += sizeof(struct rx_header) + 4;
1053
1054 /*
1055 * Print out the afs call we're invoking. The table used here was
1056 * gleaned from fsint/afscbint.xg
1057 */
1058
1059 switch (cb_op) {
1060 case 204: /* Callback */
1061 {
1062 unsigned long j, t;
1063 TRUNC(4);
1064 j = EXTRACT_32BITS(bp);
1065 bp += sizeof(int32_t);
1066
1067 for (i = 0; i < j; i++) {
1068 FIDOUT();
1069 if (i != j - 1)
1070 printf(",");
1071 }
1072
1073 if (j == 0)
1074 printf(" <none!>");
1075
1076 j = EXTRACT_32BITS(bp);
1077 bp += sizeof(int32_t);
1078
1079 if (j != 0)
1080 printf(";");
1081
1082 for (i = 0; i < j; i++) {
1083 printf(" ver");
1084 INTOUT();
1085 printf(" expires");
1086 DATEOUT();
1087 TRUNC(4);
1088 t = EXTRACT_32BITS(bp);
1089 bp += sizeof(int32_t);
1090 tok2str(cb_types, "type %d", t);
1091 }
1092 }
1093 case 214: {
1094 printf(" afsuuid");
1095 AFSUUIDOUT();
1096 break;
1097 }
1098 default:
1099 ;
1100 }
1101
1102 return;
1103
1104 trunc:
1105 printf(" [|cb]");
1106 }
1107
1108 /*
1109 * Handle replies to the AFS Callback Service
1110 */
1111
1112 static void
1113 cb_reply_print(register const u_char *bp, int length, int32_t opcode)
1114 {
1115 struct rx_header *rxh;
1116
1117 if (length <= sizeof(struct rx_header))
1118 return;
1119
1120 rxh = (struct rx_header *) bp;
1121
1122 /*
1123 * Print out the afs call we're invoking. The table used here was
1124 * gleaned from fsint/afscbint.xg
1125 */
1126
1127 printf(" cb reply %s", tok2str(cb_req, "op#%d", opcode));
1128
1129 bp += sizeof(struct rx_header);
1130
1131 /*
1132 * If it was a data packet, interpret the response.
1133 */
1134
1135 if (rxh->type == RX_PACKET_TYPE_DATA)
1136 switch (opcode) {
1137 case 213: /* InitCallBackState3 */
1138 AFSUUIDOUT();
1139 break;
1140 default:
1141 ;
1142 }
1143 else {
1144 /*
1145 * Otherwise, just print out the return code
1146 */
1147 printf(" errcode");
1148 INTOUT();
1149 }
1150
1151 return;
1152
1153 trunc:
1154 printf(" [|cb]");
1155 }
1156
1157 /*
1158 * Handle calls to the AFS protection database server
1159 */
1160
1161 static void
1162 prot_print(register const u_char *bp, int length)
1163 {
1164 unsigned long i;
1165 char s[AFSNAMEMAX];
1166 int pt_op;
1167
1168 if (length <= sizeof(struct rx_header))
1169 return;
1170
1171 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
1172 goto trunc;
1173 }
1174
1175 /*
1176 * Print out the afs call we're invoking. The table used here was
1177 * gleaned from ptserver/ptint.xg
1178 */
1179
1180 pt_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
1181
1182 printf(" pt");
1183
1184 if (is_ubik(pt_op)) {
1185 ubik_print(bp, length);
1186 return;
1187 }
1188
1189 printf(" call %s", tok2str(pt_req, "op#%d", pt_op));
1190
1191 /*
1192 * Decode some of the arguments to the PT calls
1193 */
1194
1195 bp += sizeof(struct rx_header) + 4;
1196
1197 switch (pt_op) {
1198 case 500: /* I New User */
1199 STROUT(PRNAMEMAX);
1200 printf(" id");
1201 INTOUT();
1202 printf(" oldid");
1203 INTOUT();
1204 break;
1205 case 501: /* Where is it */
1206 case 506: /* Delete */
1207 case 508: /* Get CPS */
1208 case 512: /* List entry */
1209 case 514: /* List elements */
1210 case 517: /* List owned */
1211 case 518: /* Get CPS2 */
1212 case 519: /* Get host CPS */
1213 printf(" id");
1214 INTOUT();
1215 break;
1216 case 502: /* Dump entry */
1217 printf(" pos");
1218 INTOUT();
1219 break;
1220 case 503: /* Add to group */
1221 case 507: /* Remove from group */
1222 case 515: /* Is a member of? */
1223 printf(" uid");
1224 INTOUT();
1225 printf(" gid");
1226 INTOUT();
1227 break;
1228 case 504: /* Name to ID */
1229 {
1230 unsigned long j;
1231 TRUNC(4);
1232 j = EXTRACT_32BITS(bp);
1233 bp += sizeof(int32_t);
1234
1235 /*
1236 * Who designed this chicken-shit protocol?
1237 *
1238 * Each character is stored as a 32-bit
1239 * integer!
1240 */
1241
1242 for (i = 0; i < j; i++) {
1243 VECOUT(PRNAMEMAX);
1244 }
1245 if (j == 0)
1246 printf(" <none!>");
1247 }
1248 break;
1249 case 505: /* Id to name */
1250 {
1251 unsigned long j;
1252 printf(" ids:");
1253 TRUNC(4);
1254 i = EXTRACT_32BITS(bp);
1255 bp += sizeof(int32_t);
1256 for (j = 0; j < i; j++)
1257 INTOUT();
1258 if (j == 0)
1259 printf(" <none!>");
1260 }
1261 break;
1262 case 509: /* New entry */
1263 STROUT(PRNAMEMAX);
1264 printf(" flag");
1265 INTOUT();
1266 printf(" oid");
1267 INTOUT();
1268 break;
1269 case 511: /* Set max */
1270 printf(" id");
1271 INTOUT();
1272 printf(" gflag");
1273 INTOUT();
1274 break;
1275 case 513: /* Change entry */
1276 printf(" id");
1277 INTOUT();
1278 STROUT(PRNAMEMAX);
1279 printf(" oldid");
1280 INTOUT();
1281 printf(" newid");
1282 INTOUT();
1283 break;
1284 case 520: /* Update entry */
1285 printf(" id");
1286 INTOUT();
1287 STROUT(PRNAMEMAX);
1288 break;
1289 default:
1290 ;
1291 }
1292
1293
1294 return;
1295
1296 trunc:
1297 printf(" [|pt]");
1298 }
1299
1300 /*
1301 * Handle replies to the AFS protection service
1302 */
1303
1304 static void
1305 prot_reply_print(register const u_char *bp, int length, int32_t opcode)
1306 {
1307 struct rx_header *rxh;
1308 unsigned long i;
1309 char s[AFSNAMEMAX];
1310
1311 if (length < sizeof(struct rx_header))
1312 return;
1313
1314 rxh = (struct rx_header *) bp;
1315
1316 /*
1317 * Print out the afs call we're invoking. The table used here was
1318 * gleaned from ptserver/ptint.xg. Check to see if it's a
1319 * Ubik call, however.
1320 */
1321
1322 printf(" pt");
1323
1324 if (is_ubik(opcode)) {
1325 ubik_reply_print(bp, length, opcode);
1326 return;
1327 }
1328
1329 printf(" reply %s", tok2str(pt_req, "op#%d", opcode));
1330
1331 bp += sizeof(struct rx_header);
1332
1333 /*
1334 * If it was a data packet, interpret the response
1335 */
1336
1337 if (rxh->type == RX_PACKET_TYPE_DATA)
1338 switch (opcode) {
1339 case 504: /* Name to ID */
1340 {
1341 unsigned long j;
1342 printf(" ids:");
1343 TRUNC(4);
1344 i = EXTRACT_32BITS(bp);
1345 bp += sizeof(int32_t);
1346 for (j = 0; j < i; j++)
1347 INTOUT();
1348 if (j == 0)
1349 printf(" <none!>");
1350 }
1351 break;
1352 case 505: /* ID to name */
1353 {
1354 unsigned long j;
1355 TRUNC(4);
1356 j = EXTRACT_32BITS(bp);
1357 bp += sizeof(int32_t);
1358
1359 /*
1360 * Who designed this chicken-shit protocol?
1361 *
1362 * Each character is stored as a 32-bit
1363 * integer!
1364 */
1365
1366 for (i = 0; i < j; i++) {
1367 VECOUT(PRNAMEMAX);
1368 }
1369 if (j == 0)
1370 printf(" <none!>");
1371 }
1372 break;
1373 case 508: /* Get CPS */
1374 case 514: /* List elements */
1375 case 517: /* List owned */
1376 case 518: /* Get CPS2 */
1377 case 519: /* Get host CPS */
1378 {
1379 unsigned long j;
1380 TRUNC(4);
1381 j = EXTRACT_32BITS(bp);
1382 bp += sizeof(int32_t);
1383 for (i = 0; i < j; i++) {
1384 INTOUT();
1385 }
1386 if (j == 0)
1387 printf(" <none!>");
1388 }
1389 break;
1390 case 510: /* List max */
1391 printf(" maxuid");
1392 INTOUT();
1393 printf(" maxgid");
1394 INTOUT();
1395 break;
1396 default:
1397 ;
1398 }
1399 else {
1400 /*
1401 * Otherwise, just print out the return code
1402 */
1403 printf(" errcode");
1404 INTOUT();
1405 }
1406
1407 return;
1408
1409 trunc:
1410 printf(" [|pt]");
1411 }
1412
1413 /*
1414 * Handle calls to the AFS volume location database service
1415 */
1416
1417 static void
1418 vldb_print(register const u_char *bp, int length)
1419 {
1420 int vldb_op;
1421 unsigned long i;
1422 char s[AFSNAMEMAX];
1423
1424 if (length <= sizeof(struct rx_header))
1425 return;
1426
1427 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
1428 goto trunc;
1429 }
1430
1431 /*
1432 * Print out the afs call we're invoking. The table used here was
1433 * gleaned from vlserver/vldbint.xg
1434 */
1435
1436 vldb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
1437
1438 printf(" vldb");
1439
1440 if (is_ubik(vldb_op)) {
1441 ubik_print(bp, length);
1442 return;
1443 }
1444 printf(" call %s", tok2str(vldb_req, "op#%d", vldb_op));
1445
1446 /*
1447 * Decode some of the arguments to the VLDB calls
1448 */
1449
1450 bp += sizeof(struct rx_header) + 4;
1451
1452 switch (vldb_op) {
1453 case 501: /* Create new volume */
1454 case 517: /* Create entry N */
1455 VECOUT(VLNAMEMAX);
1456 break;
1457 case 502: /* Delete entry */
1458 case 503: /* Get entry by ID */
1459 case 507: /* Update entry */
1460 case 508: /* Set lock */
1461 case 509: /* Release lock */
1462 case 518: /* Get entry by ID N */
1463 printf(" volid");
1464 INTOUT();
1465 TRUNC(sizeof(int32_t));
1466 i = EXTRACT_32BITS(bp);
1467 bp += sizeof(int32_t);
1468 if (i <= 2)
1469 printf(" type %s", voltype[i]);
1470 break;
1471 case 504: /* Get entry by name */
1472 case 519: /* Get entry by name N */
1473 case 524: /* Update entry by name */
1474 case 527: /* Get entry by name U */
1475 STROUT(VLNAMEMAX);
1476 break;
1477 case 505: /* Get new vol id */
1478 printf(" bump");
1479 INTOUT();
1480 break;
1481 case 506: /* Replace entry */
1482 case 520: /* Replace entry N */
1483 printf(" volid");
1484 INTOUT();
1485 TRUNC(sizeof(int32_t));
1486 i = EXTRACT_32BITS(bp);
1487 bp += sizeof(int32_t);
1488 if (i <= 2)
1489 printf(" type %s", voltype[i]);
1490 VECOUT(VLNAMEMAX);
1491 break;
1492 case 510: /* List entry */
1493 case 521: /* List entry N */
1494 printf(" index");
1495 INTOUT();
1496 break;
1497 default:
1498 ;
1499 }
1500
1501 return;
1502
1503 trunc:
1504 printf(" [|vldb]");
1505 }
1506
1507 /*
1508 * Handle replies to the AFS volume location database service
1509 */
1510
1511 static void
1512 vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
1513 {
1514 struct rx_header *rxh;
1515 unsigned long i;
1516 char s[AFSNAMEMAX];
1517
1518 if (length < sizeof(struct rx_header))
1519 return;
1520
1521 rxh = (struct rx_header *) bp;
1522
1523 /*
1524 * Print out the afs call we're invoking. The table used here was
1525 * gleaned from vlserver/vldbint.xg. Check to see if it's a
1526 * Ubik call, however.
1527 */
1528
1529 printf(" vldb");
1530
1531 if (is_ubik(opcode)) {
1532 ubik_reply_print(bp, length, opcode);
1533 return;
1534 }
1535
1536 printf(" reply %s", tok2str(vldb_req, "op#%d", opcode));
1537
1538 bp += sizeof(struct rx_header);
1539
1540 /*
1541 * If it was a data packet, interpret the response
1542 */
1543
1544 if (rxh->type == RX_PACKET_TYPE_DATA)
1545 switch (opcode) {
1546 case 510: /* List entry */
1547 printf(" count");
1548 INTOUT();
1549 printf(" nextindex");
1550 INTOUT();
1551 case 503: /* Get entry by id */
1552 case 504: /* Get entry by name */
1553 { unsigned long nservers, j;
1554 VECOUT(VLNAMEMAX);
1555 TRUNC(sizeof(int32_t));
1556 bp += sizeof(int32_t);
1557 printf(" numservers");
1558 TRUNC(sizeof(int32_t));
1559 nservers = EXTRACT_32BITS(bp);
1560 bp += sizeof(int32_t);
1561 printf(" %lu", nservers);
1562 printf(" servers");
1563 for (i = 0; i < 8; i++) {
1564 TRUNC(sizeof(int32_t));
1565 if (i < nservers)
1566 printf(" %s",
1567 inet_ntoa(*((struct in_addr *) bp)));
1568 bp += sizeof(int32_t);
1569 }
1570 printf(" partitions");
1571 for (i = 0; i < 8; i++) {
1572 TRUNC(sizeof(int32_t));
1573 j = EXTRACT_32BITS(bp);
1574 if (i < nservers && j <= 26)
1575 printf(" %c", 'a' + (int)j);
1576 else if (i < nservers)
1577 printf(" %lu", j);
1578 bp += sizeof(int32_t);
1579 }
1580 TRUNC(8 * sizeof(int32_t));
1581 bp += 8 * sizeof(int32_t);
1582 printf(" rwvol");
1583 UINTOUT();
1584 printf(" rovol");
1585 UINTOUT();
1586 printf(" backup");
1587 UINTOUT();
1588 }
1589 break;
1590 case 505: /* Get new volume ID */
1591 printf(" newvol");
1592 UINTOUT();
1593 break;
1594 case 521: /* List entry */
1595 case 529: /* List entry U */
1596 printf(" count");
1597 INTOUT();
1598 printf(" nextindex");
1599 INTOUT();
1600 case 518: /* Get entry by ID N */
1601 case 519: /* Get entry by name N */
1602 { unsigned long nservers, j;
1603 VECOUT(VLNAMEMAX);
1604 printf(" numservers");
1605 TRUNC(sizeof(int32_t));
1606 nservers = EXTRACT_32BITS(bp);
1607 bp += sizeof(int32_t);
1608 printf(" %lu", nservers);
1609 printf(" servers");
1610 for (i = 0; i < 13; i++) {
1611 TRUNC(sizeof(int32_t));
1612 if (i < nservers)
1613 printf(" %s",
1614 inet_ntoa(*((struct in_addr *) bp)));
1615 bp += sizeof(int32_t);
1616 }
1617 printf(" partitions");
1618 for (i = 0; i < 13; i++) {
1619 TRUNC(sizeof(int32_t));
1620 j = EXTRACT_32BITS(bp);
1621 if (i < nservers && j <= 26)
1622 printf(" %c", 'a' + (int)j);
1623 else if (i < nservers)
1624 printf(" %lu", j);
1625 bp += sizeof(int32_t);
1626 }
1627 TRUNC(13 * sizeof(int32_t));
1628 bp += 13 * sizeof(int32_t);
1629 printf(" rwvol");
1630 UINTOUT();
1631 printf(" rovol");
1632 UINTOUT();
1633 printf(" backup");
1634 UINTOUT();
1635 }
1636 break;
1637 case 526: /* Get entry by ID U */
1638 case 527: /* Get entry by name U */
1639 { unsigned long nservers, j;
1640 VECOUT(VLNAMEMAX);
1641 printf(" numservers");
1642 TRUNC(sizeof(int32_t));
1643 nservers = EXTRACT_32BITS(bp);
1644 bp += sizeof(int32_t);
1645 printf(" %lu", nservers);
1646 printf(" servers");
1647 for (i = 0; i < 13; i++) {
1648 if (i < nservers) {
1649 printf(" afsuuid");
1650 AFSUUIDOUT();
1651 } else {
1652 TRUNC(44);
1653 bp += 44;
1654 }
1655 }
1656 TRUNC(4 * 13);
1657 bp += 4 * 13;
1658 printf(" partitions");
1659 for (i = 0; i < 13; i++) {
1660 TRUNC(sizeof(int32_t));
1661 j = EXTRACT_32BITS(bp);
1662 if (i < nservers && j <= 26)
1663 printf(" %c", 'a' + (int)j);
1664 else if (i < nservers)
1665 printf(" %lu", j);
1666 bp += sizeof(int32_t);
1667 }
1668 TRUNC(13 * sizeof(int32_t));
1669 bp += 13 * sizeof(int32_t);
1670 printf(" rwvol");
1671 UINTOUT();
1672 printf(" rovol");
1673 UINTOUT();
1674 printf(" backup");
1675 UINTOUT();
1676 }
1677 default:
1678 ;
1679 }
1680
1681 else {
1682 /*
1683 * Otherwise, just print out the return code
1684 */
1685 printf(" errcode");
1686 INTOUT();
1687 }
1688
1689 return;
1690
1691 trunc:
1692 printf(" [|vldb]");
1693 }
1694
1695 /*
1696 * Handle calls to the AFS Kerberos Authentication service
1697 */
1698
1699 static void
1700 kauth_print(register const u_char *bp, int length)
1701 {
1702 int kauth_op;
1703 char s[AFSNAMEMAX];
1704
1705 if (length <= sizeof(struct rx_header))
1706 return;
1707
1708 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
1709 goto trunc;
1710 }
1711
1712 /*
1713 * Print out the afs call we're invoking. The table used here was
1714 * gleaned from kauth/kauth.rg
1715 */
1716
1717 kauth_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
1718
1719 printf(" kauth");
1720
1721 if (is_ubik(kauth_op)) {
1722 ubik_print(bp, length);
1723 return;
1724 }
1725
1726
1727 printf(" call %s", tok2str(kauth_req, "op#%d", kauth_op));
1728
1729 /*
1730 * Decode some of the arguments to the KA calls
1731 */
1732
1733 bp += sizeof(struct rx_header) + 4;
1734
1735 switch (kauth_op) {
1736 case 1: /* Authenticate old */;
1737 case 21: /* Authenticate */
1738 case 22: /* Authenticate-V2 */
1739 case 2: /* Change PW */
1740 case 5: /* Set fields */
1741 case 6: /* Create user */
1742 case 7: /* Delete user */
1743 case 8: /* Get entry */
1744 case 14: /* Unlock */
1745 case 15: /* Lock status */
1746 printf(" principal");
1747 STROUT(KANAMEMAX);
1748 STROUT(KANAMEMAX);
1749 break;
1750 case 3: /* GetTicket-old */
1751 case 23: /* GetTicket */
1752 {
1753 int i;
1754 printf(" kvno");
1755 INTOUT();
1756 printf(" domain");
1757 STROUT(KANAMEMAX);
1758 TRUNC(sizeof(int32_t));
1759 i = (int) EXTRACT_32BITS(bp);
1760 bp += sizeof(int32_t);
1761 TRUNC(i);
1762 bp += i;
1763 printf(" principal");
1764 STROUT(KANAMEMAX);
1765 STROUT(KANAMEMAX);
1766 break;
1767 }
1768 case 4: /* Set Password */
1769 printf(" principal");
1770 STROUT(KANAMEMAX);
1771 STROUT(KANAMEMAX);
1772 printf(" kvno");
1773 INTOUT();
1774 break;
1775 case 12: /* Get password */
1776 printf(" name");
1777 STROUT(KANAMEMAX);
1778 break;
1779 default:
1780 ;
1781 }
1782
1783 return;
1784
1785 trunc:
1786 printf(" [|kauth]");
1787 }
1788
1789 /*
1790 * Handle replies to the AFS Kerberos Authentication Service
1791 */
1792
1793 static void
1794 kauth_reply_print(register const u_char *bp, int length, int32_t opcode)
1795 {
1796 struct rx_header *rxh;
1797
1798 if (length <= sizeof(struct rx_header))
1799 return;
1800
1801 rxh = (struct rx_header *) bp;
1802
1803 /*
1804 * Print out the afs call we're invoking. The table used here was
1805 * gleaned from kauth/kauth.rg
1806 */
1807
1808 printf(" kauth");
1809
1810 if (is_ubik(opcode)) {
1811 ubik_reply_print(bp, length, opcode);
1812 return;
1813 }
1814
1815 printf(" reply %s", tok2str(kauth_req, "op#%d", opcode));
1816
1817 bp += sizeof(struct rx_header);
1818
1819 /*
1820 * If it was a data packet, interpret the response.
1821 */
1822
1823 if (rxh->type == RX_PACKET_TYPE_DATA)
1824 /* Well, no, not really. Leave this for later */
1825 ;
1826 else {
1827 /*
1828 * Otherwise, just print out the return code
1829 */
1830 printf(" errcode");
1831 INTOUT();
1832 }
1833
1834 return;
1835
1836 trunc:
1837 printf(" [|kauth]");
1838 }
1839
1840 /*
1841 * Handle calls to the AFS Volume location service
1842 */
1843
1844 static void
1845 vol_print(register const u_char *bp, int length)
1846 {
1847 int vol_op;
1848
1849 if (length <= sizeof(struct rx_header))
1850 return;
1851
1852 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
1853 goto trunc;
1854 }
1855
1856 /*
1857 * Print out the afs call we're invoking. The table used here was
1858 * gleaned from volser/volint.xg
1859 */
1860
1861 vol_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
1862
1863 printf(" vol call %s", tok2str(vol_req, "op#%d", vol_op));
1864
1865 /*
1866 * Normally there would be a switch statement here to decode the
1867 * arguments to the AFS call, but since I don't have access to
1868 * an AFS server (yet) and I'm not an AFS admin, I can't
1869 * test any of these calls. Leave this blank for now.
1870 */
1871
1872 return;
1873
1874 trunc:
1875 printf(" [|vol]");
1876 }
1877
1878 /*
1879 * Handle replies to the AFS Volume Service
1880 */
1881
1882 static void
1883 vol_reply_print(register const u_char *bp, int length, int32_t opcode)
1884 {
1885 struct rx_header *rxh;
1886
1887 if (length <= sizeof(struct rx_header))
1888 return;
1889
1890 rxh = (struct rx_header *) bp;
1891
1892 /*
1893 * Print out the afs call we're invoking. The table used here was
1894 * gleaned from volser/volint.xg
1895 */
1896
1897 printf(" vol reply %s", tok2str(vol_req, "op#%d", opcode));
1898
1899 bp += sizeof(struct rx_header);
1900
1901 /*
1902 * If it was a data packet, interpret the response.
1903 */
1904
1905 if (rxh->type == RX_PACKET_TYPE_DATA)
1906 /* Well, no, not really. Leave this for later */
1907 ;
1908 else {
1909 /*
1910 * Otherwise, just print out the return code
1911 */
1912 printf(" errcode");
1913 INTOUT();
1914 }
1915
1916 return;
1917
1918 trunc:
1919 printf(" [|vol]");
1920 }
1921
1922 /*
1923 * Handle calls to the AFS BOS service
1924 */
1925
1926 static void
1927 bos_print(register const u_char *bp, int length)
1928 {
1929 int bos_op;
1930 char s[BOSNAMEMAX];
1931
1932 if (length <= sizeof(struct rx_header))
1933 return;
1934
1935 if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
1936 goto trunc;
1937 }
1938
1939 /*
1940 * Print out the afs call we're invoking. The table used here was
1941 * gleaned from bozo/bosint.xg
1942 */
1943
1944 bos_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
1945
1946 printf(" bos call %s", tok2str(bos_req, "op#%d", bos_op));
1947
1948 /*
1949 * Decode some of the arguments to the BOS calls
1950 */
1951
1952 bp += sizeof(struct rx_header) + 4;
1953
1954 switch (bos_op) {
1955 case 80: /* Create B node */
1956 printf(" type");
1957 STROUT(BOSNAMEMAX);
1958 printf(" instance");
1959 STROUT(BOSNAMEMAX);
1960 break;
1961 case 81: /* Delete B node */
1962 case 83: /* Get status */
1963 case 85: /* Get instance info */
1964 case 87: /* Add super user */
1965 case 88: /* Delete super user */
1966 case 93: /* Set cell name */
1967 case 96: /* Add cell host */
1968 case 97: /* Delete cell host */
1969 case 104: /* Restart */
1970 case 106: /* Uninstall */
1971 case 108: /* Exec */
1972 case 112: /* Getlog */
1973 case 114: /* Get instance strings */
1974 STROUT(BOSNAMEMAX);
1975 break;
1976 case 82: /* Set status */
1977 case 98: /* Set T status */
1978 STROUT(BOSNAMEMAX);
1979 printf(" status");
1980 INTOUT();
1981 break;
1982 case 86: /* Get instance parm */
1983 STROUT(BOSNAMEMAX);
1984 printf(" num");
1985 INTOUT();
1986 break;
1987 case 84: /* Enumerate instance */
1988 case 89: /* List super users */
1989 case 90: /* List keys */
1990 case 91: /* Add key */
1991 case 92: /* Delete key */
1992 case 95: /* Get cell host */
1993 INTOUT();
1994 break;
1995 case 105: /* Install */
1996 STROUT(BOSNAMEMAX);
1997 printf(" size");
1998 INTOUT();
1999 printf(" flags");
2000 INTOUT();
2001 printf(" date");
2002 INTOUT();
2003 break;
2004 default:
2005 ;
2006 }
2007
2008 return;
2009
2010 trunc:
2011 printf(" [|bos]");
2012 }
2013
2014 /*
2015 * Handle replies to the AFS BOS Service
2016 */
2017
2018 static void
2019 bos_reply_print(register const u_char *bp, int length, int32_t opcode)
2020 {
2021 struct rx_header *rxh;
2022
2023 if (length <= sizeof(struct rx_header))
2024 return;
2025
2026 rxh = (struct rx_header *) bp;
2027
2028 /*
2029 * Print out the afs call we're invoking. The table used here was
2030 * gleaned from volser/volint.xg
2031 */
2032
2033 printf(" bos reply %s", tok2str(bos_req, "op#%d", opcode));
2034
2035 bp += sizeof(struct rx_header);
2036
2037 /*
2038 * If it was a data packet, interpret the response.
2039 */
2040
2041 if (rxh->type == RX_PACKET_TYPE_DATA)
2042 /* Well, no, not really. Leave this for later */
2043 ;
2044 else {
2045 /*
2046 * Otherwise, just print out the return code
2047 */
2048 printf(" errcode");
2049 INTOUT();
2050 }
2051
2052 return;
2053
2054 trunc:
2055 printf(" [|bos]");
2056 }
2057
2058 /*
2059 * Check to see if this is a Ubik opcode.
2060 */
2061
2062 static int
2063 is_ubik(u_int32_t opcode)
2064 {
2065 if ((opcode >= VOTE_LOW && opcode <= VOTE_HIGH) ||
2066 (opcode >= DISK_LOW && opcode <= DISK_HIGH))
2067 return(1);
2068 else
2069 return(0);
2070 }
2071
2072 /*
2073 * Handle Ubik opcodes to any one of the replicated database services
2074 */
2075
2076 static void
2077 ubik_print(register const u_char *bp, int length)
2078 {
2079 int ubik_op;
2080 int32_t temp;
2081
2082 /*
2083 * Print out the afs call we're invoking. The table used here was
2084 * gleaned from ubik/ubik_int.xg
2085 */
2086
2087 ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
2088
2089 printf(" ubik call %s", tok2str(ubik_req, "op#%d", ubik_op));
2090
2091 /*
2092 * Decode some of the arguments to the Ubik calls
2093 */
2094
2095 bp += sizeof(struct rx_header) + 4;
2096
2097 switch (ubik_op) {
2098 case 10000: /* Beacon */
2099 TRUNC(4);
2100 temp = EXTRACT_32BITS(bp);
2101 bp += sizeof(int32_t);
2102 printf(" syncsite %s", temp ? "yes" : "no");
2103 printf(" votestart");
2104 DATEOUT();
2105 printf(" dbversion");
2106 UBIK_VERSIONOUT();
2107 printf(" tid");
2108 UBIK_VERSIONOUT();
2109 break;
2110 case 10003: /* Get sync site */
2111 printf(" site");
2112 UINTOUT();
2113 break;
2114 case 20000: /* Begin */
2115 case 20001: /* Commit */
2116 case 20007: /* Abort */
2117 case 20008: /* Release locks */
2118 case 20010: /* Writev */
2119 printf(" tid");
2120 UBIK_VERSIONOUT();
2121 break;
2122 case 20002: /* Lock */
2123 printf(" tid");
2124 UBIK_VERSIONOUT();
2125 printf(" file");
2126 INTOUT();
2127 printf(" pos");
2128 INTOUT();
2129 printf(" length");
2130 INTOUT();
2131 temp = EXTRACT_32BITS(bp);
2132 bp += sizeof(int32_t);
2133 tok2str(ubik_lock_types, "type %d", temp);
2134 break;
2135 case 20003: /* Write */
2136 printf(" tid");
2137 UBIK_VERSIONOUT();
2138 printf(" file");
2139 INTOUT();
2140 printf(" pos");
2141 INTOUT();
2142 break;
2143 case 20005: /* Get file */
2144 printf(" file");
2145 INTOUT();
2146 break;
2147 case 20006: /* Send file */
2148 printf(" file");
2149 INTOUT();
2150 printf(" length");
2151 INTOUT();
2152 printf(" dbversion");
2153 UBIK_VERSIONOUT();
2154 break;
2155 case 20009: /* Truncate */
2156 printf(" tid");
2157 UBIK_VERSIONOUT();
2158 printf(" file");
2159 INTOUT();
2160 printf(" length");
2161 INTOUT();
2162 break;
2163 case 20012: /* Set version */
2164 printf(" tid");
2165 UBIK_VERSIONOUT();
2166 printf(" oldversion");
2167 UBIK_VERSIONOUT();
2168 printf(" newversion");
2169 UBIK_VERSIONOUT();
2170 break;
2171 default:
2172 ;
2173 }
2174
2175 return;
2176
2177 trunc:
2178 printf(" [|ubik]");
2179 }
2180
2181 /*
2182 * Handle Ubik replies to any one of the replicated database services
2183 */
2184
2185 static void
2186 ubik_reply_print(register const u_char *bp, int length, int32_t opcode)
2187 {
2188 struct rx_header *rxh;
2189
2190 if (length < sizeof(struct rx_header))
2191 return;
2192
2193 rxh = (struct rx_header *) bp;
2194
2195 /*
2196 * Print out the ubik call we're invoking. This table was gleaned
2197 * from ubik/ubik_int.xg
2198 */
2199
2200 printf(" ubik reply %s", tok2str(ubik_req, "op#%d", opcode));
2201
2202 bp += sizeof(struct rx_header);
2203
2204 /*
2205 * If it was a data packet, print out the arguments to the Ubik calls
2206 */
2207
2208 if (rxh->type == RX_PACKET_TYPE_DATA)
2209 switch (opcode) {
2210 case 10000: /* Beacon */
2211 printf(" vote no");
2212 break;
2213 case 20004: /* Get version */
2214 printf(" dbversion");
2215 UBIK_VERSIONOUT();
2216 break;
2217 default:
2218 ;
2219 }
2220
2221 /*
2222 * Otherwise, print out "yes" it it was a beacon packet (because
2223 * that's how yes votes are returned, go figure), otherwise
2224 * just print out the error code.
2225 */
2226
2227 else
2228 switch (opcode) {
2229 case 10000: /* Beacon */
2230 printf(" vote yes until");
2231 DATEOUT();
2232 break;
2233 default:
2234 printf(" errcode");
2235 INTOUT();
2236 }
2237
2238 return;
2239
2240 trunc:
2241 printf(" [|ubik]");
2242 }
2243
2244 /*
2245 * Handle RX ACK packets.
2246 */
2247
2248 void
2249 rx_ack_print(register const u_char *bp, int length)
2250 {
2251 struct rx_ackPacket *rxa;
2252 int i, start, last;
2253
2254 if (length < sizeof(struct rx_header))
2255 return;
2256
2257 bp += sizeof(struct rx_header);
2258
2259 /*
2260 * This may seem a little odd .... the rx_ackPacket structure
2261 * contains an array of individual packet acknowledgements
2262 * (used for selective ack/nack), but since it's variable in size,
2263 * we don't want to truncate based on the size of the whole
2264 * rx_ackPacket structure.
2265 */
2266
2267 TRUNC(sizeof(struct rx_ackPacket) - RX_MAXACKS);
2268
2269 rxa = (struct rx_ackPacket *) bp;
2270 bp += (sizeof(struct rx_ackPacket) - RX_MAXACKS);
2271
2272 /*
2273 * Print out a few useful things from the ack packet structure
2274 */
2275
2276 if (vflag > 2)
2277 printf(" bufspace %d maxskew %d",
2278 (int) EXTRACT_16BITS(&rxa->bufferSpace),
2279 (int) EXTRACT_16BITS(&rxa->maxSkew));
2280
2281 printf(" first %d serial %d reason %s",
2282 EXTRACT_32BITS(&rxa->firstPacket), EXTRACT_32BITS(&rxa->serial),
2283 tok2str(rx_ack_reasons, "#%d", (int) rxa->reason));
2284
2285 /*
2286 * Okay, now we print out the ack array. The way _this_ works
2287 * is that we start at "first", and step through the ack array.
2288 * If we have a contiguous range of acks/nacks, try to
2289 * collapse them into a range.
2290 *
2291 * If you're really clever, you might have noticed that this
2292 * doesn't seem quite correct. Specifically, due to structure
2293 * padding, sizeof(struct rx_ackPacket) - RX_MAXACKS won't actually
2294 * yield the start of the ack array (because RX_MAXACKS is 255
2295 * and the structure will likely get padded to a 2 or 4 byte
2296 * boundary). However, this is the way it's implemented inside
2297 * of AFS - the start of the extra fields are at
2298 * sizeof(struct rx_ackPacket) - RX_MAXACKS + nAcks, which _isn't_
2299 * the exact start of the ack array. Sigh. That's why we aren't
2300 * using bp, but instead use rxa->acks[]. But nAcks gets added
2301 * to bp after this, so bp ends up at the right spot. Go figure.
2302 */
2303
2304 if (rxa->nAcks != 0) {
2305
2306 TRUNC(rxa->nAcks);
2307
2308 /*
2309 * Sigh, this is gross, but it seems to work to collapse
2310 * ranges correctly.
2311 */
2312
2313 for (i = 0, start = last = -2; i < rxa->nAcks; i++)
2314 if (rxa->acks[i] == RX_ACK_TYPE_ACK) {
2315
2316 /*
2317 * I figured this deserved _some_ explanation.
2318 * First, print "acked" and the packet seq
2319 * number if this is the first time we've
2320 * seen an acked packet.
2321 */
2322
2323 if (last == -2) {
2324 printf(" acked %d",
2325 rxa->firstPacket + i);
2326 start = i;
2327 }
2328
2329 /*
2330 * Otherwise, if the there is a skip in
2331 * the range (such as an nacked packet in
2332 * the middle of some acked packets),
2333 * then print the current packet number
2334 * seperated from the last number by
2335 * a comma.
2336 */
2337
2338 else if (last != i - 1) {
2339 printf(",%d", rxa->firstPacket + i);
2340 start = i;
2341 }
2342
2343 /*
2344 * We always set last to the value of
2345 * the last ack we saw. Conversely, start
2346 * is set to the value of the first ack
2347 * we saw in a range.
2348 */
2349
2350 last = i;
2351
2352 /*
2353 * Okay, this bit a code gets executed when
2354 * we hit a nack ... in _this_ case we
2355 * want to print out the range of packets
2356 * that were acked, so we need to print
2357 * the _previous_ packet number seperated
2358 * from the first by a dash (-). Since we
2359 * already printed the first packet above,
2360 * just print the final packet.
2361 */
2362 } else if (last == i - 1)
2363 printf("-%d", rxa->firstPacket + i - 1);
2364
2365 /*
2366 * So, what's going on here? We ran off the end of the
2367 * ack list, and if we got a range we need to finish it up.
2368 * So we need to determine if the last packet in the list
2369 * was an ack (if so, then last will be set to it) and
2370 * we need to see if the last range didn't start with the
2371 * last packet (because if it _did_, then that would mean
2372 * that the packet number has already been printed and
2373 * we don't need to print it again).
2374 */
2375
2376 if (last == i - 1 && start != last)
2377 printf("-%d", rxa->firstPacket + i - 1);
2378
2379 /*
2380 * Same as above, just without comments
2381 */
2382
2383 for (i = 0, start = last = -2; i < rxa->nAcks; i++)
2384 if (rxa->acks[i] == RX_ACK_TYPE_NACK) {
2385 if (last == -2) {
2386 printf(" nacked %d",
2387 rxa->firstPacket + i);
2388 start = i;
2389 } else if (last != i - 1) {
2390 printf(",%d", rxa->firstPacket + i);
2391 start = i;
2392 }
2393 last = i;
2394 } else if (last == i - 1)
2395 printf("-%d", rxa->firstPacket + i - 1);
2396
2397 if (last == i - 1 && start != last)
2398 printf("-%d", rxa->firstPacket + i - 1);
2399
2400 bp += rxa->nAcks;
2401 }
2402
2403
2404 /*
2405 * These are optional fields; depending on your version of AFS,
2406 * you may or may not see them
2407 */
2408
2409 #define TRUNCRET(n) if (snapend - bp + 1 <= n) return;
2410
2411 if (vflag > 1) {
2412 TRUNCRET(4);
2413 printf(" ifmtu");
2414 INTOUT();
2415
2416 TRUNCRET(4);
2417 printf(" maxmtu");
2418 INTOUT();
2419
2420 TRUNCRET(4);
2421 printf(" rwind");
2422 INTOUT();
2423
2424 TRUNCRET(4);
2425 printf(" maxpackets");
2426 INTOUT();
2427 }
2428
2429 return;
2430
2431 trunc:
2432 printf(" [|ack]");
2433 }
2434 #undef TRUNCRET