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