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