Age | Commit message (Collapse) | Author | Files | Lines |
|
Get rid of inner loop in fast path. This simplifies code and readability.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
We still have to get curvetun and mausezahn in line with the rest
of the landscape, as they are not ready and in a quality we wish
they would be. Therefore, mark and document them as experiemental
for now until they are fixed up.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Nothing changes in that regard, Tobias and myself are both maintaining
and continue to do so on one and the same level. Tobias does an awesome
job, so this should be credited to him right here!
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Combine multiple likely conditions into one.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The line rate is given in Mbit rather than MiB (in which {rx,tx}_bytes
were converted). Correct the calculation by converting {rx,tx}_bytes to
Mbit:
(n bytes * 8 bits per byte) / 1000^2 = (n bytes) / 125000
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Let a and x register also be addressed as %x and %a.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add an entry for autocompletion support.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add a man page entry for the new -P option.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
In order to not to clutter the display too much, make the display of the
percentage of the theoretical line rate dependent on a command line
option.
Suggested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Also show the percentage of the (theoretical) line rate, not just the
current rate.
Suggested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Instead of issuing another call to device_bitrate(), reuse the the value
acquired in screen_update() and pass it to screen_header().
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
For consistency, allow for '#' prefix in numbers, which we currently
do not do. So keep old mode as compatibility to not break current
programs, and add new one with '#' prefix.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The struct stat is filled by the call to stat(2) in the next line, so
there is no need to explicitely set it to 0 before.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a note to the man-page that there's a other tool that is unrelated
to netsniff-ng.
Signed-off-by: Jon Schipp <jonschipp@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Instead of using goto, just check stats if stat() returned 0 and used
ctx->dump_dir afterwards. This makes the logic a bit easier to follow.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
We don't use the IRQ number we read from /proc/interrupts, so just skip
it while reading. This also allows us to drop the irq_nr member from
struct ifstat.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
In case the interface ifpps is running on went down, ifpps bugged out
because the stats didn't look plausible anymore, due to the IRQ count
being reset:
ifpps: ifpps.c:563: stats_diff: Assertion `!((new->irqs[i] - old->irqs[i]) > (new->irqs[i]))' failed
Fix this by setting the difference to 0 in this case. ifpps will thus
display a irqs/t value of 0 instead of bugging out.
This fixes #74.
Reported-by: Jon Schipp <jonschipp@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The number of CPUs can never be negative and get_number_cpus() returns
unsigned int too, so consistently conver all variables holding a CPU
number or number of CPUs to type unsigned int.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Update OUI entries using oui-update.py
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
s/Eror/Error/
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
We also need to add a v prefix for the version tag to the checkout
command, as similarly done for the GPG verification.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Kevin says:
With netsniff-ng 0.5.8-rc2+, when I run the below packet capture
session, the output seems to imply that 64K of memory is being
allocated per frame, which does not look like what I want since my
interface MTU is only 1500. This appears to be severely limiting
the number of frames I can fit into my packet capture ring.
As TPACKET_V3 is used in capturing to pcap files, frames are written
continuously to the ring, thus the above will give a wrong impression
to the user. Therefore, output such information in verbose mode
differently when TPACKET_V3 is being used, as it works block-wise.
Reported-by: Kevin Branch <branchnetconsulting@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The tags created by the 'release' target have a 'v' prefix, so add it to
the verification command mentioned in the generated release message.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Make sure all messages use a max. text width of 70 characters (in order
for them to be easily pasteable into an email), remove a trailing
whitespace and reword some bits.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add an auto-completion entry for commit 5e739 ("astraceroute: Support
binding to a specific IP address.")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Oliver Smith <oliver@zerolag.com>
|
|
In a situation where the IP that you wish to use as the source address
differs from the interface it needs to be sent from, it is now possible
to manually specify an address to bind to whilst still being able to
specify the physical interface to send from.
[Fixed up whitespace, minor coding style and added man-page entry --DB]
Signed-off-by: Oliver Smith <oliver@zerolag.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
On machines like RHEL6 that do not have support for TPACKET_V3, we
should still allow at least trafgen to be built for network testing.
Thus, do something useful with the TPACKET_V3 configure check and
comment out in ring.h relevant structures.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
When signal occurs, don't panic on EINTR, rather gracefully return.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Even though the loop contains only one statement, add parentheses around
it to make it more readable.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add a Makefile target to build and upload a snapshot of netsniff-ng to
the Coverity scanner. The variables COV_EMAIL and COV_PASSWD need to be
set accordingly:
make coverity COV_EMAIL=tklauser@distanz.ch COV_PASSWD=...
Currently the sub-make which is part of the cov-built call issues
warnings about undefined variables from the template. This can be
ignored, the build works just fine.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The return value of two calls to poll() are never check, despite the
(unlikely) possibility of them returning an error, fix it by checking
the return value and panic()ing on error.
This issue was discovered using the Coverity scanner.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":
trafgen.c: In function ‘timer_elapsed’:
trafgen.c:136:31: warning: unused parameter ‘number’ [-Wunused-parameter]
trafgen.c: In function ‘apply_csum16’:
trafgen.c:346:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘dump_trafgen_snippet’:
trafgen.c:415:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘xmit_smoke_probe’:
trafgen.c:490:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:506:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:509:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:512:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘__wait_and_sum_others’:
trafgen.c:721:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘__correct_global_delta’:
trafgen.c:743:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:761:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘xmit_packet_precheck’:
trafgen.c:797:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:816:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘main_loop’:
trafgen.c:837:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c: In function ‘main’:
trafgen.c:1047:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:1065:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:1078:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
trafgen.c:1090:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":
proto_icmpv6.c: In function ‘dissect_icmpv6_mcast_rec’:
proto_icmpv6.c:326:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_15’:
proto_icmpv6.c:537:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c:542:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_16’:
proto_icmpv6.c:604:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_17’:
proto_icmpv6.c:650:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":
cpusched.c: In function ‘get_appropriate_cpu’:
cpusched.c:28:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
cpusched.c:29:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warning that occurs when building with "-W
-Wall -Wextra":
rnd.c: In function ‘randombytes_strong’:
rnd.c:50:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Change parameter type for the length to size_t since this is what is
passed to them and is expected by read_exact().
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix two signed/unsigned comparison warnings by changing variable types.
Fix warnings about unused parameters by removing all of the
unimplemented functions and replacing them with one *_unimplemented()
function.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Mark unused parameters with __maybe_unused in order to prevent
-Wunused-parameter compiler warnings.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warning that occurs when building with "-W
-Wall -Wextra":
pcap_io.h: In function ‘pcap_prepare_header’:
pcap_io.h:628:255: warning: signed and unsigned type in conditional expression [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":
pcap_mm.c: In function ‘pcap_mm_read’:
pcap_mm.c:72:73: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
pcap_mm.c:79:72: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":
pcap_rw.c: In function ‘pcap_rw_write’:
pcap_rw.c:30:6: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
pcap_rw.c: In function ‘pcap_rw_read’:
pcap_rw.c:50:6: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Since entering/leaving promiscuous mode also is a device specific
function and all users of the `promisc' module also use `dev', integrate
it there. Also rename the functions to have a `device_' prefix like the
other functions in the module.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The parameter `ifname' to {enter,leave}_promiscuous_mode() is never
modified inside the functions, thus mark it as const.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warning that occurs when building with "-W
-Wall -Wextra":
ip_authentication_hdr.c: In function ‘auth_hdr’:
proto_ip_authentication_hdr.c:57:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Also remove an unnecessary check for header length smaller than 0, since
it always results from an unsigned type and is now a size_t anyway.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warning that occurs when building with "-W
-Wall -Wextra" by introducing a cast:
netsniff-ng.c: In function ‘walk_t3_block’:
netsniff-ng.c:841:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Compiling with "-W -Wall -Wextra" reveals the following warnings in
mac80211.c:
mac80211.c: In function ‘nl80211_init’:
mac80211.c:78:67: warning: unused parameter ‘device’ [-Wunused-parameter]
mac80211.c: In function ‘nl80211_wait_handler’:
mac80211.c:106:48: warning: unused parameter ‘msg’ [-Wunused-parameter]
mac80211.c: In function ‘nl80211_error_handler’:
mac80211.c:115:54: warning: unused parameter ‘nla’ [-Wunused-parameter]
mac80211.c:117:12: warning: unused parameter ‘arg’ [-Wunused-parameter]
mac80211.c: In function ‘nl80211_del_mon_if’:
mac80211.c:181:72: warning: unused parameter ‘device’ [-Wunused-parameter]
Fix them by either marking them as unused (where we need to conform to
library APIs or remove them alltogether (for our own APIs). For the
function leave_rfmon_mac80211() the according users (netsniff-ng and
trafgen) are also changed.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":
astraceroute.c: In function ‘__assemble_data’:
astraceroute.c:255:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c:262:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c: In function ‘check_ipv4’:
astraceroute.c:425:56: warning: unused parameter ‘ttl’ [-Wunused-parameter]
astraceroute.c: In function ‘handle_ipv4’:
astraceroute.c:451:49: warning: unused parameter ‘len’ [-Wunused-parameter]
astraceroute.c: In function ‘check_ipv6’:
astraceroute.c:511:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c:491:56: warning: unused parameter ‘ttl’ [-Wunused-parameter]
astraceroute.c: In function ‘handle_ipv6’:
astraceroute.c:517:49: warning: unused parameter ‘len’ [-Wunused-parameter]
astraceroute.c: In function ‘__process_node’:
astraceroute.c:690:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c: In function ‘__process_time’:
astraceroute.c:738:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c:755:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c:765:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c: In function ‘__process_ttl’:
astraceroute.c:846:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
astraceroute.c: In function ‘main’:
astraceroute.c:1060:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
We don't return negative values and the MTU is supposed to be the
(maximum) length of a packet, thus make it of type size_t. Most of the
users in the code store it in size_t already anyway.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Packet lengths are strictly positive and the functions dealing with them
(sendto(), recvfrom() etc.) take size_t, thus use size_t.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|