Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6 from ates/pfring

PF_RING support
  • Loading branch information...
commit 8f12f9b86c85b5f51c08f82cc00cf366f75d5322 2 parents c441255 + 5b279e4
@msantos authored
Showing with 33 additions and 3 deletions.
  1. +11 −0 README.md
  2. +5 −3 rebar.config
  3. +17 −0 rebar.config.script
View
11 README.md
@@ -60,6 +60,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 libraries
+ 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 ===
View
8 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"}}
- ]}.
+]}.
View
17 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.
Please sign in to comment.
Something went wrong with that request. Please try again.