Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
Finally eliminate xutils.{c,h} and move the rest to epoll2.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Add an extra file for signal handling functions.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Remove them from xutils, and add them to socket management.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Move them out of xutils, so that we can maintain them separately.
Also simplify things a bit.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Again, also to be able to maintain this more easily.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Rename xio to ioops (io-ops) and boil its include files down to a
minimum.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Break this out so that we only need to have sigint non-static where
it is really needed.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Break out all string handling functions and lockme stuff in order
to further eliminate the big code blob in xutils, so that it can
be easier maintained.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Break out IRQ functionality from xutils, simplify it, and
save + restore IRQ affinity list.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Prepare TPACKET_V3 for allowing to transparently setting up the
frame structure such that we do not need to change much in the
netsniff-ng/trafgen code.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Include long version string into tools when called with --version.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
The entire packet is zeroed using memset() three lines above, thus there
is no need to set icmp->code and icmp->checksum to 0 explicitely again.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
The version() function was missed in the previous commit 785fe152
("trafgen: Add __noreturn attribute to exiting functions"), so add
__noreturn to it now.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add the __noreturn attribute to all functions which wont return
but call die() themselves to exit().
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Replace "on default" by "by default", make it a bit more clear what the
seed in the -E/--seed option is for and mention exit after display of
information on --version and --help.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
E.g. when executing trafgen on tap devices, trafgen will complain
that it is not up and running although it was brought up. Remove
this usability restriction and let the kernel decide if it may
send the packets or not.
Reported-by: Aimal Khan <aimal.khan98@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
If we unmap TX ring buffers and still have timer shots that trigger
the kernel to traverse the TX_RING, it can send out random crap in
some situations. Prevent this by destroying the timer and flush the
TX_RING first in wait mode.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
After commit f9591eebe40c (trafgen: lexer/parser: fix cpu() selection
and whitespacing), we also need to fixup the help description, so that
users start using the cpu(X-Y) notation instead. Also, reintroduce the
alias csum16 for csumip.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
When having a config like cpu(1): {...}, and one runs it with -n1, trafgen
behaves buggy, I also noted that in other situations. Fix this by letting
the loop also return on CPU state RES, and do not perform this stupid magic
in the main routine. So far it seems to work now after some basic tests I
did.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
Let us check the return value when the timer triggers a TX flush
request to the kernel. However, ignore the case of BADFS and NOBUFS.
The socket could already have been closed before the timer triggers
in the first case, and in the second, we just let the next timer
continue processing if currently the buffer space is exhausted.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
We decided to get rid of the old Git history and start a new one for
several reasons:
*) Allow / enforce only high-quality commits (which was not the case
for many commits in the history), have a policy that is more close
to the one from the Linux kernel. With high quality commits, we
mean code that is logically split into commits and commit messages
that are signed-off and have a proper subject and message body.
We do not allow automatic Github merges anymore, since they are
total bullshit. However, we will either cherry-pick your patches
or pull them manually.
*) The old archive was about ~27MB for no particular good reason.
This basically derived from the bad decision that also some PDF
files where stored there. From this moment onwards, no binary
objects are allowed to be stored in this repository anymore.
The old archive is not wiped away from the Internet. You will still
be able to find it, e.g. on git.cryptoism.org etc.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|