]> The Tcpdump Group git mirrors - tcpdump/blob - print-udp.c
NDOize Babel decoder
[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 #include "bootp.h"
47
48 struct rtcphdr {
49 u_int16_t rh_flags; /* T:2 P:1 CNT:5 PT:8 */
50 u_int16_t rh_len; /* length of message (in words) */
51 u_int32_t rh_ssrc; /* synchronization src id */
52 };
53
54 typedef struct {
55 u_int32_t upper; /* more significant 32 bits */
56 u_int32_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 u_int32_t sr_ts; /* reference media timestamp */
65 u_int32_t sr_np; /* no. packets sent */
66 u_int32_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 u_int32_t rr_srcid; /* sender being reported */
75 u_int32_t rr_nl; /* no. packets lost */
76 u_int32_t rr_ls; /* extended last seq number received */
77 u_int32_t rr_dv; /* jitter (delay variance) */
78 u_int32_t rr_lsr; /* orig. ts from last rr from this src */
79 u_int32_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 = *(u_int16_t *)hdr;
102 if ((ts & 0xf060) != 0) {
103 /* probably vt */
104 ND_PRINT((ndo, "udp/vt %u %d / %d",
105 (u_int32_t)(EXTRACT_16BITS(&up->uh_ulen) - sizeof(*up)),
106 ts & 0x3ff, ts >> 10));
107 } else {
108 /* probably vat */
109 u_int32_t i0 = EXTRACT_32BITS(&((u_int *)hdr)[0]);
110 u_int32_t i1 = EXTRACT_32BITS(&((u_int *)hdr)[1]);
111 ND_PRINT((ndo, "udp/vat %u c%d %u%s",
112 (u_int32_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 u_int *ip = (u_int *)hdr;
129 u_int hasopt, hasext, contype, hasmarker;
130 u_int32_t i0 = EXTRACT_32BITS(&((u_int *)hdr)[0]);
131 u_int32_t i1 = EXTRACT_32BITS(&((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(&((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 struct rtcp_rr *rr = 0;
199 struct rtcp_sr *sr;
200 struct rtcphdr *rh = (struct rtcphdr *)hdr;
201 u_int len;
202 u_int16_t flags;
203 int cnt;
204 double ts, dts;
205 if ((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 = (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 ((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 = (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 = (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 ((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 u_int8_t *)(void *)up, len, len,
280 IPPROTO_UDP);
281 }
282
283 #ifdef INET6
284 static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
285 u_int len)
286 {
287 return nextproto6_cksum(ip6, (const u_int8_t *)(void *)up, len, len,
288 IPPROTO_UDP);
289 }
290 #endif
291
292 static void
293 udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dport)
294 {
295 #ifdef INET6
296 const struct ip6_hdr *ip6;
297
298 if (IP_V(ip) == 6)
299 ip6 = (const struct ip6_hdr *)ip;
300 else
301 ip6 = NULL;
302
303 if (ip6) {
304 if (ip6->ip6_nxt == IPPROTO_UDP) {
305 if (sport == -1) {
306 ND_PRINT((ndo, "%s > %s: ",
307 ip6addr_string(&ip6->ip6_src),
308 ip6addr_string(&ip6->ip6_dst)));
309 } else {
310 ND_PRINT((ndo, "%s.%s > %s.%s: ",
311 ip6addr_string(&ip6->ip6_src),
312 udpport_string(sport),
313 ip6addr_string(&ip6->ip6_dst),
314 udpport_string(dport)));
315 }
316 } else {
317 if (sport != -1) {
318 ND_PRINT((ndo, "%s > %s: ",
319 udpport_string(sport),
320 udpport_string(dport)));
321 }
322 }
323 } else
324 #endif /*INET6*/
325 {
326 if (ip->ip_p == IPPROTO_UDP) {
327 if (sport == -1) {
328 ND_PRINT((ndo, "%s > %s: ",
329 ipaddr_string(&ip->ip_src),
330 ipaddr_string(&ip->ip_dst)));
331 } else {
332 ND_PRINT((ndo, "%s.%s > %s.%s: ",
333 ipaddr_string(&ip->ip_src),
334 udpport_string(sport),
335 ipaddr_string(&ip->ip_dst),
336 udpport_string(dport)));
337 }
338 } else {
339 if (sport != -1) {
340 ND_PRINT((ndo, "%s > %s: ",
341 udpport_string(sport),
342 udpport_string(dport)));
343 }
344 }
345 }
346 }
347
348 void
349 udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
350 register const u_char *bp2, int fragmented)
351 {
352 register const struct udphdr *up;
353 register const struct ip *ip;
354 register const u_char *cp;
355 register const u_char *ep = bp + length;
356 u_int16_t sport, dport, ulen;
357 #ifdef INET6
358 register const struct ip6_hdr *ip6;
359 #endif
360
361 if (ep > ndo->ndo_snapend)
362 ep = ndo->ndo_snapend;
363 up = (struct udphdr *)bp;
364 ip = (struct ip *)bp2;
365 #ifdef INET6
366 if (IP_V(ip) == 6)
367 ip6 = (struct ip6_hdr *)bp2;
368 else
369 ip6 = NULL;
370 #endif /*INET6*/
371 cp = (u_char *)(up + 1);
372 if (!ND_TTEST(up->uh_dport)) {
373 udpipaddr_print(ndo, ip, -1, -1);
374 ND_PRINT((ndo, "[|udp]"));
375 return;
376 }
377
378 sport = EXTRACT_16BITS(&up->uh_sport);
379 dport = EXTRACT_16BITS(&up->uh_dport);
380
381 if (length < sizeof(struct udphdr)) {
382 udpipaddr_print(ndo, ip, sport, dport);
383 ND_PRINT((ndo, "truncated-udp %d", length));
384 return;
385 }
386 length -= sizeof(struct udphdr);
387
388 if (cp > ndo->ndo_snapend) {
389 udpipaddr_print(ndo, ip, sport, dport);
390 ND_PRINT((ndo, "[|udp]"));
391 return;
392 }
393
394 ulen = EXTRACT_16BITS(&up->uh_ulen);
395 if (ulen < 8) {
396 udpipaddr_print(ndo, ip, sport, dport);
397 ND_PRINT((ndo, "truncated-udplength %d", ulen));
398 return;
399 }
400 if (ndo->ndo_packettype) {
401 register struct sunrpc_msg *rp;
402 enum sunrpc_msg_type direction;
403
404 switch (ndo->ndo_packettype) {
405
406 case PT_VAT:
407 udpipaddr_print(ndo, ip, sport, dport);
408 vat_print(ndo, (void *)(up + 1), up);
409 break;
410
411 case PT_WB:
412 udpipaddr_print(ndo, ip, sport, dport);
413 wb_print(ndo, (void *)(up + 1), length);
414 break;
415
416 case PT_RPC:
417 rp = (struct sunrpc_msg *)(up + 1);
418 direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
419 if (direction == SUNRPC_CALL)
420 sunrpcrequest_print(ndo, (u_char *)rp, length,
421 (u_char *)ip);
422 else
423 nfsreply_print(ndo, (u_char *)rp, length,
424 (u_char *)ip); /*XXX*/
425 break;
426
427 case PT_RTP:
428 udpipaddr_print(ndo, ip, sport, dport);
429 rtp_print(ndo, (void *)(up + 1), length, up);
430 break;
431
432 case PT_RTCP:
433 udpipaddr_print(ndo, ip, sport, dport);
434 while (cp < ep)
435 cp = rtcp_print(ndo, cp, ep);
436 break;
437
438 case PT_SNMP:
439 udpipaddr_print(ndo, ip, sport, dport);
440 snmp_print(ndo, (const u_char *)(up + 1), length);
441 break;
442
443 case PT_CNFP:
444 udpipaddr_print(ndo, ip, sport, dport);
445 cnfp_print(ndo, cp, (const u_char *)ip);
446 break;
447
448 case PT_TFTP:
449 udpipaddr_print(ndo, ip, sport, dport);
450 tftp_print(ndo, cp, length);
451 break;
452
453 case PT_AODV:
454 udpipaddr_print(ndo, ip, sport, dport);
455 aodv_print(ndo, (const u_char *)(up + 1), length,
456 #ifdef INET6
457 ip6 != NULL);
458 #else
459 0);
460 #endif
461 break;
462
463 case PT_RADIUS:
464 udpipaddr_print(ndo, ip, sport, dport);
465 radius_print(ndo, cp, length);
466 break;
467
468 case PT_VXLAN:
469 udpipaddr_print(ndo, ip, sport, dport);
470 vxlan_print(ndo, (const u_char *)(up + 1), length);
471 break;
472
473 case PT_PGM:
474 case PT_PGM_ZMTP1:
475 udpipaddr_print(ndo, ip, sport, dport);
476 pgm_print(ndo, cp, length, bp2);
477 break;
478 case PT_LMP:
479 udpipaddr_print(ndo, ip, sport, dport);
480 lmp_print(ndo, cp, length);
481 break;
482 }
483 return;
484 }
485
486 udpipaddr_print(ndo, ip, sport, dport);
487 if (!ndo->ndo_qflag) {
488 register struct sunrpc_msg *rp;
489 enum sunrpc_msg_type direction;
490
491 rp = (struct sunrpc_msg *)(up + 1);
492 if (ND_TTEST(rp->rm_direction)) {
493 direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
494 if (dport == NFS_PORT && direction == SUNRPC_CALL) {
495 ND_PRINT((ndo, "NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
496 nfsreq_print_noaddr(ndo, (u_char *)rp, length,
497 (u_char *)ip);
498 return;
499 }
500 if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
501 ND_PRINT((ndo, "NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid)));
502 nfsreply_print_noaddr(ndo, (u_char *)rp, length,
503 (u_char *)ip);
504 return;
505 }
506 #ifdef notdef
507 if (dport == SUNRPC_PORT && direction == SUNRPC_CALL) {
508 sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
509 return;
510 }
511 #endif
512 }
513 if (ND_TTEST(((struct LAP *)cp)->type) &&
514 ((struct LAP *)cp)->type == lapDDP &&
515 (atalk_port(sport) || atalk_port(dport))) {
516 if (ndo->ndo_vflag)
517 ND_PRINT((ndo, "kip "));
518 llap_print(ndo, cp, length);
519 return;
520 }
521 }
522
523 if (ndo->ndo_vflag && !ndo->ndo_Kflag && !fragmented) {
524 /* Check the checksum, if possible. */
525 u_int16_t sum, udp_sum;
526
527 /*
528 * XXX - do this even if vflag == 1?
529 * TCP does, and we do so for UDP-over-IPv6.
530 */
531 if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) {
532 udp_sum = EXTRACT_16BITS(&up->uh_sum);
533 if (udp_sum == 0) {
534 ND_PRINT((ndo, "[no cksum] "));
535 } else if (ND_TTEST2(cp[0], length)) {
536 sum = udp_cksum(ndo, ip, up, length + sizeof(struct udphdr));
537
538 if (sum != 0) {
539 ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ",
540 udp_sum,
541 in_cksum_shouldbe(udp_sum, sum)));
542 } else
543 ND_PRINT((ndo, "[udp sum ok] "));
544 }
545 }
546 #ifdef INET6
547 else if (IP_V(ip) == 6 && ip6->ip6_plen) {
548 /* for IPv6, UDP checksum is mandatory */
549 if (ND_TTEST2(cp[0], length)) {
550 sum = udp6_cksum(ip6, up, length + sizeof(struct udphdr));
551 udp_sum = EXTRACT_16BITS(&up->uh_sum);
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 #endif
562 }
563
564 if (!ndo->ndo_qflag) {
565 #define ISPORT(p) (dport == (p) || sport == (p))
566 if (ISPORT(NAMESERVER_PORT))
567 ns_print(ndo, (const u_char *)(up + 1), length, 0);
568 else if (ISPORT(MULTICASTDNS_PORT))
569 ns_print(ndo, (const u_char *)(up + 1), length, 1);
570 else if (ISPORT(TIMED_PORT))
571 timed_print((const u_char *)(up + 1));
572 else if (ISPORT(TFTP_PORT))
573 tftp_print(ndo, (const u_char *)(up + 1), length);
574 else if (ISPORT(IPPORT_BOOTPC) || ISPORT(IPPORT_BOOTPS))
575 bootp_print(ndo, (const u_char *)(up + 1), length);
576 else if (ISPORT(RIP_PORT))
577 rip_print(ndo, (const u_char *)(up + 1), length);
578 else if (ISPORT(AODV_PORT))
579 aodv_print(ndo, (const u_char *)(up + 1), length,
580 #ifdef INET6
581 ip6 != NULL);
582 #else
583 0);
584 #endif
585 else if (ISPORT(ISAKMP_PORT))
586 isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
587 else if (ISPORT(ISAKMP_PORT_NATT))
588 isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2);
589 #if 1 /*???*/
590 else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2))
591 isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
592 #endif
593 else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT))
594 snmp_print(ndo, (const u_char *)(up + 1), length);
595 else if (ISPORT(NTP_PORT))
596 ntp_print(ndo, (const u_char *)(up + 1), length);
597 else if (ISPORT(KERBEROS_PORT) || ISPORT(KERBEROS_SEC_PORT))
598 krb_print(ndo, (const void *)(up + 1));
599 else if (ISPORT(L2TP_PORT))
600 l2tp_print(ndo, (const u_char *)(up + 1), length);
601 #ifdef TCPDUMP_DO_SMB
602 else if (ISPORT(NETBIOS_NS_PORT))
603 nbt_udp137_print(ndo, (const u_char *)(up + 1), length);
604 else if (ISPORT(NETBIOS_DGRAM_PORT))
605 nbt_udp138_print(ndo, (const u_char *)(up + 1), length);
606 #endif
607 else if (dport == VAT_PORT)
608 vat_print(ndo, (const void *)(up + 1), up);
609 else if (ISPORT(ZEPHYR_SRV_PORT) || ISPORT(ZEPHYR_CLT_PORT))
610 zephyr_print(ndo, (const void *)(up + 1), length);
611 /*
612 * Since there are 10 possible ports to check, I think
613 * a <> test would be more efficient
614 */
615 else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
616 (dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
617 rx_print(ndo, (const void *)(up + 1), length, sport, dport,
618 (u_char *) ip);
619 #ifdef INET6
620 else if (ISPORT(RIPNG_PORT))
621 ripng_print(ndo, (const u_char *)(up + 1), length);
622 else if (ISPORT(DHCP6_SERV_PORT) || ISPORT(DHCP6_CLI_PORT))
623 dhcp6_print(ndo, (const u_char *)(up + 1), length);
624 else if (ISPORT(AHCP_PORT))
625 ahcp_print(ndo, (const u_char *)(up + 1), length);
626 else if (ISPORT(BABEL_PORT) || ISPORT(BABEL_PORT_OLD))
627 babel_print(ndo, (const u_char *)(up + 1), length);
628 #endif /*INET6*/
629 /*
630 * Kludge in test for whiteboard packets.
631 */
632 else if (dport == WB_PORT)
633 wb_print(ndo, (const void *)(up + 1), length);
634 else if (ISPORT(CISCO_AUTORP_PORT))
635 cisco_autorp_print(ndo, (const void *)(up + 1), length);
636 else if (ISPORT(RADIUS_PORT) ||
637 ISPORT(RADIUS_NEW_PORT) ||
638 ISPORT(RADIUS_ACCOUNTING_PORT) ||
639 ISPORT(RADIUS_NEW_ACCOUNTING_PORT) )
640 radius_print(ndo, (const u_char *)(up+1), length);
641 else if (dport == HSRP_PORT)
642 hsrp_print(ndo, (const u_char *)(up + 1), length);
643 else if (ISPORT(LWRES_PORT))
644 lwres_print(ndo, (const u_char *)(up + 1), length);
645 else if (ISPORT(LDP_PORT))
646 ldp_print(ndo, (const u_char *)(up + 1), length);
647 else if (ISPORT(OLSR_PORT))
648 olsr_print(ndo, (const u_char *)(up + 1), length,
649 #if INET6
650 (IP_V(ip) == 6) ? 1 : 0);
651 #else
652 0);
653 #endif
654 else if (ISPORT(MPLS_LSP_PING_PORT))
655 lspping_print(ndo, (const u_char *)(up + 1), length);
656 else if (dport == BFD_CONTROL_PORT ||
657 dport == BFD_ECHO_PORT )
658 bfd_print(ndo, (const u_char *)(up+1), length, dport);
659 else if (ISPORT(LMP_PORT))
660 lmp_print(ndo, (const u_char *)(up + 1), length);
661 else if (ISPORT(VQP_PORT))
662 vqp_print(ndo, (const u_char *)(up + 1), length);
663 else if (ISPORT(SFLOW_PORT))
664 sflow_print(ndo, (const u_char *)(up + 1), length);
665 else if (dport == LWAPP_CONTROL_PORT)
666 lwapp_control_print(ndo, (const u_char *)(up + 1), length, 1);
667 else if (sport == LWAPP_CONTROL_PORT)
668 lwapp_control_print(ndo, (const u_char *)(up + 1), length, 0);
669 else if (ISPORT(LWAPP_DATA_PORT))
670 lwapp_data_print(ndo, (const u_char *)(up + 1), length);
671 else if (ISPORT(SIP_PORT))
672 sip_print(ndo, (const u_char *)(up + 1), length);
673 else if (ISPORT(SYSLOG_PORT))
674 syslog_print(ndo, (const u_char *)(up + 1), length);
675 else if (ISPORT(OTV_PORT))
676 otv_print(ndo, (const u_char *)(up + 1), length);
677 else if (ISPORT(VXLAN_PORT))
678 vxlan_print(ndo, (const u_char *)(up + 1), length);
679 else
680 ND_PRINT((ndo, "UDP, length %u",
681 (u_int32_t)(ulen - sizeof(*up))));
682 #undef ISPORT
683 } else
684 ND_PRINT((ndo, "UDP, length %u", (u_int32_t)(ulen - sizeof(*up))));
685 }
686
687
688 /*
689 * Local Variables:
690 * c-style: whitesmith
691 * c-basic-offset: 8
692 * End:
693 */
694