Age | Commit message (Collapse) | Author | Files | Lines |
|
If bpf file is not valid then cpp generated file is not
deleted because panic() func is invoked.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tk: Move exit label to the correct place]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Do not perform fclose for stdin fd.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Currently, the path to the configuration files is hardcoded to
$PREFIX/etc/netsniff-ng.
If we want to keep the configuration files outside of prefix (e.g.
during development), we need to pass the complete path as specified in
$ETCDIRE (and $ETCDIR respectively, which could e.g. be overriden on the
command line during build install) as a preprocessor define.
This way, we can e.g. install the configuration files to /etc while
installing the binaries in /usr/local with:
$ make PREFIX=/usr/local ETCDIR=/etc
$ make PREFIX=/usr/local ETCDIR=/etc install
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Check the return value of system() when invoking CPP in the BPF parser
and bail out in case of an error.
This fixes the following compiler warning:
bpf_parser.y:754:9: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
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>
|
|
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>
|
|
Do not necessarily define our own, only in case the Linux one is
not available.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
This functionality is available in the kernel, so make it also
available for use in bpfc.
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>
|
|
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>
|
|
This patch allows bpf programs to be passed to the C preprocessor
before handing over to bpfc. Example:
#define ETH_P_IP 0x800
ldh [12]
jne #ETH_P_IP, drop
ldb [23]
jneq #6, drop
ldh [20]
jset #0x1fff, drop
ldxb 4 * ([14] & 0xf)
ldh [x + 14]
jeq #0x16, pass
ldh [x + 16]
jne #0x16, drop
pass: ret #-1
drop: ret #0
Compile with: bpfc -i foo -p
Suggested-by: John Lange <JLange@trendium.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
|
|
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>
|
|
Add different bpf opcode pretty printer to support a variety of
output formats for netsniff-ng, xt_bpf, tcpdump, C-like and make
future integration of formats easier.
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>
|