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