summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-11-23mausezahn: Use all-nodes link local address for IPv6Mandar Gokhale1-3/+1
Use all-nodes link local address for IPv6 when destination is not specified. There is a comment that says this should be done anyway. According to RFC 4291, FF01:0:0:0:0:0:0:1 should be the correct address. Signed-off-by: Mandar Gokhale <mandarg@mandarg.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-11-23trafgen: parser: Fix undefined ETH_P_802AD on 2.6.x LinuxVadim Kochan1-0/+4
ETH_P_8021AD might be undefined on 2.6.x Linux version (tested on Ubuntu 10 with 2.6.32 Linux), so lets check and define it. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-11-18AUTHORS: Add Mandar GokhaleTobias Klauser1-0/+1
Add Mandar Gokhale for: c31566c6fa90 ("man: mausezahn: Add -6 option to manpage") e548da7232d4 ("mausezahn: Typofix & grammar change") submitted via pull requests #161 and #162. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-11-18man: mausezahn: Add -6 option to manpageMandar Gokhale1-0/+3
Closes #162 Signed-off-by: Mandar Gokhale <mandarg@mandarg.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-11-18mausezahn: Typofix & grammar changeMandar Gokhale1-4/+4
Closes #161 Signed-off-by: Mandar Gokhale <mandarg@mandarg.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-11-07netsniff-ng v0.5.2v0.6.2Tobias Klauser1-2/+2
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-21trafgen: proto: Don't drop const qualifier during castTobias Klauser1-2/+2
Don't drop const qualifier during cast to uint32_t * Found by compiling with -Wcast-qual. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-21csum: Don't drop const qualifier during castTobias Klauser1-3/+3
Don't drop const qualifier during cast to void * Found by compiling with -Wcast-qual. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04AUTHORS: Add Yousong Zhou for his contributionTobias Klauser1-0/+1
Add Yousong Zhou for commits 47493936 ("build: configure: fix checking CC containing -i option") and 70079759 ("all: fix build on CentOS 6 by checking presence of several macros"), submitted via #160. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04build: Unify default values for PREFIX and ETCDIR in configureTobias Klauser2-15/+6
The netsniff-ng make system is no longer usable without the `Config' file generated by the ^configure' script. Thus it's now possible to move default value definitions for PREFIX and ETCDIR to the configure script, so we they're not duplicated in `configure' and the Makefile. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04build: Simplify checking for PREFIX originTobias Klauser1-7/+3
Use the $(filter ...) make function to simplify the detection of the origin of the PREFIX variable. This allows to merge two duplicate definitions for the INSTX command. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: man: Highlight packet functions sectionVadim Kochan1-6/+8
Make the each packet functions section name to be bold. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: man: Add description for 'pfc()' functionVadim Kochan1-0/+27
Add explanation for 'pfc()' function parameters. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: parser: Add 'pfc()' function for PFC headerVadim Kochan2-2/+42
Add 'pfc()' function for PFC header creation with fields: code - MAC Control opcode prio - Priority enable vector prio(0)..prio(7) - Enable/disable pause for prio X time(0)..time(7) - Set pause time for prio X Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: l2: Add support for PFC headerVadim Kochan3-0/+64
Add PFC header fields setting (prio vector, time per priority). By default Ethernet header is pushed with required fields. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: man: Add description for 'pause()' proto functionVadim Kochan1-0/+22
Add explanation for PAUSE(802.3X) header fields. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: parser: Add 'pause()' function for IEEE 802.3X PAUSE headerVadim Kochan2-0/+31
Add 'pause()' proto header function for IEEE 802.3X PAUSE header generation with the fields: code - MAC Control opcode (default 0x0001) time - PAUSE time (default 0) Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-10-04trafgen: l2: Add support for IEEE 802.3X PAUSE headerVadim Kochan3-0/+33
Add EEE802.3X Ethernet MAC Control PAUSE frame proto header with two fields - opcode & time. By default Ethernet header is pushed on header init. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-29all: fix build on CentOS 6 by checking presence of several macrosYousong Zhou4-1/+15
Protect usage of macros not present in pre-3.x kernels. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-29build: configure: fix checking CC containing -i optionYousong Zhou1-5/+12
On CentOS 6, the configure process may hang there reading stdin if the we have CC='gcc -isystem'. This can be reproduced with bash -c 'which gcc -i' Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-23man: trafgen: Fix link to Jesper's exampleVadim Kochan1-1/+1
The link: http://thread.gmane.org/gmane.linux.network/257155 does not work anymore, so replace it with another one at: https://marc.info/?l=linux-netdev&m=135903630614184 Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Suggested-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: man: Simplify example of Jasper's UDP packet by proto functionsVadim Kochan1-3/+3
Removed unneeded fields which are calcuated by default: <udp.len> <ipv4.len> <ipv4.proto> Fixed <ipv4.id> field by changing drnd(2) -> drnd() as proto field <drnd> function does not support bytes length value but randomizes specified field by its length. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: man: Add description for 'dinc' and 'drnd' field functionsVadim Kochan1-0/+43
Add explanation about 'drnd' and 'dinc' functions which might be used for proto field functions. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: parser: Add 'drnd()' function for proto fieldsVadim Kochan1-0/+9
Add syntax for specify dynamic random function for proto field: drnd() | drnd(min, max) EXAMPLE: { udp(sport=drnd()) } { udp(sport=drnd(1000, 2000)) } Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: parser: Add support of 'dinc' function for proto fieldsVadim Kochan1-0/+53
Add 'dinc()' function in 'field_expr' rules to be used for dynamically incrementing of any specified field: SYNTAX := dinc() | dinc(step) | dinc(min, max) | dinc(min, max, step) EXAMPLES: { udp(sport=dinc() } { udp(sport=dinc(1) } { udp(sport=dinc(100, 125, 5) } Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: parser: Unify proto field value parsingVadim Kochan3-147/+218
Changed parsing logic of field value expression to be more generic. Such approach will allow to easy extend field value expression to support dynamic field functions. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: tcp: Update csum at runtime if it neededVadim Kochan2-5/+17
Update TCP checksum field if any TCP of fields was changed. Use same checksum update function on 'packet_finish' and 'header update'. Set 'is_csum_valid = false' if lower IPv4/IPv6 pseudo header was changed. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: udp: Update csum at runtime if neededVadim Kochan2-8/+47
Update UDP csum field at runtime if: 1) UDP field was changed. 2) IPv4/6 source/destination addresses were changed (which is a part of UDP pseudo header), this is handled by IPv4/6 protocols. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: proto: Introduce proto_upper_header() functionVadim Kochan2-0/+13
Added proto_upper_header() function to fetch upper proto header. It will be used by IPv4/IPv6 proto header to notify UDP/TCP proto headers to invalidate L4 csum when L3 pseudo header field was changed. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: proto: Improve to find lower header by indexVadim Kochan2-14/+12
Extended struct proto_hdr with 'index' field which is used for faster lookup of lower header without doing a loop. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: icmpv6: Update csum at runtime if neededVadim Kochan1-13/+19
Use same function to calculate csum for packet_update and for packet_finish events. Allow update csum if one of the ICMPv6 fields was changed. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: icmpv4: Update csum at runtime if neededVadim Kochan1-4/+16
Update csum if any of the ICMPv4 field was changed. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: ipv4: Update csum at runtime if neededVadim Kochan2-6/+28
Handle 'field_changed' callback to check if IPv4 csum is needed to be recalculated, if so - update it on 'packet_update' event. Added 'is_csum_valid' to proto_hdr struct to check if csum needs to be updated. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: proto: Randomize proto field at runtimeVadim Kochan2-0/+28
Add dynamic proto field function which can generate random value in specified range (default 0 - MAX_UINT32). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: proto: Increment proto field at runtimeVadim Kochan2-0/+65
Implement incrementing of proto field at runtime with min & max parameters, by default if the 'min' parameter is not specified then original value is used. For fields which len is greater than 4 - last 4 bytes are incremented as 4 byte value (this trick is used to increment MAC/IPv6 addresses). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21trafgen: proto: Update field value at runtimeVadim Kochan4-0/+63
Add basic infrastructure for update proto field value at runtime by dynamic field function. Extended 'struct packet_dyn' with proto fields which has dynamically changing values at runtime. Added 'field_changed' callback for proto header which may be used for check if csum updating is needed. This callback is called after field was changed at runtime. Added 'packet_update' callback to let proto header know when to apply final proto header changes at runtime (e.g. - csum update). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-21mz: Check device argument by ifindex instead of name prefixVadim Kochan2-7/+7
Check device argument by valid ifindex instead of guessing it by different device name prefixes like "eth", "ath", "ens", "enp". Use __device_ifindex(...) function for this, which needs to add few more dependencies like sock.o, link.o to the Makefile for mausezahn. Closes #159 Suggested-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15build: configure: Add option to specify install path for /etc filesVadim Kochan1-0/+10
Add new '--sysconfdir=PREFIX' option to control installation of config files, files will be installed into PREFIX/etc path. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15build: configure: Add option to specify install path for binary filesVadim Kochan2-1/+26
Add new --prefix=PREFIX configure commandline option to specify installation directory for binaries. Add additional check in 'Cmds' file if --prefix was specified from 'configure' script, in that case required installation path components will be created automatically as it is done for 'make PREFIX=...' option. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15ui: Rename ui_table_row_print -> ui_table_row_col_setVadim Kochan3-25/+25
Really ui_table_row_print(x) no more prints anything, it just sets column value in a row. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15flowtop: Add horizontal scrolling over flows tableVadim Kochan3-19/+46
Add left/right scrolling for flows list table to make possible see all the columns with a smaller display size. Handle 'Left' & 'Right' keypress to scroll left or right. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15flowtop: Render table row via raw ncurses bufferVadim Kochan3-14/+86
Render each column to the ncurses raw buffer first, this buffer contains ncurses {char:attr} elements which will be printed to the screen after ui_table_row_show() will be called (at the end of columns rendering by flowtop). The reason of this change is to have easy way to make horizontal scrolling over this buffer. Approach is used from the 'htop' tool. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15ifpps: Prevent division by zeroTobias Klauser1-15/+25
Even though it's very unlikely we ever read zero values from the cpu lines in /proc/stat, we should still protect against division by zero. Detected using UBSan. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-09-15trafgen: proto: Initialize lower proto header pointer on declarationTobias Klauser1-6/+2
Assign the pointer to the lower layer header on declaration instead of a separate line. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-17build: configure: Add option to enable debug symbolsVadim Kochan2-1/+11
Add '--enable-debug' option to enable debugging symbols, the reason is to simplify it by ./configure it once and do not execute 'make DEBUG=1' each time for a long debug session. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-12trafgen: proto: Split static protocol definition out of struct proto_hdrTobias Klauser6-78/+83
Currently struct proto_hdr is used twofold: 1) Statically define protocol behavior, i.e. all the *_hdr definitions in trafgen_l{2,3,4}.c which map a protocol id/layer to a set of callback functions. 2) For each packet created at parse time the struct is memcpy()'ed (including all the static information from 1) and then used to store dynamic information at parse/run time. Thus, struct proto_hdr members such as the proto id, layer and the pointers callback functions get copied for each created packet (in addition to the other fields which get changed during parsing). Also, static/dynamic information get mixed and we e.g. can't make the protocol definitions const to ensure they'll not get changed by mistake. Rather than copying the struct proto_hdr for every packet, clearly separate the two purposes defined above by splitting struct proto_hdr into two structs: 1) struct proto_ops for the static (const) protocol behavior definition 2) struct proto_hdr (reduced) for dynamic information struct proto_hdr keeps a pointer to the corresponding proto_ops instance and uses it to execute the corresponding callbacks. Reference: https://groups.google.com/forum/#!msg/netsniff-ng/20RvwJdh50Y/eMkbmKSaBgAJ Acked-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-12colorize: Squash colorize macros into colors.hVadim Kochan3-9/+4
Move colorize_xxx macroes to colors.h, the reason is to have one file for coloring stuff and have less files in the source tree. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-10trafgen: proto: Add space between switch statement and opening parenthesisTobias Klauser2-3/+3
Follow common coding style and use: switch (...) instead of: switch(...) Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-10build: Disable all optimization options for debug buildsTobias Klauser1-8/+10
Disable all optimizations with the GCC -O0 switch. Only explicitely enable additional optimization options for non-debug builds. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-08-09trafgen: proto: Make bytes pointer const in proto field set functionsTobias Klauser3-6/+9
Make the __proto_field_set_bytes() take a const uint8_t *bytes pointer and also changed all callers accordingly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>