Age | Commit message (Collapse) | Author | Files | Lines |
|
The size of mmaped netlink packet is equals to its frame size, so
may be different from actual size. It can be checked by the next
nlmsg len is 0 or not, and trim it in that case.
Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
It would be better to use NLMSG_HDRLEN instead of sizeof(*hdr)
and not to use NLMSG_PAYLOAD to get payload length, I think.
Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Display them as K->U resp. U->K.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
Complete fix for Coverity issue CID 991822, commit 047d69c4e ("curvetun:
Fix issues detected by the Coverity scanner") only fixed one instance of
this issue.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix two issues detected by the Coverity scanner (CID 991819 & CID
991822)
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Bail out early if we fail to read the current sysctl variable values for
net/netfilter/nf_conntrack_acct and net/netfilter/nf_conntrack_timestamp
Otherwise we'll not be able restore the previous value on exit/panic.
Moreover, if we fail to read the sysctl file, we usually also lack the
permissions to write it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix typo timestampinf -> timestamping
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add short info about timestamping enabling & connection duration time
feature.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tklauser: Minor rewordings]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Allow setting start/stop timestamp for new flows by enabling:
/proc/sys/net/netfilter/nf_conntrack_timestamp
on start and resetting it on exit or panic.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tklauser: Remove unnecessary cast of void pointer]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Show flow time duration in human readable form.
Originally submitted by Vadim in a slightly different form.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Don't spread the information over too many documents, this is a first
step to consolidate them a bit.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Allow to collect rx stats for multiple pcap mode, by storing
them in separated variables before switch to the next pcap file.
It allows to have the one approach when dump for single or multiple
pcap(s) mode.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
When fixing up a build error introduced by commit 579e8524
("netsniff-ng: vlan: Show vlan info from tpacket v3"), the used
definitions got mixed up and TP_STATUS_VLAN_TPID_VALID ended up not
being checked at all. Fix this up and make the code a bit easier to read
Fixes: 3384ee71 ("netsniff-ng: ring: Fix build if tp_vlan_tpid is not available in kernel header")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Otherwise we clutter the build log with warnings such as:
tput: No value for $TERM and no -T specified
on head-less CI/build systems (e.g. Debian's buildd).
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Except for some minor saving in disk space, stripping the binaries
doesn't bring any benefits and it might prevent us from getting usable
debugging information even from binaries build with DEBUG not set. Most
distributions will strip the binaries as part of their packaging process
anyhow.
If someone really wants stripped binaries as a result of the netsniff-ng
build, they could still add '-s' to CFLAGS or call strip manually.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
s/coul/could/
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Otherwise nacl will not get picked up when cross-compiling.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
This fixes the following errors when running configure e.g. inside the
OpenEmbedded environment:
./configure: line 23: [: too many arguments
./configure: line 24: [: i586-oe-linux-ld: binary operator expected
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The tp_vlan_tpid member of struct tpacket_auxdata was only added in
kernel commit a0cdfcf39362 ("packet: deliver VLAN TPID to userspace").
Support building netsniff-ng also against kernel headers from earlier
versions.
Fixes: 579e8524 ("netsniff-ng: vlan: Show vlan info from tpacket v3")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Show vlan info (vid, prio & proto) from tpacket struct, in separated
line. It might be useful to sniff it in case if vlan reordering is on
(which is by default) and physical (vlan underlying) device supports
vlan offloading.
Meanwhile it uses only v3 tpacket info as location of vlan fields are
different between v2 & v3 (v1 does not have it at all), but current code
only has possibility to check if v3 is used which is not enough.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[ tk: make print format consistent with VLAN dissector ]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add proto_vlan.h with helpers to parse VLAN fields.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add some people to the minor contributors list who were previously
missing. Also sort the list alphabetically to make it easier to keep the
list up to date.
Also move Vadim one position up in the major contributors list according
to the current commit count.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead of creating an additional struct flow_entry on the stack just to
use the CP_NFCT macros, call nfct_get_attr_u16() directly.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The tprintf module isn't used in flowtop, no need to link it in.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Commit da8fcdd7 ("netsniff-ng: Add cooked cmdline option.") added the
-w/--cooked command line option but didn't add it to the zsh
completition. Do so now.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Show byte/packet counters in the same colors as their direction:
- src in red
- dst in blue
so it will be easiser to identify them by direction.
Also unifed counters printing in one function and changed counters
naming similar to other *_src members of flow_entry struct.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tklauser: Reverted to using parentheses in printed message]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
We should get faster builds by using their new infrastructure.
Reference: http://docs.travis-ci.com/user/migrating-from-legacy/
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fixes curvetun build failure due to undefined reference to
sysctl_get_int in sock.o.
[...]
LD curvetun
curvetun/sock.o: In function `set_system_socket_mem.part.0':
sock.c:(.text+0xc0): undefined reference to `sysctl_set_int'
curvetun/sock.o: In function `set_system_socket_memory':
sock.c:(.text+0x4dd): undefined reference to `sysctl_get_int'
sock.c:(.text+0x505): undefined reference to `sysctl_get_int'
sock.c:(.text+0x52e): undefined reference to `sysctl_get_int'
sock.c:(.text+0x54f): undefined reference to `sysctl_get_int'
collect2: error: ld returned 1 exit status
Signed-off-by: Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Just ignore DNS flows instead of insert it and then
filter it out by presenter.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Do not do reverse DNS for src hostname if '-s' option
is not specified.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Don't hide status bar line when dumping flows but
print "[Collecting flows ...]" on the same line.
Really there is no sense to hide this status bar line.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
If a non-privileged user opens a pcap file then netsniff-ng tries to setup
socket memory which causes warnings about failing because of permissions.
So don't tune socket memory in pcap-read-only mode.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add some explanation about traffic counters enabling via
sysctl and its limitation.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tklauser: Reword some sentences]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Show bytes/pkts counters per src/dst direction. By default counters
originated from dst are showed. Src counters are showed only if '-s' is
specified.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Get rid of flushing connections which resets all counters.
Use dump whole ipv4/ipv6 connection tables to fullfill the existing
flows, but this needs to use hand-made flow filtering because
nfct_filter does not work when we do NFCT_Q_DUMP.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Rename collector_cb to reflect behaviour such as catching flow events.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Rename ct_dump variable & update_cb function so they reflect 'updating'
of a particular flow at runtime.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Move creating nfct filter to separate function to make collector() less
messy.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
When getting of the initial values fails in set_system_socket_memory(),
we store -1 for the values. Avoid writing these back (and causing an
error message) when calling reset_system_socket_memory().
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead print an error message including some more details. netsniff-ng
should still remain funcional without the socket sysctl values being
set.
Suggested-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Rename SYS_PATH to SYSCTL_PROC_PATH and make it available in sysctl.h
such that it can be used e.g. in error messages.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Avoid including linux specific headers if possible.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
There might be new fast connection between flush &
handling new events which can be not handled,
so put flushing connections before loop.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The city_{src,dst}, country_{src,dst} and rev_dns_{src,dst} members of
struct flow_entry have their size defined at compile time, so perform
the equal size checks at compile time as well.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Seems it was caused by specifying all netfilter groups
when flushing connections.
Used separated nfct instance w/o netfilter groups to
flush ipv4/ipv6 connections.
More info can be fetched from the issue item on github:
https://github.com/netsniff-ng/netsniff-ng/issues/145
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
Clean up ncurses screen when panic was caused. There will be limitation
that error message will be printed on stderr after ncurses cleanup, so
it will be needed now to use redirect to error file ...
ifpps -d <dev> 2> /tmp/err
... to see error message.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
Add match device name with "_" in /proc/net/dev.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
'G' should be printed when bytes > 1000000000 but
it was printed with 'M' prefix which was caused
by missing 'else'.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
Replace n & tmp variables to more understandable prev & next.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
Rename tcp -> is_tcp param and change it to bool.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|