Commit 58c7b4bb authored by Robert Ricci's avatar Robert Ricci

Belated checkin of a lot of new pcapper features. Highlights:

Event system:

When compiled with -DEVENTSYS, can be made to wait for time to start
in an experiment before starting to count packets. Times are also
reported relative to experiment time start. Use the '-e' flag to
enable.

SUID support:

If compiled with -DDROPROOT, and it seems that pcapper was started
setuid root (euid == 0, and ruid != 0), drops root permissions after
opening BPF (or raw socket in Linux.) This allows it get permissions
to read packets, but still be killed by the user. This is particularly
useful with the testbed's program objects.

New command-line options:

-s: Print out packet counts to stdout, in addition to listening
        on a socket ('-f -' does the same thing, too)
-p: Count only payload sizes, not header sizes
-e: Wait for event system time to start in pid/eid
-z: Don't count zero-length packets in the packet counts (useful
        with '-p')

Also, now creates a GNUmakefile the _right_ way.
parent abab0f6d
......@@ -1239,6 +1239,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
vis/top2png vis/render \
rc.d/GNUmakefile rc.d/2.mysql-server.sh rc.d/3.testbed.sh \
rc.d/cvsupd.sh rc.d/2.elvind.sh \
tools/pcapper/GNUmakefile \
$eventfiles \
apache/GNUmakefile apache/apache.conf "
......
......@@ -311,6 +311,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
vis/top2png vis/render \
rc.d/GNUmakefile rc.d/2.mysql-server.sh rc.d/3.testbed.sh \
rc.d/cvsupd.sh rc.d/2.elvind.sh \
tools/pcapper/GNUmakefile \
$eventfiles \
apache/GNUmakefile apache/apache.conf "
......
CPPFLAGS= -D_THREAD_SAFE -DEMULAB
CPPFLAGS_FREEBSD= $(CPPFLAGS) -I/usr/local/include/pthread/linuxthreads
CPPFLAGS_LINUX= $(CPPFLAGS) -I/usr/include/pcap
#CFLAGS=-pedantic -ansi -Wall -Werror
CFLAGS=-Wall
LDFLAGS= -lpcap -llthread -llgcc_r -L/usr/local/lib
all: pcapper
clean:
-rm pcapper pcapper.linux
pcapper: pcapper.c GNUmakefile
$(CC) $(CFLAGS) $(CPPFLAGS_FREEBSD) $(LDFLAGS) pcapper.c \
-o pcapper -lpcap
pcapper.linux: pcapper.c GNUmakefile
$(CC) $(CFLAGS) $(CPPFLAGS_LINUX) -L/usr/lib -lpthread -lpcap \
pcapper.c -o pcapper.linux -lpcap
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = tools/pcapper
include $(OBJDIR)/Makeconf
all: pcapper
include $(TESTBED_SRCDIR)/GNUmakerules
PTHREADCFLAGS = -D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads
PTHREADLIBS = -L/usr/local/lib -llthread -llgcc_r
ELVINFLAGS = `elvin-config --cflags vin4c`
ELVINLIBS = -L/usr/local/lib -lvin4c -lvin4 -lssl -lcrypto -lm
TBCFLAGS = -I$(TESTBED_SRCDIR)/event/lib -I$(TESTBED_SRCDIR)/lib/libtb
TBLIBS = $(OBJDIR)/event/lib/event.o $(OBJDIR)/event/lib/util.o \
$(OBJDIR)/lib/libtb/libtb.a
PCAPLIBS=-lpcap
CFLAGS = -Wall -static $(PTHREADCFLAGS) $(TBCFLAGS) $(ELVINFLAGS) \
-DEVENTSYS -DEMULAB -g -DDROPROOT -DBOSSNODE=\"@BOSSNODE@\"
LDFLAGS = -static
CFLAGS_FREEBSD = $(CFLAGS)
CLAGS_LINUX = $(CLAGS) -I/usr/include/pcap
LIBS = $(PTHREADLIBS) $(TBLIBS) $(ELVINLIBS) $(PCAPLIBS)
clean:
-rm pcapper pcapper.linux
pcapper: GNUmakefile pcapper.o
$(CC) $(LDFLAGS) $(CFLAGS_FREEBSD) pcapper.o $(LIBS) \
-o pcapper
cp pcapper pcapper.debug
strip pcapper
#
# Note: Building on Linux with the event system is mighty tricky
#
pcapper.linux: pcapper.c GNUmakefile
$(CC) $(CFLAGS) $(CPPFLAGS_LINUX) -L/usr/lib -lpthread -lpcap \
pcapper.c -o pcapper.linux -lpcap
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment