Age | Commit message (Collapse) | Author | Files | Lines |
|
Verbose mode is a boolean option, so make the variable and parameters
carrying it of type bool.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This reverts commit bf0df3ec1875df4b167aedd0fff25e7e56408b6b.
It turns out, just checking for "." in the IPv4 source will prevent the
user from providing an FQDN (which is explicitely allowed and
supported). Also, an FQDN would be a valid argument for the IPv6 source,
so the check for ":" is also not sufficient.
Reference: #166
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Move the sockaddr_in definitions and preparations to the scope where
they're used, i.e. only if geoip is enabled and working.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
All tools (except mausezahn) use getopt_long() and pass a pointer to a
local opt_index variable for the longindex parameter. However, this
variable is never read afterwards.
According to getopt(3) it's perfectly fine to pass NULL as the longindex
parameter instead, so do that.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Currently, mausezahn fails silently if, say the user has specified
IPv6 addresses using `-A` and `-B` but has forgotten the -6
option. Add error handling for this and the (probably uncommon)
reverse case, i.e. v4 src/dst specified, but used with the -6 option.
Signed-off-by: Mandar Gokhale <mandarg@mandarg.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add Ken Wu for commit c4e07d5142 ("trafgen: l3: Support interface
without IP address"), submitted via PR #165
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Move default source address setting to packet_finish so that we do not
need to get the device's address if the source address is set in the
packet. Without this, trafgen does not work with an interface without
address configured. In addition, in the case failing to get the address
for an interface, intead of panic, it now prints a warning and uses a
value of 0.0.0.0.
Signed-off-by: Ken Wu <abawwu@gmail.com>
Reviewed-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
...and remove a superflous whitespace.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Missing definitions don't necessarily mean that certain tools won't be
built. There might just be reduced functionality (e.g. geoip missing
means still all tools will be compiled but they don't perform geoip
lookups).
Clearify the configure warning accordingly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
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>
|
|
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>
|
|
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>
|
|
Closes #162
Signed-off-by: Mandar Gokhale <mandarg@mandarg.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Closes #161
Signed-off-by: Mandar Gokhale <mandarg@mandarg.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Don't drop const qualifier during cast to uint32_t *
Found by compiling with -Wcast-qual.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Don't drop const qualifier during cast to void *
Found by compiling with -Wcast-qual.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Add explanation for 'pfc()' function parameters.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
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>
|
|
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>
|
|
Add explanation for PAUSE(802.3X) header fields.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|