]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/tcpdump/print-udp.c
MFC r368207,368607:
[FreeBSD/stable/10.git] / contrib / tcpdump / print-udp.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  * $FreeBSD$
22  */
23
24 #ifndef lint
25 static const char rcsid[] _U_ =
26     "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.142 2007-08-08 17:20:58 hannes Exp $ (LBL)";
27 #endif
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33 #include <tcpdump-stdinc.h>
34
35 #ifdef SEGSIZE
36 #undef SEGSIZE
37 #endif
38
39 #include <stdio.h>
40 #include <string.h>
41
42 #include "interface.h"
43 #include "addrtoname.h"
44 #include "extract.h"
45 #include "appletalk.h"
46
47 #include "udp.h"
48
49 #include "ip.h"
50 #ifdef INET6
51 #include "ip6.h"
52 #endif
53 #include "ipproto.h"
54 #include "rpc_auth.h"
55 #include "rpc_msg.h"
56
57 #include "nameser.h"
58 #include "nfs.h"
59 #include "bootp.h"
60
61 struct rtcphdr {
62         u_int16_t rh_flags;     /* T:2 P:1 CNT:5 PT:8 */
63         u_int16_t rh_len;       /* length of message (in words) */
64         u_int32_t rh_ssrc;      /* synchronization src id */
65 };
66
67 typedef struct {
68         u_int32_t upper;        /* more significant 32 bits */
69         u_int32_t lower;        /* less significant 32 bits */
70 } ntp64;
71
72 /*
73  * Sender report.
74  */
75 struct rtcp_sr {
76         ntp64 sr_ntp;           /* 64-bit ntp timestamp */
77         u_int32_t sr_ts;        /* reference media timestamp */
78         u_int32_t sr_np;        /* no. packets sent */
79         u_int32_t sr_nb;        /* no. bytes sent */
80 };
81
82 /*
83  * Receiver report.
84  * Time stamps are middle 32-bits of ntp timestamp.
85  */
86 struct rtcp_rr {
87         u_int32_t rr_srcid;     /* sender being reported */
88         u_int32_t rr_nl;        /* no. packets lost */
89         u_int32_t rr_ls;        /* extended last seq number received */
90         u_int32_t rr_dv;        /* jitter (delay variance) */
91         u_int32_t rr_lsr;       /* orig. ts from last rr from this src  */
92         u_int32_t rr_dlsr;      /* time from recpt of last rr to xmit time */
93 };
94
95 /*XXX*/
96 #define RTCP_PT_SR      200
97 #define RTCP_PT_RR      201
98 #define RTCP_PT_SDES    202
99 #define         RTCP_SDES_CNAME 1
100 #define         RTCP_SDES_NAME  2
101 #define         RTCP_SDES_EMAIL 3
102 #define         RTCP_SDES_PHONE 4
103 #define         RTCP_SDES_LOC   5
104 #define         RTCP_SDES_TOOL  6
105 #define         RTCP_SDES_NOTE  7
106 #define         RTCP_SDES_PRIV  8
107 #define RTCP_PT_BYE     203
108 #define RTCP_PT_APP     204
109
110 static void
111 vat_print(const void *hdr, register const struct udphdr *up)
112 {
113         /* vat/vt audio */
114         u_int ts = *(u_int16_t *)hdr;
115         if ((ts & 0xf060) != 0) {
116                 /* probably vt */
117                 (void)printf("udp/vt %u %d / %d",
118                              (u_int32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up)),
119                              ts & 0x3ff, ts >> 10);
120         } else {
121                 /* probably vat */
122                 u_int32_t i0 = EXTRACT_32BITS(&((u_int *)hdr)[0]);
123                 u_int32_t i1 = EXTRACT_32BITS(&((u_int *)hdr)[1]);
124                 printf("udp/vat %u c%d %u%s",
125                         (u_int32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
126                         i0 & 0xffff,
127                         i1, i0 & 0x800000? "*" : "");
128                 /* audio format */
129                 if (i0 & 0x1f0000)
130                         printf(" f%d", (i0 >> 16) & 0x1f);
131                 if (i0 & 0x3f000000)
132                         printf(" s%d", (i0 >> 24) & 0x3f);
133         }
134 }
135
136 static void
137 rtp_print(const void *hdr, u_int len, register const struct udphdr *up)
138 {
139         /* rtp v1 or v2 */
140         u_int *ip = (u_int *)hdr;
141         u_int hasopt, hasext, contype, hasmarker;
142         u_int32_t i0 = EXTRACT_32BITS(&((u_int *)hdr)[0]);
143         u_int32_t i1 = EXTRACT_32BITS(&((u_int *)hdr)[1]);
144         u_int dlen = EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
145         const char * ptype;
146
147         ip += 2;
148         len >>= 2;
149         len -= 2;
150         hasopt = 0;
151         hasext = 0;
152         if ((i0 >> 30) == 1) {
153                 /* rtp v1 */
154                 hasopt = i0 & 0x800000;
155                 contype = (i0 >> 16) & 0x3f;
156                 hasmarker = i0 & 0x400000;
157                 ptype = "rtpv1";
158         } else {
159                 /* rtp v2 */
160                 hasext = i0 & 0x10000000;
161                 contype = (i0 >> 16) & 0x7f;
162                 hasmarker = i0 & 0x800000;
163                 dlen -= 4;
164                 ptype = "rtp";
165                 ip += 1;
166                 len -= 1;
167         }
168         printf("udp/%s %d c%d %s%s %d %u",
169                 ptype,
170                 dlen,
171                 contype,
172                 (hasopt || hasext)? "+" : "",
173                 hasmarker? "*" : "",
174                 i0 & 0xffff,
175                 i1);
176         if (vflag) {
177                 printf(" %u", EXTRACT_32BITS(&((u_int *)hdr)[2]));
178                 if (hasopt) {
179                         u_int i2, optlen;
180                         do {
181                                 i2 = ip[0];
182                                 optlen = (i2 >> 16) & 0xff;
183                                 if (optlen == 0 || optlen > len) {
184                                         printf(" !opt");
185                                         return;
186                                 }
187                                 ip += optlen;
188                                 len -= optlen;
189                         } while ((int)i2 >= 0);
190                 }
191                 if (hasext) {
192                         u_int i2, extlen;
193                         i2 = ip[0];
194                         extlen = (i2 & 0xffff) + 1;
195                         if (extlen > len) {
196                                 printf(" !ext");
197                                 return;
198                         }
199                         ip += extlen;
200                 }
201                 if (contype == 0x1f) /*XXX H.261 */
202                         printf(" 0x%04x", ip[0] >> 16);
203         }
204 }
205
206 static const u_char *
207 rtcp_print(const u_char *hdr, const u_char *ep)
208 {
209         /* rtp v2 control (rtcp) */
210         struct rtcp_rr *rr = 0;
211         struct rtcp_sr *sr;
212         struct rtcphdr *rh = (struct rtcphdr *)hdr;
213         u_int len;
214         u_int16_t flags;
215         int cnt;
216         double ts, dts;
217         if ((u_char *)(rh + 1) > ep) {
218                 printf(" [|rtcp]");
219                 return (ep);
220         }
221         len = (EXTRACT_16BITS(&rh->rh_len) + 1) * 4;
222         flags = EXTRACT_16BITS(&rh->rh_flags);
223         cnt = (flags >> 8) & 0x1f;
224         switch (flags & 0xff) {
225         case RTCP_PT_SR:
226                 sr = (struct rtcp_sr *)(rh + 1);
227                 printf(" sr");
228                 if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
229                         printf(" [%d]", len);
230                 if (vflag)
231                         printf(" %u", EXTRACT_32BITS(&rh->rh_ssrc));
232                 if ((u_char *)(sr + 1) > ep) {
233                         printf(" [|rtcp]");
234                         return (ep);
235                 }
236                 ts = (double)(EXTRACT_32BITS(&sr->sr_ntp.upper)) +
237                     ((double)(EXTRACT_32BITS(&sr->sr_ntp.lower)) /
238                     4294967296.0);
239                 printf(" @%.2f %u %up %ub", ts, EXTRACT_32BITS(&sr->sr_ts),
240                     EXTRACT_32BITS(&sr->sr_np), EXTRACT_32BITS(&sr->sr_nb));
241                 rr = (struct rtcp_rr *)(sr + 1);
242                 break;
243         case RTCP_PT_RR:
244                 printf(" rr");
245                 if (len != cnt * sizeof(*rr) + sizeof(*rh))
246                         printf(" [%d]", len);
247                 rr = (struct rtcp_rr *)(rh + 1);
248                 if (vflag)
249                         printf(" %u", EXTRACT_32BITS(&rh->rh_ssrc));
250                 break;
251         case RTCP_PT_SDES:
252                 printf(" sdes %d", len);
253                 if (vflag)
254                         printf(" %u", EXTRACT_32BITS(&rh->rh_ssrc));
255                 cnt = 0;
256                 break;
257         case RTCP_PT_BYE:
258                 printf(" bye %d", len);
259                 if (vflag)
260                         printf(" %u", EXTRACT_32BITS(&rh->rh_ssrc));
261                 cnt = 0;
262                 break;
263         default:
264                 printf(" type-0x%x %d", flags & 0xff, len);
265                 cnt = 0;
266                 break;
267         }
268         if (cnt > 1)
269                 printf(" c%d", cnt);
270         while (--cnt >= 0) {
271                 if ((u_char *)(rr + 1) > ep) {
272                         printf(" [|rtcp]");
273                         return (ep);
274                 }
275                 if (vflag)
276                         printf(" %u", EXTRACT_32BITS(&rr->rr_srcid));
277                 ts = (double)(EXTRACT_32BITS(&rr->rr_lsr)) / 65536.;
278                 dts = (double)(EXTRACT_32BITS(&rr->rr_dlsr)) / 65536.;
279                 printf(" %ul %us %uj @%.2f+%.2f",
280                     EXTRACT_32BITS(&rr->rr_nl) & 0x00ffffff,
281                     EXTRACT_32BITS(&rr->rr_ls),
282                     EXTRACT_32BITS(&rr->rr_dv), ts, dts);
283         }
284         return (hdr + len);
285 }
286
287 static int udp_cksum(register const struct ip *ip,
288                      register const struct udphdr *up,
289                      register u_int len)
290 {
291         return (nextproto4_cksum(ip, (const u_int8_t *)(void *)up, len,
292             IPPROTO_UDP));
293 }
294
295 #ifdef INET6
296 static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
297         u_int len)
298 {
299         return (nextproto6_cksum(ip6, (const u_int8_t *)(void *)up, len,
300             IPPROTO_UDP));
301 }
302 #endif
303
304 static void
305 udpipaddr_print(const struct ip *ip, int sport, int dport)
306 {
307 #ifdef INET6
308         const struct ip6_hdr *ip6;
309
310         if (IP_V(ip) == 6)
311                 ip6 = (const struct ip6_hdr *)ip;
312         else
313                 ip6 = NULL;
314
315         if (ip6) {
316                 if (ip6->ip6_nxt == IPPROTO_UDP) {
317                         if (sport == -1) {
318                                 (void)printf("%s > %s: ",
319                                         ip6addr_string(&ip6->ip6_src),
320                                         ip6addr_string(&ip6->ip6_dst));
321                         } else {
322                                 (void)printf("%s.%s > %s.%s: ",
323                                         ip6addr_string(&ip6->ip6_src),
324                                         udpport_string(sport),
325                                         ip6addr_string(&ip6->ip6_dst),
326                                         udpport_string(dport));
327                         }
328                 } else {
329                         if (sport != -1) {
330                                 (void)printf("%s > %s: ",
331                                         udpport_string(sport),
332                                         udpport_string(dport));
333                         }
334                 }
335         } else
336 #endif /*INET6*/
337         {
338                 if (ip->ip_p == IPPROTO_UDP) {
339                         if (sport == -1) {
340                                 (void)printf("%s > %s: ",
341                                         ipaddr_string(&ip->ip_src),
342                                         ipaddr_string(&ip->ip_dst));
343                         } else {
344                                 (void)printf("%s.%s > %s.%s: ",
345                                         ipaddr_string(&ip->ip_src),
346                                         udpport_string(sport),
347                                         ipaddr_string(&ip->ip_dst),
348                                         udpport_string(dport));
349                         }
350                 } else {
351                         if (sport != -1) {
352                                 (void)printf("%s > %s: ",
353                                         udpport_string(sport),
354                                         udpport_string(dport));
355                         }
356                 }
357         }
358 }
359
360 void
361 udp_print(register const u_char *bp, u_int length,
362           register const u_char *bp2, int fragmented)
363 {
364         register const struct udphdr *up;
365         register const struct ip *ip;
366         register const u_char *cp;
367         register const u_char *ep = bp + length;
368         u_int16_t sport, dport, ulen;
369 #ifdef INET6
370         register const struct ip6_hdr *ip6;
371 #endif
372
373         if (ep > snapend)
374                 ep = snapend;
375         up = (struct udphdr *)bp;
376         ip = (struct ip *)bp2;
377 #ifdef INET6
378         if (IP_V(ip) == 6)
379                 ip6 = (struct ip6_hdr *)bp2;
380         else
381                 ip6 = NULL;
382 #endif /*INET6*/
383         cp = (u_char *)(up + 1);
384         if (!TTEST(up->uh_dport)) {
385                 udpipaddr_print(ip, -1, -1);
386                 (void)printf("[|udp]");
387                 return;
388         }
389
390         sport = EXTRACT_16BITS(&up->uh_sport);
391         dport = EXTRACT_16BITS(&up->uh_dport);
392
393         if (length < sizeof(struct udphdr)) {
394                 udpipaddr_print(ip, sport, dport);
395                 (void)printf("truncated-udp %d", length);
396                 return;
397         }
398         length -= sizeof(struct udphdr);
399
400         if (cp > snapend) {
401                 udpipaddr_print(ip, sport, dport);
402                 (void)printf("[|udp]");
403                 return;
404         }
405
406         ulen = EXTRACT_16BITS(&up->uh_ulen);
407         if (ulen < 8) {
408                 udpipaddr_print(ip, sport, dport);
409                 (void)printf("truncated-udplength %d", ulen);
410                 return;
411         }
412         if (packettype) {
413                 register struct sunrpc_msg *rp;
414                 enum sunrpc_msg_type direction;
415
416                 switch (packettype) {
417
418                 case PT_VAT:
419                         udpipaddr_print(ip, sport, dport);
420                         vat_print((void *)(up + 1), up);
421                         break;
422
423                 case PT_WB:
424                         udpipaddr_print(ip, sport, dport);
425                         wb_print((void *)(up + 1), length);
426                         break;
427
428                 case PT_RPC:
429                         rp = (struct sunrpc_msg *)(up + 1);
430                         direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
431                         if (direction == SUNRPC_CALL)
432                                 sunrpcrequest_print((u_char *)rp, length,
433                                     (u_char *)ip);
434                         else
435                                 nfsreply_print((u_char *)rp, length,
436                                     (u_char *)ip);                      /*XXX*/
437                         break;
438
439                 case PT_RTP:
440                         udpipaddr_print(ip, sport, dport);
441                         rtp_print((void *)(up + 1), length, up);
442                         break;
443
444                 case PT_RTCP:
445                         udpipaddr_print(ip, sport, dport);
446                         while (cp < ep)
447                                 cp = rtcp_print(cp, ep);
448                         break;
449
450                 case PT_SNMP:
451                         udpipaddr_print(ip, sport, dport);
452                         snmp_print((const u_char *)(up + 1), length);
453                         break;
454
455                 case PT_CNFP:
456                         udpipaddr_print(ip, sport, dport);
457                         cnfp_print(cp, (const u_char *)ip);
458                         break;
459
460                 case PT_TFTP:
461                         udpipaddr_print(ip, sport, dport);
462                         tftp_print(cp, length);
463                         break;
464
465                 case PT_AODV:
466                         udpipaddr_print(ip, sport, dport);
467                         aodv_print((const u_char *)(up + 1), length,
468 #ifdef INET6
469                             ip6 != NULL);
470 #else
471                             0);
472 #endif
473                         break;
474
475                 case PT_RADIUS:
476                         udpipaddr_print(ip, sport, dport);
477                         radius_print(cp, length);
478                         break;
479
480                 case PT_VXLAN:
481                         udpipaddr_print(ip, sport, dport);
482                         vxlan_print((const u_char *)(up + 1), length);
483                         break;
484                 }
485                 return;
486         }
487
488         if (!qflag) {
489                 register struct sunrpc_msg *rp;
490                 enum sunrpc_msg_type direction;
491
492                 rp = (struct sunrpc_msg *)(up + 1);
493                 if (TTEST(rp->rm_direction)) {
494                         direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
495                         if (dport == NFS_PORT && direction == SUNRPC_CALL) {
496                                 nfsreq_print((u_char *)rp, length,
497                                     (u_char *)ip);
498                                 return;
499                         }
500                         if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
501                                 nfsreply_print((u_char *)rp, length,
502                                     (u_char *)ip);
503                                 return;
504                         }
505 #ifdef notdef
506                         if (dport == SUNRPC_PORT && direction == SUNRPC_CALL) {
507                                 sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
508                                 return;
509                         }
510 #endif
511                 }
512                 if (TTEST(((struct LAP *)cp)->type) &&
513                     ((struct LAP *)cp)->type == lapDDP &&
514                     (atalk_port(sport) || atalk_port(dport))) {
515                         if (vflag)
516                                 fputs("kip ", stdout);
517                         llap_print(cp, length);
518                         return;
519                 }
520         }
521         udpipaddr_print(ip, sport, dport);
522
523         if (vflag && !Kflag && !fragmented) {
524                 /* Check the checksum, if possible. */
525                 u_int16_t sum, udp_sum;
526
527                 /*
528                  * XXX - do this even if vflag == 1?
529                  * TCP does, and we do so for UDP-over-IPv6.
530                  */
531                 if (IP_V(ip) == 4 && (vflag > 1)) {
532                         udp_sum = EXTRACT_16BITS(&up->uh_sum);
533                         if (udp_sum == 0) {
534                                 (void)printf("[no cksum] ");
535                         } else if (TTEST2(cp[0], length)) {
536                                 sum = udp_cksum(ip, up, length + sizeof(struct udphdr));
537
538                                 if (sum != 0) {
539                                         (void)printf("[bad udp cksum 0x%04x -> 0x%04x!] ",
540                                             udp_sum,
541                                             in_cksum_shouldbe(udp_sum, sum));
542                                 } else
543                                         (void)printf("[udp sum ok] ");
544                         }
545                 }
546 #ifdef INET6
547                 else if (IP_V(ip) == 6 && ip6->ip6_plen) {
548                         /* for IPv6, UDP checksum is mandatory */
549                         if (TTEST2(cp[0], length)) {
550                                 sum = udp6_cksum(ip6, up, length + sizeof(struct udphdr));
551                                 udp_sum = EXTRACT_16BITS(&up->uh_sum);
552
553                                 if (sum != 0) {
554                                         (void)printf("[bad udp cksum 0x%04x -> 0x%04x!] ",
555                                             udp_sum,
556                                             in_cksum_shouldbe(udp_sum, sum));
557                                 } else
558                                         (void)printf("[udp sum ok] ");
559                         }
560                 }
561 #endif
562         }
563
564         if (!qflag) {
565 #define ISPORT(p) (dport == (p) || sport == (p))
566                 if (ISPORT(NAMESERVER_PORT))
567                         ns_print((const u_char *)(up + 1), length, 0);
568                 else if (ISPORT(MULTICASTDNS_PORT))
569                         ns_print((const u_char *)(up + 1), length, 1);
570                 else if (ISPORT(TIMED_PORT))
571                         timed_print((const u_char *)(up + 1));
572                 else if (ISPORT(TFTP_PORT))
573                         tftp_print((const u_char *)(up + 1), length);
574                 else if (ISPORT(IPPORT_BOOTPC) || ISPORT(IPPORT_BOOTPS))
575                         bootp_print((const u_char *)(up + 1), length);
576                 else if (ISPORT(RIP_PORT))
577                         rip_print((const u_char *)(up + 1), length);
578                 else if (ISPORT(AODV_PORT))
579                         aodv_print((const u_char *)(up + 1), length,
580 #ifdef INET6
581                             ip6 != NULL);
582 #else
583                             0);
584 #endif
585                 else if (ISPORT(ISAKMP_PORT))
586                          isakmp_print(gndo, (const u_char *)(up + 1), length, bp2);
587                 else if (ISPORT(ISAKMP_PORT_NATT))
588                          isakmp_rfc3948_print(gndo, (const u_char *)(up + 1), length, bp2);
589 #if 1 /*???*/
590                 else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2))
591                         isakmp_print(gndo, (const u_char *)(up + 1), length, bp2);
592 #endif
593                 else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT))
594                         snmp_print((const u_char *)(up + 1), length);
595                 else if (ISPORT(NTP_PORT))
596                         ntp_print((const u_char *)(up + 1), length);
597                 else if (ISPORT(KERBEROS_PORT) || ISPORT(KERBEROS_SEC_PORT))
598                         krb_print((const void *)(up + 1));
599                 else if (ISPORT(L2TP_PORT))
600                         l2tp_print((const u_char *)(up + 1), length);
601 #ifdef TCPDUMP_DO_SMB
602                 else if (ISPORT(NETBIOS_NS_PORT))
603                         nbt_udp137_print((const u_char *)(up + 1), length);
604                 else if (ISPORT(NETBIOS_DGRAM_PORT))
605                         nbt_udp138_print((const u_char *)(up + 1), length);
606 #endif
607                 else if (dport == 3456)
608                         vat_print((const void *)(up + 1), up);
609                 else if (ISPORT(ZEPHYR_SRV_PORT) || ISPORT(ZEPHYR_CLT_PORT))
610                         zephyr_print((const void *)(up + 1), length);
611                 /*
612                  * Since there are 10 possible ports to check, I think
613                  * a <> test would be more efficient
614                  */
615                 else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
616                          (dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
617                         rx_print((const void *)(up + 1), length, sport, dport,
618                                  (u_char *) ip);
619 #ifdef INET6
620                 else if (ISPORT(RIPNG_PORT))
621                         ripng_print((const u_char *)(up + 1), length);
622                 else if (ISPORT(DHCP6_SERV_PORT) || ISPORT(DHCP6_CLI_PORT))
623                         dhcp6_print((const u_char *)(up + 1), length);
624                 else if (ISPORT(BABEL_PORT) || ISPORT(BABEL_PORT_OLD))
625                         babel_print((const u_char *)(up + 1), length);
626 #endif /*INET6*/
627                 /*
628                  * Kludge in test for whiteboard packets.
629                  */
630                 else if (dport == 4567)
631                         wb_print((const void *)(up + 1), length);
632                 else if (ISPORT(CISCO_AUTORP_PORT))
633                         cisco_autorp_print((const void *)(up + 1), length);
634                 else if (ISPORT(RADIUS_PORT) ||
635                          ISPORT(RADIUS_NEW_PORT) ||
636                          ISPORT(RADIUS_ACCOUNTING_PORT) ||
637                          ISPORT(RADIUS_NEW_ACCOUNTING_PORT) )
638                         radius_print((const u_char *)(up+1), length);
639                 else if (dport == HSRP_PORT)
640                         hsrp_print((const u_char *)(up + 1), length);
641                 else if (ISPORT(LWRES_PORT))
642                         lwres_print((const u_char *)(up + 1), length);
643                 else if (ISPORT(LDP_PORT))
644                         ldp_print((const u_char *)(up + 1), length);
645                 else if (ISPORT(OLSR_PORT))
646                         olsr_print((const u_char *)(up + 1), length,
647 #if INET6
648                                         (IP_V(ip) == 6) ? 1 : 0);
649 #else
650                                         0);
651 #endif
652                 else if (ISPORT(MPLS_LSP_PING_PORT))
653                         lspping_print((const u_char *)(up + 1), length);
654                 else if (dport == BFD_CONTROL_PORT ||
655                          dport == BFD_ECHO_PORT )
656                         bfd_print((const u_char *)(up+1), length, dport);
657                 else if (ISPORT(LMP_PORT))
658                         lmp_print((const u_char *)(up + 1), length);
659                 else if (ISPORT(VQP_PORT))
660                         vqp_print((const u_char *)(up + 1), length);
661                 else if (ISPORT(SFLOW_PORT))
662                         sflow_print((const u_char *)(up + 1), length);
663                 else if (dport == LWAPP_CONTROL_PORT)
664                         lwapp_control_print((const u_char *)(up + 1), length, 1);
665                 else if (sport == LWAPP_CONTROL_PORT)
666                         lwapp_control_print((const u_char *)(up + 1), length, 0);
667                 else if (ISPORT(LWAPP_DATA_PORT))
668                         lwapp_data_print((const u_char *)(up + 1), length);
669                 else if (ISPORT(SIP_PORT))
670                         sip_print((const u_char *)(up + 1), length);
671                 else if (ISPORT(SYSLOG_PORT))
672                         syslog_print((const u_char *)(up + 1), length);
673                 else if (ISPORT(OTV_PORT))
674                         otv_print((const u_char *)(up + 1), length);
675                 else
676                         (void)printf("UDP, length %u",
677                             (u_int32_t)(ulen - sizeof(*up)));
678 #undef ISPORT
679         } else
680                 (void)printf("UDP, length %u", (u_int32_t)(ulen - sizeof(*up)));
681 }
682
683
684 /*
685  * Local Variables:
686  * c-style: whitesmith
687  * c-basic-offset: 8
688  * End:
689  */
690