summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2020-12-15 15:23:07 +0300
committerVladimir Homutov <vl@nginx.com>2020-12-15 15:23:07 +0300
commitb20b58ca7d1323664c5e8f91231ade0edf0d0f31 (patch)
tree905836ac882ea9868241dc4d553885db230f99ff /auto
parentfb655007a110e3bfd4e8eaba8b401d67fb283a9a (diff)
downloadnginx-b20b58ca7d1323664c5e8f91231ade0edf0d0f31.tar.gz
nginx-b20b58ca7d1323664c5e8f91231ade0edf0d0f31.tar.bz2
Core: added interface to linux bpf() system call.
It contains wrappers for operations with BPF maps and for loading BPF programs.
Diffstat (limited to 'auto')
-rw-r--r--auto/options2
-rw-r--r--auto/os/linux26
2 files changed, 28 insertions, 0 deletions
diff --git a/auto/options b/auto/options
index fc4365ed3..ad3583058 100644
--- a/auto/options
+++ b/auto/options
@@ -169,6 +169,8 @@ USE_GEOIP=NO
NGX_GOOGLE_PERFTOOLS=NO
NGX_CPP_TEST=NO
+BPF_FOUND=NO
+
NGX_LIBATOMIC=NO
NGX_CPU_CACHE_LINE=
diff --git a/auto/os/linux b/auto/os/linux
index 5e280eca7..f257d1afe 100644
--- a/auto/os/linux
+++ b/auto/os/linux
@@ -208,3 +208,29 @@ ngx_include="sys/vfs.h"; . auto/include
CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
+
+
+# (E)BPF
+
+ngx_feature="BPF support"
+ngx_feature_name="NGX_HAVE_BPF"
+ngx_feature_run=no
+ngx_feature_incs="#include <linux/bpf.h>
+ #include <sys/syscall.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="
+ union bpf_attr attr = { 0 };
+ /* only declare BPF support if all required features found */
+ attr.map_flags = 0;
+ attr.map_type = BPF_MAP_TYPE_SOCKHASH;
+ syscall(__NR_bpf, 0, &attr, 0);"
+
+. auto/feature
+
+if [ $ngx_found = yes ]; then
+ BPF_FOUND=YES
+
+ CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c"
+ CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h"
+fi