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