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