From 0b8a5af19b866b9949bfc9bfcc1c63410f61afdc Mon Sep 17 00:00:00 2001 From: Artem Teslenko Date: Tue, 2 Oct 2012 10:55:44 +0200 Subject: [PATCH 1/4] Add possibility to compile epcap with PF_RING --- rebar.config.script | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 rebar.config.script diff --git a/rebar.config.script b/rebar.config.script new file mode 100644 index 0000000..277c9ef --- /dev/null +++ b/rebar.config.script @@ -0,0 +1,17 @@ +case os:getenv("PFRING") of + false -> + CONFIG; + Value -> + case filelib:is_dir(Value) of + true -> + case lists:keysearch(port_env, 1, CONFIG) of + {value, {port_env, Flags}} -> + {"EXE_LDFLAGS", LDFLAGS} = hd(Flags), + NewFlags = LDFLAGS ++ " -static -L " ++ Value ++ " -lpfring -lpthread", + NewLDFLAGS = lists:keyreplace("EXE_LDFLAGS", 1, Flags, {"EXE_LDFLAGS", NewFlags}), + lists:keyreplace(port_env, 1, CONFIG, {port_env, NewLDFLAGS}); + _ -> CONFIG + end; + _ -> CONFIG + end +end. From fa8c364186718f375131128dddc72f1715b08255 Mon Sep 17 00:00:00 2001 From: Artem Teslenko Date: Tue, 2 Oct 2012 15:21:28 +0200 Subject: [PATCH 2/4] Fix formatting --- rebar.config | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rebar.config b/rebar.config index 7a1ac27..690e219 100644 --- a/rebar.config +++ b/rebar.config @@ -2,10 +2,12 @@ {"EXE_LDFLAGS", "-lpcap $ERL_LDFLAGS"}, {"linux", "EXE_CFLAGS", "$EXE_CFLAGS -DEPCAP_RLIMIT_NOFILES=1"}, {"solaris", "EXE_CFLAGS", "$EXE_CFLAGS -DEPCAP_RLIMIT_NOFILES=1"} - ]}. +]}. + {port_specs, [ {"priv/epcap", ["c_src/epcap.c", "c_src/epcap_priv.c"]} - ]}. +]}. + {deps, [ {pkt, ".*", {git, "https://github.com/msantos/pkt.git", "master"}} - ]}. +]}. From f1a01092e929bb1579f8118ca290084c901b02ec Mon Sep 17 00:00:00 2001 From: Artem Teslenko Date: Wed, 3 Oct 2012 11:51:12 +0200 Subject: [PATCH 3/4] Update README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index e3d5e46..507eabe 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,17 @@ epcap includes a small example program called sniff. The Packet is a binary holding the captured data. +## PF_RING + + In case you want to compile epcap with PF_RING support, + just specify the path to the libpfring and modified libpcap + via shell variable PFRING. + + PFRING=/home/user/pfring make + + As a result epcap binary will be linked with the following flags: -static -lpfring -lpthread + + ## SCREENSHOT =INFO REPORT==== 6-Jan-2010::20:35:18 === From 5b279e4bd8b0ec3082c690d0c7d58a8ac81fe8a8 Mon Sep 17 00:00:00 2001 From: Artem Teslenko Date: Wed, 3 Oct 2012 11:52:35 +0200 Subject: [PATCH 4/4] Fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 507eabe..929371c 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ epcap includes a small example program called sniff. ## PF_RING In case you want to compile epcap with PF_RING support, - just specify the path to the libpfring and modified libpcap + just specify the path to the libpfring and modified libpcap libraries via shell variable PFRING. PFRING=/home/user/pfring make