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