summaryrefslogtreecommitdiff
path: root/bpf_parser.y
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2015-12-15 23:09:14 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-12-17 10:41:17 +0100
commit121119215276e645b358d7ce0593251f215920df (patch)
tree7d6c5a4d724d69d0cad54201f2d6b6f20d462339 /bpf_parser.y
parent6a310b07a1c5f73998fd0ff265d5701de04ab4f1 (diff)
bpfc: Add option to pass macro/define for C preprocessor
Add -D,--define option to pass macro/define for C preprocessor (e.g. to use #ifdef's within bpf file). Option allows to pass multiple -D,--define options. Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Diffstat (limited to 'bpf_parser.y')
-rw-r--r--bpf_parser.y6
1 files changed, 3 insertions, 3 deletions
diff --git a/bpf_parser.y b/bpf_parser.y
index 7331cc5..2c566a1 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -28,7 +28,7 @@
#include "cpp.h"
int compile_filter(char *file, int verbose, int bypass, int format,
- bool invoke_cpp);
+ bool invoke_cpp, char **cpp_argv);
static int curr_instr = 0;
@@ -735,7 +735,7 @@ static void pretty_printer(const struct sock_fprog *prog, int format)
}
int compile_filter(char *file, int verbose, int bypass, int format,
- bool invoke_cpp)
+ bool invoke_cpp, char **cpp_argv)
{
int i;
struct sock_fprog res;
@@ -745,7 +745,7 @@ int compile_filter(char *file, int verbose, int bypass, int format,
memset(tmp_file, 0, sizeof(tmp_file));
if (invoke_cpp) {
- ret = cpp_exec(file, tmp_file, sizeof(tmp_file), NULL);
+ ret = cpp_exec(file, tmp_file, sizeof(tmp_file), cpp_argv);
if (ret) {
fprintf(stderr, "Failed to invoke C preprocessor!\n");
goto exit;