1
0

100-tcpdump_mini.patch 24 KB

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