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