tcpdump: reduce size of -mini by removing more infrequently used protocols
[openwrt/openwrt.git] / package / network / utils / tcpdump / patches / 100-tcpdump_mini.patch
1 --- a/Makefile.in
2 +++ b/Makefile.in
3 @@ -70,6 +70,82 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
4 @rm -f $@
5 $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
6
7 +ifdef TCPDUMP_MINI
8 +
9 +CSRC=\
10 + tcpdump.c \
11 + util.c \
12 + setsignal.c \
13 + addrtoname.c \
14 + addrtostr.c \
15 + af.c \
16 + ascii_strcasecmp.c \
17 + checksum.c \
18 + cpack.c \
19 + gmpls.c \
20 + gmt2local.c \
21 + in_cksum.c \
22 + ipproto.c \
23 + l2vpn.c \
24 + machdep.c \
25 + nlpid.c \
26 + oui.c \
27 + parsenfsfh.c \
28 + print.c \
29 + print-802_11.c \
30 + print-aodv.c \
31 + print-arp.c \
32 + print-ascii.c \
33 + print-bootp.c \
34 + print-dhcp6.c \
35 + print-domain.c \
36 + print-eap.c \
37 + print-ether.c \
38 + print-ftp.c \
39 + print-gre.c \
40 + print-http.c \
41 + print-icmp.c \
42 + print-icmp6.c \
43 + print-igmp.c \
44 + print-ip.c \
45 + print-ip6.c \
46 + print-ip6opts.c \
47 + print-ipnet.c \
48 + print-l2tp.c \
49 + print-llc.c \
50 + print-lldp.c \
51 + print-loopback.c \
52 + print-nfs.c \
53 + print-ntp.c \
54 + print-null.c \
55 + print-olsr.c \
56 + print-ospf.c \
57 + print-ospf6.c \
58 + print-ppp.c \
59 + print-pppoe.c \
60 + print-pptp.c \
61 + print-radius.c \
62 + print-raw.c \
63 + print-rsvp.c \
64 + print-rt6.c \
65 + print-rtsp.c \
66 + print-sip.c \
67 + print-sll.c \
68 + print-smtp.c \
69 + print-snmp.c \
70 + print-stp.c \
71 + print-sunrpc.c \
72 + print-syslog.c \
73 + print-tcp.c \
74 + print-telnet.c \
75 + print-tftp.c \
76 + print-udp.c \
77 + signature.c \
78 + strtoaddr.c \
79 + util-print.c
80 +
81 +else
82 +
83 CSRC = setsignal.c tcpdump.c util.c
84
85 LIBNETDISSECT_SRC=\
86 @@ -236,12 +312,16 @@ LIBNETDISSECT_SRC=\
87 strtoaddr.c \
88 util-print.c
89
90 +endif
91 +
92 LOCALSRC = @LOCALSRC@
93 GENSRC = version.c
94 LIBOBJS = @LIBOBJS@
95
96 +ifndef TCPDUMP_MINI
97 LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
98 LIBNETDISSECT=libnetdissect.a
99 +endif
100
101
102 SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
103 @@ -367,10 +447,12 @@ $(PROG): $(OBJ) @V_PCAPDEP@
104 @rm -f $@
105 $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
106
107 +ifndef TCPDUMP_MINI
108 $(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
109 @rm -f $@
110 $(AR) cr $@ $(LIBNETDISSECT_OBJ)
111 $(RANLIB) $@
112 +endif
113
114 datalinks.o: $(srcdir)/missing/datalinks.c
115 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
116 --- a/addrtoname.c
117 +++ b/addrtoname.c
118 @@ -564,8 +564,10 @@ linkaddr_string(netdissect_options *ndo,
119 if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN)
120 return (etheraddr_string(ndo, ep));
121
122 +#ifndef TCPDUMP_MINI
123 if (type == LINKADDR_FRELAY)
124 return (q922_string(ndo, ep, len));
125 +#endif
126
127 tp = lookup_bytestring(ndo, ep, len);
128 if (tp->e_name)
129 @@ -1200,6 +1202,7 @@ init_addrtoname(netdissect_options *ndo,
130 init_ipxsaparray(ndo);
131 }
132
133 +#ifndef TCPDUMP_MINI
134 const char *
135 dnaddr_string(netdissect_options *ndo, u_short dnaddr)
136 {
137 @@ -1219,6 +1222,7 @@ dnaddr_string(netdissect_options *ndo, u
138
139 return(tp->name);
140 }
141 +#endif
142
143 /* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */
144 struct hnamemem *
145 --- a/print.c
146 +++ b/print.c
147 @@ -48,6 +48,7 @@ static const struct printer printers[] =
148 #ifdef DLT_IPNET
149 { ipnet_if_print, DLT_IPNET },
150 #endif
151 +#ifndef TCPDUMP_MINI
152 #ifdef DLT_IEEE802_15_4
153 { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
154 #endif
155 @@ -57,12 +58,14 @@ static const struct printer printers[] =
156 #ifdef DLT_PPI
157 { ppi_if_print, DLT_PPI },
158 #endif
159 +#endif
160 #ifdef DLT_NETANALYZER
161 { netanalyzer_if_print, DLT_NETANALYZER },
162 #endif
163 #ifdef DLT_NETANALYZER_TRANSPARENT
164 { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT },
165 #endif
166 +#ifndef TCPDUMP_MINI
167 #if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
168 { nflog_if_print, DLT_NFLOG},
169 #endif
170 @@ -75,10 +78,12 @@ static const struct printer printers[] =
171 #ifdef DLT_IP_OVER_FC
172 { ipfc_if_print, DLT_IP_OVER_FC },
173 #endif
174 +#endif
175 { null_if_print, DLT_NULL },
176 #ifdef DLT_LOOP
177 { null_if_print, DLT_LOOP },
178 #endif
179 +#ifndef TCPDUMP_MINI
180 #ifdef DLT_APPLE_IP_OVER_IEEE1394
181 { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 },
182 #endif
183 @@ -92,7 +97,9 @@ static const struct printer printers[] =
184 #ifdef DLT_ARCNET_LINUX
185 { arcnet_linux_if_print, DLT_ARCNET_LINUX },
186 #endif
187 +#endif
188 { raw_if_print, DLT_RAW },
189 +#ifndef TCPDUMP_MINI
190 #ifdef DLT_IPV4
191 { raw_if_print, DLT_IPV4 },
192 #endif
193 @@ -116,17 +123,21 @@ static const struct printer printers[] =
194 #ifdef DLT_HDLC
195 { chdlc_if_print, DLT_HDLC },
196 #endif
197 +#endif
198 #ifdef DLT_PPP_ETHER
199 { pppoe_if_print, DLT_PPP_ETHER },
200 #endif
201 +#ifndef TCPDUMP_MINI
202 #if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H)
203 { pflog_if_print, DLT_PFLOG },
204 #endif
205 { token_if_print, DLT_IEEE802 },
206 { fddi_if_print, DLT_FDDI },
207 +#endif
208 #ifdef DLT_LINUX_SLL
209 { sll_if_print, DLT_LINUX_SLL },
210 #endif
211 +#ifndef TCPDUMP_MINI
212 #ifdef DLT_FR
213 { fr_if_print, DLT_FR },
214 #endif
215 @@ -198,6 +209,7 @@ static const struct printer printers[] =
216 #ifdef DLT_PKTAP
217 { pktap_if_print, DLT_PKTAP },
218 #endif
219 +#endif
220 #ifdef DLT_IEEE802_11_RADIO
221 { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO },
222 #endif
223 @@ -214,12 +226,14 @@ static const struct printer printers[] =
224 #ifdef DLT_PPP_WITHDIRECTION
225 { ppp_if_print, DLT_PPP_WITHDIRECTION },
226 #endif
227 +#ifndef TCPDUMP_MINI
228 #ifdef DLT_PPP_BSDOS
229 { ppp_bsdos_if_print, DLT_PPP_BSDOS },
230 #endif
231 #ifdef DLT_PPP_SERIAL
232 { ppp_hdlc_if_print, DLT_PPP_SERIAL },
233 #endif
234 +#endif
235 { NULL, 0 },
236 };
237
238 --- a/print-ether.c
239 +++ b/print-ether.c
240 @@ -332,6 +332,7 @@ ethertype_print(netdissect_options *ndo,
241 arp_print(ndo, p, length, caplen);
242 return (1);
243
244 +#ifndef TCPDUMP_MINI
245 case ETHERTYPE_DN:
246 decnet_print(ndo, p, length, caplen);
247 return (1);
248 @@ -354,6 +355,7 @@ ethertype_print(netdissect_options *ndo,
249 case ETHERTYPE_ISO:
250 isoclns_print(ndo, p + 1, length - 1, length - 1);
251 return(1);
252 +#endif
253
254 case ETHERTYPE_PPPOED:
255 case ETHERTYPE_PPPOES:
256 @@ -366,9 +368,11 @@ ethertype_print(netdissect_options *ndo,
257 eap_print(ndo, p, length);
258 return (1);
259
260 +#ifndef TCPDUMP_MINI
261 case ETHERTYPE_RRCP:
262 rrcp_print(ndo, p - 14 , length + 14);
263 return (1);
264 +#endif
265
266 case ETHERTYPE_PPP:
267 if (length) {
268 @@ -377,6 +381,7 @@ ethertype_print(netdissect_options *ndo,
269 }
270 return (1);
271
272 +#ifndef TCPDUMP_MINI
273 case ETHERTYPE_MPCP:
274 mpcp_print(ndo, p, length);
275 return (1);
276 @@ -389,6 +394,7 @@ ethertype_print(netdissect_options *ndo,
277 case ETHERTYPE_CFM_OLD:
278 cfm_print(ndo, p, length);
279 return (1);
280 +#endif
281
282 case ETHERTYPE_LLDP:
283 lldp_print(ndo, p, length);
284 @@ -398,6 +404,7 @@ ethertype_print(netdissect_options *ndo,
285 loopback_print(ndo, p, length);
286 return (1);
287
288 +#ifndef TCPDUMP_MINI
289 case ETHERTYPE_MPLS:
290 case ETHERTYPE_MPLS_MULTI:
291 mpls_print(ndo, p, length);
292 @@ -427,6 +434,7 @@ ethertype_print(netdissect_options *ndo,
293 case ETHERTYPE_MEDSA:
294 medsa_print(ndo, p, length, caplen);
295 return (1);
296 +#endif
297
298 case ETHERTYPE_LAT:
299 case ETHERTYPE_SCA:
300 --- a/print-gre.c
301 +++ b/print-gre.c
302 @@ -203,6 +203,7 @@ gre_print_0(netdissect_options *ndo, con
303 case ETHERTYPE_IPV6:
304 ip6_print(ndo, bp, len);
305 break;
306 +#ifndef TCPDUMP_MINI
307 case ETHERTYPE_MPLS:
308 mpls_print(ndo, bp, len);
309 break;
310 @@ -218,6 +219,7 @@ gre_print_0(netdissect_options *ndo, con
311 case ETHERTYPE_TEB:
312 ether_print(ndo, bp, len, len, NULL, NULL);
313 break;
314 +#endif
315 default:
316 ND_PRINT((ndo, "gre-proto-0x%x", prot));
317 }
318 --- a/print-igmp.c
319 +++ b/print-igmp.c
320 @@ -304,6 +304,7 @@ igmp_print(netdissect_options *ndo,
321 ND_TCHECK2(bp[4], 4);
322 ND_PRINT((ndo, "igmp leave %s", ipaddr_string(ndo, &bp[4])));
323 break;
324 +#ifndef TCPDUMP_MINI
325 case 0x13:
326 ND_PRINT((ndo, "igmp dvmrp"));
327 if (len < 8)
328 @@ -315,6 +316,7 @@ igmp_print(netdissect_options *ndo,
329 ND_PRINT((ndo, "igmp pimv1"));
330 pimv1_print(ndo, bp, len);
331 break;
332 +#endif
333 case 0x1e:
334 print_mresp(ndo, bp, len);
335 break;
336 --- a/print-ip6.c
337 +++ b/print-ip6.c
338 @@ -297,6 +297,7 @@ ip6_print(netdissect_options *ndo, const
339 advance = dstopt_print(ndo, cp);
340 nh = *cp;
341 break;
342 +#ifndef TCPDUMP_MINI
343 case IPPROTO_FRAGMENT:
344 advance = frag6_print(ndo, cp, (const u_char *)ip6);
345 if (ndo->ndo_snapend <= cp + advance)
346 @@ -318,16 +319,19 @@ ip6_print(netdissect_options *ndo, const
347 advance = mobility_print(ndo, cp, (const u_char *)ip6);
348 nh = *cp;
349 return;
350 +#endif
351 case IPPROTO_ROUTING:
352 advance = rt6_print(ndo, cp, (const u_char *)ip6);
353 nh = *cp;
354 break;
355 +#ifndef TCPDUMP_MINI
356 case IPPROTO_SCTP:
357 sctp_print(ndo, cp, (const u_char *)ip6, len);
358 return;
359 case IPPROTO_DCCP:
360 dccp_print(ndo, cp, (const u_char *)ip6, len);
361 return;
362 +#endif
363 case IPPROTO_TCP:
364 tcp_print(ndo, cp, len, (const u_char *)ip6, fragmented);
365 return;
366 @@ -337,6 +341,7 @@ ip6_print(netdissect_options *ndo, const
367 case IPPROTO_ICMPV6:
368 icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented);
369 return;
370 +#ifndef TCPDUMP_MINI
371 case IPPROTO_AH:
372 advance = ah_print(ndo, cp);
373 nh = *cp;
374 @@ -360,6 +365,7 @@ ip6_print(netdissect_options *ndo, const
375 case IPPROTO_PIM:
376 pim_print(ndo, cp, len, (const u_char *)ip6);
377 return;
378 +#endif
379
380 case IPPROTO_OSPF:
381 ospf6_print(ndo, cp, len);
382 @@ -373,9 +379,11 @@ ip6_print(netdissect_options *ndo, const
383 ip_print(ndo, cp, len);
384 return;
385
386 +#ifndef TCPDUMP_MINI
387 case IPPROTO_PGM:
388 pgm_print(ndo, cp, len, (const u_char *)ip6);
389 return;
390 +#endif
391
392 case IPPROTO_GRE:
393 gre_print(ndo, cp, len);
394 --- a/print-ip.c
395 +++ b/print-ip.c
396 @@ -327,6 +327,7 @@ ip_print_demux(netdissect_options *ndo,
397 again:
398 switch (ipds->nh) {
399
400 +#ifndef TCPDUMP_MINI
401 case IPPROTO_AH:
402 ipds->nh = *ipds->cp;
403 ipds->advance = ah_print(ndo, ipds->cp);
404 @@ -361,7 +362,9 @@ again:
405 ipds->nh = enh & 0xff;
406 goto again;
407 }
408 +#endif
409
410 +#ifndef TCPDUMP_MINI
411 case IPPROTO_SCTP:
412 sctp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
413 break;
414 @@ -369,6 +372,7 @@ again:
415 case IPPROTO_DCCP:
416 dccp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
417 break;
418 +#endif
419
420 case IPPROTO_TCP:
421 /* pass on the MF bit plus the offset to detect fragments */
422 @@ -388,6 +392,7 @@ again:
423 ipds->off & (IP_MF|IP_OFFMASK));
424 break;
425
426 +#ifndef TCPDUMP_MINI
427 case IPPROTO_PIGP:
428 /*
429 * XXX - the current IANA protocol number assignments
430 @@ -408,14 +413,17 @@ again:
431 case IPPROTO_EIGRP:
432 eigrp_print(ndo, ipds->cp, ipds->len);
433 break;
434 +#endif
435
436 case IPPROTO_ND:
437 ND_PRINT((ndo, " nd %d", ipds->len));
438 break;
439
440 +#ifndef TCPDUMP_MINI
441 case IPPROTO_EGP:
442 egp_print(ndo, ipds->cp, ipds->len);
443 break;
444 +#endif
445
446 case IPPROTO_OSPF:
447 ospf_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip);
448 @@ -448,6 +456,7 @@ again:
449 gre_print(ndo, ipds->cp, ipds->len);
450 break;
451
452 +#ifndef TCPDUMP_MINI
453 case IPPROTO_MOBILE:
454 mobile_print(ndo, ipds->cp, ipds->len);
455 break;
456 @@ -476,6 +485,7 @@ again:
457 case IPPROTO_PGM:
458 pgm_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip);
459 break;
460 +#endif
461
462 default:
463 if (ndo->ndo_nflag==0 && (proto = getprotobynumber(ipds->nh)) != NULL)
464 --- a/print-llc.c
465 +++ b/print-llc.c
466 @@ -204,6 +204,7 @@ llc_print(netdissect_options *ndo, const
467 hdrlen = 4; /* DSAP, SSAP, 2-byte control field */
468 }
469
470 +#ifndef TCPDUMP_MINI
471 if (ssap_field == LLCSAP_GLOBAL && dsap_field == LLCSAP_GLOBAL) {
472 /*
473 * This is an Ethernet_802.3 IPX frame; it has an
474 @@ -226,6 +227,7 @@ llc_print(netdissect_options *ndo, const
475 ipx_print(ndo, p, length);
476 return (0); /* no LLC header */
477 }
478 +#endif
479
480 dsap = dsap_field & ~LLC_IG;
481 ssap = ssap_field & ~LLC_GSAP;
482 @@ -289,6 +291,7 @@ llc_print(netdissect_options *ndo, const
483 return (hdrlen);
484 }
485
486 +#ifndef TCPDUMP_MINI
487 if (ssap == LLCSAP_IPX && dsap == LLCSAP_IPX &&
488 control == LLC_UI) {
489 /*
490 @@ -302,6 +305,7 @@ llc_print(netdissect_options *ndo, const
491 ipx_print(ndo, p, length);
492 return (hdrlen);
493 }
494 +#endif
495
496 #ifdef ENABLE_SMB
497 if (ssap == LLCSAP_NETBEUI && dsap == LLCSAP_NETBEUI
498 @@ -320,11 +324,13 @@ llc_print(netdissect_options *ndo, const
499 return (hdrlen);
500 }
501 #endif
502 +#ifndef TCPDUMP_MINI
503 if (ssap == LLCSAP_ISONS && dsap == LLCSAP_ISONS
504 && control == LLC_UI) {
505 isoclns_print(ndo, p, length, caplen);
506 return (hdrlen);
507 }
508 +#endif
509
510 if (!ndo->ndo_eflag) {
511 if (ssap == dsap) {
512 @@ -458,6 +464,7 @@ snap_print(netdissect_options *ndo, cons
513
514 case OUI_CISCO:
515 switch (et) {
516 +#ifndef TCPDUMP_MINI
517 case PID_CISCO_CDP:
518 cdp_print(ndo, p, length, caplen);
519 return (1);
520 @@ -470,6 +477,7 @@ snap_print(netdissect_options *ndo, cons
521 case PID_CISCO_VTP:
522 vtp_print(ndo, p, length);
523 return (1);
524 +#endif
525 case PID_CISCO_PVST:
526 case PID_CISCO_VLANBRIDGE:
527 stp_print(ndo, p, length);
528 @@ -482,6 +490,7 @@ snap_print(netdissect_options *ndo, cons
529 case OUI_RFC2684:
530 switch (et) {
531
532 +#ifndef TCPDUMP_MINI
533 case PID_RFC2684_ETH_FCS:
534 case PID_RFC2684_ETH_NOFCS:
535 /*
536 @@ -543,6 +552,7 @@ snap_print(netdissect_options *ndo, cons
537 */
538 fddi_print(ndo, p, length, caplen);
539 return (1);
540 +#endif
541
542 case PID_RFC2684_BPDU:
543 stp_print(ndo, p, length);
544 --- a/print-null.c
545 +++ b/print-null.c
546 @@ -114,6 +114,7 @@ null_if_print(netdissect_options *ndo, c
547 ip6_print(ndo, p, length);
548 break;
549
550 +#ifndef TCPDUMP_MINI
551 case BSD_AFNUM_ISO:
552 isoclns_print(ndo, p, length, caplen);
553 break;
554 @@ -125,6 +126,7 @@ null_if_print(netdissect_options *ndo, c
555 case BSD_AFNUM_IPX:
556 ipx_print(ndo, p, length);
557 break;
558 +#endif
559
560 default:
561 /* unknown AF_ value */
562 --- a/print-ppp.c
563 +++ b/print-ppp.c
564 @@ -1346,6 +1346,7 @@ trunc:
565 return 0;
566 }
567
568 +#ifndef TCPDUMP_MINI
569 static void
570 ppp_hdlc(netdissect_options *ndo,
571 const u_char *p, int length)
572 @@ -1424,6 +1425,7 @@ trunc:
573 free(b);
574 ND_PRINT((ndo, "[|ppp]"));
575 }
576 +#endif
577
578
579 /* PPP */
580 @@ -1431,10 +1433,12 @@ static void
581 handle_ppp(netdissect_options *ndo,
582 u_int proto, const u_char *p, int length)
583 {
584 +#ifndef TCPDUMP_MINI
585 if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */
586 ppp_hdlc(ndo, p - 1, length);
587 return;
588 }
589 +#endif
590
591 switch (proto) {
592 case PPP_LCP: /* fall through */
593 @@ -1467,6 +1471,7 @@ handle_ppp(netdissect_options *ndo,
594 case PPP_IPV6:
595 ip6_print(ndo, p, length);
596 break;
597 +#ifndef TCPDUMP_MINI
598 case ETHERTYPE_IPX: /*XXX*/
599 case PPP_IPX:
600 ipx_print(ndo, p, length);
601 @@ -1478,6 +1483,7 @@ handle_ppp(netdissect_options *ndo,
602 case PPP_MPLS_MCAST:
603 mpls_print(ndo, p, length);
604 break;
605 +#endif
606 case PPP_COMP:
607 ND_PRINT((ndo, "compressed PPP data"));
608 break;
609 @@ -1618,6 +1624,7 @@ ppp_if_print(netdissect_options *ndo,
610 return (0);
611 }
612
613 +#ifndef TCPDUMP_MINI
614 /*
615 * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
616 * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
617 @@ -1840,6 +1847,7 @@ printx:
618 #endif /* __bsdi__ */
619 return (hdrlength);
620 }
621 +#endif
622
623
624 /*
625 --- a/print-sll.c
626 +++ b/print-sll.c
627 @@ -236,12 +236,14 @@ recurse:
628 */
629 switch (ether_type) {
630
631 +#ifndef TCPDUMP_MINI
632 case LINUX_SLL_P_802_3:
633 /*
634 * Ethernet_802.3 IPX frame.
635 */
636 ipx_print(ndo, p, length);
637 break;
638 +#endif
639
640 case LINUX_SLL_P_802_2:
641 /*
642 --- a/print-tcp.c
643 +++ b/print-tcp.c
644 @@ -565,12 +565,14 @@ tcp_print(netdissect_options *ndo,
645 ND_PRINT((ndo, " %u", utoval));
646 break;
647
648 +#ifndef TCPDUMP_MINI
649 case TCPOPT_MPTCP:
650 datalen = len - 2;
651 LENCHECK(datalen);
652 if (!mptcp_print(ndo, cp-2, len, flags))
653 goto bad;
654 break;
655 +#endif
656
657 case TCPOPT_FASTOPEN:
658 datalen = len - 2;
659 @@ -645,6 +647,7 @@ tcp_print(netdissect_options *ndo,
660 return;
661 }
662
663 +#ifndef TCPDUMP_MINI
664 if (ndo->ndo_packettype) {
665 switch (ndo->ndo_packettype) {
666 case PT_ZMTP1:
667 @@ -656,28 +659,36 @@ tcp_print(netdissect_options *ndo,
668 }
669 return;
670 }
671 +#endif
672
673 if (IS_SRC_OR_DST_PORT(TELNET_PORT)) {
674 telnet_print(ndo, bp, length);
675 } else if (IS_SRC_OR_DST_PORT(SMTP_PORT)) {
676 ND_PRINT((ndo, ": "));
677 smtp_print(ndo, bp, length);
678 - } else if (IS_SRC_OR_DST_PORT(BGP_PORT))
679 + }
680 +#ifndef TCPDUMP_MINI
681 + else if (IS_SRC_OR_DST_PORT(BGP_PORT))
682 bgp_print(ndo, bp, length);
683 +#endif
684 else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
685 pptp_print(ndo, bp);
686 +#ifndef TCPDUMP_MINI
687 else if (IS_SRC_OR_DST_PORT(REDIS_PORT))
688 resp_print(ndo, bp, length);
689 +#endif
690 #ifdef ENABLE_SMB
691 else if (IS_SRC_OR_DST_PORT(NETBIOS_SSN_PORT))
692 nbt_tcp_print(ndo, bp, length);
693 else if (IS_SRC_OR_DST_PORT(SMB_PORT))
694 smb_tcp_print(ndo, bp, length);
695 #endif
696 +#ifndef TCPDUMP_MINI
697 else if (IS_SRC_OR_DST_PORT(BEEP_PORT))
698 beep_print(ndo, bp, length);
699 else if (IS_SRC_OR_DST_PORT(OPENFLOW_PORT_OLD) || IS_SRC_OR_DST_PORT(OPENFLOW_PORT_IANA))
700 openflow_print(ndo, bp, length);
701 +#endif
702 else if (IS_SRC_OR_DST_PORT(FTP_PORT)) {
703 ND_PRINT((ndo, ": "));
704 ftp_print(ndo, bp, length);
705 @@ -694,6 +705,7 @@ tcp_print(netdissect_options *ndo,
706 * XXX packet could be unaligned, it can go strange
707 */
708 ns_print(ndo, bp + 2, length - 2, 0);
709 +#ifndef TCPDUMP_MINI
710 } else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) {
711 msdp_print(ndo, bp, length);
712 } else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) {
713 @@ -701,6 +713,7 @@ tcp_print(netdissect_options *ndo,
714 }
715 else if (length > 0 && (IS_SRC_OR_DST_PORT(LDP_PORT))) {
716 ldp_print(ndo, bp, length);
717 +#endif
718 }
719 else if ((IS_SRC_OR_DST_PORT(NFS_PORT)) &&
720 length >= 4 && ND_TTEST2(*bp, 4)) {
721 --- a/print-udp.c
722 +++ b/print-udp.c
723 @@ -397,10 +397,12 @@ udp_print(netdissect_options *ndo, regis
724 vat_print(ndo, (const void *)(up + 1), up);
725 break;
726
727 +#ifndef TCPDUMP_MINI
728 case PT_WB:
729 udpipaddr_print(ndo, ip, sport, dport);
730 wb_print(ndo, (const void *)(up + 1), length);
731 break;
732 +#endif
733
734 case PT_RPC:
735 rp = (const struct sunrpc_msg *)(up + 1);
736 @@ -429,10 +431,12 @@ udp_print(netdissect_options *ndo, regis
737 snmp_print(ndo, (const u_char *)(up + 1), length);
738 break;
739
740 +#ifndef TCPDUMP_MINI
741 case PT_CNFP:
742 udpipaddr_print(ndo, ip, sport, dport);
743 cnfp_print(ndo, cp);
744 break;
745 +#endif
746
747 case PT_TFTP:
748 udpipaddr_print(ndo, ip, sport, dport);
749 @@ -450,6 +454,7 @@ udp_print(netdissect_options *ndo, regis
750 radius_print(ndo, cp, length);
751 break;
752
753 +#ifndef TCPDUMP_MINI
754 case PT_VXLAN:
755 udpipaddr_print(ndo, ip, sport, dport);
756 vxlan_print(ndo, (const u_char *)(up + 1), length);
757 @@ -464,6 +469,7 @@ udp_print(netdissect_options *ndo, regis
758 udpipaddr_print(ndo, ip, sport, dport);
759 lmp_print(ndo, cp, length);
760 break;
761 +#endif
762 }
763 return;
764 }
765 @@ -541,31 +547,40 @@ udp_print(netdissect_options *ndo, regis
766 ns_print(ndo, (const u_char *)(up + 1), length, 0);
767 else if (IS_SRC_OR_DST_PORT(MULTICASTDNS_PORT))
768 ns_print(ndo, (const u_char *)(up + 1), length, 1);
769 +#ifndef TCPDUMP_MINI
770 else if (IS_SRC_OR_DST_PORT(TIMED_PORT))
771 timed_print(ndo, (const u_char *)(up + 1));
772 +#endif
773 else if (IS_SRC_OR_DST_PORT(TFTP_PORT))
774 tftp_print(ndo, (const u_char *)(up + 1), length);
775 else if (IS_SRC_OR_DST_PORT(BOOTPC_PORT) || IS_SRC_OR_DST_PORT(BOOTPS_PORT))
776 bootp_print(ndo, (const u_char *)(up + 1), length);
777 +#ifndef TCPDUMP_MINI
778 else if (IS_SRC_OR_DST_PORT(RIP_PORT))
779 rip_print(ndo, (const u_char *)(up + 1), length);
780 +#endif
781 else if (IS_SRC_OR_DST_PORT(AODV_PORT))
782 aodv_print(ndo, (const u_char *)(up + 1), length,
783 ip6 != NULL);
784 +#ifndef TCPDUMP_MINI
785 else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT))
786 isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
787 +
788 else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_NATT))
789 isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2);
790 #if 1 /*???*/
791 else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER1) || IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER2))
792 isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
793 #endif
794 +#endif
795 else if (IS_SRC_OR_DST_PORT(SNMP_PORT) || IS_SRC_OR_DST_PORT(SNMPTRAP_PORT))
796 snmp_print(ndo, (const u_char *)(up + 1), length);
797 else if (IS_SRC_OR_DST_PORT(NTP_PORT))
798 ntp_print(ndo, (const u_char *)(up + 1), length);
799 +#ifndef TCPDUMP_MINI
800 else if (IS_SRC_OR_DST_PORT(KERBEROS_PORT) || IS_SRC_OR_DST_PORT(KERBEROS_SEC_PORT))
801 krb_print(ndo, (const void *)(up + 1));
802 +#endif
803 else if (IS_SRC_OR_DST_PORT(L2TP_PORT))
804 l2tp_print(ndo, (const u_char *)(up + 1), length);
805 #ifdef ENABLE_SMB
806 @@ -576,6 +591,7 @@ udp_print(netdissect_options *ndo, regis
807 #endif
808 else if (dport == VAT_PORT)
809 vat_print(ndo, (const void *)(up + 1), up);
810 +#ifndef TCPDUMP_MINI
811 else if (IS_SRC_OR_DST_PORT(ZEPHYR_SRV_PORT) || IS_SRC_OR_DST_PORT(ZEPHYR_CLT_PORT))
812 zephyr_print(ndo, (const void *)(up + 1), length);
813 /*
814 @@ -588,8 +604,11 @@ udp_print(netdissect_options *ndo, regis
815 (const u_char *) ip);
816 else if (IS_SRC_OR_DST_PORT(RIPNG_PORT))
817 ripng_print(ndo, (const u_char *)(up + 1), length);
818 +#endif
819 +
820 else if (IS_SRC_OR_DST_PORT(DHCP6_SERV_PORT) || IS_SRC_OR_DST_PORT(DHCP6_CLI_PORT))
821 dhcp6_print(ndo, (const u_char *)(up + 1), length);
822 +#ifndef TCPDUMP_MINI
823 else if (IS_SRC_OR_DST_PORT(AHCP_PORT))
824 ahcp_print(ndo, (const u_char *)(up + 1), length);
825 else if (IS_SRC_OR_DST_PORT(BABEL_PORT) || IS_SRC_OR_DST_PORT(BABEL_PORT_OLD))
826 @@ -603,6 +622,7 @@ udp_print(netdissect_options *ndo, regis
827 wb_print(ndo, (const void *)(up + 1), length);
828 else if (IS_SRC_OR_DST_PORT(CISCO_AUTORP_PORT))
829 cisco_autorp_print(ndo, (const void *)(up + 1), length);
830 +#endif
831 else if (IS_SRC_OR_DST_PORT(RADIUS_PORT) ||
832 IS_SRC_OR_DST_PORT(RADIUS_NEW_PORT) ||
833 IS_SRC_OR_DST_PORT(RADIUS_ACCOUNTING_PORT) ||
834 @@ -610,15 +630,18 @@ udp_print(netdissect_options *ndo, regis
835 IS_SRC_OR_DST_PORT(RADIUS_CISCO_COA_PORT) ||
836 IS_SRC_OR_DST_PORT(RADIUS_COA_PORT) )
837 radius_print(ndo, (const u_char *)(up+1), length);
838 +#ifndef TCPDUMP_MINI
839 else if (dport == HSRP_PORT)
840 hsrp_print(ndo, (const u_char *)(up + 1), length);
841 else if (IS_SRC_OR_DST_PORT(LWRES_PORT))
842 lwres_print(ndo, (const u_char *)(up + 1), length);
843 else if (IS_SRC_OR_DST_PORT(LDP_PORT))
844 ldp_print(ndo, (const u_char *)(up + 1), length);
845 +#endif
846 else if (IS_SRC_OR_DST_PORT(OLSR_PORT))
847 olsr_print(ndo, (const u_char *)(up + 1), length,
848 (IP_V(ip) == 6) ? 1 : 0);
849 +#ifndef TCPDUMP_MINI
850 else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT))
851 lspping_print(ndo, (const u_char *)(up + 1), length);
852 else if (dport == BFD_CONTROL_PORT ||
853 @@ -636,10 +659,12 @@ udp_print(netdissect_options *ndo, regis
854 lwapp_control_print(ndo, (const u_char *)(up + 1), length, 0);
855 else if (IS_SRC_OR_DST_PORT(LWAPP_DATA_PORT))
856 lwapp_data_print(ndo, (const u_char *)(up + 1), length);
857 +#endif
858 else if (IS_SRC_OR_DST_PORT(SIP_PORT))
859 sip_print(ndo, (const u_char *)(up + 1), length);
860 else if (IS_SRC_OR_DST_PORT(SYSLOG_PORT))
861 syslog_print(ndo, (const u_char *)(up + 1), length);
862 +#ifndef TCPDUMP_MINI
863 else if (IS_SRC_OR_DST_PORT(OTV_PORT))
864 otv_print(ndo, (const u_char *)(up + 1), length);
865 else if (IS_SRC_OR_DST_PORT(VXLAN_PORT))
866 @@ -656,7 +681,9 @@ udp_print(netdissect_options *ndo, regis
867 if (ndo->ndo_vflag)
868 ND_PRINT((ndo, "kip "));
869 llap_print(ndo, cp, length);
870 - } else {
871 + }
872 +#endif
873 + else {
874 if (ulen > length)
875 ND_PRINT((ndo, "UDP, bad length %u > %u",
876 ulen, length));