Skip to content

Commit

Permalink
Merge pull request #6 from ates/pfring
Browse files Browse the repository at this point in the history
PF_RING support
  • Loading branch information
msantos committed Oct 3, 2012
2 parents c441255 + 5b279e4 commit 8f12f9b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -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 ===
Expand Down
8 changes: 5 additions & 3 deletions rebar.config
Expand Up @@ -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"}}
]}.
]}.
17 changes: 17 additions & 0 deletions 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.

0 comments on commit 8f12f9b

Please sign in to comment.