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