Age | Commit message (Collapse) | Author | Files | Lines |
|
Disable all optimizations with the GCC -O0 switch. Only explicitely
enable additional optimization options for non-debug builds.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Ensure a stable link order independent of the configured locale in order
to make the build reproducible.
Patch from Reiner Herrmann, submitted via the Debian Bug Tracker
(#806547).
Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806547
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Otherwise we clutter the build log with warnings such as:
tput: No value for $TERM and no -T specified
on head-less CI/build systems (e.g. Debian's buildd).
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Except for some minor saving in disk space, stripping the binaries
doesn't bring any benefits and it might prevent us from getting usable
debugging information even from binaries build with DEBUG not set. Most
distributions will strip the binaries as part of their packaging process
anyhow.
If someone really wants stripped binaries as a result of the netsniff-ng
build, they could still add '-s' to CFLAGS or call strip manually.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Ever since we switched to the hand-crafted ./configure script, support
for cross-compiling the netsniff-ng toolkit was basically broken.
Restore the abaility to cross-compile our tools by making ./configure
consider the CROSS_COMPILE and SYSROOT variables.
Example for cross-compiling on arm:
$ CROSS_COMPILE=arm-linux-gnueabihf- \
SYSROOT=/usr/arm-linux-gnueabihf \
./configure
$ make
assuming the cross-compiled libraries (and their respective pkg-config
information) are in /usr/arm-linux-gnueabihf.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In order to be able to set the (sort of) standard command variables CC,
LD etc. from configure via Config, rename the silent LD command variable
to LDQ, in accordance with the existing CCQ.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Currently, when building with DISTRO=0 we optimize for the build host's
architecture by default. This is not compatible with cross-compiling.
Remove the DISTRO flag and only build with -O2 and no -march/-mtune
flags by default.
Support for specifying optimization flags via configure script will be
added in a follow-up patch.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tillmann Karras <tilkax@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Using ccache by default for compilation if it is available on the system
might confuse people and in rare cases also lead to unexpected results.
Thus, from now on the use of ccache for compilation has to explicitely
specified by setting the CCACHE make variable to the name/path of the
ccache binary, i.e. `make CCACHE=ccache'
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Don't reset the variable CC in the Makefile, but set it to gcc by
default (can be overriden when e.g. compiling with `make CC=clang').
This way we can also have non-verbose compiles with compilers other than
gcc. Furthermore make sure that the CC variable is also respected for
LD.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Create a make variable $(COMPILER) which is set to either `gcc' or
`clang' depending on the compiler used. Use this variable to filter out
command line options not supported by clang (for now only
-fno-delete-null-pointer-checks).
Compiler detection snippet extracted from the Linux kernel Makefile.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Similar to the 'make C=1' for the Linux kernel, wire up the sparse
command for our build system in a similar fashion. Use 'make C=1 [tool]'
to check the source files using sparse. Of course, the sparse tool needs
to be installed and available in your $PATH for this to work.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This will fix issue of installation of configuration files to
/usr/local/etc (or /usr/etc for distribution builds) instead of /etc.
[tklauser: extended description a bit]
Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Currently, the path to the configuration files is hardcoded to
$PREFIX/etc/netsniff-ng.
If we want to keep the configuration files outside of prefix (e.g.
during development), we need to pass the complete path as specified in
$ETCDIRE (and $ETCDIR respectively, which could e.g. be overriden on the
command line during build install) as a preprocessor define.
This way, we can e.g. install the configuration files to /etc while
installing the binaries in /usr/local with:
$ make PREFIX=/usr/local ETCDIR=/etc
$ make PREFIX=/usr/local ETCDIR=/etc install
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This change fixes the use of PREFIX by not hard wiring /usr into the path.
Besides that if no PREFIX is provided by the user, it is set to /usr/local now
which is considered to be the right location for most LSB conforming distros if
the user is compiling from sources to not interfere with the package management
for binary packages which are build using /usr as prefix in most of the cases.
current behavior without setting PREFIX will most likely interfere
with most distro package managers when building from source:
------------------------------------------------------------------------
$ sudo make uninstall
RM /usr/sbin/netsniff-ng
RM /usr/share/man/man8/netsniff-ng.8.gz
RM /usr/sbin/trafgen
RM /usr/share/man/man8/trafgen.8.gz
RM /usr/sbin/astraceroute
RM /usr/share/man/man8/astraceroute.8.gz
RM /usr/sbin/ifpps
RM /usr/share/man/man8/ifpps.8.gz
RM /usr/sbin/bpfc
RM /usr/share/man/man8/bpfc.8.gz
RM /usr/sbin/curvetun
RM /usr/share/man/man8/curvetun.8.gz
------------------------------------------------------------------------
current behavior when setting PREFIX=/usr/local looks kind of weird
because of the hard wired /usr:
------------------------------------------------------------------------
$ sudo make PREFIX=/usr/local uninstall
RM /usr/local/usr/sbin/netsniff-ng
RM /usr/local/usr/share/man/man8/netsniff-ng.8.gz
RM /usr/local/usr/sbin/trafgen
RM /usr/local/usr/share/man/man8/trafgen.8.gz
RM /usr/local/usr/sbin/astraceroute
RM /usr/local/usr/share/man/man8/astraceroute.8.gz
RM /usr/local/usr/sbin/ifpps
RM /usr/local/usr/share/man/man8/ifpps.8.gz
RM /usr/local/usr/sbin/bpfc
RM /usr/local/usr/share/man/man8/bpfc.8.gz
RM /usr/local/usr/sbin/curvetun
RM /usr/local/usr/share/man/man8/curvetun.8.gz
------------------------------------------------------------------------
using the proposed fix without setting PREFIX:
------------------------------------------------------------------------
$ sudo make uninstall
RM /usr/local/sbin/netsniff-ng
RM /usr/local/share/man/man8/netsniff-ng.8.gz
RM /usr/local/sbin/trafgen
RM /usr/local/share/man/man8/trafgen.8.gz
RM /usr/local/sbin/astraceroute
RM /usr/local/share/man/man8/astraceroute.8.gz
RM /usr/local/sbin/ifpps
RM /usr/local/share/man/man8/ifpps.8.gz
RM /usr/local/sbin/bpfc
RM /usr/local/share/man/man8/bpfc.8.gz
RM /usr/local/sbin/curvetun
RM /usr/local/share/man/man8/curvetun.8.gz
------------------------------------------------------------------------
Signed-off-by: Christian Wiese <chris@opensde.org>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This change implements support for specifying an alternative
installation destination directory by setting DESTDIR when
calling 'make install'.
Example: make DESTDIR=/alternative-rootfs install
It is particularly useful when cross-compiling and installing
in a dedicated directory where for example the rootfs or a
build sandbox for the target architecture is mounted.
By using DESTDIR you can avoid to mess with PREFIX to include
the alternative installation directory!
Signed-off-by: Christian Wiese <chris@opensde.org>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a Makefile target to build and upload a snapshot of netsniff-ng to
the Coverity scanner. The variables COV_EMAIL and COV_PASSWD need to be
set accordingly:
make coverity COV_EMAIL=tklauser@distanz.ch COV_PASSWD=...
Currently the sub-make which is part of the cov-built call issues
warnings about undefined variables from the template. This can be
ignored, the build works just fine.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a -U_FORTIFY_SOURCE in HARDENING=1 [1] to prevent [2], e.g. as in:
x86_64-pc-linux-gnu-gcc -march=native -O2 -pipe -std=gnu99 -pipe -fPIE
-pie -Wl,-z,relro,-z,now -fstack-protector-all -Wstack-protector
--param=ssp-buffer-size=4 -ftrapv -D_FORTIFY_SOURCE=2 -fexceptions
-fomit-frame-pointer -fno-strict-aliasing -fasynchronous-unwind-tables
-fno-delete-null-pointer-checks -D_REENTRANT -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION_STRING=\""0.5.8-rc2"""\"
-DVERSION_LONG=\""0.5.8-rc2"" (Ziggomatic)"\" -DPREFIX_STRING=\"\"
-Wall -I. -I/usr/include/libnl3 -I/usr/include/libnl3
-DHAVE_DISSECTOR_PROTOS -DNEED_TCPDUMP_LIKE_FILTER -I/usr/include/libnl3
-I/usr/include/libnl3 -DHAVE_DISSECTOR_PROTOS -DNEED_TCPDUMP_LIKE_FILTER
-o netsniff-ng/proto_igmp.o -c proto_igmp.c
:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
proto_igmp.c:1:0: note: this is the location of the previous definition
[1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-analyzer/netsniff-ng/files/netsniff-ng-0.5.8-fortify_source.patch?revision=1.1&view=markup
[2] http://b-4.xmw.de/var/log/portage/build/net-analyzer/netsniff-ng-0.5.8_rc2:20130805-070734.log
Reported-by: Michael Weber <michael@xmw.de>
Suggested-by: Michael Weber <michael@xmw.de>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Currently, when doing a custom "make CFLAGS=...", we run into a compile
error as several necessary defines are not set. Therefore, use override
to always set those.
Reported-by: Marco Belmonte <mbelmonte@globalmedia.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Improve the build system, so that configuration files are installed
per tool basis. Also, introduce post_install targets, so that config
files can be altered in some way, e.g. done by trafgen. Moreover,
move custom targets from Extra to tool-specific Makefiles.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Several of the tools install/uninstall files from $NCONF_FILES,
however if we call the uninstall target for a specific tool (e.g. `make
astraceroute_uninstall') but other tools depending on one or more of the
config files are still installed, the file is still removed
unconditionally. As it would require quite some logic in the Makefile
in order to detect installed tools and their dependencies, we just don't
uninstall the configuration files anymore.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
We have recently changed VERSION_STRING to append CONFIG_RC at the
end of the string. Thus, for the build system, change it to
VERSION_SHORT where needed, e.g. in release targets where the "+"
appendix is not wished.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Just a minor whitespace alignment, nothing else.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
For each build that has no tag name (thus for all commits except
releases), we add a "+" version appendix to indicate that it is
further than the rc tag itself, like in the kernel. Do this during
configure automatically. This is useful in case someone wants to
package a relase, so that the full version name indicates that.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Split the build system into smaller manageable pieces, grouped by
context. In that sense, we can keep the most important information
within the Makefile itself, and group out misc bits and pieces that
we just include into it. E.g. 'Cmds' contains all defined commands
that we call from other locations, 'Template' contains the generic
build template for all tools, 'Extra' has pieces that need special
treatment for the tools to build and 'Misc' contains help and release
code. This makes it more manageable on the long run. While at it, I
also simplified some code and removed all Wflags expect "-Wall" as
we want to convert into "-Wall -Wextra -W" anyway.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Lets just move it instead of symlink as there is no concrete need
for it.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This silences a complaint if the toolkit is not built within a Git
repository:
...
[*] Checking libnet ... [YES]
fatal: Not a git repository (or any of the parent directories): .git
[*] Generating config.h ...
[*] Looks good! All tools will be built!
This is not problematic as the build can be done without any problems.
It will just have an empty Git id in --version output. So simply
silence this complaint and move on.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Place a newline after GIT_PEOPLE in the mail announcement target.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Use git describe --always in the Makefile instead of git describe
as it can fail otherwise.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
If pkg-config doesn't find a library it prints an error to stderr.
Instead of directly printing them as part of the configure output,
redirect them to config.log and let the user know about it in case there
are any messages.
Suggested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
To get the normal Makefile a bit cleaner, push the tool specific
build options into <tool>/Makefile.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
As curvetun needs to undergo some major cleanups, we exclude it from
the main build process for the moment until we have fixed all of it
in a non-rc release.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
In some part of the help text, we speak about <toolnames> in some
other <toolname>. Lets consolidate this to <tool> to avoid any
possible confusion.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This patch is a bundle of multiple fixes.
1) Fix compilation of astraceroute when HAVE_LIBPCAP=1:
astraceroute doesn't need libpcap, so add an additional
guard/define to bpf.h and bpf_comp.c and netsniff-ng.c.
Also since we generate a config.h file, we do not need
to have this additional compile flag anymore.
2) Fix tstamping.{h,c} to use the configure script instead
of the Makefile. For doing this, also fix the object
inclusion in netsniff-ng/Makefile.
Last but not least, rename __WITH_... into HAVE_... as this
is more clean.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
While we're at it, also let configure script generate the config.h
file. The generation of it is currently quite static, but that could
change in future. While at it, we also generate a GITVERSION define,
that we will use for ``--version'' output of the individual tools for
being able to provide better support since we can see what concrete
commit people are using when building from Git repo.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
netsniff-ng uses libpcap only for high-level filter compiling.
Thus, let netsniff-ng not "hard-depend" on libpcap, but rather
disable filter compiling in case the user does not want to
install libpcap.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|