Age | Commit message (Collapse) | Author | Files | Lines |
|
Use ARPHRD_ETHER for the "any" device, so that when typing "netsniff-ng"
without any arguments, ethernet is assumed.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Refactor ctx initialization and destruction into separate handlers.
That is more clean.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Invoke dev->type to pcap linktype mapper in order to write a correct
pcap file header for various link types. Also fix two bugs in pcap
file header parsing and print a warning with the magic link number in
case of an unknown link type.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Various fixes for last commit. Sorry for that.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Do not panic on linktypes that are unknown to us. Just skip the usual
dissector entry point and based on user input, print in hex, ascii, or
hex + ascii.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add a device_type() method to get the assigned dev->type from the
kernel, and add support for automatic selection of the correct pcap
file header's linktype. This needs to be integrated into the core
code though.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This adds basic linktype support for netlink "nlmon" devices.
Todo: we sill need to set the correct pcap type on capturing.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
As nlmon's device setup has now been changed to use rtnl link setup,
give a full example on how to setup and teardown nlmon devices.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
As per [1] we now also have an official hw device identifier for
Netlink. Add it to bpfc man page as we can capture from an nlmon
device.
[1] http://patchwork.ozlabs.org/patch/253293/
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Pull in the configure script. From now on, before calling 'make' the
'./configure' script will need to get called.
This is no autotools generated script, but manually written to check for
netsniff-ng's dependencies.
|
|
Actually call some functions in the check program so they will need to
get linked.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Check whether pkg-config and ccache are in the PATH. A missing
pkg-config will cause the configure script to abort with an error. The
presence of ccache is written to Config and used by the Makefile to
conditionally make use of it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Newer versions of GCC expect the linker flags after the object code, so
move the ouput of 'pkg-config --libs ncurses' there to not make the test
fail even if ncurses is present on the system.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In netsniff-ng, we use tpacketv3 for capturing-only mode. The issue
observed lately is that when using f.e. -n10 or capturing a pcap and
then quitting, the pcap or actually seen number of packets are less
than what the statistics tell us from getsockopt(2).
This is due to the fact that tpacketv3 divides its ring buffer into
blocks of frames. Meaning, while we are traversing block n, the kernel
already fills up block n+1 and following if new packets arrive. While
doing so, it increments packet counters. Thus, when we ^C, we haven't
seen those blocks, so the stats tell us mostly a slightly higher
result. Fix this by adjusting socket stats printing to this fact.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Recently, the nlmon device driver got accepted [1], so that it's now
possible to debug netlink traffic as well.
[1] http://thread.gmane.org/gmane.linux.network/273952
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
ncurses (de-)initialization is duplicated across flowtop and ifpps, so
move it to an own module and use it from both tools.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Check for some more libraries we make use of in the configure step.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Ignore the build config generated by the configure script.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Remove some trailing whitespaces from documentation.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In order to use an installation of NaCl provided by the distro or by
previous manual installation, provide a configure script which checks
for nacl's presence.
Also check of libnl-genl headers. More checks of the other libraries
depended on by netsniff-ng as well as checks for necessary kernel
headers should be added here too.
The configure script is preliminary and has not yet extensively been
tested on multiple systems.
The concept was inspired by the configure script of trinity and
iproute2.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Mark them as what is to be most expected.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
It's used as such, so therefore make it a bool instead of int.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add a colophon to the end of each man page.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Use explicit form to initialize array.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Make the code a bit simpler. Also use bool for the syslog_maybe
condition.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Simplify code a bit and mark error paths unlikely.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
If we fail to find the ifindex of a given device, bail out.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Do not necessarily define our own, only in case the Linux one is
not available.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
First destroy spinlocks, then free the encryption and decryption
buffers.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Facilitate allocation and destruction of crypto objects through
common helper functions.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Just some minor whitespacing arrangements.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This seems to have been corrupted. Must be crypto_box_beforenmbytes.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Simplify curve25519_encode() and curve25519_decode() transforms by making
the code more clear and by introducing macro accessors to nonces.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Simplify the function curve25519_proto_init() and also have minor
cleanups in other related ones.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
No need to prefix them with _buf, this just makes the names longer
and therefore less readable.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Fix the bug in "if (!entry == 0 && errno == ENOENT)" and also do some
cleanups, make the code more readable and remove useless stuff. Used
in curvetun.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
It's ridiculous to have a header comment here.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Mark some error paths as unlikely, and fixup some minor whitespace
issues. Nothing big to see here.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
We should also make this clear from the beginning that one can use
bpfc for seccomps as well. Might be interesting for security
researchers to play around with.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Just add a minor sentence to help stating this.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add the example in bpfc code from http://outflux.net/teach-seccomp/
to the man page, so that people can also experiment with seccomp
bpf and to demonstrate that there are no limits on bpfc when it
comes to this. Actually this code is even more efficient than the
one given in the example URL above.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Seccomp-BPF is used for syscall sandboxing. bpfc can also be used for
creating such filters without any problems.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
When we decode BPF extensions, add the missing opcode for poff.
While at it, also remove the '#' prefix, since it's optional in
bpfc.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Took quite a while to git bisect the cause for the wrong TCP checksum
in the -e example. It turned out that commit bf43e1993c7037 ("trafgen:
lexer: return original string if no shellcode") "broke" it, since
before that commit the TCP checksum from -e example was correct and
afterwards not anymore. Well, it didn't break it. What was happening
here is that with this fix above, the packet got 1 byte longer since
the first character of the example string is not omitted anymore,
therefore the checksum got wrong. Fix this by fixing the IP total
length of the packet in the -e and man page example. The UDP example
from the man page still works well if csumudp() is used, so not
affected of this.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
It seems not critical at this point, but lets check it for all offsets
here as well, and mark this check as unlikely to happen.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
In the current situation, it can happen when we set -n1, that no packet
at all will be scheduled. This is due to the case that nearbyint() will
for e.g. 2 cpus round to 0 each, and since in __correct_global_delta()
we only correct a total delta when a particular CPU is allowed to tx
packets (means already has a num > 0), then we correct the delta on the
first such CPU. Switch to using round(), so that on 0.5 it will be round
to the next higher int, and fix the check to >= 0 in __correct_global_delta()
so that a CPU could also get a 0 share of packets. I did a couple of tests
with different -n params and cpu(..) configs and this seems to fix that.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
That's the last man page where `` occurs, so fix this up by making it
consistentlt '' as the rest of all man pages.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Until now we didn't check the return value of set_sockopt_hwtimestamp()
and the Coverity scanner complained about it, so use it's return value
to report if timstamping is actually enabled in verbose mode.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|