1
0

100-tcpdump_mini.patch 24 KB

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