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