summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-04-28netsniff-ng: Remove locally declared labelsTobias Klauser1-13/+4
These usually only make sense for complex macros which are expanded moree than once. The label for `out' doesn't make sense anyhow as it is declared on function level. Also don't indent the labels, so they're clearer to spot. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-27trafgen: performance regression at 10G due to smaller ring buffer sizeJesper Dangaard Brouer1-1/+1
commit c10621e ("trafgen: keep a small initial ring buffer size to reduce cache-misses") reduced default ring buffer size to 196KiB, but on my big machines with 10Gbit/s this size is too small. Increase default ring-size to 512 KiB, yield the best results, without increasing ring buffer size too much, this fixes #120. Single CPU results from my E5-2630 CPU with intel ixgbe/82599. (Cmd: trafgen --cpp --dev eth8 --conf udp_example01.trafgen --cpu 1) * 769,440 pkts/sec -- default ring-size 196 KiB * 1,417,908 pkts/sec -- ring-size 500 KiB Going above CPUs L3 cache size which is (15Mb) * 1,236,580 pkts/sec -- ring-size 20000KiB The mmap'ed ring buffer is now faster than using sendto(). For comparison, not using the ring-buffer, by using option "-t0": * 1,381,364 (with qdisc bypass) And using the qdisc code path in the kernel (enable via parameter "--qdisc-path") * 1,227,772 pkts/sec (with --qdisc-path) Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2014-04-27build: Also use proper previous tag for people listTobias Klauser1-2/+3
Follow up for commit 311d4376 ("build: Make sure we get the correct previous tag for the changelog"). Move getting the previous tag into an own command and use it where appropriate. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-27conf: oui: update oui.confTobias Klauser1-15/+147
Update oui.conf using oui-update.py Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-27build: Make sure we get the correct previous tag for the changelogTobias Klauser1-1/+1
When going from an -rc release to a stable release (e.g. v0.5.8 ;-) the generated shortlog will not be generated from the latest -rc tag but from the second to last due to the sort order of the tag list: 0.5.5 0.5.6 0.5.7 v0.5.8 <-- newest tag v0.5.8-rc1 v0.5.8-rc2 v0.5.8-rc3 v0.5.8-rc4 v0.5.8-rc5 <-- second newest tag Thus use 'git describe' to get the proper previous tag. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-25ifpps: Fix coding styleTobias Klauser1-4/+6
Fix spacing and move a pointer increment out of the for loop initializer. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-25ifpps: fix matching wrong interface/deviceJesper Dangaard Brouer1-1/+7
There were a bug in ifpps, that would match the first occurance of a device/interface name in /proc/net/dev, because it located the device based on a substring. If the device name were starting with the same characters, e.g. having a device named eth4 and a VLAN device named eth4.100. If specifying --dev eth4, then depending on the order of /proc/net/dev the wrong device could be choosen for stats. (Note kernel does not guarantee the order of devices in proc file) Fix the bug, by matching with a colon ':' appended to the device name, as the kernel proc format prints a ':' behind the device name. Fixes #119 Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2014-04-22doc: AUTHORS: Add Oliver Smith to contributorsTobias Klauser1-0/+1
Oliver contributed a patch to astraceroute back in August 2013, but he was never properly credited in AUTHORS. Do that now. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-22conf: Use configuration file path from Makefile instead of hardcoded pathsTobias Klauser7-17/+16
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>
2014-04-22bpf: Remove unncessary #include <xmalloc.h> from bpf.hTobias Klauser1-1/+1
Only die.h is needed in the header for panic(). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-22built_in: Remove unnecessary #include <built_in.h> from several headersTobias Klauser4-5/+0
These are not needed in the headers themselves and are pulled in in the .c file where necessary. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-22man: astraceroute: Fix closing quotation markTobias Klauser1-1/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-14dissector: Get rid of header dependency on pcap_io.hTobias Klauser4-24/+35
The dissector only needs the LINKTYPE_* #defines from pcap_io.h. Instead of pulling in this rather large header just for this, move the LINKTYPE_* #defines to an own header and include it where needed. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-04-12built_in: changed RUNTIME_PAGE_SIZE to use sysconf(_SC_PAGE_SIZE) instead of ↵Christian Wiese1-1/+1
getpagesize() getpagesize(2) is considered legacy and has been dropped with POSIX.1-2001. See discussion: https://github.com/netsniff-ng/netsniff-ng/pull/112 Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-12built_in: changed to use RUNTIME_PAGE_SIZE instead of PAGE_SIZEChristian Wiese8-15/+13
References: https://github.com/netsniff-ng/netsniff-ng/commit/453f6eb9d79dd5aa2812ef956b22723f0a493086 https://github.com/netsniff-ng/netsniff-ng/pull/112 Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-12build: fixed PREFIX usageChristian Wiese1-4/+4
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>
2014-04-11doc: add Christian to AUTHORS fileDaniel Borkmann1-0/+1
For Christian Wiese's contributions, add him to AUTHORS. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-11doc: curvetun: add documentation how to use libsodium instead of libnaclChristian Wiese1-1/+19
Add information to INSTALL on how to build with libsodium. Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-11build: curvetun: add NACL_LIB variable to configure to be able to set an ↵Christian Wiese2-1/+6
alternative lib This way one can simply set an alternative lib like libsodium for linking the curvetun binary. The current default linking against libnacl is preserved! To link curvetun against libsodium you can set NACL_LIB=sodium Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-11built_in: changed to not unconditionally define PAGE_SIZEChristian Wiese1-1/+3
When building against musl libc I encountered following issue: --------------------------------------------------------------------------- In file included from xmalloc.h:6:0, from xmalloc.c:17: built_in.h:181:0: warning: "PAGE_SIZE" redefined [enabled by default] In file included from /usr/include/limits.h:8:0 --------------------------------------------------------------------------- According to the POSIX standard PAGE_SIZE should be defined in <limits.h> [1] which is the case with musl libc if for example _GNU_SOURCE or _BSD_SOURCE are defined which both is the case in netsniff-ng sources. On my i686 test build the interesting part of <bits/limits.h> which itself gets included by <limits.h> looks like this: --------------------------------------------------------------------------- #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define PAGE_SIZE 4096 #define LONG_BIT 64 #endif --------------------------------------------------------------------------- Note: Besides that I noticed that currently getpagesize(2) is used, which is considered legacy and has been dropped with POSIX.1-2001 [2]. According to getpagesize(2) [2] portable applications should use sysconf(3) [3] By using getpagesize(2) unconditionally the intention was maybe to always use the run time configuration value of PAGE_SIZE as returned by the kernel. At least in the case of musl libc and applying this change this would not be the case anymore as the static PAGE_SIZE value from the header would be used! References: [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html [2] http://man7.org/linux/man-pages/man2/getpagesize.2.html [3] http://man7.org/linux/man-pages/man3/sysconf.3.html Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10doc: fix make help for CROSS_COMPILE optionChristian Wiese1-1/+1
One doesn't need to specify a path for the CROSS_COMPILE option but a prefix identifying the target architecture. Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10doc: add documentation of DESTDIR usage in INSTALL and make helpChristian Wiese2-0/+9
Document the newly introduced DESTDIR option. Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10poll: changed to include <poll.h> instead of <sys/poll.h>Christian Wiese3-3/+2
This is a very cosmetic change but I think it is good to be standards compliant. The standard defines <poll.h> and not <sys/poll.h>: http://pubs.opengroup.org/onlinepubs/009696799/basedefs/poll.h.html When building against musl libc it silences some annoying cpp warnings like this: ----------------------------------------------------------------------- warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp] ----------------------------------------------------------------------- Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10docs: be more precise on readme with experimental toolsDaniel Borkmann1-5/+6
Just improve the note on tools that are still experimental. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10built_in: improved to define DEFFILEMODE if not provided by the libcChristian Wiese1-0/+4
musl libc doesn't provide the non-standard macros for common mode bit masks, which other libc implementations like glibc define in <sys/stat.h>. Compile time error when building against musl libc: -------------------------------------------------------------------------- netsniff-ng.c: In function 'read_pcap': netsniff-ng.c:592:33: error: 'DEFFILEMODE' undeclared (first use in this function) -------------------------------------------------------------------------- This change improves built_in.h to check if DEFFILEMODE is defined and if not it defines it to be available internally. Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10build: add DESTDIR supportChristian Wiese3-6/+10
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>
2014-04-10link: fixed to include <sys/types.h> for caddr_tChristian Wiese1-0/+1
When building against musl libc compiling bails out because of caddr_t not being declared: -------------------------------------------------------------------------- link.c: In function 'wireless_sigqual': link.c:41:24: error: 'caddr_t' undeclared (first use in this function) -------------------------------------------------------------------------- As caddr_t is declared in <sys/types.h> this header needs to be included. Signed-off-by: Christian Wiese <chris@opensde.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-10dissector: display packet direction for tap'ing on netlink devices (nlmon)Daniel Borkmann2-6/+16
Linux kernel provides nlmon device (ARPHRD_NETLINK) driver that can tap on netlink traffic, e.g.: Setup: modprobe nlmon ip link add type nlmon ip link set nlmon0 up Capture: netsniff-ng -i nlmon0 ... (or -i any) Teardown: ip link set nlmon0 down ip link del dev nlmon0 rmmod nlmon Provide information about the packet direction (user space or kernel space), so that dissector will show that properly. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-04-07pcap_io: fill sll when reading pcapDaniel Borkmann2-3/+26
When reading from a pcap in Kuznetsov/netsniff-ng format, we currently do not fill out sll. Do so so that users can see pkttype and the interface. Reported-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-03-26trafgen: keep a small initial ring buffer size to reduce cache-missesDaniel Borkmann1-0/+3
Heavily reduce the initial ring buffer size for trafgen to just 196KiB, so that we can heavily reduce the number of cache-misses related to cache references. People can still overwrite this setting later on via command line option for their specific architecture if they wish. Perhaps the RX_RING should be checked as well in netsniff-ng though the use case there is slightly different. Before: Performance counter stats for 'trafgen -i blub -o dummy0 -n100000000': 137,765,493,346 instructions:k # 0.82 insns per cycle 167,438,826,578 cycles:k # 0.000 GHz 59,508,315 branch-misses:k 361 context-switches:k 6 cpu-migrations:k 134,751,541 cache-misses:k # 85.019 % of all cache refs 158,495,358 cache-references:k 755 kmem:kmem_cache_alloc 15.139458202 seconds time elapsed After: Performance counter stats for 'trafgen -i blub -o dummy0 -n100000000': 137,889,782,650 instructions:k # 0.92 insns per cycle 150,239,185,971 cycles:k # 0.000 GHz 71,583,573 branch-misses:k 423 context-switches:k 7 cpu-migrations:k 60,239 cache-misses:k # 0.073 % of all cache refs 82,502,468 cache-references:k 740 kmem:kmem_cache_alloc 12.028787964 seconds time elapsed Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-03-26trafgen: remove timer-based trigger modelDaniel Borkmann1-43/+10
perf reports in mmap case a huge number of kmem_cache_alloc's which seem to stem from triggering signals from kernel to user application, against dummy device: Performance counter stats for 'trafgen -i blub -o dummy0 -n100000000 -k100': <-- mmap case 175,837 kmem:kmem_cache_alloc 14.758900522 seconds time elapsed Performance counter stats for 'trafgen -i blub -o dummy0 -n100000000 -k100 -t0': <-- non-mmap case 707 kmem:kmem_cache_alloc 15.591667364 seconds time elapsed It seems not to case significant number of cache-misses, but it's better to switch to a direct trigger when we cannot fill new frames anymore. After this patch, we see a similar number of kmem_cache_alloc's as in the non-mmap case. This basically renders the kpull interval useless, we can optionally remove it if we don't care about people's scripts. ;-) Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-03-23conf: oui: update oui.confTobias Klauser1-5/+97
Update oui.conf using oui-update.py Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-03-23zsh: Unify completion help messages for --version and --helpTobias Klauser7-12/+12
2014-03-18astraceroute.zsh: Remove duplicate entryTobias Klauser1-1/+0
The entry for -q/--num-probes is duplicated in the zsh completion file and the description of the first entry doesn't match the option's real purpose, thus remove it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-03-16Typo: longitudeKartik Mistry2-2/+2
Fixed typo in astraceroute.* files. Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
2014-03-14man: manpage warning fixesKartik Mistry8-18/+10
Usage: man --warnings -E UTF-8 -l -Tutf8 -Z foo.8 > /dev/null Signed-off-by: Kartik Mistry <kartik.mistry@gmail.com>
2014-03-11pcap_io: Only check byteswapped linktype if pcap magic is swappedTobias Klauser1-13/+8
In pcap_validate_header() the linktype and the byte-swapped linktype are currently checked against the supported linktypes. Since the swapped linktype is always larger than LINKTYPE_MAX, only one of the two tests was actually done. Make this intention a bit more clear by explicitly checking only for either the swapped or non-swapped linktype, depending on whether the pcap magic is swapped. Also make the error messages a bit more verbose regarding the major/minor version. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-03-04docs: install: Fix a minor typoTobias Klauser1-1/+1
s/faily/fairly/ Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-27build: fix syntax error when detecting SHELL make variableJesper Dangaard Brouer1-1/+1
Fix the shell syntax error, introduced in: commit 11c34c86ca4 (build: Set SHELL make variable to bash if possible) Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2014-02-26dissectors: ethernet: Handle multicast/broadcast addresses properlyTobias Klauser1-5/+25
Until now, we just looked up the vendor string based on the OUI for each MAC address. Thus, multicast and broadcast addresses were just printed as "Unknown" which is a bit misleading. Improve this situation by checking bit 0 of the 1st octet of the address and by checking for the broadcast address if it is set. If a multicast/broadcast address is found, the respective string is returned. In all other cases, the existing OUI lookup is done. In the future we might extend this mechanism to look up well-known multicast addresses. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-26ifpps: Reorder buffer allocation and file opening in stats_proc_interruptsTobias Klauser1-4/+4
We don't need the file open to allocate the buffer so open it just before it's used for the first time. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-26conf: oui: update oui.confTobias Klauser1-250/+1010
Update OUI entries using oui-update.py Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-24dissectors: Get rid of unecessary includes of protos.hTobias Klauser29-33/+1
This header is actually only needed in dissector_eth and dissector_80211, so remove the other users accordingly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-24ring: Get rid of unnecessary wrapper for get_sockopt_tpacketTobias Klauser1-13/+8
get_sockopt_tpacket is never used in the "raw" version and the wrapper does no additional checking anyway, so get rid of it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-24build: Set SHELL make variable to bash if possibleTobias Klauser1-0/+3
On Debian/Ubuntu systems, /bin/sh is /bin/dash which doesn't understand the -e option to the `echo' builtin. Thus the build output looks something like the following: Building netsniff-ng toolkit (0.5.8-rc5+) for x86_64-linux-gnu: Building netsniff-ng: -e CC dissector.c -e CC dissector_eth.c -e CC dissector_80211.c ... Prevent this by setting SHELL to /bin/bash if it exists on the system, otherwise stick to /bin/sh. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-22ifpps: Exit gracefully for all possible termination signalsTobias Klauser1-0/+4
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-22flowtop: Exit gracefully for all possible termination signalsTobias Klauser1-0/+4
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-22astraceroute: Exit gracefully for all possible termination signalsTobias Klauser1-0/+4
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-22trafgen: Exit gracefully for all possible termination signalsTobias Klauser1-0/+4
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-02-21netsniff-ng: Exit gracefully for all possible termination signalsTobias Klauser1-0/+4
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Without this fix, pcap files written by netsniff-ng might be corrupted. Reported-by: Mike Westmacott <mikewestmacott@googlemail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>