summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-03-20flowtop: Don't init screen until collector is readyVadim Kochan2-0/+40
In case if main thread already initialized screen but then collector called panic, the process exits but console stays with the same colored screen and shifted shell prompt. Fixed by adding conditional variable locking. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-03-19authors: add Vadim for his contributionsDaniel Borkmann1-0/+1
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2015-03-17mz: Add igmp v1/v2 packet type crafting supportVadim Kochan4-32/+153
Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-03-02mz: Allow to print packet types by '-t help'Vadim Kochan2-69/+71
Changed to print packet types by '-t help' earlier before mz will try to identify link device to bind. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tklauser: whitespace cleanup and minor commit message adjustments] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-23proto: Make protocol->key member constTobias Klauser1-1/+1
It's always initialized on declaration in the individual dissectors, so make it const. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-20mz: Dont bind to dev if help was specifiedVadim Kochan1-6/+12
Fixed warnings: Warning: [lookupdev.c get_dev_params()] Cannot open socket! when specify help for packet type: # mz -t tcp help Also fixes delayed output of the same command if user is root. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-05xmalloc: Make xrealloc() arguments conform to realloc()Tobias Klauser6-25/+22
xrealloc() has an additional nmemb argument compared to realloc() for which it should serve as a wrapper. Since we always call with nmemb = 1, we might as well remove this argument and thus have xrealloc() conform to the realloc() function prototype. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-02-05xmalloc: Remove unnecessary NULL check before realloc()Tobias Klauser1-5/+1
If realloc() is passed NULL as its first argument, it behaves like malloc(), so the check for ptr begin NULL is not necessary Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-01-30geoip: Fix update failingVadim Kochan1-5/+5
I have no enough arguments for this fix but it fixes the failing of geoip updating. Seems "shutdown(..)" closes socket too early. So shutdown(...) is removed and added "Connection: close" http header which says http server to close connection after response will be sent. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2015-01-30trafgen: disable timer slackEric Dumazet1-0/+2
linux has default time slack of 50 usec, which means that trafgen 'gap' option is unable to precisely control delays. Set the process timer slack to the minimum of 1 nsec. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2015-01-26netsniff: Allow filter input pcap file to output pcapVadim Kochan2-5/+24
It might be useful to filter out interesting traffic from input pcap to output pcap file which will contain only filtered packets: $ netsniff-ng -i input.pcap -o output.pcap ip src 192.168.1.198 Now it is possible by specifying output pcap file with ".pcap" extension, otherwise the trafgen file will be generated as by default. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tklauser: small wording and whitespace adjustment] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-01-12gitignore: Add compiled executablesVadim Kochan1-0/+11
Add following files to ignore list: astraceroute/astraceroute bpfc/bpfc curvetun/curvetun curvetun/abiname flowtop/flowtop ifpps/ifpps mausezahn/mausezahn netsniff-ng/netsniff-ng trafgen/trafgen Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2015-01-11mz: allow for zero udp checksumMark Latimer1-2/+4
I have been investigating tools to generate UDP with checksums of zero for software testing. This is legal in IPv4 but unwise due to inability to verify the data has not been corrupted. I found that mausezahn was not able to create these packets due despite being able to create incorrect UDP checksums. The code does not distinguish set to zero and unset. Results as seen by wireshark (UDP checksum verification enabled) mausezahn eth0 -A 192.168.0.105 -B 192.168.0.104 -t udp "sp=32452,dp=1024" -P Hello -> UDP checksum is automatically set to the valid value. mausezahn eth0 -A 192.168.0.105 -B 192.168.0.104 -t udp "sp=32452,dp=1024,udp_sum=1" -P Hello -> UDP checksum is set to 1 (which is invalid and highlighted by wireshark). mausezahn eth0 -A 192.168.0.105 -B 192.168.0.104 -t udp "sp=32452,dp=1024,udp_sum=0" -P Hello -> Before patch the checksum was set to the valid value. -> After patch the checksum was sent to zero. Signed-off-by: Mark Latimer <mark.latimer@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2015-01-11sock: Add cause message in case of errorVadim Kochan1-9/+9
Add error messages which explain the cause of error state of the socket functions, so it makes message like: $ ./netsniff-ng/netsniff-ng -i wlp3s0 Creation of PF socket failed: Operation not permitted more understandable. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-12-12all: Reduce amount of empty liens in usage and version output a bitTobias Klauser7-32/+32
No need for some of the empty lines, remove them to make the output a bit denser. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-11-19build: Enable customization of sysconfdir (ETCDIR)Tillmann Karras1-1/+1
Signed-off-by: Tillmann Karras <tilkax@gmail.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2014-10-01netsniff-ng: Combine redundant pcap file rotation logic into functionTobias Klauser1-34/+24
The code to create the next pcap dump file is duplicated for the HAVE_TPACKET3 and !HAVE_TPACKET3 case. Consolidate the functionality into a function to reduce code duplication. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-10-01build: Make ccache opt-in rather than opt-outTobias Klauser3-18/+4
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>
2014-09-29built_in: Remove unused macro force_castTobias Klauser1-4/+0
The macro is unused and explicit cast should be used anyway. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-29netsniff-ng: Fix tpacketv2-only capturingTobias Klauser2-1/+8
We need to set up the RX ring depending on whether tpacket v3 is available or not. Otherwise end up setting its structure up for tpacket v3, even though only tpacket v2 is available. This should fix packet capturing for tpacket v2 (i.e. corrupted frames in pcap). Reported-by: Mike Reeves <luke@geekempire.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-29ring_rx: Fix typo in header guard #endifTobias Klauser1-1/+1
It's HAVE_TPACKET3, not HAVE_TPACKETV3. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-29netsniff-ng: Move variable definitionTobias Klauser1-3/+2
Save one #ifdef block by moving the tpacket v3 only variable definition to the block where it is actually used. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-18INSTALL: Fix formattingTobias Klauser1-16/+16
Use spaces for indentation in the INSTALL file so the dependency listing are properly aligned in any case. Also reorder the lists slightly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-18build: nacl: Propagate nacl specific environment variables to parent shellwilson1-1/+1
Use source command to execute the nacl_build.sh script in order to change parent shell's environment variable needed to find the just built libnacl. wilson says: > As I use "make nacl" to install nacl, the nacl_path.sh would be execute. > Then NACL_INC_DIR env variable will be set and appended to ~/.bashrc. In > nacl_build.sh, it used 'source' command to execute nacl_path.sh, however > the NACL_INC_DIR variable only took effect in this script context, but > not in the shell I was running. > I think we need the 'source' command to execute nacl_build.sh so that we > don't need to restart the shell for further installation. Signed-off-by: wilson <wilson.wen.chn@gmail.com> [tklauser: Reformated commit message] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-12csum: Use ISO C fixed width typesTobias Klauser1-22/+22
Use the ISO C fixed width types from stdint.h instead of the self-defined Linux types. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-11netsniff-ng: Remvoe unnecessary cast to void *Tobias Klauser1-2/+1
The iov_base member of struct iovec is already void *, so there is no need to cast it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-11netsniff-ng: Unindent goto labelTobias Klauser1-2/+1
Stick to the usual style of having goto labels not indented. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-09dissectors: 80211_mac_hdr: Remove remaining binary constantsTobias Klauser1-41/+32
Commit 151fd88f7429 ("dissectors: 80211_mac_hdr: Remove usage of binary constants") removed binary constants in a particular case that was reported to cause a compile error. However, this module uses binary constants in some other places. Replace them by hexadecimal constants, which makes it easier to read and is C99 compatible. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-09dissectors: 80211_mac_hdr: Fix clang warningTobias Klauser1-14/+14
clang gives the following warning about function meas_type(): proto_80211_mac_hdr.c:1704:1: warning: control may reach end of non-void function [-Wreturn-type] } ^ Even though this is a false positive (since we check the entire range of an u8 in the switch/case), fix it by turning the case 13 ... 255 into default. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-09dissector: Don't re-initialize packet_types arrayTobias Klauser1-1/+0
Both sparse and clang warn about the initializers overriding previous initialization of the packet_types array. Since every access of the packet_types array checks the value for NULL (the default value, since the array is static) and prints a "?" if it isNULL, we don't need the prior initialization with "?". Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-09sock: Error out if setting of the system socket memory failsTobias Klauser1-1/+2
Currently we ignore the return value of the write() calls to /proc/sys/net/core/{r,w}mem_{default,max} in set_system_socket_mem(). Better check the return value and notify the user about it. This also fixes a clang compiler warning about a variable explicitely assigned to itself. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-09netsniff-ng: Remove useless check for ctx.device_inTobias Klauser1-2/+1
If ctx.device_in is NULL after option parsing, it is always set to "any", which is before this check. Thus, it serves no purpose and can be removed. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-09build: Don't overwrite CC variableTobias Klauser3-9/+10
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>
2014-09-08flowtop: Use integer conversion to determine PID proc entriesTobias Klauser1-13/+20
Try to convert the directory entry name to an unsigned integer with strtoul() instead of using strspn() to determine if a proc entry is a PID. If it is a valid PID (i.e. strtoul returned a value != 0), we can directly use it to pass into walk_process() and there set flow_entry->proc_num. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-08flowtop: Simplify entry skip logicTobias Klauser1-10/+5
Instead of testing three skip conditions for every entry, make use of the short-circuit evaluation of the boolean OR operator to only test as few conditions as necessary. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-08build: Detect compiler (gcc or clang) and filter out compiler flagsTobias Klauser1-0/+12
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>
2014-09-08build: travis: Re-enable clang and also use it for configureTobias Klauser1-1/+2
Make sure we also use clang for the compile tests in the configure script. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-08build: Change return type of main in configure compile test programsTobias Klauser1-12/+12
When running the configure script with `CC=clang ./configure' clang fails all the compile test programs due to the main() function not having return type int. Change it, so we can use clang as a compiler in the configure script. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05bpfc: Don't duplicate copyright/bug report/license stringTobias Klauser1-14/+11
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of bpfc.o slightly smaller: before: text data bss dec hex filename 3594 0 0 3594 e0a bpfc/bpfc.o after: text data bss dec hex filename 3313 0 0 3313 cf1 bpfc/bpfc.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05flowtop: Don't duplicate copyright/bug report/license stringTobias Klauser1-16/+12
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of flowtop.o slightly smaller: before: text data bss dec hex filename 15601 4 48 15653 3d25 flowtop/flowtop.o after: text data bss dec hex filename 15228 4 48 15280 3bb0 flowtop/flowtop.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05astraceroute: Don't duplicate copyright/bug report/license stringTobias Klauser1-14/+11
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of astraceroute.o slightly smaller: before: text data bss dec hex filename 18481 0 4 18485 4835 astraceroute/astraceroute.o after: text data bss dec hex filename 18201 0 4 18205 471d astraceroute/astraceroute.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05ifpps: Don't duplicate copyright/bug report/license stringTobias Klauser1-16/+12
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of ifpps.o slightly smaller: before: text data bss dec hex filename 22146 0 1456 23602 5c32 ifpps/ifpps.o after: text data bss dec hex filename 21807 0 1456 23263 5adf ifpps/ifpps.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05netsniff-ng: Don't duplicate copyright/bug report/license stringTobias Klauser1-18/+13
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of netsniff-ng.o slightly smaller: before: text data bss dec hex filename 26998 8 68 27074 69c2 netsniff-ng/netsniff-ng.o after: text data bss dec hex filename 26582 8 68 26658 6822 netsniff-ng/netsniff-ng.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05trafgen: Don't duplicate copyright/bug report/license stringTobias Klauser1-14/+11
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of trafgen.o slightly smaller: before: text data bss dec hex filename 18512 0 104 18616 48b8 trafgen/trafgen.o after: text data bss dec hex filename 18240 0 104 18344 47a8 trafgen/trafgen.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-05trafgen: Consistently use unsigned int for number of CPUsTobias Klauser1-9/+9
The number of CPUs is stored in ctx.cpus which is unsigned int, so use unsigned int consistently when using CPU number. Negative CPU numbers wont occur anyhow. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-03build: travis: Disable clang for nowTobias Klauser1-1/+0
clang doesn't understand all our (GCC-spcific) compiler flags. We need to work around it by filtering them out properly in case clang is used. For now, just disable clang on travis, until I figured this out locally. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-03build: travis: Pass on CC environment variable to makeTobias Klauser1-1/+1
If travis compiles with clang, the environment variable CC is set. Since the netsniff-ng build system doesn't currently pick it up unless explicitly specified as a make variable, pass it on as such. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-03build: travis: Install dependencies before buildTobias Klauser1-0/+4
In order to make sure all tools (except curvetun) are built by Travis CI, install the libraries they depend upon. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-03mausezahn: Fix non-ANSI function declarationsTobias Klauser21-29/+27
ANSI C doesn't allow empty parameter list, thus use void where appropriate. This fixes the corresponding sparse warning. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2014-09-03build: Add continuous integration support via travis-ciTobias Klauser2-0/+7
This allows any libnl github repo to link to travis-ci which will result in new commits and pull requests to be automatically built with both gcc and clang. Any build failures including the addition of warnings are reported to the author and committer. Following Thomas Graf's suggestion: https://plus.google.com/103961622207897185587/posts/GaVC6jwcMgp Signed-off-by: Tobias Klauser <tklauser@distanz.ch>