]> The Tcpdump Group git mirrors - tcpdump/blob - print-atalk.c
Updated 802.15.4 code
[tcpdump] / print-atalk.c
1 /*
2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22 /* \summary: AppleTalk printer */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include "netdissect-stdinc.h"
29
30 #include <stdio.h>
31 #include <string.h>
32
33 #include "netdissect.h"
34 #include "addrtoname.h"
35 #include "ethertype.h"
36 #include "extract.h"
37 #include "appletalk.h"
38
39
40 static const struct tok type2str[] = {
41 { ddpRTMP, "rtmp" },
42 { ddpRTMPrequest, "rtmpReq" },
43 { ddpECHO, "echo" },
44 { ddpIP, "IP" },
45 { ddpARP, "ARP" },
46 { ddpKLAP, "KLAP" },
47 { 0, NULL }
48 };
49
50 struct aarp {
51 nd_uint16_t htype, ptype;
52 nd_uint8_t halen, palen;
53 nd_uint16_t op;
54 uint8_t hsaddr[6];
55 uint8_t psaddr[4];
56 uint8_t hdaddr[6];
57 uint8_t pdaddr[4];
58 };
59
60 static void atp_print(netdissect_options *, const struct atATP *, u_int);
61 static void atp_bitmap_print(netdissect_options *, u_char);
62 static void nbp_print(netdissect_options *, const struct atNBP *, u_int, u_short, u_char, u_char);
63 static const struct atNBPtuple *nbp_tuple_print(netdissect_options *ndo, const struct atNBPtuple *,
64 const u_char *,
65 u_short, u_char, u_char);
66 static const struct atNBPtuple *nbp_name_print(netdissect_options *, const struct atNBPtuple *,
67 const u_char *);
68 static const char *ataddr_string(netdissect_options *, u_short, u_char);
69 static void ddp_print(netdissect_options *, const u_char *, u_int, u_int, u_short, u_char, u_char);
70 static const char *ddpskt_string(netdissect_options *, u_int);
71
72 /*
73 * Print LLAP packets received on a physical LocalTalk interface.
74 */
75 u_int
76 ltalk_if_print(netdissect_options *ndo,
77 const struct pcap_pkthdr *h, const u_char *p)
78 {
79 u_int hdrlen;
80
81 ndo->ndo_protocol = "ltalk_if";
82 hdrlen = llap_print(ndo, p, h->len);
83 if (hdrlen == 0) {
84 /* Cut short by the snapshot length. */
85 return (h->caplen);
86 }
87 return (hdrlen);
88 }
89
90 /*
91 * Print AppleTalk LLAP packets.
92 */
93 u_int
94 llap_print(netdissect_options *ndo,
95 const u_char *bp, u_int length)
96 {
97 const struct LAP *lp;
98 const struct atDDP *dp;
99 const struct atShortDDP *sdp;
100 u_short snet;
101 u_int hdrlen;
102
103 ndo->ndo_protocol = "llap";
104 if (length < sizeof(*lp)) {
105 ND_PRINT(" [|llap %u]", length);
106 return (length);
107 }
108 if (!ND_TTEST_LEN(bp, sizeof(*lp))) {
109 nd_print_trunc(ndo);
110 return (0); /* cut short by the snapshot length */
111 }
112 lp = (const struct LAP *)bp;
113 bp += sizeof(*lp);
114 length -= sizeof(*lp);
115 hdrlen = sizeof(*lp);
116 switch (EXTRACT_U_1(lp->type)) {
117
118 case lapShortDDP:
119 if (length < ddpSSize) {
120 ND_PRINT(" [|sddp %u]", length);
121 return (length);
122 }
123 if (!ND_TTEST_LEN(bp, ddpSSize)) {
124 ND_PRINT(" [|sddp]");
125 return (0); /* cut short by the snapshot length */
126 }
127 sdp = (const struct atShortDDP *)bp;
128 ND_PRINT("%s.%s",
129 ataddr_string(ndo, 0, EXTRACT_U_1(lp->src)), ddpskt_string(ndo, EXTRACT_U_1(sdp->srcSkt)));
130 ND_PRINT(" > %s.%s:",
131 ataddr_string(ndo, 0, EXTRACT_U_1(lp->dst)), ddpskt_string(ndo, EXTRACT_U_1(sdp->dstSkt)));
132 bp += ddpSSize;
133 length -= ddpSSize;
134 hdrlen += ddpSSize;
135 ddp_print(ndo, bp, length, EXTRACT_U_1(sdp->type), 0, EXTRACT_U_1(lp->src), EXTRACT_U_1(sdp->srcSkt));
136 break;
137
138 case lapDDP:
139 if (length < ddpSize) {
140 ND_PRINT(" [|ddp %u]", length);
141 return (length);
142 }
143 if (!ND_TTEST_LEN(bp, ddpSize)) {
144 ND_PRINT(" [|ddp]");
145 return (0); /* cut short by the snapshot length */
146 }
147 dp = (const struct atDDP *)bp;
148 snet = EXTRACT_BE_U_2(dp->srcNet);
149 ND_PRINT("%s.%s", ataddr_string(ndo, snet, EXTRACT_U_1(dp->srcNode)),
150 ddpskt_string(ndo, EXTRACT_U_1(dp->srcSkt)));
151 ND_PRINT(" > %s.%s:",
152 ataddr_string(ndo, EXTRACT_BE_U_2(dp->dstNet), EXTRACT_U_1(dp->dstNode)),
153 ddpskt_string(ndo, EXTRACT_U_1(dp->dstSkt)));
154 bp += ddpSize;
155 length -= ddpSize;
156 hdrlen += ddpSize;
157 ddp_print(ndo, bp, length, EXTRACT_U_1(dp->type), snet, EXTRACT_U_1(dp->srcNode), EXTRACT_U_1(dp->srcSkt));
158 break;
159
160 #ifdef notdef
161 case lapKLAP:
162 klap_print(bp, length);
163 break;
164 #endif
165
166 default:
167 ND_PRINT("%u > %u at-lap#%u %u",
168 EXTRACT_U_1(lp->src), EXTRACT_U_1(lp->dst), EXTRACT_U_1(lp->type), length);
169 break;
170 }
171 return (hdrlen);
172 }
173
174 /*
175 * Print EtherTalk/TokenTalk packets (or FDDITalk, or whatever it's called
176 * when it runs over FDDI; yes, I've seen FDDI captures with AppleTalk
177 * packets in them).
178 */
179 void
180 atalk_print(netdissect_options *ndo,
181 const u_char *bp, u_int length)
182 {
183 const struct atDDP *dp;
184 u_short snet;
185
186 ndo->ndo_protocol = "atalk";
187 if(!ndo->ndo_eflag)
188 ND_PRINT("AT ");
189
190 if (length < ddpSize) {
191 ND_PRINT(" [|ddp %u]", length);
192 return;
193 }
194 if (!ND_TTEST_LEN(bp, ddpSize)) {
195 ND_PRINT(" [|ddp]");
196 return;
197 }
198 dp = (const struct atDDP *)bp;
199 snet = EXTRACT_BE_U_2(dp->srcNet);
200 ND_PRINT("%s.%s", ataddr_string(ndo, snet, EXTRACT_U_1(dp->srcNode)),
201 ddpskt_string(ndo, EXTRACT_U_1(dp->srcSkt)));
202 ND_PRINT(" > %s.%s: ",
203 ataddr_string(ndo, EXTRACT_BE_U_2(dp->dstNet), EXTRACT_U_1(dp->dstNode)),
204 ddpskt_string(ndo, EXTRACT_U_1(dp->dstSkt)));
205 bp += ddpSize;
206 length -= ddpSize;
207 ddp_print(ndo, bp, length, EXTRACT_U_1(dp->type), snet, EXTRACT_U_1(dp->srcNode), EXTRACT_U_1(dp->srcSkt));
208 }
209
210 /* XXX should probably pass in the snap header and do checks like arp_print() */
211 void
212 aarp_print(netdissect_options *ndo,
213 const u_char *bp, u_int length)
214 {
215 const struct aarp *ap;
216
217 #define AT(member) ataddr_string(ndo, (ap->member[1]<<8)|ap->member[2],ap->member[3])
218
219 ndo->ndo_protocol = "aarp";
220 ND_PRINT("aarp ");
221 ap = (const struct aarp *)bp;
222 if (!ND_TTEST_SIZE(ap)) {
223 /* Just bail if we don't have the whole chunk. */
224 nd_print_trunc(ndo);
225 return;
226 }
227 if (length < sizeof(*ap)) {
228 ND_PRINT(" [|aarp %u]", length);
229 return;
230 }
231 if (EXTRACT_BE_U_2(ap->htype) == 1 &&
232 EXTRACT_BE_U_2(ap->ptype) == ETHERTYPE_ATALK &&
233 EXTRACT_U_1(ap->halen) == 6 && EXTRACT_U_1(ap->palen) == 4 )
234 switch (EXTRACT_BE_U_2(ap->op)) {
235
236 case 1: /* request */
237 ND_PRINT("who-has %s tell %s", AT(pdaddr), AT(psaddr));
238 return;
239
240 case 2: /* response */
241 ND_PRINT("reply %s is-at %s", AT(psaddr), etheraddr_string(ndo, ap->hsaddr));
242 return;
243
244 case 3: /* probe (oy!) */
245 ND_PRINT("probe %s tell %s", AT(pdaddr), AT(psaddr));
246 return;
247 }
248 ND_PRINT("len %u op %u htype %u ptype %#x halen %u palen %u",
249 length, EXTRACT_BE_U_2(ap->op), EXTRACT_BE_U_2(ap->htype),
250 EXTRACT_BE_U_2(ap->ptype), EXTRACT_U_1(ap->halen), EXTRACT_U_1(ap->palen));
251 }
252
253 /*
254 * Print AppleTalk Datagram Delivery Protocol packets.
255 */
256 static void
257 ddp_print(netdissect_options *ndo,
258 const u_char *bp, u_int length, u_int t,
259 u_short snet, u_char snode, u_char skt)
260 {
261
262 switch (t) {
263
264 case ddpNBP:
265 nbp_print(ndo, (const struct atNBP *)bp, length, snet, snode, skt);
266 break;
267
268 case ddpATP:
269 atp_print(ndo, (const struct atATP *)bp, length);
270 break;
271
272 case ddpEIGRP:
273 eigrp_print(ndo, bp, length);
274 break;
275
276 default:
277 ND_PRINT(" at-%s %u", tok2str(type2str, NULL, t), length);
278 break;
279 }
280 }
281
282 static void
283 atp_print(netdissect_options *ndo,
284 const struct atATP *ap, u_int length)
285 {
286 uint8_t control;
287 uint32_t data;
288
289 if ((const u_char *)(ap + 1) > ndo->ndo_snapend) {
290 /* Just bail if we don't have the whole chunk. */
291 nd_print_trunc(ndo);
292 return;
293 }
294 if (length < sizeof(*ap)) {
295 ND_PRINT(" [|atp %u]", length);
296 return;
297 }
298 length -= sizeof(*ap);
299 control = EXTRACT_U_1(ap->control);
300 switch (control & 0xc0) {
301
302 case atpReqCode:
303 ND_PRINT(" atp-req%s %u",
304 control & atpXO? " " : "*",
305 EXTRACT_BE_U_2(ap->transID));
306
307 atp_bitmap_print(ndo, EXTRACT_U_1(ap->bitmap));
308
309 if (length != 0)
310 ND_PRINT(" [len=%u]", length);
311
312 switch (control & (atpEOM|atpSTS)) {
313 case atpEOM:
314 ND_PRINT(" [EOM]");
315 break;
316 case atpSTS:
317 ND_PRINT(" [STS]");
318 break;
319 case atpEOM|atpSTS:
320 ND_PRINT(" [EOM,STS]");
321 break;
322 }
323 break;
324
325 case atpRspCode:
326 ND_PRINT(" atp-resp%s%u:%u (%u)",
327 control & atpEOM? "*" : " ",
328 EXTRACT_BE_U_2(ap->transID), EXTRACT_U_1(ap->bitmap), length);
329 switch (control & (atpXO|atpSTS)) {
330 case atpXO:
331 ND_PRINT(" [XO]");
332 break;
333 case atpSTS:
334 ND_PRINT(" [STS]");
335 break;
336 case atpXO|atpSTS:
337 ND_PRINT(" [XO,STS]");
338 break;
339 }
340 break;
341
342 case atpRelCode:
343 ND_PRINT(" atp-rel %u", EXTRACT_BE_U_2(ap->transID));
344
345 atp_bitmap_print(ndo, EXTRACT_U_1(ap->bitmap));
346
347 /* length should be zero */
348 if (length)
349 ND_PRINT(" [len=%u]", length);
350
351 /* there shouldn't be any control flags */
352 if (control & (atpXO|atpEOM|atpSTS)) {
353 char c = '[';
354 if (control & atpXO) {
355 ND_PRINT("%cXO", c);
356 c = ',';
357 }
358 if (control & atpEOM) {
359 ND_PRINT("%cEOM", c);
360 c = ',';
361 }
362 if (control & atpSTS) {
363 ND_PRINT("%cSTS", c);
364 }
365 ND_PRINT("]");
366 }
367 break;
368
369 default:
370 ND_PRINT(" atp-0x%x %u (%u)", control,
371 EXTRACT_BE_U_2(ap->transID), length);
372 break;
373 }
374 data = EXTRACT_BE_U_4(ap->userData);
375 if (data != 0)
376 ND_PRINT(" 0x%x", data);
377 }
378
379 static void
380 atp_bitmap_print(netdissect_options *ndo,
381 u_char bm)
382 {
383 u_int i;
384
385 /*
386 * The '& 0xff' below is needed for compilers that want to sign
387 * extend a u_char, which is the case with the Ultrix compiler.
388 * (gcc is smart enough to eliminate it, at least on the Sparc).
389 */
390 if ((bm + 1) & (bm & 0xff)) {
391 char c = '<';
392 for (i = 0; bm; ++i) {
393 if (bm & 1) {
394 ND_PRINT("%c%u", c, i);
395 c = ',';
396 }
397 bm >>= 1;
398 }
399 ND_PRINT(">");
400 } else {
401 for (i = 0; bm; ++i)
402 bm >>= 1;
403 if (i > 1)
404 ND_PRINT("<0-%u>", i - 1);
405 else
406 ND_PRINT("<0>");
407 }
408 }
409
410 static void
411 nbp_print(netdissect_options *ndo,
412 const struct atNBP *np, u_int length, u_short snet,
413 u_char snode, u_char skt)
414 {
415 const struct atNBPtuple *tp =
416 (const struct atNBPtuple *)((const u_char *)np + nbpHeaderSize);
417 uint8_t control;
418 u_int i;
419 const u_char *ep;
420
421 if (length < nbpHeaderSize) {
422 ND_PRINT(" truncated-nbp %u", length);
423 return;
424 }
425
426 length -= nbpHeaderSize;
427 if (length < 8) {
428 /* must be room for at least one tuple */
429 ND_PRINT(" truncated-nbp %u", length + nbpHeaderSize);
430 return;
431 }
432 /* ep points to end of available data */
433 ep = ndo->ndo_snapend;
434 if ((const u_char *)tp > ep) {
435 nd_print_trunc(ndo);
436 return;
437 }
438 control = EXTRACT_U_1(np->control);
439 switch (i = (control & 0xf0)) {
440
441 case nbpBrRq:
442 case nbpLkUp:
443 ND_PRINT(i == nbpLkUp? " nbp-lkup %u:":" nbp-brRq %u:", EXTRACT_U_1(np->id));
444 if ((const u_char *)(tp + 1) > ep) {
445 nd_print_trunc(ndo);
446 return;
447 }
448 (void)nbp_name_print(ndo, tp, ep);
449 /*
450 * look for anomalies: the spec says there can only
451 * be one tuple, the address must match the source
452 * address and the enumerator should be zero.
453 */
454 if ((control & 0xf) != 1)
455 ND_PRINT(" [ntup=%u]", control & 0xf);
456 if (EXTRACT_U_1(tp->enumerator))
457 ND_PRINT(" [enum=%u]", EXTRACT_U_1(tp->enumerator));
458 if (EXTRACT_BE_U_2(tp->net) != snet ||
459 EXTRACT_U_1(tp->node) != snode ||
460 EXTRACT_U_1(tp->skt) != skt)
461 ND_PRINT(" [addr=%s.%u]",
462 ataddr_string(ndo, EXTRACT_BE_U_2(tp->net),
463 EXTRACT_U_1(tp->node)),
464 EXTRACT_U_1(tp->skt));
465 break;
466
467 case nbpLkUpReply:
468 ND_PRINT(" nbp-reply %u:", EXTRACT_U_1(np->id));
469
470 /* print each of the tuples in the reply */
471 for (i = control & 0xf; i != 0 && tp; i--)
472 tp = nbp_tuple_print(ndo, tp, ep, snet, snode, skt);
473 break;
474
475 default:
476 ND_PRINT(" nbp-0x%x %u (%u)", control, EXTRACT_U_1(np->id), length);
477 break;
478 }
479 }
480
481 /* print a counted string */
482 static const u_char *
483 print_cstring(netdissect_options *ndo,
484 const u_char *cp, const u_char *ep)
485 {
486 u_int length;
487
488 if (cp >= ep) {
489 nd_print_trunc(ndo);
490 return (0);
491 }
492 length = EXTRACT_U_1(cp);
493 cp++;
494
495 /* Spec says string can be at most 32 bytes long */
496 if (length > 32) {
497 ND_PRINT("[len=%u]", length);
498 return (0);
499 }
500 while (length != 0) {
501 if (cp >= ep) {
502 nd_print_trunc(ndo);
503 return (0);
504 }
505 fn_print_char(ndo, EXTRACT_U_1(cp));
506 cp++;
507 length--;
508 }
509 return (cp);
510 }
511
512 static const struct atNBPtuple *
513 nbp_tuple_print(netdissect_options *ndo,
514 const struct atNBPtuple *tp, const u_char *ep,
515 u_short snet, u_char snode, u_char skt)
516 {
517 const struct atNBPtuple *tpn;
518
519 if ((const u_char *)(tp + 1) > ep) {
520 nd_print_trunc(ndo);
521 return 0;
522 }
523 tpn = nbp_name_print(ndo, tp, ep);
524
525 /* if the enumerator isn't 1, print it */
526 if (EXTRACT_U_1(tp->enumerator) != 1)
527 ND_PRINT("(%u)", EXTRACT_U_1(tp->enumerator));
528
529 /* if the socket doesn't match the src socket, print it */
530 if (EXTRACT_U_1(tp->skt) != skt)
531 ND_PRINT(" %u", EXTRACT_U_1(tp->skt));
532
533 /* if the address doesn't match the src address, it's an anomaly */
534 if (EXTRACT_BE_U_2(tp->net) != snet ||
535 EXTRACT_U_1(tp->node) != snode)
536 ND_PRINT(" [addr=%s]",
537 ataddr_string(ndo, EXTRACT_BE_U_2(tp->net), EXTRACT_U_1(tp->node)));
538
539 return (tpn);
540 }
541
542 static const struct atNBPtuple *
543 nbp_name_print(netdissect_options *ndo,
544 const struct atNBPtuple *tp, const u_char *ep)
545 {
546 const u_char *cp = (const u_char *)tp + nbpTupleSize;
547
548 ND_PRINT(" ");
549
550 /* Object */
551 ND_PRINT("\"");
552 if ((cp = print_cstring(ndo, cp, ep)) != NULL) {
553 /* Type */
554 ND_PRINT(":");
555 if ((cp = print_cstring(ndo, cp, ep)) != NULL) {
556 /* Zone */
557 ND_PRINT("@");
558 if ((cp = print_cstring(ndo, cp, ep)) != NULL)
559 ND_PRINT("\"");
560 }
561 }
562 return ((const struct atNBPtuple *)cp);
563 }
564
565
566 #define HASHNAMESIZE 4096
567
568 struct hnamemem {
569 u_int addr;
570 char *name;
571 struct hnamemem *nxt;
572 };
573
574 static struct hnamemem hnametable[HASHNAMESIZE];
575
576 static const char *
577 ataddr_string(netdissect_options *ndo,
578 u_short atnet, u_char athost)
579 {
580 struct hnamemem *tp, *tp2;
581 u_int i = (atnet << 8) | athost;
582 char nambuf[256+1];
583 static int first = 1;
584 FILE *fp;
585
586 /*
587 * Are we doing address to name resolution?
588 */
589 if (!ndo->ndo_nflag) {
590 /*
591 * Yes. Have we tried to open and read an AppleTalk
592 * number to name map file?
593 */
594 if (!first) {
595 /*
596 * No; try to do so.
597 */
598 first = 0;
599 fp = fopen("/etc/atalk.names", "r");
600 if (fp != NULL) {
601 char line[256];
602 u_int i1, i2;
603
604 while (fgets(line, sizeof(line), fp)) {
605 if (line[0] == '\n' || line[0] == 0 ||
606 line[0] == '#')
607 continue;
608 if (sscanf(line, "%u.%u %256s", &i1,
609 &i2, nambuf) == 3)
610 /* got a hostname. */
611 i2 |= (i1 << 8);
612 else if (sscanf(line, "%u %256s", &i1,
613 nambuf) == 2)
614 /* got a net name */
615 i2 = (i1 << 8) | 255;
616 else
617 continue;
618
619 for (tp = &hnametable[i2 & (HASHNAMESIZE-1)];
620 tp->nxt; tp = tp->nxt)
621 ;
622 tp->addr = i2;
623 tp->nxt = newhnamemem(ndo);
624 tp->name = strdup(nambuf);
625 if (tp->name == NULL)
626 (*ndo->ndo_error)(ndo,
627 S_ERR_ND_MEM_ALLOC,
628 "ataddr_string: strdup(nambuf)");
629 }
630 fclose(fp);
631 }
632 }
633 }
634
635 /*
636 * Now try to look up the address in the table.
637 */
638 for (tp = &hnametable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
639 if (tp->addr == i)
640 return (tp->name);
641
642 /* didn't have the node name -- see if we've got the net name */
643 i |= 255;
644 for (tp2 = &hnametable[i & (HASHNAMESIZE-1)]; tp2->nxt; tp2 = tp2->nxt)
645 if (tp2->addr == i) {
646 tp->addr = (atnet << 8) | athost;
647 tp->nxt = newhnamemem(ndo);
648 (void)nd_snprintf(nambuf, sizeof(nambuf), "%s.%u",
649 tp2->name, athost);
650 tp->name = strdup(nambuf);
651 if (tp->name == NULL)
652 (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
653 "ataddr_string: strdup(nambuf)");
654 return (tp->name);
655 }
656
657 tp->addr = (atnet << 8) | athost;
658 tp->nxt = newhnamemem(ndo);
659 if (athost != 255)
660 (void)nd_snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
661 else
662 (void)nd_snprintf(nambuf, sizeof(nambuf), "%u", atnet);
663 tp->name = strdup(nambuf);
664 if (tp->name == NULL)
665 (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
666 "ataddr_string: strdup(nambuf)");
667
668 return (tp->name);
669 }
670
671 static const struct tok skt2str[] = {
672 { rtmpSkt, "rtmp" }, /* routing table maintenance */
673 { nbpSkt, "nis" }, /* name info socket */
674 { echoSkt, "echo" }, /* AppleTalk echo protocol */
675 { zipSkt, "zip" }, /* zone info protocol */
676 { 0, NULL }
677 };
678
679 static const char *
680 ddpskt_string(netdissect_options *ndo,
681 u_int skt)
682 {
683 static char buf[8];
684
685 if (ndo->ndo_nflag) {
686 (void)nd_snprintf(buf, sizeof(buf), "%u", skt);
687 return (buf);
688 }
689 return (tok2str(skt2str, "%u", skt));
690 }