Skip to content
This repository
Browse code

Merge pull request #6 from ates/pfring

PF_RING support
  • Loading branch information...
commit 8f12f9b86c85b5f51c08f82cc00cf366f75d5322 2 parents c441255 + 5b279e4
Michael Santos authored

Showing 3 changed files with 33 additions and 3 deletions. Show diff stats Hide diff stats

  1. +11 0 README.md
  2. +5 3 rebar.config
  3. +17 0 rebar.config.script
11 README.md
Source Rendered
@@ -60,6 +60,17 @@ epcap includes a small example program called sniff.
60 60 The Packet is a binary holding the captured data.
61 61
62 62
  63 +## PF_RING
  64 +
  65 + In case you want to compile epcap with PF_RING support,
  66 + just specify the path to the libpfring and modified libpcap libraries
  67 + via shell variable PFRING.
  68 +
  69 + PFRING=/home/user/pfring make
  70 +
  71 + As a result epcap binary will be linked with the following flags: -static -lpfring -lpthread
  72 +
  73 +
63 74 ## SCREENSHOT
64 75
65 76 =INFO REPORT==== 6-Jan-2010::20:35:18 ===
8 rebar.config
@@ -2,10 +2,12 @@
2 2 {"EXE_LDFLAGS", "-lpcap $ERL_LDFLAGS"},
3 3 {"linux", "EXE_CFLAGS", "$EXE_CFLAGS -DEPCAP_RLIMIT_NOFILES=1"},
4 4 {"solaris", "EXE_CFLAGS", "$EXE_CFLAGS -DEPCAP_RLIMIT_NOFILES=1"}
5   - ]}.
  5 +]}.
  6 +
6 7 {port_specs, [
7 8 {"priv/epcap", ["c_src/epcap.c", "c_src/epcap_priv.c"]}
8   - ]}.
  9 +]}.
  10 +
9 11 {deps, [
10 12 {pkt, ".*", {git, "https://github.com/msantos/pkt.git", "master"}}
11   - ]}.
  13 +]}.
17 rebar.config.script
... ... @@ -0,0 +1,17 @@
  1 +case os:getenv("PFRING") of
  2 + false ->
  3 + CONFIG;
  4 + Value ->
  5 + case filelib:is_dir(Value) of
  6 + true ->
  7 + case lists:keysearch(port_env, 1, CONFIG) of
  8 + {value, {port_env, Flags}} ->
  9 + {"EXE_LDFLAGS", LDFLAGS} = hd(Flags),
  10 + NewFlags = LDFLAGS ++ " -static -L " ++ Value ++ " -lpfring -lpthread",
  11 + NewLDFLAGS = lists:keyreplace("EXE_LDFLAGS", 1, Flags, {"EXE_LDFLAGS", NewFlags}),
  12 + lists:keyreplace(port_env, 1, CONFIG, {port_env, NewLDFLAGS});
  13 + _ -> CONFIG
  14 + end;
  15 + _ -> CONFIG
  16 + end
  17 +end.

0 comments on commit 8f12f9b

Please sign in to comment.
Something went wrong with that request. Please try again.