tcpdump: reduce size of -mini by removing more infrequently used protocols

This removes:
- BGP
- CDP
- SCTP

MIPS binary .ipk size is reduced from ~150k to ~130k

Signed-off-by: Felix Fietkau <nbd@nbd.name>
v19.07.3_mercusys_ac12_duma
Felix Fietkau 8 years ago
parent a4a00d794f
commit b9ddf3098b

@ -1,6 +1,6 @@
--- a/Makefile.in --- a/Makefile.in
+++ b/Makefile.in +++ b/Makefile.in
@@ -70,6 +70,87 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ @@ -70,6 +70,82 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
@rm -f $@ @rm -f $@
$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
@ -30,15 +30,12 @@
+ print-aodv.c \ + print-aodv.c \
+ print-arp.c \ + print-arp.c \
+ print-ascii.c \ + print-ascii.c \
+ print-bgp.c \
+ print-bootp.c \ + print-bootp.c \
+ print-cdp.c \
+ print-dhcp6.c \ + print-dhcp6.c \
+ print-domain.c \ + print-domain.c \
+ print-eap.c \ + print-eap.c \
+ print-ether.c \ + print-ether.c \
+ print-ftp.c \ + print-ftp.c \
+ print-forces.c \
+ print-gre.c \ + print-gre.c \
+ print-http.c \ + print-http.c \
+ print-icmp.c \ + print-icmp.c \
@ -52,7 +49,6 @@
+ print-llc.c \ + print-llc.c \
+ print-lldp.c \ + print-lldp.c \
+ print-loopback.c \ + print-loopback.c \
+ print-m3ua.c \
+ print-nfs.c \ + print-nfs.c \
+ print-ntp.c \ + print-ntp.c \
+ print-null.c \ + print-null.c \
@ -67,7 +63,6 @@
+ print-rsvp.c \ + print-rsvp.c \
+ print-rt6.c \ + print-rt6.c \
+ print-rtsp.c \ + print-rtsp.c \
+ print-sctp.c \
+ print-sip.c \ + print-sip.c \
+ print-sll.c \ + print-sll.c \
+ print-smtp.c \ + print-smtp.c \
@ -88,7 +83,7 @@
CSRC = setsignal.c tcpdump.c util.c CSRC = setsignal.c tcpdump.c util.c
LIBNETDISSECT_SRC=\ LIBNETDISSECT_SRC=\
@@ -236,12 +317,16 @@ LIBNETDISSECT_SRC=\ @@ -236,12 +312,16 @@ LIBNETDISSECT_SRC=\
strtoaddr.c \ strtoaddr.c \
util-print.c util-print.c
@ -105,7 +100,7 @@
SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC) SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
@@ -367,10 +452,12 @@ $(PROG): $(OBJ) @V_PCAPDEP@ @@ -367,10 +447,12 @@ $(PROG): $(OBJ) @V_PCAPDEP@
@rm -f $@ @rm -f $@
$(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
@ -348,7 +343,7 @@
case IPPROTO_FRAGMENT: case IPPROTO_FRAGMENT:
advance = frag6_print(ndo, cp, (const u_char *)ip6); advance = frag6_print(ndo, cp, (const u_char *)ip6);
if (ndo->ndo_snapend <= cp + advance) if (ndo->ndo_snapend <= cp + advance)
@@ -318,6 +319,7 @@ ip6_print(netdissect_options *ndo, const @@ -318,16 +319,19 @@ ip6_print(netdissect_options *ndo, const
advance = mobility_print(ndo, cp, (const u_char *)ip6); advance = mobility_print(ndo, cp, (const u_char *)ip6);
nh = *cp; nh = *cp;
return; return;
@ -356,11 +351,11 @@
case IPPROTO_ROUTING: case IPPROTO_ROUTING:
advance = rt6_print(ndo, cp, (const u_char *)ip6); advance = rt6_print(ndo, cp, (const u_char *)ip6);
nh = *cp; nh = *cp;
@@ -325,9 +327,11 @@ ip6_print(netdissect_options *ndo, const break;
+#ifndef TCPDUMP_MINI
case IPPROTO_SCTP: case IPPROTO_SCTP:
sctp_print(ndo, cp, (const u_char *)ip6, len); sctp_print(ndo, cp, (const u_char *)ip6, len);
return; return;
+#ifndef TCPDUMP_MINI
case IPPROTO_DCCP: case IPPROTO_DCCP:
dccp_print(ndo, cp, (const u_char *)ip6, len); dccp_print(ndo, cp, (const u_char *)ip6, len);
return; return;
@ -406,17 +401,17 @@
case IPPROTO_AH: case IPPROTO_AH:
ipds->nh = *ipds->cp; ipds->nh = *ipds->cp;
ipds->advance = ah_print(ndo, ipds->cp); ipds->advance = ah_print(ndo, ipds->cp);
@@ -361,14 +362,17 @@ again: @@ -361,7 +362,9 @@ again:
ipds->nh = enh & 0xff; ipds->nh = enh & 0xff;
goto again; goto again;
} }
+#endif +#endif
+#ifndef TCPDUMP_MINI
case IPPROTO_SCTP: case IPPROTO_SCTP:
sctp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len); sctp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
break; break;
@@ -369,6 +372,7 @@ again:
+#ifndef TCPDUMP_MINI
case IPPROTO_DCCP: case IPPROTO_DCCP:
dccp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len); dccp_print(ndo, ipds->cp, (const u_char *)ipds->ip, ipds->len);
break; break;
@ -514,14 +509,14 @@
if (!ndo->ndo_eflag) { if (!ndo->ndo_eflag) {
if (ssap == dsap) { if (ssap == dsap) {
@@ -461,6 +467,7 @@ snap_print(netdissect_options *ndo, cons @@ -458,6 +464,7 @@ snap_print(netdissect_options *ndo, cons
case OUI_CISCO:
switch (et) {
+#ifndef TCPDUMP_MINI
case PID_CISCO_CDP: case PID_CISCO_CDP:
cdp_print(ndo, p, length, caplen); cdp_print(ndo, p, length, caplen);
return (1); return (1);
+#ifndef TCPDUMP_MINI
case PID_CISCO_DTP:
dtp_print(ndo, p, length);
return (1);
@@ -470,6 +477,7 @@ snap_print(netdissect_options *ndo, cons @@ -470,6 +477,7 @@ snap_print(netdissect_options *ndo, cons
case PID_CISCO_VTP: case PID_CISCO_VTP:
vtp_print(ndo, p, length); vtp_print(ndo, p, length);
@ -669,7 +664,7 @@
if (ndo->ndo_packettype) { if (ndo->ndo_packettype) {
switch (ndo->ndo_packettype) { switch (ndo->ndo_packettype) {
case PT_ZMTP1: case PT_ZMTP1:
@@ -656,6 +659,7 @@ tcp_print(netdissect_options *ndo, @@ -656,28 +659,36 @@ tcp_print(netdissect_options *ndo,
} }
return; return;
} }
@ -677,8 +672,15 @@
if (IS_SRC_OR_DST_PORT(TELNET_PORT)) { if (IS_SRC_OR_DST_PORT(TELNET_PORT)) {
telnet_print(ndo, bp, length); telnet_print(ndo, bp, length);
@@ -666,18 +670,22 @@ tcp_print(netdissect_options *ndo, } else if (IS_SRC_OR_DST_PORT(SMTP_PORT)) {
ND_PRINT((ndo, ": "));
smtp_print(ndo, bp, length);
- } else if (IS_SRC_OR_DST_PORT(BGP_PORT))
+ }
+#ifndef TCPDUMP_MINI
+ else if (IS_SRC_OR_DST_PORT(BGP_PORT))
bgp_print(ndo, bp, length); bgp_print(ndo, bp, length);
+#endif
else if (IS_SRC_OR_DST_PORT(PPTP_PORT)) else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
pptp_print(ndo, bp); pptp_print(ndo, bp);
+#ifndef TCPDUMP_MINI +#ifndef TCPDUMP_MINI
@ -700,7 +702,7 @@
else if (IS_SRC_OR_DST_PORT(FTP_PORT)) { else if (IS_SRC_OR_DST_PORT(FTP_PORT)) {
ND_PRINT((ndo, ": ")); ND_PRINT((ndo, ": "));
ftp_print(ndo, bp, length); ftp_print(ndo, bp, length);
@@ -694,6 +702,7 @@ tcp_print(netdissect_options *ndo, @@ -694,6 +705,7 @@ tcp_print(netdissect_options *ndo,
* XXX packet could be unaligned, it can go strange * XXX packet could be unaligned, it can go strange
*/ */
ns_print(ndo, bp + 2, length - 2, 0); ns_print(ndo, bp + 2, length - 2, 0);
@ -708,7 +710,7 @@
} else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) { } else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) {
msdp_print(ndo, bp, length); msdp_print(ndo, bp, length);
} else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) { } else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) {
@@ -701,6 +710,7 @@ tcp_print(netdissect_options *ndo, @@ -701,6 +713,7 @@ tcp_print(netdissect_options *ndo,
} }
else if (length > 0 && (IS_SRC_OR_DST_PORT(LDP_PORT))) { else if (length > 0 && (IS_SRC_OR_DST_PORT(LDP_PORT))) {
ldp_print(ndo, bp, length); ldp_print(ndo, bp, length);

Loading…
Cancel
Save