GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/tcpdump/print-udp.c Lines: 0 309 0.0 %
Date: 2017-11-07 Branches: 0 264 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: print-udp.c,v 1.40 2015/12/22 21:01:07 mmcc Exp $	*/
2
3
/*
4
 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
5
 *	The Regents of the University of California.  All rights reserved.
6
 *
7
 * Redistribution and use in source and binary forms, with or without
8
 * modification, are permitted provided that: (1) source code distributions
9
 * retain the above copyright notice and this paragraph in its entirety, (2)
10
 * distributions including binary code include the above copyright notice and
11
 * this paragraph in its entirety in the documentation or other materials
12
 * provided with the distribution, and (3) all advertising materials mentioning
13
 * features or use of this software display the following acknowledgement:
14
 * ``This product includes software developed by the University of California,
15
 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
16
 * the University nor the names of its contributors may be used to endorse
17
 * or promote products derived from this software without specific prior
18
 * written permission.
19
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22
 */
23
24
#include <sys/time.h>
25
#include <sys/socket.h>
26
27
#include <netinet/in.h>
28
#include <netinet/ip.h>
29
#include <netinet/ip_var.h>
30
#include <netinet/udp.h>
31
#include <netinet/udp_var.h>
32
33
#include <net80211/ieee80211.h>
34
35
#ifdef NOERROR
36
#undef NOERROR					/* Solaris sucks */
37
#endif
38
#ifdef T_UNSPEC
39
#undef T_UNSPEC					/* SINIX does too */
40
#endif
41
#include <arpa/nameser.h>
42
#ifdef SEGSIZE
43
#undef SEGSIZE
44
#endif
45
#include <arpa/tftp.h>
46
47
#include <rpc/rpc.h>
48
49
#include <stdio.h>
50
#include <string.h>
51
52
#ifdef INET6
53
#include <netinet/ip6.h>
54
#endif
55
56
#include "interface.h"
57
#include "addrtoname.h"
58
#include "extract.h"
59
#include "appletalk.h"
60
61
#include "nfsv2.h"
62
#include "bootp.h"
63
#include "iapp.h"
64
65
struct rtcphdr {
66
	u_short rh_flags;	/* T:2 P:1 CNT:5 PT:8 */
67
	u_short rh_len;		/* length of message (in words) */
68
	u_int rh_ssrc;		/* synchronization src id */
69
};
70
71
typedef struct {
72
	u_int upper;		/* more significant 32 bits */
73
	u_int lower;		/* less significant 32 bits */
74
} ntp64;
75
76
/*
77
 * Sender report.
78
 */
79
struct rtcp_sr {
80
	ntp64 sr_ntp;		/* 64-bit ntp timestamp */
81
	u_int sr_ts;		/* reference media timestamp */
82
	u_int sr_np;		/* no. packets sent */
83
	u_int sr_nb;		/* no. bytes sent */
84
};
85
86
/*
87
 * Receiver report.
88
 * Time stamps are middle 32-bits of ntp timestamp.
89
 */
90
struct rtcp_rr {
91
	u_int rr_srcid;		/* sender being reported */
92
	u_int rr_nl;		/* no. packets lost */
93
	u_int rr_ls;		/* extended last seq number received */
94
	u_int rr_dv;		/* jitter (delay variance) */
95
	u_int rr_lsr;		/* orig. ts from last rr from this src  */
96
	u_int rr_dlsr;		/* time from recpt of last rr to xmit time */
97
};
98
99
/*XXX*/
100
#define RTCP_PT_SR	200
101
#define RTCP_PT_RR	201
102
#define RTCP_PT_SDES	202
103
#define 	RTCP_SDES_CNAME	1
104
#define 	RTCP_SDES_NAME	2
105
#define 	RTCP_SDES_EMAIL	3
106
#define 	RTCP_SDES_PHONE	4
107
#define 	RTCP_SDES_LOC	5
108
#define 	RTCP_SDES_TOOL	6
109
#define 	RTCP_SDES_NOTE	7
110
#define 	RTCP_SDES_PRIV	8
111
#define RTCP_PT_BYE	203
112
#define RTCP_PT_APP	204
113
114
static void
115
vat_print(const void *hdr, u_int len, const struct udphdr *up)
116
{
117
	/* vat/vt audio */
118
	u_int ts = *(u_short *)hdr;
119
	if ((ts & 0xf060) != 0) {
120
		/* probably vt */
121
		(void)printf(" udp/vt %u %d / %d",
122
			     (u_int32_t)(ntohs(up->uh_ulen) - sizeof(*up)),
123
			     ts & 0x3ff, ts >> 10);
124
	} else {
125
		/* probably vat */
126
		u_int i0 = ntohl(((u_int *)hdr)[0]);
127
		u_int i1 = ntohl(((u_int *)hdr)[1]);
128
		printf(" udp/vat %u c%d %u%s",
129
			(u_int32_t)(ntohs(up->uh_ulen) - sizeof(*up) - 8),
130
			i0 & 0xffff,
131
			i1, i0 & 0x800000? "*" : "");
132
		/* audio format */
133
		if (i0 & 0x1f0000)
134
			printf(" f%d", (i0 >> 16) & 0x1f);
135
		if (i0 & 0x3f000000)
136
			printf(" s%d", (i0 >> 24) & 0x3f);
137
	}
138
}
139
140
static void
141
rtp_print(const void *hdr, u_int len, const struct udphdr *up)
142
{
143
	/* rtp v1 or v2 */
144
	u_int *ip = (u_int *)hdr;
145
	u_int hasopt, hasext, contype, hasmarker;
146
	u_int i0 = ntohl(((u_int *)hdr)[0]);
147
	u_int i1 = ntohl(((u_int *)hdr)[1]);
148
	u_int dlen = ntohs(up->uh_ulen) - sizeof(*up) - 8;
149
	const char * ptype;
150
151
	ip += 2;
152
	len >>= 2;
153
	len -= 2;
154
	hasopt = 0;
155
	hasext = 0;
156
	if ((i0 >> 30) == 1) {
157
		/* rtp v1 */
158
		hasopt = i0 & 0x800000;
159
		contype = (i0 >> 16) & 0x3f;
160
		hasmarker = i0 & 0x400000;
161
		ptype = "rtpv1";
162
	} else {
163
		/* rtp v2 */
164
		hasext = i0 & 0x10000000;
165
		contype = (i0 >> 16) & 0x7f;
166
		hasmarker = i0 & 0x800000;
167
		dlen -= 4;
168
		ptype = "rtp";
169
		ip += 1;
170
		len -= 1;
171
	}
172
	printf(" udp/%s %d c%d %s%s %d %u",
173
		ptype,
174
		dlen,
175
		contype,
176
		(hasopt || hasext)? "+" : "",
177
		hasmarker? "*" : "",
178
		i0 & 0xffff,
179
		i1);
180
	if (vflag) {
181
		printf(" %u", i1);
182
		if (hasopt) {
183
			u_int i2, optlen;
184
			do {
185
				i2 = ip[0];
186
				optlen = (i2 >> 16) & 0xff;
187
				if (optlen == 0 || optlen > len) {
188
					printf(" !opt");
189
					return;
190
				}
191
				ip += optlen;
192
				len -= optlen;
193
			} while ((int)i2 >= 0);
194
		}
195
		if (hasext) {
196
			u_int i2, extlen;
197
			i2 = ip[0];
198
			extlen = (i2 & 0xffff) + 1;
199
			if (extlen > len) {
200
				printf(" !ext");
201
				return;
202
			}
203
			ip += extlen;
204
		}
205
		if (contype == 0x1f) /*XXX H.261 */
206
			printf(" 0x%04x", ip[0] >> 16);
207
	}
208
}
209
210
static const u_char *
211
rtcp_print(const u_char *hdr, const u_char *ep)
212
{
213
	/* rtp v2 control (rtcp) */
214
	struct rtcp_rr *rr = NULL;
215
	struct rtcp_sr *sr;
216
	struct rtcphdr *rh = (struct rtcphdr *)hdr;
217
	u_int len;
218
	u_short flags;
219
	int cnt;
220
	double ts, dts;
221
	if ((u_char *)(rh + 1) > ep) {
222
		printf(" [|rtcp]");
223
		return (ep);
224
	}
225
	len = (ntohs(rh->rh_len) + 1) * 4;
226
	flags = ntohs(rh->rh_flags);
227
	cnt = (flags >> 8) & 0x1f;
228
	switch (flags & 0xff) {
229
	case RTCP_PT_SR:
230
		sr = (struct rtcp_sr *)(rh + 1);
231
		printf(" sr");
232
		if (len != cnt * sizeof(*rr) + sizeof(*sr) + sizeof(*rh))
233
			printf(" [%d]", len);
234
		if (vflag)
235
		  printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
236
		if ((u_char *)(sr + 1) > ep) {
237
			printf(" [|rtcp]");
238
			return (ep);
239
		}
240
		ts = (double)((u_int32_t)ntohl(sr->sr_ntp.upper)) +
241
		    ((double)((u_int32_t)ntohl(sr->sr_ntp.lower)) /
242
		    4294967296.0);
243
		printf(" @%.2f %u %up %ub", ts, (u_int32_t)ntohl(sr->sr_ts),
244
		    (u_int32_t)ntohl(sr->sr_np), (u_int32_t)ntohl(sr->sr_nb));
245
		rr = (struct rtcp_rr *)(sr + 1);
246
		break;
247
	case RTCP_PT_RR:
248
		printf(" rr");
249
		if (len != cnt * sizeof(*rr) + sizeof(*rh))
250
			printf(" [%d]", len);
251
		rr = (struct rtcp_rr *)(rh + 1);
252
		if (vflag)
253
		  printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
254
		break;
255
	case RTCP_PT_SDES:
256
		printf(" sdes %d", len);
257
		if (vflag)
258
		  printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
259
		cnt = 0;
260
		break;
261
	case RTCP_PT_BYE:
262
		printf(" bye %d", len);
263
		if (vflag)
264
		  printf(" %u", (u_int32_t)ntohl(rh->rh_ssrc));
265
		cnt = 0;
266
		break;
267
	default:
268
		printf(" type-0x%x %d", flags & 0xff, len);
269
		cnt = 0;
270
		break;
271
	}
272
	if (cnt > 1)
273
		printf(" c%d", cnt);
274
	while (--cnt >= 0) {
275
		if ((u_char *)(rr + 1) > ep) {
276
			printf(" [|rtcp]");
277
			return (ep);
278
		}
279
		if (vflag)
280
			printf(" %u", (u_int32_t)ntohl(rr->rr_srcid));
281
		ts = (double)((u_int32_t)ntohl(rr->rr_lsr)) / 65536.;
282
		dts = (double)((u_int32_t)ntohl(rr->rr_dlsr)) / 65536.;
283
		printf(" %ul %us %uj @%.2f+%.2f",
284
		    (u_int32_t)ntohl(rr->rr_nl) & 0x00ffffff,
285
		    (u_int32_t)ntohl(rr->rr_ls),
286
		    (u_int32_t)ntohl(rr->rr_dv), ts, dts);
287
	}
288
	return (hdr + len);
289
}
290
291
static int udp_cksum(const struct ip *ip, const struct udphdr *up, int len)
292
{
293
	union phu {
294
		struct phdr {
295
			u_int32_t src;
296
			u_int32_t dst;
297
			u_char mbz;
298
			u_char proto;
299
			u_int16_t len;
300
		} ph;
301
		u_int16_t pa[6];
302
	} phu;
303
	const u_int16_t *sp;
304
	u_int32_t sum;
305
306
	/* pseudo-header.. */
307
	phu.ph.len = htons((u_int16_t)len);
308
	phu.ph.mbz = 0;
309
	phu.ph.proto = IPPROTO_UDP;
310
	memcpy(&phu.ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t));
311
	memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t));
312
313
	sp = &phu.pa[0];
314
	sum = sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5];
315
316
	return in_cksum((u_short *)up, len, sum);
317
}
318
319
#ifdef INET6
320
static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
321
	u_int len)
322
{
323
	union {
324
		struct {
325
			struct in6_addr ph_src;
326
			struct in6_addr ph_dst;
327
			u_int32_t	ph_len;
328
			u_int8_t	ph_zero[3];
329
			u_int8_t	ph_nxt;
330
		} ph;
331
		u_int16_t pa[20];
332
	} phu;
333
	size_t i;
334
	u_int32_t sum = 0;
335
336
	/* pseudo-header */
337
	memset(&phu, 0, sizeof(phu));
338
	phu.ph.ph_src = ip6->ip6_src;
339
	phu.ph.ph_dst = ip6->ip6_dst;
340
	phu.ph.ph_len = htonl(len);
341
	phu.ph.ph_nxt = IPPROTO_UDP;
342
343
	for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
344
		sum += phu.pa[i];
345
346
	return in_cksum((u_short *)up, len, sum);
347
}
348
#endif
349
350
351
352
/* XXX probably should use getservbyname() and cache answers */
353
#define TFTP_PORT		69		/*XXX*/
354
#define KERBEROS_PORT		88		/*XXX*/
355
#define SUNRPC_PORT		111		/*XXX*/
356
#define NTP_PORT		123		/*XXX*/
357
#define NETBIOS_NS_PORT		137		/*XXX*/
358
#define NETBIOS_DGRAM_PORT	138		/*XXX*/
359
#define SNMP_PORT		161		/*XXX*/
360
#define SNMPTRAP_PORT		162		/*XXX*/
361
#define ISAKMP_PORT		500		/*XXX*/
362
#define RIP_PORT		520		/*XXX*/
363
#define TIMED_PORT		525		/*XXX*/
364
#define KERBEROS_SEC_PORT	750		/*XXX*/
365
#define LWRES_PORT		921
366
#define VQP_PORT		1589
367
#define OLD_RADIUS_AUTH_PORT	1645
368
#define OLD_RADIUS_ACCT_PORT	1646
369
#define L2TP_PORT		1701		/*XXX*/
370
#define RADIUS_AUTH_PORT	1812
371
#define RADIUS_ACCT_PORT	1813
372
#define HSRP_PORT		1985		/*XXX*/
373
#define GTP_C_PORT		2123
374
#define GTP_U_PORT		2152
375
#define GTP_PRIME_PORT		3386
376
#define UDPENCAP_PORT		4500		/*XXX*/
377
#define MULTICASTDNS_PORT	5353
378
379
#ifdef INET6
380
#define RIPNG_PORT		521		/*XXX*/
381
#define DHCP6_PORT1		546		/*XXX*/
382
#define DHCP6_PORT2		547		/*XXX*/
383
#endif
384
385
void
386
udp_print(const u_char *bp, u_int length, const u_char *bp2)
387
{
388
	const struct udphdr *up;
389
	const struct ip *ip;
390
	const u_char *cp;
391
	const u_char *ep = bp + length;
392
	u_int16_t sport, dport, ulen;
393
#ifdef INET6
394
	const struct ip6_hdr *ip6;
395
#endif
396
397
	if (ep > snapend)
398
		ep = snapend;
399
	up = (struct udphdr *)bp;
400
	ip = (struct ip *)bp2;
401
#ifdef INET6
402
	if (ip->ip_v == 6)
403
		ip6 = (struct ip6_hdr *)bp2;
404
	else
405
		ip6 = NULL;
406
#endif /*INET6*/
407
	cp = (u_char *)(up + 1);
408
	if (cp > snapend) {
409
		printf("[|udp]");
410
		return;
411
	}
412
	if (length < sizeof(struct udphdr)) {
413
		(void)printf(" truncated-udp %d", length);
414
		return;
415
	}
416
	length -= sizeof(struct udphdr);
417
418
	sport = ntohs(up->uh_sport);
419
	dport = ntohs(up->uh_dport);
420
	ulen = ntohs(up->uh_ulen);
421
	if (packettype) {
422
		struct rpc_msg *rp;
423
		enum msg_type direction;
424
425
		switch (packettype) {
426
427
		case PT_VAT:
428
			(void)printf("%s.%s > %s.%s:",
429
				ipaddr_string(&ip->ip_src),
430
				udpport_string(sport),
431
				ipaddr_string(&ip->ip_dst),
432
				udpport_string(dport));
433
			vat_print((void *)(up + 1), length, up);
434
			break;
435
436
		case PT_WB:
437
			(void)printf("%s.%s > %s.%s:",
438
				ipaddr_string(&ip->ip_src),
439
				udpport_string(sport),
440
				ipaddr_string(&ip->ip_dst),
441
				udpport_string(dport));
442
			wb_print((void *)(up + 1), length);
443
			break;
444
445
		case PT_RPC:
446
			(void)printf("%s.%s > %s.%s: ",
447
				ipaddr_string(&ip->ip_src),
448
				udpport_string(sport),
449
				ipaddr_string(&ip->ip_dst),
450
				udpport_string(dport));
451
			rp = (struct rpc_msg *)(up + 1);
452
			direction = (enum msg_type)ntohl(rp->rm_direction);
453
			if (direction == CALL)
454
				sunrpcrequest_print((u_char *)rp, length,
455
				    (u_char *)ip);
456
			else
457
				nfsreply_print((u_char *)rp, length,
458
				    (u_char *)ip);			/*XXX*/
459
			break;
460
461
		case PT_RTP:
462
			(void)printf("%s.%s > %s.%s:",
463
				ipaddr_string(&ip->ip_src),
464
				udpport_string(sport),
465
				ipaddr_string(&ip->ip_dst),
466
				udpport_string(dport));
467
			rtp_print((void *)(up + 1), length, up);
468
			break;
469
470
		case PT_RTCP:
471
			(void)printf("%s.%s > %s.%s:",
472
				ipaddr_string(&ip->ip_src),
473
				udpport_string(sport),
474
				ipaddr_string(&ip->ip_dst),
475
				udpport_string(dport));
476
			while (cp < ep)
477
				cp = rtcp_print(cp, ep);
478
			break;
479
		case PT_CNFP:
480
			cnfp_print(cp, length, (u_char *)ip);
481
			break;
482
		}
483
		return;
484
	}
485
486
	if (!qflag) {
487
		struct rpc_msg *rp;
488
		enum msg_type direction;
489
490
		rp = (struct rpc_msg *)(up + 1);
491
		if (TTEST(rp->rm_direction)) {
492
			direction = (enum msg_type)ntohl(rp->rm_direction);
493
			if (dport == NFS_PORT && direction == CALL) {
494
				(void)printf("%s.%s > %s.%s: ",
495
					ipaddr_string(&ip->ip_src),
496
					udpport_string(sport),
497
					ipaddr_string(&ip->ip_dst),
498
					udpport_string(dport));
499
				nfsreq_print((u_char *)rp, length,
500
				    (u_char *)ip);
501
				return;
502
			}
503
			if (sport == NFS_PORT && direction == REPLY) {
504
				(void)printf("%s.%s > %s.%s: ",
505
					ipaddr_string(&ip->ip_src),
506
					udpport_string(sport),
507
					ipaddr_string(&ip->ip_dst),
508
					udpport_string(dport));
509
				nfsreply_print((u_char *)rp, length,
510
				    (u_char *)ip);
511
				return;
512
			}
513
#ifdef notdef
514
			if (dport == SUNRPC_PORT && direction == CALL) {
515
				(void)printf("%s.%s > %s.%s: ",
516
					ipaddr_string(&ip->ip_src),
517
					udpport_string(sport),
518
					ipaddr_string(&ip->ip_dst),
519
					udpport_string(dport));
520
				sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
521
				return;
522
			}
523
#endif
524
		}
525
		if (TTEST(((struct LAP *)cp)->type) &&
526
		    ((struct LAP *)cp)->type == lapDDP &&
527
		    (atalk_port(sport) || atalk_port(dport))) {
528
			if (vflag)
529
				fputs("kip ", stdout);
530
			atalk_print_llap(cp, length);
531
			return;
532
		}
533
	}
534
#if 0
535
	(void)printf("%s.%s > %s.%s:",
536
		ipaddr_string(&ip->ip_src), udpport_string(sport),
537
		ipaddr_string(&ip->ip_dst), udpport_string(dport));
538
#else
539
#ifdef INET6
540
	if (ip6) {
541
		if (ip6->ip6_nxt == IPPROTO_UDP) {
542
			(void)printf("%s.%s > %s.%s:",
543
				ip6addr_string(&ip6->ip6_src),
544
				udpport_string(sport),
545
				ip6addr_string(&ip6->ip6_dst),
546
				udpport_string(dport));
547
		} else {
548
			(void)printf("%s > %s: ",
549
				udpport_string(sport), udpport_string(dport));
550
		}
551
	} else
552
#endif /*INET6*/
553
	{
554
		if (ip->ip_p == IPPROTO_UDP) {
555
			(void)printf("%s.%s > %s.%s:",
556
				ipaddr_string(&ip->ip_src),
557
				udpport_string(sport),
558
				ipaddr_string(&ip->ip_dst),
559
				udpport_string(dport));
560
		} else {
561
			(void)printf("%s > %s:",
562
				udpport_string(sport), udpport_string(dport));
563
		}
564
	}
565
#endif
566
567
	if (ip->ip_v == 4 && vflag) {
568
		u_int16_t sum, udp_sum = EXTRACT_16BITS(&up->uh_sum);
569
		if (udp_sum == 0) {
570
			(void)printf(" [no udp cksum]");
571
		} else if (TTEST2(cp[0], length)) {
572
			sum = udp_cksum(ip, up, length + sizeof(struct udphdr));
573
			if (sum != 0)
574
				(void)printf(" [bad udp cksum %x! -> %x]", udp_sum,
575
				    in_cksum_shouldbe(udp_sum, sum));
576
			else
577
				(void)printf(" [udp sum ok]");
578
		}
579
	}
580
#ifdef INET6
581
	if (ip->ip_v == 6 && ip6->ip6_plen && vflag) {
582
		u_int16_t sum, udp_sum = EXTRACT_16BITS(&up->uh_sum);
583
		/* for IPv6, UDP checksum is mandatory */
584
		if (udp_sum == 0) {
585
			(void)printf(" [invalid udp cksum 0]");
586
		} else if (TTEST2(cp[0], length)) {
587
			sum = udp6_cksum(ip6, up, length + sizeof(struct udphdr));
588
			if (sum != 0)
589
				(void)printf(" [bad udp cksum %x! -> %x]", udp_sum,
590
				    in_cksum_shouldbe(udp_sum, sum));
591
			else
592
				(void)printf(" [udp sum ok]");
593
		}
594
	}
595
#endif
596
597
	if (!qflag) {
598
#define ISPORT(p) (dport == (p) || sport == (p))
599
		if (ISPORT(NAMESERVER_PORT))
600
			ns_print((const u_char *)(up + 1), length, 0);
601
		else if (ISPORT(MULTICASTDNS_PORT))
602
			ns_print((const u_char *)(up + 1), length, 1);
603
		else if (ISPORT(LWRES_PORT))
604
			lwres_print((const u_char *)(up + 1), length);
605
		else if (ISPORT(TIMED_PORT))
606
			timed_print((const u_char *)(up + 1), length);
607
		else if (ISPORT(TFTP_PORT))
608
			tftp_print((const u_char *)(up + 1), length);
609
		else if (ISPORT(IPPORT_BOOTPC) || ISPORT(IPPORT_BOOTPS))
610
			bootp_print((const u_char *)(up + 1), length,
611
			    sport, dport);
612
		else if (ISPORT(RIP_PORT))
613
			rip_print((const u_char *)(up + 1), length);
614
		else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT))
615
			snmp_print((const u_char *)(up + 1), length);
616
		else if (ISPORT(NTP_PORT))
617
			ntp_print((const u_char *)(up + 1), length);
618
		else if (ISPORT(KERBEROS_PORT) || ISPORT(KERBEROS_SEC_PORT))
619
			krb_print((const void *)(up + 1), length);
620
		else if (ISPORT(L2TP_PORT))
621
			l2tp_print((const u_char *)(up + 1), length);
622
		else if (ISPORT(UDPENCAP_PORT))
623
			udpencap_print((const u_char *)(up + 1), length, bp2);
624
		else if (ISPORT(ISAKMP_PORT))
625
			ike_print((const u_char *)(up + 1), length);
626
#if 0
627
		else if (ISPORT(NETBIOS_NS_PORT))
628
			nbt_udp137_print((const u_char *)(up + 1), length);
629
		else if (ISPORT(NETBIOS_DGRAM_PORT))
630
			nbt_udp138_print((const u_char *)(up + 1), length);
631
#endif
632
                else if (ISPORT(OLD_RADIUS_AUTH_PORT) ||
633
                         ISPORT(OLD_RADIUS_ACCT_PORT) ||
634
                         ISPORT(RADIUS_AUTH_PORT)     ||
635
                         ISPORT(RADIUS_ACCT_PORT))
636
                        radius_print((const u_char *)(up + 1), length);
637
		else if (dport == 3456)
638
			vat_print((const void *)(up + 1), length, up);
639
		else if (ISPORT(IAPP_PORT) || ISPORT(IAPP_OLD_PORT))
640
			iapp_print((const u_char *)(up + 1), length);
641
		else if (ISPORT(VQP_PORT))
642
			vqp_print((const u_char *)(up + 1), length);
643
#ifdef INET6
644
		else if (ISPORT(RIPNG_PORT))
645
			ripng_print((const u_char *)(up + 1), length);
646
		else if (ISPORT(DHCP6_PORT1) || ISPORT(DHCP6_PORT2)) {
647
			dhcp6_print((const u_char *)(up + 1), length,
648
				sport, dport);
649
		}
650
#endif /*INET6*/
651
		else if (ISPORT(GTP_C_PORT) || ISPORT(GTP_U_PORT) ||
652
		    ISPORT(GTP_PRIME_PORT))
653
			gtp_print((const u_char *)(up + 1), length,
654
			    sport, dport);
655
		/*
656
		 * Kludge in test for whiteboard packets.
657
		 */
658
		else if (dport == 4567)
659
			wb_print((const void *)(up + 1), length);
660
		else if (dport == HSRP_PORT)
661
			hsrp_print((const u_char *)(up + 1), length);
662
		else
663
			(void)printf(" udp %u",
664
			    (u_int32_t)(ulen - sizeof(*up)));
665
#undef ISPORT
666
	} else
667
		(void)printf(" udp %u", (u_int32_t)(ulen - sizeof(*up)));
668
}