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