bpfc: filter: add poff ancillary operation

In preparation for [1], add the #poff operation, so that users can
dynamically truncate packets on the payload start offset. This is
useful for several reasons: privacy, speed, ...

Example for bpfc:

  ld #poff
  ret a

  [1] http://thread.gmane.org/gmane.linux.network/262512

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
ring: first unmap, then destroy ring buffer

In both, the RX_RING and TX_RING we need to unmap first and then destroy
the buffer, otherwise, we get a device or resource busy.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen: fix bug in packet scheduling

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>
trafgen: lexer/parser: fix cpu() selection and whitespacing

It looks unintuitive when once needs to write cpu(0:3), so also allow
cpu(0-3). Then it's quite stupid to enforce whitespace after the double
colon before the curley braces open. So make this rather optional here.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen: parser: add possibility for negative numbers

The previous commit reduced it, so now we allow it within cX() containers
in order to negate a result, if someone needs that.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen: update help description

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>
trafgen: lexer: return if no needle found

Also return if no needle has been found in the shell code haystack.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
trafgen: parser: do not enforce whitesapce

Do not enforce whitespace at the beginning or end of a packet
configuration, there's no reason to do so.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
ring: purge timer before we unmap tx ring buffers

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>
make: when mrproper, also remove Git tree unrelated files

When we really clean up everything, also remove crap files that do
not belong to the Git tree.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
make: also credit involved people in mail message

Still untested, since we did not yet tag a release, but for now,
also credit all involved people in a particular release.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: add ifpps.8 man page

Finally I found some time and started writing man pages. This is a
first one in a series of man pages for all tools.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
netsniff-ng: also capture if NIC is currently down

There is actually no reason why netsniff-ng should fail if the NIC is
down at startup. We still can setup everything and already capture at
the time it goes up. This might be useful when replugging cables on
servers, for instance.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: man page updates for bpfc, curvetun

These are the writings so far. For sure they are not yet finished, so
I will push updates for both of them as soon as possible, but for now
this is a first version people can start to read.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: finish bpfc man page

This patch adds BPF architecture and instruction description with
supported Linux extensions. Also, essential bpfc examples are given.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: start netsniff-ng.8 man page

Not yet finished, but it already contains some useful example
descriptions and notes for tuning. More to come very soon.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: netsniff-ng: finish usage examples and add filter examples

The usage examples are good so far. Most of the things one needs
to know. Also, add a short howto on how to use bpfc filtering or
pcap-like high-level filters.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: netsniff-ng: add description paragraph and some options

This patch continues on the netsniff-ng man page. It adds a program
description and documents some options, not yet all. More to come.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: finish netsniff-ng man page

Fill in the rest of the gaps for this man page.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
man: ifpps: add bugs section

Add a section of known bugs/todos for bpfc.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>