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