Merge pull request #580 from wigyori/cc-libpcap
[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 @@ -578,8 +578,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->bs_name)
106 @@ -1214,6 +1216,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 @@ -1233,6 +1236,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);
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 @@ -305,6 +305,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 @@ -328,6 +329,7 @@ ip6_print(netdissect_options *ndo, const
324                                 return;
325                         nh = *cp;
326                         return;
327 +#endif
328                 case IPPROTO_ROUTING:
329                         ND_TCHECK(*cp);
330                         advance = rt6_print(ndo, cp, (const u_char *)ip6);
331 @@ -335,12 +337,14 @@ ip6_print(netdissect_options *ndo, const
332                                 return;
333                         nh = *cp;
334                         break;
335 +#ifndef TCPDUMP_MINI
336                 case IPPROTO_SCTP:
337                         sctp_print(ndo, cp, (const u_char *)ip6, len);
338                         return;
339                 case IPPROTO_DCCP:
340                         dccp_print(ndo, cp, (const u_char *)ip6, len);
341                         return;
342 +#endif
343                 case IPPROTO_TCP:
344                         tcp_print(ndo, cp, len, (const u_char *)ip6, fragmented);
345                         return;
346 @@ -350,6 +354,7 @@ ip6_print(netdissect_options *ndo, const
347                 case IPPROTO_ICMPV6:
348                         icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented);
349                         return;
350 +#ifndef TCPDUMP_MINI
351                 case IPPROTO_AH:
352                         advance = ah_print(ndo, cp);
353                         if (advance < 0)
354 @@ -382,6 +387,7 @@ ip6_print(netdissect_options *ndo, const
355                 case IPPROTO_PIM:
356                         pim_print(ndo, cp, len, (const u_char *)ip6);
357                         return;
358 +#endif
359  
360                 case IPPROTO_OSPF:
361                         ospf6_print(ndo, cp, len);
362 @@ -395,9 +401,11 @@ ip6_print(netdissect_options *ndo, const
363                         ip_print(ndo, cp, len);
364                         return;
365  
366 +#ifndef TCPDUMP_MINI
367                  case IPPROTO_PGM:
368                          pgm_print(ndo, cp, len, (const u_char *)ip6);
369                          return;
370 +#endif
371  
372                 case IPPROTO_GRE:
373                         gre_print(ndo, cp, len);
374 --- a/print-ip.c
375 +++ b/print-ip.c
376 @@ -344,6 +344,7 @@ ip_print_demux(netdissect_options *ndo,
377  again:
378         switch (ipds->nh) {
379  
380 +#ifndef TCPDUMP_MINI
381         case IPPROTO_AH:
382                 if (!ND_TTEST(*ipds->cp)) {
383                         ND_PRINT((ndo, "[|AH]"));
384 @@ -382,7 +383,9 @@ again:
385                  */
386                 break;
387         }
388 +#endif
389  
390 +#ifndef TCPDUMP_MINI
391         case IPPROTO_SCTP:
392                 sctp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
393                 break;
394 @@ -390,6 +393,7 @@ again:
395         case IPPROTO_DCCP:
396                 dccp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
397                 break;
398 +#endif
399  
400         case IPPROTO_TCP:
401                 /* pass on the MF bit plus the offset to detect fragments */
402 @@ -409,6 +413,7 @@ again:
403                            ipds->off & (IP_MF|IP_OFFMASK));
404                 break;
405  
406 +#ifndef TCPDUMP_MINI
407         case IPPROTO_PIGP:
408                 /*
409                  * XXX - the current IANA protocol number assignments
410 @@ -429,14 +434,17 @@ again:
411         case IPPROTO_EIGRP:
412                 eigrp_print(ndo, ipds->cp, ipds->len);
413                 break;
414 +#endif
415  
416         case IPPROTO_ND:
417                 ND_PRINT((ndo, " nd %d", ipds->len));
418                 break;
419  
420 +#ifndef TCPDUMP_MINI
421         case IPPROTO_EGP:
422                 egp_print(ndo, ipds->cp, ipds->len);
423                 break;
424 +#endif
425  
426         case IPPROTO_OSPF:
427                 ospf_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip);
428 @@ -469,6 +477,7 @@ again:
429                 gre_print(ndo, ipds->cp, ipds->len);
430                 break;
431  
432 +#ifndef TCPDUMP_MINI
433         case IPPROTO_MOBILE:
434                 mobile_print(ndo, ipds->cp, ipds->len);
435                 break;
436 @@ -497,6 +506,7 @@ again:
437         case IPPROTO_PGM:
438                 pgm_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip);
439                 break;
440 +#endif
441  
442         default:
443                 if (ndo->ndo_nflag==0 && (p_name = netdb_protoname(ipds->nh)) != NULL)
444 --- a/print-llc.c
445 +++ b/print-llc.c
446 @@ -206,6 +206,7 @@ llc_print(netdissect_options *ndo, const
447                 hdrlen = 4;     /* DSAP, SSAP, 2-byte control field */
448         }
449  
450 +#ifndef TCPDUMP_MINI
451         if (ssap_field == LLCSAP_GLOBAL && dsap_field == LLCSAP_GLOBAL) {
452                 /*
453                  * This is an Ethernet_802.3 IPX frame; it has an
454 @@ -228,6 +229,7 @@ llc_print(netdissect_options *ndo, const
455              ipx_print(ndo, p, length);
456              return (0);                /* no LLC header */
457         }
458 +#endif
459  
460         dsap = dsap_field & ~LLC_IG;
461         ssap = ssap_field & ~LLC_GSAP;
462 @@ -291,6 +293,7 @@ llc_print(netdissect_options *ndo, const
463                 return (hdrlen);
464         }
465  
466 +#ifndef TCPDUMP_MINI
467         if (ssap == LLCSAP_IPX && dsap == LLCSAP_IPX &&
468             control == LLC_UI) {
469                 /*
470 @@ -304,6 +307,7 @@ llc_print(netdissect_options *ndo, const
471                 ipx_print(ndo, p, length);
472                 return (hdrlen);
473         }
474 +#endif
475  
476  #ifdef ENABLE_SMB
477         if (ssap == LLCSAP_NETBEUI && dsap == LLCSAP_NETBEUI
478 @@ -322,12 +326,13 @@ llc_print(netdissect_options *ndo, const
479                 return (hdrlen);
480         }
481  #endif
482 +#ifndef TCPDUMP_MINI
483         if (ssap == LLCSAP_ISONS && dsap == LLCSAP_ISONS
484             && control == LLC_UI) {
485                 isoclns_print(ndo, p, length);
486                 return (hdrlen);
487         }
488 -
489 +#endif
490         if (!ndo->ndo_eflag) {
491                 if (ssap == dsap) {
492                         if (src == NULL || dst == NULL)
493 @@ -480,6 +485,7 @@ snap_print(netdissect_options *ndo, cons
494  
495         case OUI_CISCO:
496                  switch (et) {
497 +#ifndef TCPDUMP_MINI
498                  case PID_CISCO_CDP:
499                          cdp_print(ndo, p, length, caplen);
500                          return (1);
501 @@ -492,6 +498,7 @@ snap_print(netdissect_options *ndo, cons
502                  case PID_CISCO_VTP:
503                          vtp_print(ndo, p, length);
504                          return (1);
505 +#endif
506                  case PID_CISCO_PVST:
507                  case PID_CISCO_VLANBRIDGE:
508                          stp_print(ndo, p, length);
509 @@ -504,6 +511,7 @@ snap_print(netdissect_options *ndo, cons
510         case OUI_RFC2684:
511                 switch (et) {
512  
513 +#ifndef TCPDUMP_MINI
514                 case PID_RFC2684_ETH_FCS:
515                 case PID_RFC2684_ETH_NOFCS:
516                         /*
517 @@ -565,6 +573,7 @@ snap_print(netdissect_options *ndo, cons
518                          */
519                         fddi_print(ndo, p, length, caplen);
520                         return (1);
521 +#endif
522  
523                 case PID_RFC2684_BPDU:
524                         stp_print(ndo, p, length);
525 --- a/print-null.c
526 +++ b/print-null.c
527 @@ -116,6 +116,7 @@ null_if_print(netdissect_options *ndo, c
528                 ip6_print(ndo, p, length);
529                 break;
530  
531 +#ifndef TCPDUMP_MINI
532         case BSD_AFNUM_ISO:
533                 isoclns_print(ndo, p, length);
534                 break;
535 @@ -127,6 +128,7 @@ null_if_print(netdissect_options *ndo, c
536         case BSD_AFNUM_IPX:
537                 ipx_print(ndo, p, length);
538                 break;
539 +#endif
540  
541         default:
542                 /* unknown AF_ value */
543 --- a/print-ppp.c
544 +++ b/print-ppp.c
545 @@ -1367,6 +1367,7 @@ trunc:
546         return 0;
547  }
548  
549 +#ifndef TCPDUMP_MINI
550  static void
551  ppp_hdlc(netdissect_options *ndo,
552           const u_char *p, int length)
553 @@ -1445,6 +1446,7 @@ trunc:
554         free(b);
555         ND_PRINT((ndo, "[|ppp]"));
556  }
557 +#endif
558  
559  
560  /* PPP */
561 @@ -1452,10 +1454,12 @@ static void
562  handle_ppp(netdissect_options *ndo,
563             u_int proto, const u_char *p, int length)
564  {
565 +#ifndef TCPDUMP_MINI
566         if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */
567                 ppp_hdlc(ndo, p - 1, length);
568                 return;
569         }
570 +#endif
571  
572         switch (proto) {
573         case PPP_LCP: /* fall through */
574 @@ -1488,6 +1492,7 @@ handle_ppp(netdissect_options *ndo,
575         case PPP_IPV6:
576                 ip6_print(ndo, p, length);
577                 break;
578 +#ifndef TCPDUMP_MINI
579         case ETHERTYPE_IPX:     /*XXX*/
580         case PPP_IPX:
581                 ipx_print(ndo, p, length);
582 @@ -1499,6 +1504,7 @@ handle_ppp(netdissect_options *ndo,
583         case PPP_MPLS_MCAST:
584                 mpls_print(ndo, p, length);
585                 break;
586 +#endif
587         case PPP_COMP:
588                 ND_PRINT((ndo, "compressed PPP data"));
589                 break;
590 @@ -1639,6 +1645,7 @@ ppp_if_print(netdissect_options *ndo,
591         return (0);
592  }
593  
594 +#ifndef TCPDUMP_MINI
595  /*
596   * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like
597   * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547,
598 @@ -1866,6 +1873,7 @@ printx:
599  #endif /* __bsdi__ */
600         return (hdrlength);
601  }
602 +#endif
603  
604  
605  /*
606 --- a/print-sll.c
607 +++ b/print-sll.c
608 @@ -238,12 +238,14 @@ recurse:
609                  */
610                 switch (ether_type) {
611  
612 +#ifndef TCPDUMP_MINI
613                 case LINUX_SLL_P_802_3:
614                         /*
615                          * Ethernet_802.3 IPX frame.
616                          */
617                         ipx_print(ndo, p, length);
618                         break;
619 +#endif
620  
621                 case LINUX_SLL_P_802_2:
622                         /*
623 --- a/print-tcp.c
624 +++ b/print-tcp.c
625 @@ -589,12 +589,14 @@ tcp_print(netdissect_options *ndo,
626                                  ND_PRINT((ndo, " %u", utoval));
627                                  break;
628  
629 +#ifndef TCPDUMP_MINI
630                          case TCPOPT_MPTCP:
631                                  datalen = len - 2;
632                                  LENCHECK(datalen);
633                                  if (!mptcp_print(ndo, cp-2, len, flags))
634                                          goto bad;
635                                  break;
636 +#endif
637  
638                          case TCPOPT_FASTOPEN:
639                                  datalen = len - 2;
640 @@ -670,6 +672,7 @@ tcp_print(netdissect_options *ndo,
641                  return;
642          }
643  
644 +#ifndef TCPDUMP_MINI
645          if (ndo->ndo_packettype) {
646                  switch (ndo->ndo_packettype) {
647                  case PT_ZMTP1:
648 @@ -681,28 +684,36 @@ tcp_print(netdissect_options *ndo,
649                  }
650                  return;
651          }
652 +#endif
653  
654          if (IS_SRC_OR_DST_PORT(TELNET_PORT)) {
655                  telnet_print(ndo, bp, length);
656          } else if (IS_SRC_OR_DST_PORT(SMTP_PORT)) {
657                  ND_PRINT((ndo, ": "));
658                  smtp_print(ndo, bp, length);
659 -        } else if (IS_SRC_OR_DST_PORT(BGP_PORT))
660 +        }
661 +#ifndef TCPDUMP_MINI
662 +        else if (IS_SRC_OR_DST_PORT(BGP_PORT))
663                  bgp_print(ndo, bp, length);
664 +#endif
665          else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
666                  pptp_print(ndo, bp);
667 +#ifndef TCPDUMP_MINI
668          else if (IS_SRC_OR_DST_PORT(REDIS_PORT))
669                  resp_print(ndo, bp, length);
670 +#endif
671  #ifdef ENABLE_SMB
672          else if (IS_SRC_OR_DST_PORT(NETBIOS_SSN_PORT))
673                  nbt_tcp_print(ndo, bp, length);
674         else if (IS_SRC_OR_DST_PORT(SMB_PORT))
675                 smb_tcp_print(ndo, bp, length);
676  #endif
677 +#ifndef TCPDUMP_MINI
678          else if (IS_SRC_OR_DST_PORT(BEEP_PORT))
679                  beep_print(ndo, bp, length);
680          else if (IS_SRC_OR_DST_PORT(OPENFLOW_PORT_OLD) || IS_SRC_OR_DST_PORT(OPENFLOW_PORT_IANA))
681                  openflow_print(ndo, bp, length);
682 +#endif
683          else if (IS_SRC_OR_DST_PORT(FTP_PORT)) {
684                  ND_PRINT((ndo, ": "));
685                  ftp_print(ndo, bp, length);
686 @@ -719,6 +730,7 @@ tcp_print(netdissect_options *ndo,
687                   * XXX packet could be unaligned, it can go strange
688                   */
689                  ns_print(ndo, bp + 2, length - 2, 0);
690 +#ifndef TCPDUMP_MINI
691          } else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) {
692                  msdp_print(ndo, bp, length);
693          } else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) {
694 @@ -726,6 +738,7 @@ tcp_print(netdissect_options *ndo,
695          }
696          else if (length > 0 && (IS_SRC_OR_DST_PORT(LDP_PORT))) {
697                  ldp_print(ndo, bp, length);
698 +#endif
699          }
700          else if ((IS_SRC_OR_DST_PORT(NFS_PORT)) &&
701                   length >= 4 && ND_TTEST2(*bp, 4)) {
702 --- a/print-udp.c
703 +++ b/print-udp.c
704 @@ -430,10 +430,12 @@ udp_print(netdissect_options *ndo, regis
705                         vat_print(ndo, (const void *)(up + 1), up);
706                         break;
707  
708 +#ifndef TCPDUMP_MINI
709                 case PT_WB:
710                         udpipaddr_print(ndo, ip, sport, dport);
711                         wb_print(ndo, (const void *)(up + 1), length);
712                         break;
713 +#endif
714  
715                 case PT_RPC:
716                         rp = (const struct sunrpc_msg *)(up + 1);
717 @@ -462,10 +464,12 @@ udp_print(netdissect_options *ndo, regis
718                         snmp_print(ndo, (const u_char *)(up + 1), length);
719                         break;
720  
721 +#ifndef TCPDUMP_MINI
722                 case PT_CNFP:
723                         udpipaddr_print(ndo, ip, sport, dport);
724                         cnfp_print(ndo, cp);
725                         break;
726 +#endif
727  
728                 case PT_TFTP:
729                         udpipaddr_print(ndo, ip, sport, dport);
730 @@ -483,6 +487,7 @@ udp_print(netdissect_options *ndo, regis
731                         radius_print(ndo, cp, length);
732                         break;
733  
734 +#ifndef TCPDUMP_MINI
735                 case PT_VXLAN:
736                         udpipaddr_print(ndo, ip, sport, dport);
737                         vxlan_print(ndo, (const u_char *)(up + 1), length);
738 @@ -497,6 +502,7 @@ udp_print(netdissect_options *ndo, regis
739                         udpipaddr_print(ndo, ip, sport, dport);
740                         lmp_print(ndo, cp, length);
741                         break;
742 +#endif
743                 }
744                 return;
745         }
746 @@ -574,31 +580,40 @@ udp_print(netdissect_options *ndo, regis
747                         ns_print(ndo, (const u_char *)(up + 1), length, 0);
748                 else if (IS_SRC_OR_DST_PORT(MULTICASTDNS_PORT))
749                         ns_print(ndo, (const u_char *)(up + 1), length, 1);
750 +#ifndef TCPDUMP_MINI
751                 else if (IS_SRC_OR_DST_PORT(TIMED_PORT))
752                         timed_print(ndo, (const u_char *)(up + 1));
753 +#endif
754                 else if (IS_SRC_OR_DST_PORT(TFTP_PORT))
755                         tftp_print(ndo, (const u_char *)(up + 1), length);
756                 else if (IS_SRC_OR_DST_PORT(BOOTPC_PORT) || IS_SRC_OR_DST_PORT(BOOTPS_PORT))
757                         bootp_print(ndo, (const u_char *)(up + 1), length);
758 +#ifndef TCPDUMP_MINI
759                 else if (IS_SRC_OR_DST_PORT(RIP_PORT))
760                         rip_print(ndo, (const u_char *)(up + 1), length);
761 +#endif
762                 else if (IS_SRC_OR_DST_PORT(AODV_PORT))
763                         aodv_print(ndo, (const u_char *)(up + 1), length,
764                             ip6 != NULL);
765 +#ifndef TCPDUMP_MINI
766                 else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT))
767                          isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
768 +
769                 else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_NATT))
770                          isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2);
771  #if 1 /*???*/
772                 else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER1) || IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER2))
773                         isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
774  #endif
775 +#endif
776                 else if (IS_SRC_OR_DST_PORT(SNMP_PORT) || IS_SRC_OR_DST_PORT(SNMPTRAP_PORT))
777                         snmp_print(ndo, (const u_char *)(up + 1), length);
778                 else if (IS_SRC_OR_DST_PORT(NTP_PORT))
779                         ntp_print(ndo, (const u_char *)(up + 1), length);
780 +#ifndef TCPDUMP_MINI
781                 else if (IS_SRC_OR_DST_PORT(KERBEROS_PORT) || IS_SRC_OR_DST_PORT(KERBEROS_SEC_PORT))
782                         krb_print(ndo, (const void *)(up + 1));
783 +#endif
784                 else if (IS_SRC_OR_DST_PORT(L2TP_PORT))
785                         l2tp_print(ndo, (const u_char *)(up + 1), length);
786  #ifdef ENABLE_SMB
787 @@ -609,6 +624,7 @@ udp_print(netdissect_options *ndo, regis
788  #endif
789                 else if (dport == VAT_PORT)
790                         vat_print(ndo, (const void *)(up + 1), up);
791 +#ifndef TCPDUMP_MINI
792                 else if (IS_SRC_OR_DST_PORT(ZEPHYR_SRV_PORT) || IS_SRC_OR_DST_PORT(ZEPHYR_CLT_PORT))
793                         zephyr_print(ndo, (const void *)(up + 1), length);
794                 /*
795 @@ -621,8 +637,11 @@ udp_print(netdissect_options *ndo, regis
796                                  (const u_char *) ip);
797                 else if (IS_SRC_OR_DST_PORT(RIPNG_PORT))
798                         ripng_print(ndo, (const u_char *)(up + 1), length);
799 +#endif
800 +
801                 else if (IS_SRC_OR_DST_PORT(DHCP6_SERV_PORT) || IS_SRC_OR_DST_PORT(DHCP6_CLI_PORT))
802                         dhcp6_print(ndo, (const u_char *)(up + 1), length);
803 +#ifndef TCPDUMP_MINI
804                 else if (IS_SRC_OR_DST_PORT(AHCP_PORT))
805                         ahcp_print(ndo, (const u_char *)(up + 1), length);
806                 else if (IS_SRC_OR_DST_PORT(BABEL_PORT) || IS_SRC_OR_DST_PORT(BABEL_PORT_OLD))
807 @@ -636,6 +655,7 @@ udp_print(netdissect_options *ndo, regis
808                         wb_print(ndo, (const void *)(up + 1), length);
809                 else if (IS_SRC_OR_DST_PORT(CISCO_AUTORP_PORT))
810                         cisco_autorp_print(ndo, (const void *)(up + 1), length);
811 +#endif
812                 else if (IS_SRC_OR_DST_PORT(RADIUS_PORT) ||
813                          IS_SRC_OR_DST_PORT(RADIUS_NEW_PORT) ||
814                          IS_SRC_OR_DST_PORT(RADIUS_ACCOUNTING_PORT) ||
815 @@ -643,15 +663,18 @@ udp_print(netdissect_options *ndo, regis
816                          IS_SRC_OR_DST_PORT(RADIUS_CISCO_COA_PORT) ||
817                          IS_SRC_OR_DST_PORT(RADIUS_COA_PORT) )
818                         radius_print(ndo, (const u_char *)(up+1), length);
819 +#ifndef TCPDUMP_MINI
820                 else if (dport == HSRP_PORT)
821                         hsrp_print(ndo, (const u_char *)(up + 1), length);
822                 else if (IS_SRC_OR_DST_PORT(LWRES_PORT))
823                         lwres_print(ndo, (const u_char *)(up + 1), length);
824                 else if (IS_SRC_OR_DST_PORT(LDP_PORT))
825                         ldp_print(ndo, (const u_char *)(up + 1), length);
826 +#endif
827                 else if (IS_SRC_OR_DST_PORT(OLSR_PORT))
828                         olsr_print(ndo, (const u_char *)(up + 1), length,
829                                         (IP_V(ip) == 6) ? 1 : 0);
830 +#ifndef TCPDUMP_MINI
831                 else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT))
832                         lspping_print(ndo, (const u_char *)(up + 1), length);
833                 else if (dport == BFD_CONTROL_PORT ||
834 @@ -669,10 +692,12 @@ udp_print(netdissect_options *ndo, regis
835                          lwapp_control_print(ndo, (const u_char *)(up + 1), length, 0);
836                  else if (IS_SRC_OR_DST_PORT(LWAPP_DATA_PORT))
837                          lwapp_data_print(ndo, (const u_char *)(up + 1), length);
838 +#endif
839                  else if (IS_SRC_OR_DST_PORT(SIP_PORT))
840                         sip_print(ndo, (const u_char *)(up + 1), length);
841                  else if (IS_SRC_OR_DST_PORT(SYSLOG_PORT))
842                         syslog_print(ndo, (const u_char *)(up + 1), length);
843 +#ifndef TCPDUMP_MINI
844                  else if (IS_SRC_OR_DST_PORT(OTV_PORT))
845                         otv_print(ndo, (const u_char *)(up + 1), length);
846                  else if (IS_SRC_OR_DST_PORT(VXLAN_PORT))
847 @@ -689,7 +714,9 @@ udp_print(netdissect_options *ndo, regis
848                         if (ndo->ndo_vflag)
849                                 ND_PRINT((ndo, "kip "));
850                         llap_print(ndo, cp, length);
851 -               } else {
852 +               }
853 +#endif
854 +               else {
855                         if (ulen > length)
856                                 ND_PRINT((ndo, "UDP, bad length %u > %u",
857                                     ulen, length));