Skip to content

Add autoconf option to enable a stripped down build. #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 4 additions & 144 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,157 +91,15 @@ LIBNETDISSECT_SRC=\
oui.c \
parsenfsfh.c \
print.c \
print-802_11.c \
print-802_15_4.c \
print-ah.c \
print-ahcp.c \
print-aodv.c \
print-aoe.c \
print-ap1394.c \
print-arcnet.c \
print-arp.c \
print-ascii.c \
print-atalk.c \
print-atm.c \
print-babel.c \
print-beep.c \
print-bfd.c \
print-bgp.c \
print-bootp.c \
print-bt.c \
print-calm-fast.c \
print-carp.c \
print-cdp.c \
print-cfm.c \
print-chdlc.c \
print-cip.c \
print-cnfp.c \
print-dccp.c \
print-decnet.c \
print-dhcp6.c \
print-domain.c \
print-dtp.c \
print-dvmrp.c \
print-eap.c \
print-egp.c \
print-eigrp.c \
print-enc.c \
print-esp.c \
print-ether.c \
print-fddi.c \
print-forces.c \
print-fr.c \
print-frag6.c \
print-ftp.c \
print-geneve.c \
print-geonet.c \
print-gre.c \
print-hncp.c \
print-hsrp.c \
print-http.c \
print-icmp.c \
print-icmp6.c \
print-igmp.c \
print-igrp.c \
print-ip.c \
print-ip6.c \
print-ip6opts.c \
print-ipcomp.c \
print-ipfc.c \
print-ipnet.c \
print-ipx.c \
print-isakmp.c \
print-isoclns.c \
print-juniper.c \
print-krb.c \
print-l2tp.c \
print-lane.c \
print-ldp.c \
print-lisp.c \
print-llc.c \
print-lldp.c \
print-lmp.c \
print-loopback.c \
print-lspping.c \
print-lwapp.c \
print-lwres.c \
print-m3ua.c \
print-medsa.c \
print-mobile.c \
print-mobility.c \
print-mpcp.c \
print-mpls.c \
print-mptcp.c \
print-msdp.c \
print-msnlb.c \
print-nflog.c \
print-nfs.c \
print-nsh.c \
print-ntp.c \
print-null.c \
print-olsr.c \
print-openflow-1.0.c \
print-openflow.c \
print-ospf.c \
print-ospf6.c \
print-otv.c \
print-pgm.c \
print-pim.c \
print-pktap.c \
print-ppi.c \
print-ppp.c \
print-pppoe.c \
print-pptp.c \
print-radius.c \
print-raw.c \
print-resp.c \
print-rip.c \
print-ripng.c \
print-rpki-rtr.c \
print-rrcp.c \
print-rsvp.c \
print-rt6.c \
print-rtsp.c \
print-rx.c \
print-sctp.c \
print-sflow.c \
print-sip.c \
print-sl.c \
print-sll.c \
print-slow.c \
print-smtp.c \
print-snmp.c \
print-stp.c \
print-sunatm.c \
print-sunrpc.c \
print-symantec.c \
print-syslog.c \
print-tcp.c \
print-telnet.c \
print-tftp.c \
print-timed.c \
print-tipc.c \
print-token.c \
print-udld.c \
print-udp.c \
print-usb.c \
print-vjc.c \
print-vqp.c \
print-vrrp.c \
print-vtp.c \
print-vxlan.c \
print-vxlan-gpe.c \
print-wb.c \
print-zephyr.c \
print-zeromq.c \
signature.c \
strtoaddr.c \
util-print.c

DISSECTORS = @DISSECTORS@
LOCALSRC = @LOCALSRC@
LIBOBJS = @LIBOBJS@

LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${DISSECTORS:.c=.o} ${LOCALSRC:.c=.o} ${LIBOBJS}
LIBNETDISSECT=libnetdissect.a


Expand Down Expand Up @@ -363,6 +221,8 @@ EXTRA_DIST = \
missing/win_ether_ntohost.h \
mkdep \
packetdat.awk \
pcap_dump_ftell.c \
@ALL_DISSECTORS@ \
print-pflog.c \
print-smb.c \
send-ack.awk \
Expand Down
4 changes: 4 additions & 0 deletions addrtoname.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,10 @@ linkaddr_string(netdissect_options *ndo, const uint8_t *ep,
if (type == LINKADDR_ETHER && len == MAC_ADDR_LEN)
return (etheraddr_string(ndo, ep));

#ifndef ND_MINIMAL
if (type == LINKADDR_FRELAY)
return (q922_string(ndo, ep, len));
#endif

tp = lookup_bytestring(ndo, ep, len);
if (tp->bs_name)
Expand Down Expand Up @@ -1239,6 +1241,7 @@ init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
init_ipxsaparray(ndo);
}

#ifndef ND_MINIMAL
const char *
dnaddr_string(netdissect_options *ndo, u_short dnaddr)
{
Expand All @@ -1258,6 +1261,7 @@ dnaddr_string(netdissect_options *ndo, u_short dnaddr)

return(tp->name);
}
#endif

/* Return a zero'ed hnamemem struct and cuts down on calloc() overhead */
struct hnamemem *
Expand Down
3 changes: 3 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@
/* Define to 1 if netenet/dnetdb.h declares `dnet_htoa' */
#undef NETDNET_DNETDB_H_DECLARES_DNET_HTOA

/* Minimal build */
#undef ND_MINIMAL

/* Define to 1 if netinet/ether.h declares `ether_ntohost' */
#undef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST

Expand Down
44 changes: 44 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ ac_subst_vars='LTLIBOBJS
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
ALL_DISSECTORS
DISSECTORS
ND_MINIMAL
MAN_MISC_INFO
MAN_FILE_FORMATS
LOCALSRC
Expand Down Expand Up @@ -705,6 +708,7 @@ enable_smb
with_user
with_chroot
with_sandbox_capsicum
enable_minimal
with_system_libpcap
with_crypto
with_cap_ng
Expand Down Expand Up @@ -1345,6 +1349,8 @@ Optional Features:
--disable-universal don't build universal on macOS
--enable-smb enable possibly-buggy SMB printer default=yes
--disable-smb disable possibly-buggy SMB printer
--enable-minimal Support printing only common protocols, for a
smaller binary

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Expand Down Expand Up @@ -4456,6 +4462,41 @@ else
$as_echo "no" >&6; }
fi

# Check whether --enable-minimal was given.
if test "${enable_minimal+set}" = set; then :
enableval=$enable_minimal;
cat >>confdefs.h <<_ACEOF
#define ND_MINIMAL $enableval
_ACEOF


fi

for i in `ls print-*.c | grep -v print-smb.c | grep -v print-pflog.c`
do
ALL_DISSECTORS="$i $ALL_DISSECTORS"
done
if test "x$enable_minimal" = xyes; then :

DISSECTORS="\
print-802_11.c print-aodv.c print-arp.c print-ascii.c \
print-bgp.c print-bootp.c print-cdp.c print-domain.c print-eap.c \
print-ether.c print-gre.c print-icmp.c print-igmp.c print-ip.c \
print-ip6.c print-ip6opts.c print-rt6.c print-frag6.c print-icmp6.c \
print-l2tp.c print-lldp.c print-llc.c print-nfs.c print-ntp.c \
print-null.c print-olsr.c print-ospf.c print-ppp.c print-pppoe.c \
print-pptp.c print-radius.c print-raw.c print-rsvp.c print-sctp.c \
print-sip.c print-sll.c print-snmp.c print-stp.c print-sunrpc.c \
print-syslog.c print-tcp.c print-telnet.c print-tftp.c print-udp.c \
print-ipnet.c print-forces.c"

else

DISSECTORS=$ALL_DISSECTORS


fi

#
# We must check this before checking whether to check the OS's IPv6,
# support because, on some platforms (such as SunOS 5.x), the test
Expand Down Expand Up @@ -7743,6 +7784,9 @@ fi






# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
Expand Down
31 changes: 31 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,34 @@ else
AC_MSG_RESULT(no)
fi

AC_ARG_ENABLE(minimal,
AS_HELP_STRING([--enable-minimal], [Support printing only common
protocols, for a smaller binary]),
[AC_DEFINE_UNQUOTED([ND_MINIMAL], [$enableval], [Minimal build])]
)
for i in `ls print-*.c | grep -v print-smb.c | grep -v print-pflog.c`
do
ALL_DISSECTORS="$i $ALL_DISSECTORS"
done
AS_IF([test "x$enable_minimal" = xyes],
[
DISSECTORS="\
print-802_11.c print-aodv.c print-arp.c print-ascii.c \
print-bgp.c print-bootp.c print-cdp.c print-domain.c print-eap.c \
print-ether.c print-gre.c print-icmp.c print-igmp.c print-ip.c \
print-ip6.c print-ip6opts.c print-rt6.c print-frag6.c print-icmp6.c \
print-l2tp.c print-lldp.c print-llc.c print-nfs.c print-ntp.c \
print-null.c print-olsr.c print-ospf.c print-ppp.c print-pppoe.c \
print-pptp.c print-radius.c print-raw.c print-rsvp.c print-sctp.c \
print-sip.c print-sll.c print-snmp.c print-stp.c print-sunrpc.c \
print-syslog.c print-tcp.c print-telnet.c print-tftp.c print-udp.c \
print-ipnet.c print-forces.c"
],
[
DISSECTORS=$ALL_DISSECTORS
]
)

#
# We must check this before checking whether to check the OS's IPv6,
# support because, on some platforms (such as SunOS 5.x), the test
Expand Down Expand Up @@ -1007,6 +1035,9 @@ AC_SUBST(V_PCAPDEP)
AC_SUBST(LOCALSRC)
AC_SUBST(MAN_FILE_FORMATS)
AC_SUBST(MAN_MISC_INFO)
AC_SUBST(ND_MINIMAL)
AC_SUBST(DISSECTORS)
AC_SUBST(ALL_DISSECTORS)

AC_PROG_INSTALL

Expand Down
8 changes: 8 additions & 0 deletions print-ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ ethertype_print(netdissect_options *ndo,
arp_print(ndo, p, length, caplen);
return (1);

#ifndef ND_MINIMAL
case ETHERTYPE_DN:
decnet_print(ndo, p, length, caplen);
return (1);
Expand All @@ -388,6 +389,7 @@ ethertype_print(netdissect_options *ndo,
}
isoclns_print(ndo, p + 1, length - 1);
return(1);
#endif

case ETHERTYPE_PPPOED:
case ETHERTYPE_PPPOES:
Expand All @@ -400,9 +402,11 @@ ethertype_print(netdissect_options *ndo,
eap_print(ndo, p, length);
return (1);

#ifndef ND_MINIMAL
case ETHERTYPE_RRCP:
rrcp_print(ndo, p, length, src, dst);
return (1);
#endif

case ETHERTYPE_PPP:
if (length) {
Expand All @@ -411,6 +415,7 @@ ethertype_print(netdissect_options *ndo,
}
return (1);

#ifndef ND_MINIMAL
case ETHERTYPE_MPCP:
mpcp_print(ndo, p, length);
return (1);
Expand All @@ -423,11 +428,13 @@ ethertype_print(netdissect_options *ndo,
case ETHERTYPE_CFM_OLD:
cfm_print(ndo, p, length);
return (1);
#endif

case ETHERTYPE_LLDP:
lldp_print(ndo, p, length);
return (1);

#ifndef ND_MINIMAL
case ETHERTYPE_NSH:
nsh_print(ndo, p, length);
return (1);
Expand Down Expand Up @@ -465,6 +472,7 @@ ethertype_print(netdissect_options *ndo,
case ETHERTYPE_MEDSA:
medsa_print(ndo, p, length, caplen, src, dst);
return (1);
#endif

case ETHERTYPE_LAT:
case ETHERTYPE_SCA:
Expand Down
Loading