summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-11-16lookup: Return const char * from all lookup functionsTobias Klauser7-16/+17
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-16lookup: Convert __do_lookup_inline to functionTobias Klauser1-13/+13
Make __do_lookup_inline an inline function and shorten its name to __lookup_inline. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-16lookup: Use lookup module for OUI lookup as wellTobias Klauser12-148/+23
Do not needlessly duplicate code between the oui and the lookup module. Instead, add an additional lookup table for OUIs to the lookup module. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-15lookup: Keep track of lookup table initialization stateTobias Klauser1-8/+15
Make sure every lookup table is only initialized once. Preparatory patch before moving OUI lookup. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-15lookup: Make lookup type and function names more genericTobias Klauser4-41/+43
It's not only ports we look up, make the names a bit more generic. Preparatory patch before moving OUI lookup to the lookup module. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-11geoip: Use correct line endings in HTTP requestTobias Klauser1-2/+2
The lines in an HTTP request should all end with \r\n (CRLF) according to RFC 2616, so use these consistently. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-11geoip: Don't NULL-terminate download bufferTobias Klauser1-2/+0
The end of the buffer might already contain part of the data payload. Setting the last byte to 0 will thus corrupt the gz file, leading to failed decompression (or previously, to invalid GeoIP database files). The NULL-termination is not necessary in this case, so just omit it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-11geoip: Error out if file is not inflated completelyTobias Klauser1-0/+3
In case the downloaded gzip file got corrupted somehow, the gzread would fail, leaving part of the file uninflated and thus leading to a corrupted GeoIP database. This can in the worst case lead to a crash in libgeoip which in turn causes netsniff-ng/flowtop/astraceroute to crash. So better panic() if we fail to uncompress. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-11netsniff-ng: nlmsg: Explicitly cast RTA_LEN to an intTobias Klauser1-4/+4
It looks like the result of RTA_PAYLOAD() can be of different type depending on architecture/kernel header version/... In order to prevent warnings related to non-matching types, just explicitly cast RTA_LEN to an int, since it can't possible be larger than the unsigned short of rta_len anyhow and it is used as an in in the call to device_addr2str(). Fixes: 664dcf4217 ("netsniff-ng: nlmsg: Use correct pritnf format specifier for int") Reported-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-10netsniff-ng: tcp: Don't print trailing space after last TCP flag nameTobias Klauser1-16/+18
Check whether there were flags printed before and if this is the case, add a space before printing the next flag. Nicely wrap this all in a macro. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-10netsniff-ng: nlmsg: Use correct pritnf format specifier for intTobias Klauser1-1/+1
RTA_LEN is defined as an alias of RTA_PAYLOAD which is defined as: #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) Thus use the correct format specifier %d for int instead of %lu. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-10netsniff-ng: Use correct printf format specifier for uint64_tTobias Klauser1-1/+1
ctx->pkts_recvd_last and ctx->pkts_drops_last are uint64_t, so use the PRIu64 format specifier to print them. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-10bpfc: man: Add example how to filter rtnetlink by attributesVadim Kochan1-0/+24
Example shows how to filter rtnetlink messages by ifindex & oper state. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-10bpfc, trafgen: Do not close stdin when "-" is specifiedVadim Kochan2-2/+5
Do not perform fclose for stdin fd. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-10netsniff-ng: Allow to specify compiled BPF from stdinVadim Kochan3-5/+11
Allow read compiled BPF instructions from stdin by via '-f -' option. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09dissectors: igmp: Fix calc_csum() callsTobias Klauser1-5/+5
Fix calls to calc_csum() missed in the previous commit b2eaec6. Fixes: b2eaec6 ("csum: Remove unused parameter from calc_csum()") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09csum: Remove unused parameter from calc_csum()Tobias Klauser5-6/+5
The `ccsum' parameter to calc_csum() is never used and is set to 0 by all callers. There's no reason to keep it, so remove it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09trafgen: Allow to build packet from command lineVadim Kochan4-6/+51
Craft packet directly from command line with same syntax as for conf file. It might be as first step to extend current syntax with specific proto fields. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09str: Add converting cmdline args vector to str moduleVadim Kochan3-16/+26
Move piece of code which converts cmdline args vector to string from netsniff-ng.c to str.c as function. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09flowtop: Simplify toggling of help stateTobias Klauser1-5/+1
No need to use if/else, just toogle it like any other bool. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09flowtop: Add runtime command to show only active flowsVadim Kochan1-9/+20
Add command 'a' to show only active flows with rate > 0 (dst or src). Now 'n->is_visible' means which flow to show by presenter. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09flowtop: Add runtime command to change rate unitsVadim Kochan1-0/+12
Add interactive command 'b' to change rate units to show. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-09flowtop: Add runtime command to show help windowVadim Kochan1-25/+90
Show help window by pressing '?' with interactive commands description. Added simple footer bar with help label. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-07trafgen, minor: newline in help textDaniel Borkmann1-1/+1
Just add a newline before notes. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2015-11-06build: configure: Silence pkg-config check for libnetfilter_conntrackTobias Klauser1-1/+6
Redirect stderr output of pkg-config to config.log in order to not spam the configure output with pkg-config errors. Instead, use the same pkg-config commands as for the other library checks to get libnetfilter_conntrack cflags. Additionally, use pkg-config to the the linker flags as well. Fixes: 19991f90 ("build: Handle libnetfilter-conntrack with pkg-config") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06build: configure: Check for libnl-routeVadim Kochan1-0/+36
libnl-route is used in netsniff-ng to dump nlmsg flags. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06netsniff-ng v0.6.0v0.6.0Tobias Klauser1-3/+3
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06build: misc: Mention the release name in the announcementTobias Klauser1-1/+1
Since we have such a nice naming scheme (who can guess it?), mention the release name in the release announcement. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06ring: Move common ring block_r/frame_nr shrinking to generic functionTobias Klauser3-8/+10
Merge shrinking code duplicated for RX/TX rings into an own generic function. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06lookup: Adjust error message on failed openTobias Klauser1-1/+4
Print the strerror() and rephrase the message a bit. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06flowtop: Redraw screen in 1s if no key was pressedVadim Kochan1-2/+16
Seems like screen is updating too frequently which may block some terminals, so lets do it once in 1s but only if no key was pressed. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06lookup: Do not panic if conf file does not existVadim Kochan1-2/+4
It is not necessary to do not allow run application if there is no conf file for port resolving, but instead print message to stderr. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-06curvetun: Move copyright text to separate variableVadim Kochan1-14/+12
Use copyright text from one place when print it in version or help output. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-05trafgen: let the kernel check min/max transm. unit boundariesDaniel Borkmann1-10/+2
Let AF_PACKET do this job to fail in case boundaries are too small or too large. I found it quite useful for testing the kernel. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2015-11-05trafgen: Fix typo in error messageTobias Klauser1-1/+1
Spell out "resolve" properly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-05build: Handle libnetfilter-conntrack with pkg-configMartin Hauke2-2/+3
Needed for openSUSE since they have versioned libnetfilter-header files. Signed-off-by: Martin Hauke <mardnh@gmx.de> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-05ifpps: Remove unnecessary memset before ethtool_drvinf()Tobias Klauser1-2/+0
ethtool_drvinf() already clears the struct ethtool_drvinfo, so there is no need to do it manually before calling it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-05flowtop: Calculate flow rate more carefullyVadim Kochan1-5/+9
Make rate calculation more carefully by checking previous & current bytes/pkts counter. Do calculation only if update time passed >= 1s. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-04flowtop: Show rate in yellow colorVadim Kochan1-2/+8
It is easier to differentiate bytes/pkts counters with rate counters if to use different colors. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-04flowtop: Rename enum flow_entry_direction to flow_directionVadim Kochan1-16/+16
Rename flow_entry_direction to flow_direction, which is a bit shorter and change the enum value names to be in upper case. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-04flowtop: Handle return value of gettimeofday()Tobias Klauser1-2/+2
Handle non-zero return values by exiting flowtop like we do in the other tools. This fixes Coverity warnings CID 1338093 and CID 1338092. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-02trafgen: Add missing inline functionTobias Klauser1-1/+6
Add the inline function packet_dyn_has_only_csums() which is used in the previous commit but accidentially wasn't added there. Fixes: b5d757a ("trafgen: Pre-calculate checksums if possible") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-11-02trafgen: Pre-calculate checksums if possibleTobias Klauser1-0/+19
The TCP/UDP checksums cannot be calculated in the parser as the packet payload following the TCP/UDP header is not yet know. However, we can calculate these checksums before the send loop if the only dynamic elements of the packet are checksums. This change avoids the overhead of recalculating the checksums for every iteration the send loop in these cases. Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-29ring, bind_ring_generic: no need to nullify members twiceDaniel Borkmann1-7/+2
We already do a memset before, no need to set members to null twice, just some minor cleanup. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2015-10-29ring: alloc_ring_frames_generic make types size_tDaniel Borkmann3-5/+4
Lets make i and num as size_t, there's no particular reason for them to be int. At least i is used to setup iov_base offsets. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2015-10-29ring: Simplify calculation of number of frames in a tpacket ringTobias Klauser1-4/+1
The number of frames in a tpacket ring (ring->layout.tp_frame_nr) is currently calculated as: tp_frame_nr = tp_block_size / tp_frame_size * tp_block_nr Substituting tp_block_nr with 'size / tp_block_size' (as calculated in the line above), we get: tp_frame_nr = tp_block_size / tp_frame_size * (size / tp_block_size) and realize that we can omit tp_block_size as it cancels out, leading to: tp_frame_nr = 1 / tp_frame_size * (size / 1) = size / tp_frame_size Adjust the calculation in setup_ring_layout_generic() accordingly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-29ring: Move generic code for ring layout setup to own functionTobias Klauser4-29/+28
Initialization of the ring->layout members is the same for RX and TX rings. Instead of duplicating the code in setup_rx_ring_layout() and setup_tx_ring_layout(), create a new function setup_ring_layout_generic() which is called from the former two. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-29zsh: flowtop: Add completion for newly added command line optionsTobias Klauser1-0/+4
Update the zsh completion with option -n/--no-dns, -G/--no-geoip, -b/--bits, -t/--interval. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-29flowtop: Fix missing --no-geoip option in usage outputVadim Kochan1-0/+1
Add G,--no-geoip to the usage output. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-28all: Change reporting bugs emailVadim Kochan7-8/+8
Replace bugs@netsniff-ng.com with netsniff-ng@googlegroups.com which is used in REPORTING-BUGS file. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>