summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-04-30man: mausezahn: Fix man warningsTobias Klauser1-3/+3
Fix warnings such as the following, reported by lintian [1]: usr/share/man/man8/mausezahn.8.gz 106: warning: macro `'own''' not defined [1] https://lintian.debian.org/maintainer/daniel.borkmann@alumni.ethz.ch.html#netsniff-ng Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-29doc: Document Travis CI Coverity integrationTobias Klauser1-2/+7
Update README.devel with information about the Travis CI Coverity integration. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-29build: travis: Move coverity_scan to existing addons configurationTobias Klauser1-12/+10
Move the coverity_scan configuration to the exisint, otherwise the apt packages won't get installed it seems. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-29build: travis: Set up Coverity scanTobias Klauser1-0/+14
Set up Travis CI integration for Coverity scan according to https://scan.coverity.com/travis_ci Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-27ring: Mark potentially unused parameters as suchTobias Klauser1-2/+4
The parameters to tpacket_uhdr_vlan_tci() and tpacket_uhdr_vlan_proto() might be unused, depending on the definition of HAVE_TPACKET3 and TP_STATUS_VLAN_TPID_VALID. Thus, mark them with __maybe_unused to prevent -Wunused-parameter warnings. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-27ring: Remove unused parameter sock from setup_ring_layout_generic()Tobias Klauser4-4/+4
setup_ring_layout_generic() takes an "int sock" parameter but never uses it. Remove it to prevent -Wunused-parameter warnings. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-27flowtop: Mark parameter in callback function as unusedTobias Klauser1-1/+1
Mark the nf_conntrack_msg_type parameter to flow_dump_cb with __maybe_unused to prevent a warning when compiling with -Wunused-parameter. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26ifpps: Mark arg parameter of on_panic_handler() as unusedTobias Klauser1-1/+1
This fixes the following -Wunused-parameter warning: ifpps.c: In function ‘on_panic_handler’: ifpps.c:1128:36: warning: unused parameter ‘arg’ [-Wunused-parameter] static void on_panic_handler(void *arg) Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26flowtop: Use fl argument instead of hard coded global flow_listTobias Klauser1-1/+1
The only place where flow_list_update_entry() is called passes the global flow_list anyway, so use the passed argument instead of the global. This fixes the following -Wunused-parameter warning: flowtop.c: In function ‘flow_list_update_entry’: flowtop.c:1438:53: warning: unused parameter ‘fl’ [-Wunused-parameter] static int flow_list_update_entry(struct flow_list *fl, struct nf_conntrack *ct) Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26flowtop: Remove unused parameters from draw_help() and draw_footer()Tobias Klauser1-4/+4
The WINDOW *screen parameter to draw_help() and draw_footer() is unused, so remove it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26flowtop: Remove unused parameters from draw_flow_entry()Vadim Kochan1-2/+2
Remove unused "screen" & "line" parameters from draw_flow_entry(). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26cpp: Use mkstemps() to create unique temporary fileTobias Klauser1-4/+9
Use mkstemps() to safely create a unique temporary file instead of using rand() to manually create a (potentially unsafe) temporary filename. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26trafgen: Use mkostemp_or_die() to create unique temporary fileTobias Klauser1-8/+2
Use the mkostemp_or_die() wrapper introduced in commit a87f181bd836 ("ioops: Add mkostemp_or_die") to safely create a unique temporary file instead of using rand() to manually create a (potentially unsafe) temporary filename. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-26ioops: Add mkostemp_or_die() wrapper for mkostemp(3)Tobias Klauser2-0/+11
Add a panic()ing wrapper for mkostemp(3). This will be used to safely create unique temporary files. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-25trafgen: proto: Add ICMPv6 header generationTobias Klauser7-0/+125
Support for generating simple ICMPv6 headers using the 'icmp6()/icmpv6()' trafgen generation function. Fields supported: mtype Message type (default: 0) Supported keywords: echorequest, echoreply code Code (default: 0) csum Message checksum (calculated by default) Examples: { eth(), ipv6(daddr=::1), icmpv6(echorequest), 42, 42, 0, 0 }' If not explicitely specified, the lower header is initialized as Ethernet. Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-25trafgen: proto: Add IPv6 header generationTobias Klauser8-40/+254
Support for generating simple IPv6 headers using the 'ip6()/ipv6()' trafgen generation function. Fields supported: ver|version Version (default: 6) tc|tclass Traffic class (default: 0) fl|flow Flow Label (default: 0) len|length Payload length (calculated by default) nh|nexthdr Type of next header (default: 0) hl|hoplimit|ttl Hop Limit, TTL (default: 0) sa|saddr Source IPv6 address (default: device address) da|daddr Destination IPv6 address (default: 0:0:0:0:0:0:0:0) Examples: { eth(), ipv6(daddr=1:2:3:4:5:6:7:8) } { ipv6(tc=2, hl=3, daddr=::1) } { eth(), ipv6(nh=58, sa=2001:db8::, da=::1), 128, 0, 0x52, 0x03, 0, 0, 0, 0 } If not explicitely specified, the lower header is initialized as Ethernet. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22man: trafgen: Add example program, rewritten using the trafgen functionsTobias Klauser1-0/+13
Show how the trafgen header generation functions can make a trafgen script much more concise by rewritting Jesper's example using these functions. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22trafgen: proto: Replace panic() with bug() where applicableTobias Klauser3-4/+3
In some cases we use panic() in situations where the error could only happen due to an implementation error. Use bug() there as it is more applicable, as panic() is mainly used to report system call errors. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22build: Always silence the no-op check commandTobias Klauser1-1/+1
There is no point in outputing the true no-op command, as it will only clutter the logs. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22flowtop: man: Add how-to activate conntrack by modprobeVadim Kochan1-0/+8
Add another tip how to activate conntrack mechanism by loading required kernel modules via modprobe. This info might be used to make these modules load automatically at startup. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22flowtop: Simplify flows refresh delayVadim Kochan1-18/+3
Simplify screen refresh logic by removing tricky delay logic which freezes a little key pressing. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22flowtop: Get rid of clear() & refresh() callsVadim Kochan1-7/+6
Don't use refresh() & clear() as we draw entire screen and flows table will be filled with empty rows. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22ui: Print empty rows when clearing tableVadim Kochan2-1/+15
Fill table with empty rows while clearing. It will allow to get rid of clear() & refresh() each time before print the flows list. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22flowtop: Use new UI table API for draw flows listVadim Kochan2-105/+141
Used new UI table API for flows printing to make it more generic. Also it will allow to have same code to dump flows in text mode. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22ui: Implement UI table for flows printingVadim Kochan2-0/+192
Add new module ui.c which is responsible to render different kinds of UI widgets - tables, etc. Implemented generic API for print table-like list of elements. This table API might be used for print flows in curses or text mode. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: change bug_on(true) to bug(), whitespace fix] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22list: Add re-defined double-linked list API from liburcuVadim Kochan1-0/+39
Add definitions for list structure & functions without cds_/CDS_ prefix. The purpose of this change is to use such linked-list in sorting or ordering some kind of items (e.g. flowtop - flows, columns). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22build: travis: Build with and without libGeoIP/zlibTobias Klauser1-1/+5
In order to catch problems with missing libGeoIP/zlib stubs already in Travis CI, use the DISABLE_{GEOIP,ZLIB} variables to the configure script in all possible combinations during the CI build. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22build: configure: Allow to disable support for libgeoip and zlibTobias Klauser2-0/+21
Allow users to explicitely disable linking against libgeoip and zlib, as they are completely optional, e.g: DISABLE_GEOIP=1 ./configure && make DISABLE_ZLIB=1 ./configure && make This change should also help to increase build coverage once we use these options in the Travis CI setup. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22build: configure: Write a comment to config.h for disabled featuresTobias Klauser1-0/+10
When looking at config.h it should be obvious which features were enabled and disabled, so put a comment there in cased they are disabled. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-22flowtop: Fix compilation error when build without geoipVadim Kochan1-0/+10
Commit f61f39d ("geoip: Allow to get country 3-code") added new helpers without considering HAVE_GEOIP definition. Fixed by adding dummy functions for get 3-code country name in case if HAVE_GEOIP is not defined. Tested only by manualy disabling HAVE_GEOIP in config.h and geoip.c compilation in Config file. Fixes: f61f39d (geoip: Allow to get country 3-code) Reported-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-21trafgen: proto: Inline proto_current_header() into its only callerTobias Klauser1-9/+1
proto_lower_header() is the only caller for proto_current_header() which already checks header_count > 0, so inline proto_current_header() and omit the additional check and a panic() which thus can never be triggered. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-18flowtop: Use new colors naming & helpersVadim Kochan1-20/+22
Use new colors definitions via enum variables instead of numbers which helps to undrerstand better which kind of color is used. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-18screen: Add helpers to easy use color by nameVadim Kochan1-0/+17
Added macros which allow easy specify color pair like: INIT_COLOR(YELLOW, BLACK); COLOR(YELLOW, BLACK); COLOR_ON(YELLOW, BLACK); by calculating pair id via generic formula. Added shorter color names via new enum. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-18flowtop: Add display option to show src infoVadim Kochan1-9/+11
Add 's' key option to toggle source peer info at runtime, behaviour is the same like for '-s' command line option. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-18flowtop: Change flows layout to 1-row viewVadim Kochan1-200/+191
Changed flows list layout to look more a top-like output with header and in 1 line. When -s option is specified then layout changes to 2 lines view including with src peer info and dst under it on next line. Also shortified flow state names to allocate less space. Removed presenter_get_port be cause ports are printed for both peers separately. The flow duration time is printed in very short form in one of the units: XXd - days XXh - hours XXm - minutes XXs - seconds the reason is that it is enough to have actually generic understanding about flow time in the biggest time unit. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-18geoip: Allow to get country 3-codeVadim Kochan2-0/+16
Add func to get country code-3 name by IPv4/6 address Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-17AUTHORS: Add Arch3y for his contributionTobias Klauser1-0/+1
Add Arch3y for a0f448c and f5ae2cd (PR #156). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-17build: fix compilation warnings with _GNU_SOURCEarch3y3-4/+9
Fix the following warnings when building with glibc>=2.20: proc.c:1:0: warning: "_GNU_SOURCE" redefined ioops.c:1:0: warning: "_GNU_SOURCE" redefined xmalloc.c:8:0: warning: "_GNU_SOURCE" redefined Signed-off-by: Arch3y <arch3y@archstrike.org> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-04-17build: Define _DEFAULT_SOURCE to fix compilation warnings with glibc>=2.20arch3y2-0/+2
Fixes depracation issues for glibc>=2.20 if we define _BSD_SOURCE we must also define _DEFAULT_SOURCE as well from tprintf.c warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" from astraceroute.c warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" Signed-off-by: Arch3y <arch3y@archstrike.org> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-03-29AUTHORS: Add Tommy for his contributionTobias Klauser1-0/+1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-03-29mausezahn: Allow IPv6 ranges to be specified for source and dest addressesTommy Beadle5-34/+444
This allows a user to pass a range of IPv6 addresses, either like: fec0:5000::1-fec0:5000::100 or in CIDR notation: fec0:5000::0/112 These can be used for the -A and/or -B command-line options. The largest range that can be used is a /64. In other words, if using CIDR notation, the masklen must be <= 128 and >= 64. Signed-off-by: Tommy Beadle <tbeadle@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-03-22netsniff-ng v0.6.1v0.6.1Tobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-23trafgen: man: Add description for 'mpls()' functionVadim Kochan1-2/+27
Add syntax & fields description for 'mpls()' function, also: 1) add line break for VLAN header notes 2) fix ip -> ipv4 in UDP echo example 3) consistent spelling of EtherType Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-23trafgen: parser: Add syntax for MPLS header creatingVadim Kochan2-1/+40
Add 'mpls()' function for creating MPLS header with parameters: lbl|label MPLS label last Indicates the last label on MPLS stack tc|tclass|exp Traffic Class (TC) ttl TTL (Time To Live) Currently only unicast MPLS is supported, but multicast might be set via 'eth()' function. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-23trafgen: l2: Add MPLS header generationVadim Kochan3-0/+40
Add support for MPLS header creating with fields: Label, TClass, Bottom-Stack, TTL By default S-field is set to 1 (last label), but resets to 0 if lower MPLS header is added. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-23trafgen: proto: Fix bad field maskingVadim Kochan1-4/+20
Current logic does OR of existing field value & shift-masked specified value, which is not enough as 0s bits from the specified value will be not set (be cause of OR), so fixed it by reseting original field value by AND with reverted field mask, in otherwords - bits part of original field value is reset to 0s and only after OR-ed with specified shift-masked value. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-03built_in: Include stddef.h to avoid redefinition of offsetof() macroTobias Klauser1-1/+2
The stddef.h header might define the offsetof() macro unconditionally, leading to the macro being redefined if built_in.h is included _before_ stddef.h. This will lead sparse to complain as follows: /usr/lib/gcc/x86_64-linux-gnu/4.8//include/stddef.h:413:9: warning: preprocessor token offsetof redefined ./built_in.h:151:10: this was the original definition Fix this by explicitly including stddef.h in built_in.h Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-03trafgen: proto: Make proto_current_header() staticTobias Klauser2-2/+1
After commit 88b359d2aa7e ("trafgen: proto: Simplify getting lower protocol after init") proto_current_header() is no longer used outside trafgen_proto.c, so make it static. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-02trafgen: man: Add help for VLAN header functionVadim Kochan1-0/+29
Add usage, syntax & parameters description for 'vlan()' function. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-02-02trafgen: parser: Add syntax for VLAN header creatingVadim Kochan2-0/+49
Add 'vlan()' function to generate VLAN header. Fields supported: tpid|proto Set TPID (Tag Protocol Identifier) (default 0x8100) 1ad Set TPID field as 0x88a8 1q Set TPID field as 0x8100 tci Set TCI (Tag Control Information) (default 0) pcp Set PCP (Priority Code Point) (PCP) (default 0) dei|cfi Set DEI (Drop Eligible Indicator) (default 0) id Set VID (VLAN Identifier) (default 0) Examples: { eth(), vlan(id=1), ipv4() } { vlan(id=1, 1ad), vlan(id=100, pcp=3), ipv4() } Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>