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