summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
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>
2015-10-28flowtop: Add command-line option to show rates in bitsVadim Kochan2-5/+27
Add -b,--bits command line option to show rates in bits/s instead of bytes/s. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-27flowtop: Use strlcpy instead of memcpy to copy stringsTobias Klauser1-14/+10
Make sure we always terminate the strings with '\0'. Also only set the first byte to '\0' instead of memset()ing the entire buffer in case no city/country is returned. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-27flowtop: Use bool for show_src optionTobias Klauser1-3/+4
Use boolean false/true for show_src option value. This makes the handling of on/off parameters more consistent. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-27flowtop: Add command-line option to disable GeoIP lookupVadim Kochan2-5/+18
Add option -G,--no-geoip which allows to disable GeoIP lookup. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: Minor wording tweaks] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-27flowtop: Add command-line option to disable hostname lookupVadim Kochan2-2/+30
Add option -n,--no-dns which allows to disable hostname lookup. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: Minor wording tweaks] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-27flowtop: Fix src hostname showed with garbageVadim Kochan1-6/+3
Use strlcpy to copy resolved src/dst hostname. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: Remove superflous min() for size argument] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-26flowtop: Fix short form unit of kilobytes from KB to kBTobias Klauser1-2/+2
The SI prefix for 1000 is 'k', not 'K' (which is used for 1024 bytes by some). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-26flowtop: Add option for flow refresh intervalVadim Kochan2-4/+18
Add new -t,--interval option to specify flow refresh interval in seconds. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: Fix type conversion on rate calculation] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-26flowtop: man: Add notice about rate infoVadim Kochan1-0/+2
Add notice about rate info to the feature list. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-26flowtop: Change traffic amount unit namesVadim Kochan1-8/+8
Use GB/MB/KB for traffic rate & accounting. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-23flowtop: Constify pointer function parametersTobias Klauser1-12/+12
Constify pointers struct flow_entry and struct nf_conntrack where possible. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-23flowtop: Store basename of cmdline in struct flow_entryTobias Klauser1-5/+8
The cmdline entry of struct flow_entry is only used to display the process name using basename() in presenter_screen_do_line(). Instead of calling basename() everytime just call it once when we read the cmdline proc entry and store the basename in struct flow_entry. Also rename the struct member accordingly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-23flowtop: Show flow rate of bytes & packetsVadim Kochan1-6/+75
Calculate and display the rate of src/dst bytes and packets. Also change the refresh time for the flows to 1s so the rate info will not disappear too quickly. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-20pkt_buff: Remove unused size member from struct pkt_buffTobias Klauser1-5/+3
The size member of struct pkt_buff is set but never accessed. It can savely be dropped as we can still get the size implicitly using pkt->tail - pkt->head if necessary. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-19netsniff-ng: nlmsg: Display raw data if family is unknownTobias Klauser1-0/+12
Currently we only support full dissection of RTNL netlink messages. For non-RTNL message we only print the header and omit the data. Change this behavior and print a full ascii/hex dump of the remaining data (like it is done in dissector_entry_point() for trailing data after all known protocols have been processed) to give the user a chance to still inspect the message content. Reported-by: Geoff Ladwig <gladwig@verdantnetworks.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-19netsniff-ng: proto: Make raw hex/ascii print function globally availableTobias Klauser2-2/+4
Allow other dissectors to access the hex/ascii printing functions with a raw uint8_t* instead of only through struct pkt_buff. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-19netsniff-ng: nlmsg: Display "(none)" instead of "()" for zero flagsTobias Klauser1-2/+3
nl_nlmsg_flags2str() returns an empty string if the provided flags argument is 0. Check this condition and display "none" instead to make the output nicer to read. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-17netsniff-ng: Fix print stats in silent modeVadim Kochan1-6/+3
RX stats were not printed because of wrong check on PRINT_NONE. Fixes: 5f94671f31c040f ("netsniff-ng: Show total rx stats for multi pcap mode") Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-14trafgen: Move checking of dynamic packet elements to headerTobias Klauser3-8/+8
Move has_dynamic_elems() to to trafgen_conf.h, rename it to packet_dyn_has_elems() and use it to check whether dynamic packet elements are present. Also change the return type to bool and use || instead of + to potentially make use of short-circuit evaluation. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-14csum: Remove unnecessary memset in p4_csum()Tobias Klauser1-4/+3
No need to memset the IPv4 pseudo header to 0 as all its members will explicitly be set. Also reorder the setting of the pseudo header to match the order of the fields. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13trafgen: Change signature of compile_packets() to match provided typesTobias Klauser2-2/+2
Match two arguments to the respective types provided in its only caller in trafgen.c:main_loop() Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13trafgen: Don't panic() on parser errorsTobias Klauser2-10/+19
If the C preprocessor is used to parse the packet description, a temporary file is created which is not deleted if an error occurs during parsing in compile_packets(). Instead, don't panic() on errors and only print a message, and only die() once we cleaned up after us. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13trafgen: Make xmit_packet_precheck() return voidTobias Klauser1-6/+3
The return value of xmit_packet_precheck() is always 0 and it calls panic() in any error cases, so its return value isn't of any use. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13conf: oui: update oui.confTobias Klauser1-1755/+2390
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13oui-update: Explicitly sort OUI list and strip trailing whitespacesTobias Klauser1-5/+9
It looks like http://standards-oui.ieee.org/oui.txt is no longer sorted by OUI, so do in manually when creating oui.conf. Also, it looks like the file has been converted to use CRLF line endings, so strip those as well (and any other trailing whitespaces in the vendor name). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13trafgen: Add checksum helpers for TCP/UDP over IPv6Tobias Klauser7-6/+71
Add the csumudp6 and csumtcp6 helper functions in order to simplify checksum generation for TCP/UDP packets sent over IPv6. trafgen example for TCP over IPv6: { /* MAC Destination */ fill(0xff, 6), /* MAC Source */ 0x00, 0x02, 0xb3, drnd(3), /* IPv6 Protocol */ c16(0x86DD), /* Version, Traffic Class, Flow Label */ 0b01100000, c8(0), c16(0), /* Payload Length */ c16(54), /* Next Header (TCP) */ c8(6), /* Hop Limit */ c8(64), /* Source IPv6 */ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0xac, 0x6f, 0xff, 0xfe, 0xa4, 0x12, 0xe3, /* Destination IPv6 */ 0xfe, 0x80, 0x82, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xff, 0xfe, 0x00, 0x06, 0xde, /* TCP Source Port */ c16(55042), /* TCP Destination Port */ c16(55043), /* TCP Sequence Number */ drnd(4), /* TCP Ackn. Number */ c32(0), /* TCP Header length + TCP SYN/ECN Flag */ c16((8 << 12) | (1 << 1) | (1 << 6)) /* Window Size */ c16(16), /* TCP Checksum (offset IPv6, offset TCP) */ csumtcp6(14, 54), /* TCP Options */ 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x06, 0x91, 0x68, 0x7d, 0x06, 0x91, 0x68, 0x6f, /* Data blob */ "foobar!", } Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-10-13trafgen: Adjust syntax error messageTobias Klauser1-1/+1
Make it more readable. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>