Age | Commit message (Collapse) | Author | Files | Lines |
|
Use 'kbit' instead of kBit in usage and manpage to actually reflect what
trafgen expects.
Fixes: 9ece0fe02096 ("trafgen: Add option to specify packets sending rate")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Added -b,--rate option in units of:
pps/B/kB/MB/kBit/Mbit/Gbit/KiB/MiB/GiB
to specify rate at which packets will be sent.
Similarly to -t,--gap option the packets will be sent
in slow mode with 1 CPU.
Tested with ifpps.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
gzip from busybox does not understand the '--best' command line option.
Use '-9' instead which is understood by all gzip flavours (checked with
GNU, BSD and busybox).
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Reset do_reload_flows flag before dump flows. It allows to change
filter state more dynamically
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Show 'Active' filter status if 'a' was pressed.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Show family name in the filter status line.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add zsh completion for -D/--define command line option added in commit
126e0038a73b ("trafgen: Added option to pass macro/define for C
preprocessor")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add zsh completion for -D/--define command line option added in commit
121119215276 ("bpfc: Add option to pass macro/define for C
preprocessor")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Pass argv as char *const argv[] as execvp expects it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add -D,--define option which allows to pass multiple
macro/defines which can be used in trafgen script
(e.g. by #ifdef ).
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add -D,--define option to pass macro/define for C preprocessor
(e.g. to use #ifdef's within bpf file). Option allows to pass
multiple -D,--define options.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
|
|
Add argv_insert function to dynamically insert string
into argv list.
Also added argv_free func to easy free dynamically allocated
argv list.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Extend cpp_exec function with args parameter to
specify additional cpp options (like -D).
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Replace 'system' call by proc_exec function from proc.c
module. It allows to easy extend cpp invoking with additional
options (like -D) in more secure way.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add proc_exec function which executes given process with
argv list via fork + execvp.
It allows to replace 'system' call approach which is used
for invoking cpp and securely extend it with additional options
like -D.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The sd_len member of struct ctx stores a copy of struct addrinfo member
ai_addrlen which is of type socklen_t. Also it is used in a sendto()
call which also expects a socklen_t. Adjust sd_len to be socklen_t too.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The zsh completion of trafgen is missing a backspace after the -t/--gap
option which leads to the completion not working correctly. Fix it.
Signed-off-by: Tobias Klauser <tobias.klauser@zhinst.com>
|
|
The URL and one form name for the coverity scanner changed, adjust our
coverity target accordingly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Ensure a stable link order independent of the configured locale in order
to make the build reproducible.
Patch from Reiner Herrmann, submitted via the Debian Bug Tracker
(#806547).
Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806547
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Remove empty lines in switch/case after break in genl_print_ctrl_attrs
to be consistent with coding style in the rest of the file.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Dump Generic netlink ops & mcast groups nested attributes.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Follow 3f2f363485d3 ("trafgen: Make sure yyin is set before close it")
and check the yyin pointer against NULL before attempting to call
fclose() with it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In case if cpp failed then it is possible that trafgen
may hang on closing uninitialized yyin.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
No need to duplicate the call to preprocess_packets(), just call it
directly after compile_packets()/compile_packets_str().
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
There might be a case when input file is located
in read-only directory and cpp fails when it tries to
create output file there, so use /tmp folder for that
as usually it should be writeable for any user.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Use cpp_exec func to invoke C preprocesor.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Use cpp_exec func from cpp.c module to invoke C preprocessor.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add cpp_exec func to invoke C preprocessor
which allow to change the logic in one place only.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add U/T/I/D/S runtime commands (same like for command line)
to filter flows by UDP/TCP/ICMP/DCCP/SCTP proto.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add Ken-ichirou MATSUZAWA and Martin Hauke to the list of contributors.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
If bpf file is not valid then cpp generated file is not
deleted because panic() func is invoked.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tk: Move exit label to the correct place]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Do not print rtnl message if there is only nlmsg header, which is happen
when dump all rtnl table.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Rename attr_fmt to rta_fmt as it uses rtattr struct.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add dissection of basic Netlink Generic Controller family info.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Print not handled attributes which will be helpful to
indicate such attributes and add dissection code.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add header bar to be symmetric to the footer.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Make __do_lookup_inline an inline function and shorten its name to
__lookup_inline.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
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>
|
|
Make sure every lookup table is only initialized once. Preparatory patch
before moving OUI lookup.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|