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