]> The Tcpdump Group git mirrors - tcpdump/blob - print-udp.c
Initial commit for support of Type 3 and Type 4 LISP packets.
[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 #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(const struct ip6_hdr *ip6, const struct udphdr *up,
279 u_int len)
280 {
281 return nextproto6_cksum(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 if (ND_TTEST(((const struct LAP *)cp)->type) &&
499 ((const struct LAP *)cp)->type == lapDDP &&
500 (atalk_port(sport) || atalk_port(dport))) {
501 if (ndo->ndo_vflag)
502 ND_PRINT((ndo, "kip "));
503 llap_print(ndo, cp, length);
504 return;
505 }
506 }
507
508 if (ndo->ndo_vflag && !ndo->ndo_Kflag && !fragmented) {
509 /* Check the checksum, if possible. */
510 uint16_t sum, udp_sum;
511
512 /*
513 * XXX - do this even if vflag == 1?
514 * TCP does, and we do so for UDP-over-IPv6.
515 */
516 if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) {
517 udp_sum = EXTRACT_16BITS(&up->uh_sum);
518 if (udp_sum == 0) {
519 ND_PRINT((ndo, "[no cksum] "));
520 } else if (ND_TTEST2(cp[0], length)) {
521 sum = udp_cksum(ndo, ip, up, length + sizeof(struct udphdr));
522
523 if (sum != 0) {
524 ND_PRINT((ndo, "[bad udp cksum 0x%04x -> 0x%04x!] ",
525 udp_sum,
526 in_cksum_shouldbe(udp_sum, sum)));
527 } else
528 ND_PRINT((ndo, "[udp sum ok] "));
529 }
530 }
531 else if (IP_V(ip) == 6 && ip6->ip6_plen) {
532 /* for IPv6, UDP checksum is mandatory */
533 if (ND_TTEST2(cp[0], length)) {
534 sum = udp6_cksum(ip6, up, length + sizeof(struct udphdr));
535 udp_sum = EXTRACT_16BITS(&up->uh_sum);
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 }
546
547 if (!ndo->ndo_qflag) {
548 #define ISPORT(p) (dport == (p) || sport == (p))
549 if (ISPORT(NAMESERVER_PORT))
550 ns_print(ndo, (const u_char *)(up + 1), length, 0);
551 else if (ISPORT(MULTICASTDNS_PORT))
552 ns_print(ndo, (const u_char *)(up + 1), length, 1);
553 else if (ISPORT(TIMED_PORT))
554 timed_print(ndo, (const u_char *)(up + 1));
555 else if (ISPORT(TFTP_PORT))
556 tftp_print(ndo, (const u_char *)(up + 1), length);
557 else if (ISPORT(BOOTPC_PORT) || ISPORT(BOOTPS_PORT))
558 bootp_print(ndo, (const u_char *)(up + 1), length);
559 else if (ISPORT(RIP_PORT))
560 rip_print(ndo, (const u_char *)(up + 1), length);
561 else if (ISPORT(AODV_PORT))
562 aodv_print(ndo, (const u_char *)(up + 1), length,
563 ip6 != NULL);
564 else if (ISPORT(ISAKMP_PORT))
565 isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
566 else if (ISPORT(ISAKMP_PORT_NATT))
567 isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2);
568 #if 1 /*???*/
569 else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2))
570 isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
571 #endif
572 else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT))
573 snmp_print(ndo, (const u_char *)(up + 1), length);
574 else if (ISPORT(NTP_PORT))
575 ntp_print(ndo, (const u_char *)(up + 1), length);
576 else if (ISPORT(KERBEROS_PORT) || ISPORT(KERBEROS_SEC_PORT))
577 krb_print(ndo, (const void *)(up + 1));
578 else if (ISPORT(L2TP_PORT))
579 l2tp_print(ndo, (const u_char *)(up + 1), length);
580 #ifdef TCPDUMP_DO_SMB
581 else if (ISPORT(NETBIOS_NS_PORT))
582 nbt_udp137_print(ndo, (const u_char *)(up + 1), length);
583 else if (ISPORT(NETBIOS_DGRAM_PORT))
584 nbt_udp138_print(ndo, (const u_char *)(up + 1), length);
585 #endif
586 else if (dport == VAT_PORT)
587 vat_print(ndo, (const void *)(up + 1), up);
588 else if (ISPORT(ZEPHYR_SRV_PORT) || ISPORT(ZEPHYR_CLT_PORT))
589 zephyr_print(ndo, (const void *)(up + 1), length);
590 /*
591 * Since there are 10 possible ports to check, I think
592 * a <> test would be more efficient
593 */
594 else if ((sport >= RX_PORT_LOW && sport <= RX_PORT_HIGH) ||
595 (dport >= RX_PORT_LOW && dport <= RX_PORT_HIGH))
596 rx_print(ndo, (const void *)(up + 1), length, sport, dport,
597 (const u_char *) ip);
598 else if (ISPORT(RIPNG_PORT))
599 ripng_print(ndo, (const u_char *)(up + 1), length);
600 else if (ISPORT(DHCP6_SERV_PORT) || ISPORT(DHCP6_CLI_PORT))
601 dhcp6_print(ndo, (const u_char *)(up + 1), length);
602 else if (ISPORT(AHCP_PORT))
603 ahcp_print(ndo, (const u_char *)(up + 1), length);
604 else if (ISPORT(BABEL_PORT) || ISPORT(BABEL_PORT_OLD))
605 babel_print(ndo, (const u_char *)(up + 1), length);
606 /*
607 * Kludge in test for whiteboard packets.
608 */
609 else if (dport == WB_PORT)
610 wb_print(ndo, (const void *)(up + 1), length);
611 else if (ISPORT(CISCO_AUTORP_PORT))
612 cisco_autorp_print(ndo, (const void *)(up + 1), length);
613 else if (ISPORT(RADIUS_PORT) ||
614 ISPORT(RADIUS_NEW_PORT) ||
615 ISPORT(RADIUS_ACCOUNTING_PORT) ||
616 ISPORT(RADIUS_NEW_ACCOUNTING_PORT) ||
617 ISPORT(RADIUS_COA_PORT) )
618 radius_print(ndo, (const u_char *)(up+1), length);
619 else if (dport == HSRP_PORT)
620 hsrp_print(ndo, (const u_char *)(up + 1), length);
621 else if (ISPORT(LWRES_PORT))
622 lwres_print(ndo, (const u_char *)(up + 1), length);
623 else if (ISPORT(LDP_PORT))
624 ldp_print(ndo, (const u_char *)(up + 1), length);
625 else if (ISPORT(OLSR_PORT))
626 olsr_print(ndo, (const u_char *)(up + 1), length,
627 (IP_V(ip) == 6) ? 1 : 0);
628 else if (ISPORT(MPLS_LSP_PING_PORT))
629 lspping_print(ndo, (const u_char *)(up + 1), length);
630 else if (dport == BFD_CONTROL_PORT ||
631 dport == BFD_ECHO_PORT )
632 bfd_print(ndo, (const u_char *)(up+1), length, dport);
633 else if (ISPORT(LMP_PORT))
634 lmp_print(ndo, (const u_char *)(up + 1), length);
635 else if (ISPORT(VQP_PORT))
636 vqp_print(ndo, (const u_char *)(up + 1), length);
637 else if (ISPORT(SFLOW_PORT))
638 sflow_print(ndo, (const u_char *)(up + 1), length);
639 else if (dport == LWAPP_CONTROL_PORT)
640 lwapp_control_print(ndo, (const u_char *)(up + 1), length, 1);
641 else if (sport == LWAPP_CONTROL_PORT)
642 lwapp_control_print(ndo, (const u_char *)(up + 1), length, 0);
643 else if (ISPORT(LWAPP_DATA_PORT))
644 lwapp_data_print(ndo, (const u_char *)(up + 1), length);
645 else if (ISPORT(SIP_PORT))
646 sip_print(ndo, (const u_char *)(up + 1), length);
647 else if (ISPORT(SYSLOG_PORT))
648 syslog_print(ndo, (const u_char *)(up + 1), length);
649 else if (ISPORT(OTV_PORT))
650 otv_print(ndo, (const u_char *)(up + 1), length);
651 else if (ISPORT(VXLAN_PORT))
652 vxlan_print(ndo, (const u_char *)(up + 1), length);
653 else if (ISPORT(GENEVE_PORT))
654 geneve_print(ndo, (const u_char *)(up + 1), length);
655 else if (ISPORT(LISP_CONTROL_PORT))
656 lisp_print(ndo, (const u_char *)(up + 1), length);
657 else {
658 if (ulen > length)
659 ND_PRINT((ndo, "UDP, bad length %u > %u",
660 ulen, length));
661 else
662 ND_PRINT((ndo, "UDP, length %u", ulen));
663 }
664 #undef ISPORT
665 } else {
666 if (ulen > length)
667 ND_PRINT((ndo, "UDP, bad length %u > %u",
668 ulen, length));
669 else
670 ND_PRINT((ndo, "UDP, length %u", ulen));
671 }
672 }
673
674
675 /*
676 * Local Variables:
677 * c-style: whitesmith
678 * c-basic-offset: 8
679 * End:
680 */
681