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